From 4151a0ec900d0fe90f6243918a49ad25efdc0294 Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 17:06:46 +0000 Subject: [PATCH 01/53] Record the task card for feature-sillytavern-review --- .task/feature-sillytavern-review.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .task/feature-sillytavern-review.md diff --git a/.task/feature-sillytavern-review.md b/.task/feature-sillytavern-review.md new file mode 100644 index 00000000..0c2cfcfa --- /dev/null +++ b/.task/feature-sillytavern-review.md @@ -0,0 +1,25 @@ +# feature/sillytavern-review 任务卡 + +任务主记录:;状态:进行中;owner:weichen + +## 基线与授权 + +- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 4fd03eee6230f82464def08f2543adab27aba948 +- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-sillytavern-review(worktree);分支:feature/sillytavern-review +- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> + +## 目标与非目标 + +<预期结果、受影响入口/模块/契约;明确不做什么。> + +## 同步记录 + +| 节点 | sync_base_sha | tested_head_sha | checked_at | +|---|---|---|---| +| 启动 | 4fd03eee6230f82464def08f2543adab27aba948 | 4fd03eee6230f82464def08f2543adab27aba948 | 2026-10-04T17:06:46Z | + +## 结果与验证(完成后填写) + +- 结果: +- 验证: +- 影响与剩余项: From f8e06090e6ab59e052572ff7c43fd1dd62dfebfa Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 18:21:17 +0000 Subject: [PATCH 02/53] Pin the SillyTavern borrow across the linked repositories Why: The research record, HTML cleaning, listen guard, secret store, and context controls land together, and the parent pointers have to name those commits. Evidence: Child commits are core bd63223, agent-native 3a110a7, ui d76a8e6, frontend 36b92ed, documents f3f823e, backend 42cca8f. svc.sh forwards the listen switches and info prints them. Impact: A reverse proxy or a LAN hostname needs allowedHosts or an unauthenticated host check returns 403. Startup moves raw API keys into the secret table after a settings snapshot. Refs: .task/feature-sillytavern-review.md Co-authored-by: Cursor --- DESIGN.md | 2 ++ deps/agent-native | 2 +- docs/svc.md | 2 ++ modules/backend | 2 +- modules/core | 2 +- modules/documents | 2 +- modules/frontend | 2 +- modules/ui | 2 +- scripts/svc.sh | 24 +++++++++++++++++++++--- 9 files changed, 31 insertions(+), 9 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 480f5280..75655853 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -169,6 +169,7 @@ Agent-System-Dev 是桌面优先、Web 兼容的 AI 工作台。界面应**冷 - 展开态按 id 记忆,切回不丢; - 失败不强制展开:状态词虚线下划线,hover tooltip 给报错,支持一键复制; - 内容懒渲染,收起后延迟卸载(300ms,配合高度动画)。 +- 模型、卡片和文档里的 HTML 只经 `@ui` `safeHtml` 写入。外部图片和音视频不直接加载,改成带来源域名的链接;同源地址、`data:image` 和 `blob:` 照常显示。 ### 9.2 折叠(@ui Collapsible 原语) @@ -232,6 +233,7 @@ Primary(`--primary` 反色)、Ghost(透明,hover 出表面)、Danger 5. 弹窗套弹窗; 6. 同一对象出现第二个预览落位(预览只在预览区,全屏是它的放大); 7. `
` 折叠——用 Collapsible。 +8. 绕过 `safeHtml` 直接把 HTML 字符串写进页面(`dangerouslySetInnerHTML` 或非空的 `innerHTML` 赋值)。 ## 12. 演进规则 diff --git a/deps/agent-native b/deps/agent-native index e4020d29..3a110a72 160000 --- a/deps/agent-native +++ b/deps/agent-native @@ -1 +1 @@ -Subproject commit e4020d297c168347626f9fd75456a71374a0a6c8 +Subproject commit 3a110a728cf520cfbbbafc0c4c75f14bf78bec3f diff --git a/docs/svc.md b/docs/svc.md index aabfe710..c70fd7b8 100644 --- a/docs/svc.md +++ b/docs/svc.md @@ -164,6 +164,8 @@ scripts/svc.sh ui deploy --kind static --dir ../dist # 直接服务既有 | `--data DIR` | agent 数据目录(默认 `runtime//data`) | | `--plugins DIR` | agent 插件源(默认随 deploy 复制环境目录的 `plugins/`) | | `--dsn DSN` / `--auth on\|off\|auto` / `--mock` | agent 运行参数(非 dev 环境默认 `--auth auto`) | +| `SVC__INSECURE_LISTEN` | 设为 `1` 时允许该服务在非回环地址上不开启认证。值传给进程的 `AGENT_SYSTEM_INSECURE_LISTEN`,不写进 `exec=`。旧二进制会忽略 | +| `SVC__ALLOWED_HOSTS` | 逗号分隔的额外主机名,传给 `AGENT_SYSTEM_ALLOWED_HOSTS`,供反向代理的 Host / Origin 校验 | | `--model-base/--model-key/--model-name`、`--light-*`、`--tavily-keys` | 启动健康后播种 | | `--dry-run` | 只解析并打印部署计划(来源、物化路径、产物去向、启动参数) | | `--pick [dev\|release]` | 交互式编号选提交(需 TTY) | diff --git a/modules/backend b/modules/backend index fd170110..42cca8fa 160000 --- a/modules/backend +++ b/modules/backend @@ -1 +1 @@ -Subproject commit fd17011047e5059e59df5f2f10965c7b6ef34070 +Subproject commit 42cca8fadea73de04e1127fe758954910cb7ac5d diff --git a/modules/core b/modules/core index 5dc190ee..bd632236 160000 --- a/modules/core +++ b/modules/core @@ -1 +1 @@ -Subproject commit 5dc190ee63174be71208609309f0b36a5fe070e0 +Subproject commit bd632236c2d0a21d7f6dd9a2f67a5d2df22e57f7 diff --git a/modules/documents b/modules/documents index 847f6815..f3f823ef 160000 --- a/modules/documents +++ b/modules/documents @@ -1 +1 @@ -Subproject commit 847f6815f15cd1d778a312fcd2f67c0a9f6dbd54 +Subproject commit f3f823ef8d68045350039e1fbffd1bf8ed591093 diff --git a/modules/frontend b/modules/frontend index e26119db..36b92ede 160000 --- a/modules/frontend +++ b/modules/frontend @@ -1 +1 @@ -Subproject commit e26119db89d254aee15fba834e4bf1d8309ad153 +Subproject commit 36b92ede88ad6a72db1a56269709f9e51b2c3742 diff --git a/modules/ui b/modules/ui index 8e66bce0..d76a8e6f 160000 --- a/modules/ui +++ b/modules/ui @@ -1 +1 @@ -Subproject commit 8e66bce0f93529ae6e709cecf4b9db804da460cf +Subproject commit d76a8e6fc805ec82a02808a1d143f0000e853295 diff --git a/scripts/svc.sh b/scripts/svc.sh index 574bbf99..f46eaa43 100755 --- a/scripts/svc.sh +++ b/scripts/svc.sh @@ -55,7 +55,8 @@ # ════════════════════ 配置优先级 ════════════════════ # 命令行 > --config/--env 文件 > svc.env 持久化(exec=/addr=)> SVC__* 环境变量 # (.svc.env 自动加载,同层)> 默认值。裸 start/restart 复用上次启动配置;显式参数 -# 出现即覆盖。任意环境 X 的变量名:SVC__ADDR/DATA/DSN/AUTH/MOCK。 +# 出现即覆盖。任意环境 X 的变量名:SVC__ADDR/DATA/DSN/AUTH/MOCK, +# 以及 INSECURE_LISTEN / ALLOWED_HOSTS(传给进程的 AGENT_SYSTEM_*,旧二进制会忽略)。 # # ════════════════════ 服务模型与登记 ════════════════════ # - 服务名 ^[a-z][a-z0-9-]{0,15}$(保留字不可用);dev=8788 / prod=8787 默认端口, @@ -1206,9 +1207,22 @@ agent_do_start() { fi SVC_EXEC="$exec_args" SVC_PIDCHECK="$ENV_BIN" + local guard_env=() insecure hosts + insecure="$(env_var "$ENV_NAME" INSECURE_LISTEN)" + hosts="$(env_var "$ENV_NAME" ALLOWED_HOSTS)" + [ -n "$insecure" ] && guard_env+=("AGENT_SYSTEM_INSECURE_LISTEN=$insecure") + [ -n "$hosts" ] && guard_env+=("AGENT_SYSTEM_ALLOWED_HOSTS=$hosts") c_info "[$ENV_NAME] 启动:$ENV_BIN serve $exec_args" + if [ -n "$insecure" ] || [ -n "$hosts" ]; then + c_info "[$ENV_NAME] 监听守卫:insecureListen=${insecure:-0} allowedHosts=${hosts:-无}" + fi # 直接 nohup 简单命令:$! 即服务进程本身,pidfile 语义才成立。 - nohup "$ENV_BIN" serve $exec_args >> "$ENV_DIR/svc.log" 2>&1 & + # 守卫变量走环境,不写进 exec=;旧二进制不认识这两个变量,会忽略。 + if [ "${#guard_env[@]}" -gt 0 ]; then + nohup env "${guard_env[@]}" "$ENV_BIN" serve $exec_args >> "$ENV_DIR/svc.log" 2>&1 & + else + nohup "$ENV_BIN" serve $exec_args >> "$ENV_DIR/svc.log" 2>&1 & + fi echo $! > "$ENV_PID" record_state # 健康探测:取 exec 里的 --addr(复用持久化配置时可能与当前派生值不同)。 @@ -2402,7 +2416,11 @@ env_status_detail() { printf ' 数据库 %s\n' "${dbref:-无(内嵌 SQLite 档;绑定: db )}" cfile="$(svc_get conffile)" [ -z "$cfile" ] && cfile="$(printf '%s' "$(svc_get exec)" | sed -n 's/.*--config \([^ ]*\).*/\1/p')" - printf ' 配置文件 %s\n' "${cfile:-无(命令行参数形态; config 绑定)}" ;; + printf ' 配置文件 %s\n' "${cfile:-无(命令行参数形态; config 绑定)}" + printf ' 监听守卫 insecureListen=%s allowedHosts=%s\n' \ + "$(env_var "$ENV_NAME" INSECURE_LISTEN)" \ + "$(env_var "$ENV_NAME" ALLOWED_HOSTS)" + ;; postgres) printf ' 库 %s 用户 %s\n' "$(svc_get dbname)" "$(svc_get user)" printf ' DSN postgresql://%s:***@%s:%s/%s(db dsn %s --reveal 看密码)\n' \ From 5c3f756efa08d750d57343ee0b4b72ad06014bb2 Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 18:22:06 +0000 Subject: [PATCH 03/53] Fill in the SillyTavern review task card Why: The card still had placeholders for authorization, scope, and the compatibility note that reverse proxies need allowedHosts. Evidence: The card names the new message and observation fields and the items that stay out of this task. Impact: Reviewers can use the card as the PR description without reconstructing the scope. Refs: docs/records/2026-10-04-sillytavern-review.md Co-authored-by: Cursor --- .task/feature-sillytavern-review.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.task/feature-sillytavern-review.md b/.task/feature-sillytavern-review.md index 0c2cfcfa..ebe0ba85 100644 --- a/.task/feature-sillytavern-review.md +++ b/.task/feature-sillytavern-review.md @@ -6,11 +6,14 @@ - 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 4fd03eee6230f82464def08f2543adab27aba948 - 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-sillytavern-review(worktree);分支:feature/sillytavern-review -- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> +- 授权与交付终点:调研记录、已核实的安全缺口,以及方案里的批次 A–D 都在本任务实现。完成后推送、建 PR、合入,并在 worktree 内 `make task-finish`。不拷 SillyTavern 代码或文案。不轮换 Tavily 密钥,只在验收说明里建议轮换。不改认证默认 `auto`,不加 CSRF token,不加 CSP 上报端点。 ## 目标与非目标 -<预期结果、受影响入口/模块/契约;明确不做什么。> +- 目标:Documents 记录与提案 §2.5;HTML 清洗与安全响应头;来源校验与非回环无认证拒绝启动;密钥独立存储与设置快照;个人指令、会话要求、条件注入、上下文分段估算与消息整形;复制、成组排除、追加式候选回复;用户 `/` 命令展开成提示词且不自动触发。 +- 契约:`Message` 增加 `excluded` / `variantGroup` / `variantIndex`。`Conversation` 增加 `sessionNote`。`ContextObservation` 增加 `sections` 与 `prefixHash`。新表见 Backend 迁移 v16。设置新增 `context.userInstructions`、`context.contextWindow`、`context.messageShape`。 +- 兼容:反向代理或用主机名从局域网访问时,必须把对外域名写入 `allowedHosts`,否则未开认证时 Host 校验返回 403。旧设置里的明文密钥在启动时迁入 `secret_keys` 后从设置 JSON 清除;运行时仍接受尚未迁走的旧字段。 +- 非目标:缓存断点、编辑重发、会话分支、窗口外召回、世界书概率/递归/分组/定时、密钥静态加密、i18n、出站代理、画像导入导出、扩展系统、宏、群聊、角色卡、自定义 CSS、删除消息、自动触发的快捷回复。 ## 同步记录 From 3b2e887f27315e25a746052f4c7ed446ca6a781b Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 18:26:32 +0000 Subject: [PATCH 04/53] Pin the HTML sink ratchet fix Why: Empty innerHTML clears were flagged because the space matcher could backtrack past the quotes. The child tests now keep that whitespace inside the lookahead. Evidence: Frontend vitest 78 passed. UI html-sinks passed. Child commits are ui 5f8308a and frontend 02cebc0. Impact: The parent pins match the ratchet that allows clearing a node before appending sanitized children. Refs: .task/feature-sillytavern-review.md Co-authored-by: Cursor --- modules/frontend | 2 +- modules/ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/frontend b/modules/frontend index 36b92ede..02cebc06 160000 --- a/modules/frontend +++ b/modules/frontend @@ -1 +1 @@ -Subproject commit 36b92ede88ad6a72db1a56269709f9e51b2c3742 +Subproject commit 02cebc06ce40506b3b27ceabd734691a92f8dd26 diff --git a/modules/ui b/modules/ui index d76a8e6f..5f8308a8 160000 --- a/modules/ui +++ b/modules/ui @@ -1 +1 @@ -Subproject commit d76a8e6fc805ec82a02808a1d143f0000e853295 +Subproject commit 5f8308a8751a55ed920ea5fc6d30546df546fafb From 6b8151c4d6d20814eed160f1fc9e67804f887458 Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 18:28:30 +0000 Subject: [PATCH 05/53] Pin agent-squad to the shared agent-native commit Why: Dev's agent-native moved for message shaping, so squad and backend have to follow or check-pins fails. Evidence: Squad 5a57636 and backend include that pin. make test previously stopped at test-pins on this mismatch. Impact: The parent, backend, and squad all resolve agent-native 3a110a7. Refs: .task/feature-sillytavern-review.md Co-authored-by: Cursor --- deps/agent-squad | 2 +- modules/backend | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/agent-squad b/deps/agent-squad index dcd523ea..5a57636c 160000 --- a/deps/agent-squad +++ b/deps/agent-squad @@ -1 +1 @@ -Subproject commit dcd523ea05fe44901a6ab06e9cc8a2f0d074e0e6 +Subproject commit 5a57636cc0b8426a86a72bbbdd5b7f30e4fcac88 diff --git a/modules/backend b/modules/backend index 42cca8fa..8c7f3d9a 160000 --- a/modules/backend +++ b/modules/backend @@ -1 +1 @@ -Subproject commit 42cca8fadea73de04e1127fe758954910cb7ac5d +Subproject commit 8c7f3d9a7ef81abc0046393dae913c58bb6f2a83 From d2a8abd7e3757c2834c0cf0ee3d40c9780cd31cb Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 18:29:23 +0000 Subject: [PATCH 06/53] Allow the app package to import config Why: The listen guard reads auth and host policy from config before the database opens, so app depending on config is a real edge. Evidence: make test stopped in lint-boundaries on backend/app backend/config. The edge is now in the baseline. Impact: New imports still fail the ratchet. This one records the startup guard's dependency. Refs: .task/feature-sillytavern-review.md Co-authored-by: Cursor --- policy/architecture-baseline.json | 1 + 1 file changed, 1 insertion(+) diff --git a/policy/architecture-baseline.json b/policy/architecture-baseline.json index d9147566..a26faaab 100644 --- a/policy/architecture-baseline.json +++ b/policy/architecture-baseline.json @@ -2,6 +2,7 @@ "backend/app backend/bus", "backend/app backend/cardsvc", "backend/app backend/cmdbus", + "backend/app backend/config", "backend/app backend/hostapi", "backend/app backend/intentgate", "backend/app backend/pgbus", From ebced5e1502948f85fbcda3a43ba7fe453ef326d Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 18:37:16 +0000 Subject: [PATCH 07/53] Pin the contract cleanup across core, UI, frontend, and backend Why: The shared types dropped a spare export so the knip ratchet stays at its baseline, and every container must name those commits. Evidence: core 0b5c774, ui 6b2589c, frontend 13a1c63, backend c05832d. UI knip 55 and frontend knip 43. Impact: Gitlinks move together. JSON field names are unchanged. Refs: .task/feature-sillytavern-review.md Co-authored-by: Cursor --- modules/backend | 2 +- modules/core | 2 +- modules/frontend | 2 +- modules/ui | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/backend b/modules/backend index 8c7f3d9a..c05832dd 160000 --- a/modules/backend +++ b/modules/backend @@ -1 +1 @@ -Subproject commit 8c7f3d9a7ef81abc0046393dae913c58bb6f2a83 +Subproject commit c05832dd6a3624cfdbd528f23288b9c20dc76f24 diff --git a/modules/core b/modules/core index bd632236..0b5c7747 160000 --- a/modules/core +++ b/modules/core @@ -1 +1 @@ -Subproject commit bd632236c2d0a21d7f6dd9a2f67a5d2df22e57f7 +Subproject commit 0b5c7747a3165bf0d0f2219204b7b70ec3ed7645 diff --git a/modules/frontend b/modules/frontend index 02cebc06..13a1c632 160000 --- a/modules/frontend +++ b/modules/frontend @@ -1 +1 @@ -Subproject commit 02cebc06ce40506b3b27ceabd734691a92f8dd26 +Subproject commit 13a1c63280e986c7db92a81f747d09693301a0df diff --git a/modules/ui b/modules/ui index 5f8308a8..6b2589c1 160000 --- a/modules/ui +++ b/modules/ui @@ -1 +1 @@ -Subproject commit 5f8308a8751a55ed920ea5fc6d30546df546fafb +Subproject commit 6b2589c19873719c1c203ef7feb542b20a56799a From 4ba1d499dfba54ae0d5c74144f78645247d2e970 Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 18:41:41 +0000 Subject: [PATCH 08/53] Pin the frontend build info refresh Why: The incremental build info commit has to be the gitlink Dev records. Evidence: modules/frontend is eb6502f. make build produced bin/agent-system. Impact: The parent branch names the same frontend commit the worktree built. Refs: .task/feature-sillytavern-review.md Co-authored-by: Cursor --- modules/frontend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/frontend b/modules/frontend index 13a1c632..eb6502f0 160000 --- a/modules/frontend +++ b/modules/frontend @@ -1 +1 @@ -Subproject commit 13a1c63280e986c7db92a81f747d09693301a0df +Subproject commit eb6502f0effd0d02d8a131930fbe60e61d651657 From cd6be001414759f3ad00cf860ae095b70593e296 Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 18:42:54 +0000 Subject: [PATCH 09/53] Record the SillyTavern review verification evidence Why: The task card has to name the commits and the gates that already passed before sync. Evidence: make test and make build exited 0. config explain refuses 0.0.0.0:8788. serve on 0.0.0.0:18799 exited 1 and left no database directory. Impact: The card still says the work is in progress until the pull requests merge. Refs: .task/feature-sillytavern-review.md Co-authored-by: Cursor --- .task/feature-sillytavern-review.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.task/feature-sillytavern-review.md b/.task/feature-sillytavern-review.md index ebe0ba85..ccf229a7 100644 --- a/.task/feature-sillytavern-review.md +++ b/.task/feature-sillytavern-review.md @@ -23,6 +23,6 @@ ## 结果与验证(完成后填写) -- 结果: -- 验证: -- 影响与剩余项: +- 结果:安全缺口 S1–S4 与批次 A–D 已在本分支实现。Documents 记录写明 A–D 在本任务落地。指针:core `0b5c774`,agent-native `3a110a7`,agent-squad `5a57636`,ui `6b2589c`,frontend `eb6502f`,documents `f3f823e`,backend `c05832d`,Dev `4ba1d49`。 +- 验证:Dev `make test` 退出码 0(boundaries、pins、三库、core、backend、frontend vitest 16 文件 78 项、knip 43、ui tsc/vitest/knip 55、agent-command)。`make build` 退出码 0,产出 `bin/agent-system`。Backend `GOWORK=off go vet ./...` 退出码 0。 +- 影响与剩余项:合入前还要 task-sync、推送、PR、dev 验收。Tavily 密钥建议轮换,本任务不轮换。暂缓项与拒绝项仍不做。 From ce551683256e770d96c18fdaf93df49df4e0e3b1 Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 18:42:56 +0000 Subject: [PATCH 10/53] Record the sync checkpoint --- .task/feature-sillytavern-review.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-sillytavern-review.md b/.task/feature-sillytavern-review.md index ccf229a7..e84d2d29 100644 --- a/.task/feature-sillytavern-review.md +++ b/.task/feature-sillytavern-review.md @@ -26,3 +26,4 @@ - 结果:安全缺口 S1–S4 与批次 A–D 已在本分支实现。Documents 记录写明 A–D 在本任务落地。指针:core `0b5c774`,agent-native `3a110a7`,agent-squad `5a57636`,ui `6b2589c`,frontend `eb6502f`,documents `f3f823e`,backend `c05832d`,Dev `4ba1d49`。 - 验证:Dev `make test` 退出码 0(boundaries、pins、三库、core、backend、frontend vitest 16 文件 78 项、knip 43、ui tsc/vitest/knip 55、agent-command)。`make build` 退出码 0,产出 `bin/agent-system`。Backend `GOWORK=off go vet ./...` 退出码 0。 - 影响与剩余项:合入前还要 task-sync、推送、PR、dev 验收。Tavily 密钥建议轮换,本任务不轮换。暂缓项与拒绝项仍不做。 +| 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | cd6be001414759f3ad00cf860ae095b70593e296 | 2026-10-04T18:42:56Z | From ae06838d66c295d674cee0334ac2a7e9acd1a92f Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 18:45:13 +0000 Subject: [PATCH 11/53] Record the sync checkpoint --- .task/feature-sillytavern-review.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-sillytavern-review.md b/.task/feature-sillytavern-review.md index e84d2d29..b2426ebf 100644 --- a/.task/feature-sillytavern-review.md +++ b/.task/feature-sillytavern-review.md @@ -27,3 +27,4 @@ - 验证:Dev `make test` 退出码 0(boundaries、pins、三库、core、backend、frontend vitest 16 文件 78 项、knip 43、ui tsc/vitest/knip 55、agent-command)。`make build` 退出码 0,产出 `bin/agent-system`。Backend `GOWORK=off go vet ./...` 退出码 0。 - 影响与剩余项:合入前还要 task-sync、推送、PR、dev 验收。Tavily 密钥建议轮换,本任务不轮换。暂缓项与拒绝项仍不做。 | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | cd6be001414759f3ad00cf860ae095b70593e296 | 2026-10-04T18:42:56Z | +| 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ce551683256e770d96c18fdaf93df49df4e0e3b1 | 2026-10-04T18:45:12Z | From b97e4265b58821284b6fa691bb7dda676bfbf813 Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 19:45:46 +0000 Subject: [PATCH 12/53] Record the sync checkpoint --- .task/feature-sillytavern-review.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-sillytavern-review.md b/.task/feature-sillytavern-review.md index b2426ebf..7c85b979 100644 --- a/.task/feature-sillytavern-review.md +++ b/.task/feature-sillytavern-review.md @@ -28,3 +28,4 @@ - 影响与剩余项:合入前还要 task-sync、推送、PR、dev 验收。Tavily 密钥建议轮换,本任务不轮换。暂缓项与拒绝项仍不做。 | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | cd6be001414759f3ad00cf860ae095b70593e296 | 2026-10-04T18:42:56Z | | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ce551683256e770d96c18fdaf93df49df4e0e3b1 | 2026-10-04T18:45:12Z | +| 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ae06838d66c295d674cee0334ac2a7e9acd1a92f | 2026-10-04T19:45:46Z | From 3678f58cd3b8b3ca48e412c650c6be3befdf04fa Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 19:46:37 +0000 Subject: [PATCH 13/53] Record the merged child pull requests and acceptance evidence Why: The task card is the pull request description, and it has to name the child merges and the checks that already passed. Evidence: Documents 37, UI 34, Core 21, Frontend 43, Native 16, Squad 15, and Backend 63 are merged. Dev is still open. Impact: The card stays in progress until the Dev pull request merges. Refs: .task/feature-sillytavern-review.md Co-authored-by: Cursor --- .task/feature-sillytavern-review.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.task/feature-sillytavern-review.md b/.task/feature-sillytavern-review.md index 7c85b979..35504ef3 100644 --- a/.task/feature-sillytavern-review.md +++ b/.task/feature-sillytavern-review.md @@ -1,6 +1,6 @@ # feature/sillytavern-review 任务卡 -任务主记录:;状态:进行中;owner:weichen +任务主记录:[Dev #186](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/186);状态:进行中;owner:weichen ## 基线与授权 @@ -23,9 +23,9 @@ ## 结果与验证(完成后填写) -- 结果:安全缺口 S1–S4 与批次 A–D 已在本分支实现。Documents 记录写明 A–D 在本任务落地。指针:core `0b5c774`,agent-native `3a110a7`,agent-squad `5a57636`,ui `6b2589c`,frontend `eb6502f`,documents `f3f823e`,backend `c05832d`,Dev `4ba1d49`。 -- 验证:Dev `make test` 退出码 0(boundaries、pins、三库、core、backend、frontend vitest 16 文件 78 项、knip 43、ui tsc/vitest/knip 55、agent-command)。`make build` 退出码 0,产出 `bin/agent-system`。Backend `GOWORK=off go vet ./...` 退出码 0。 -- 影响与剩余项:合入前还要 task-sync、推送、PR、dev 验收。Tavily 密钥建议轮换,本任务不轮换。暂缓项与拒绝项仍不做。 +- 结果:安全缺口 S1–S4 与批次 A–D 已在本分支实现。子仓 PR 已合入:Documents [#37](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Documents/pulls/37)、UI [#34](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-UI/pulls/34)、Core [#21](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Core/pulls/21)、Frontend [#43](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Frontend/pulls/43)、Native [#16](https://git-home.u1680832.nyat.app:30319/weichen/Agent-Native/pulls/16)、Squad [#15](https://git-home.u1680832.nyat.app:30319/weichen/Agent-Squad/pulls/15)、Backend [#63](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Backend/pulls/63)。Dev 钉住的功能提交是这些合入提交的祖先:core `0b5c774`,native `3a110a7`,squad `5a57636`,ui `6b2589c`,frontend `eb6502f`,documents `f3f823e`,backend `c05832d`。 +- 验证:`make test` 与 `make build` 退出码 0。`config explain --addr 0.0.0.0:8788` 显示拒绝启动。`serve --addr 0.0.0.0:18799` 退出码 1 且不建库。dev 已部署 `dev@ae06838`,监听 `127.0.0.1:8788`;`/` 带 CSP、nosniff、same-origin。该实例开了认证:跨站 POST 403,无 Origin 的 POST 与 `Host: evil.example` 为 401。同一二进制的无认证实例上,无 Origin 的 POST 为 201,跨站 POST 403,`Host: evil.example` 403,`127.0.0.1` 的健康检查 200,HTML 工件带 `sandbox`。浏览器:Markdown 预览去掉 script 与 `javascript:` 链接,外链图片变成「外部图片 · 域名」;docx、xlsx、pdf 与示例插件工作区无 CSP 报错;mock 对话一轮可见复制、排除、重新生成和「约 N token」。 +- 影响与剩余项:Tavily 密钥曾暴露在无认证监听上,建议轮换,本任务不轮换。暂缓项与拒绝项仍不做。pptx 没有可用样例,未单独打开预览。 | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | cd6be001414759f3ad00cf860ae095b70593e296 | 2026-10-04T18:42:56Z | | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ce551683256e770d96c18fdaf93df49df4e0e3b1 | 2026-10-04T18:45:12Z | | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ae06838d66c295d674cee0334ac2a7e9acd1a92f | 2026-10-04T19:45:46Z | From c65f56fe369c699297e3ea62259d46c654aebc6f Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 19:46:37 +0000 Subject: [PATCH 14/53] Record the sync checkpoint --- .task/feature-sillytavern-review.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-sillytavern-review.md b/.task/feature-sillytavern-review.md index 35504ef3..8c0fd085 100644 --- a/.task/feature-sillytavern-review.md +++ b/.task/feature-sillytavern-review.md @@ -29,3 +29,4 @@ | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | cd6be001414759f3ad00cf860ae095b70593e296 | 2026-10-04T18:42:56Z | | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ce551683256e770d96c18fdaf93df49df4e0e3b1 | 2026-10-04T18:45:12Z | | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ae06838d66c295d674cee0334ac2a7e9acd1a92f | 2026-10-04T19:45:46Z | +| 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | 3678f58cd3b8b3ca48e412c650c6be3befdf04fa | 2026-10-04T19:46:37Z | From e5c0b75b3f7d08829bc853e04ce577ec4a4bec95 Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 19:55:48 +0000 Subject: [PATCH 15/53] Close the merged SillyTavern review task card and archive it Why: The feature branch is on main, and the open task card would stay as bookkeeping debt. Evidence: Dev pull request 186 merged as 090be2404e. The merge subject does not contain the from-branch line, so the automatic scan skipped it. Impact: The card moves to .task/archive with status filled in. No product code changes. Refs: .task/archive/feature-sillytavern-review.md Co-authored-by: Cursor --- .task/{ => archive}/feature-sillytavern-review.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) rename .task/{ => archive}/feature-sillytavern-review.md (90%) diff --git a/.task/feature-sillytavern-review.md b/.task/archive/feature-sillytavern-review.md similarity index 90% rename from .task/feature-sillytavern-review.md rename to .task/archive/feature-sillytavern-review.md index 8c0fd085..b6e1cb5a 100644 --- a/.task/feature-sillytavern-review.md +++ b/.task/archive/feature-sillytavern-review.md @@ -1,6 +1,6 @@ # feature/sillytavern-review 任务卡 -任务主记录:[Dev #186](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/186);状态:进行中;owner:weichen +任务主记录:[Dev #186](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/186);状态:已完成(回填);owner:weichen ## 基线与授权 @@ -21,7 +21,7 @@ |---|---|---|---| | 启动 | 4fd03eee6230f82464def08f2543adab27aba948 | 4fd03eee6230f82464def08f2543adab27aba948 | 2026-10-04T17:06:46Z | -## 结果与验证(完成后填写) +## 结果与验证 - 结果:安全缺口 S1–S4 与批次 A–D 已在本分支实现。子仓 PR 已合入:Documents [#37](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Documents/pulls/37)、UI [#34](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-UI/pulls/34)、Core [#21](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Core/pulls/21)、Frontend [#43](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Frontend/pulls/43)、Native [#16](https://git-home.u1680832.nyat.app:30319/weichen/Agent-Native/pulls/16)、Squad [#15](https://git-home.u1680832.nyat.app:30319/weichen/Agent-Squad/pulls/15)、Backend [#63](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Backend/pulls/63)。Dev 钉住的功能提交是这些合入提交的祖先:core `0b5c774`,native `3a110a7`,squad `5a57636`,ui `6b2589c`,frontend `eb6502f`,documents `f3f823e`,backend `c05832d`。 - 验证:`make test` 与 `make build` 退出码 0。`config explain --addr 0.0.0.0:8788` 显示拒绝启动。`serve --addr 0.0.0.0:18799` 退出码 1 且不建库。dev 已部署 `dev@ae06838`,监听 `127.0.0.1:8788`;`/` 带 CSP、nosniff、same-origin。该实例开了认证:跨站 POST 403,无 Origin 的 POST 与 `Host: evil.example` 为 401。同一二进制的无认证实例上,无 Origin 的 POST 为 201,跨站 POST 403,`Host: evil.example` 403,`127.0.0.1` 的健康检查 200,HTML 工件带 `sandbox`。浏览器:Markdown 预览去掉 script 与 `javascript:` 链接,外链图片变成「外部图片 · 域名」;docx、xlsx、pdf 与示例插件工作区无 CSP 报错;mock 对话一轮可见复制、排除、重新生成和「约 N token」。 @@ -30,3 +30,9 @@ | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ce551683256e770d96c18fdaf93df49df4e0e3b1 | 2026-10-04T18:45:12Z | | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ae06838d66c295d674cee0334ac2a7e9acd1a92f | 2026-10-04T19:45:46Z | | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | 3678f58cd3b8b3ca48e412c650c6be3befdf04fa | 2026-10-04T19:46:37Z | + +## 闭合记录(card-autoclose 回填) + +- 依据:merge 090be2404e2157f5df551c62165074625c602403(PR #186)已包含于 origin/main,分支成果已落盘;本段为合入后回填。 +- 合并主题:Pin the SillyTavern borrow, guards, and context controls +- 归档:随闭合移入 .task/archive/;任务执行期的过程证据见原任务记录与 PR。 From ef23756fa19ad4eebb0eb9119bcf97855df534b5 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 01:51:21 +0000 Subject: [PATCH 16/53] Record the task card for feature-svc-start-keep-db-binding --- .task/feature-svc-start-keep-db-binding.md | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .task/feature-svc-start-keep-db-binding.md diff --git a/.task/feature-svc-start-keep-db-binding.md b/.task/feature-svc-start-keep-db-binding.md new file mode 100644 index 00000000..1601a921 --- /dev/null +++ b/.task/feature-svc-start-keep-db-binding.md @@ -0,0 +1,25 @@ +# feature/svc-start-keep-db-binding 任务卡 + +任务主记录:;状态:进行中;owner:weichen + +## 基线与授权 + +- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 4d59610fd17fb1a05cf55ff266f393cc007995e2 +- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-svc-start-keep-db-binding(worktree);分支:feature/svc-start-keep-db-binding +- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> + +## 目标与非目标 + +<预期结果、受影响入口/模块/契约;明确不做什么。> + +## 同步记录 + +| 节点 | sync_base_sha | tested_head_sha | checked_at | +|---|---|---|---| +| 启动 | 4d59610fd17fb1a05cf55ff266f393cc007995e2 | 4d59610fd17fb1a05cf55ff266f393cc007995e2 | 2026-10-05T01:51:21Z | + +## 结果与验证(完成后填写) + +- 结果: +- 验证: +- 影响与剩余项: From 42151071263aa133520fe346b6b1929e1ecda008 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 02:16:20 +0000 Subject: [PATCH 17/53] Keep the DB binding and fail closed on svc.sh start rebuilds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: the 2026-10-05 dev outage — a restart with an explicit --addr rebuilt the start args, and the rebuild branch dropped the persisted --dsn for the dev env, so the binary resolved auth=auto to off on 0.0.0.0 and the new listen guard refused to spawn; record_state then persisted the broken exec= before the health probe, so bare starts kept failing. Evidence: bash -n clean; sandbox registry with stub binaries — dbref DSN is re-derived on rebuild (priority CLI > env > dbref), the pre-flight blocks non-loopback without auth with actionable remedies, immediate-death starts leave the previous exec= intact, and DSN masking covers all start-path log lines; make test green. Impact: dev/prod agent starts keep their DB binding across explicit-arg rebuilds; failed starts no longer corrupt the registry; static/pg paths get the same persist-after-probe ordering (pg already had it); no change to deploy materialization or the binary guard semantics. Refs: backend 8eda35f (listen guard), runtime/dev history.jsonl 01:23 fail --- .task/feature-svc-start-keep-db-binding.md | 14 +++- scripts/svc.sh | 93 +++++++++++++++++++--- 2 files changed, 92 insertions(+), 15 deletions(-) diff --git a/.task/feature-svc-start-keep-db-binding.md b/.task/feature-svc-start-keep-db-binding.md index 1601a921..a328f991 100644 --- a/.task/feature-svc-start-keep-db-binding.md +++ b/.task/feature-svc-start-keep-db-binding.md @@ -6,11 +6,21 @@ - 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 4d59610fd17fb1a05cf55ff266f393cc007995e2 - 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-svc-start-keep-db-binding(worktree);分支:feature/svc-start-keep-db-binding -- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> +- 授权与交付终点:用户明确要求修复 svc.sh 此类缺陷(2026-10-05 dev 服务事故后续)。终点 = PR 合入 main + 主检出回归验证。 ## 目标与非目标 -<预期结果、受影响入口/模块/契约;明确不做什么。> +背景(2026-10-05 01:23 dev 事故):后端 8eda35f 引入 listen guard 后,`svc.sh dev restart --addr 0.0.0.0:8788` 走"显式参数重建"分支,dev 分支刻意不拼 `--dsn/--auth`,持久化的 pg1 绑定被静默丢弃 → 二进制 `--auth auto` 无 DSN 判认证关 → 守卫拒启("进程即退")。且 `record_state` 在健康探测前写盘,坏 `exec=` 持久化,裸 start 复用导致二次失败。 + +修复项: +1. 重建分支 dbref 兜底:`dsn_from_dbref` 由 dbref 从 pg 实例登记重建 `--dsn`(优先级 CLI_DSN > SVC_*_DSN > dbref;mock 除外);dev 同样尊重显式 `--dsn/--auth`(此前传入即被静默丢弃)。 +2. 失败不落坏配置:agent/static 启动的 `record_state` 后移至健康探测后——探测通过才写 svc.env;进程即退时保留上次配置并明示;超时(进程存活)按实际运行参数登记。pg 路径原本就在 pg_ctl 成功后落盘,不动。 +3. 预检拦截:非回环 + 认证判定关(按二进制 AuthEnabled 口径:--auth on;未显式 off 且带 --dsn)时 svc.sh 层提前拒绝并给可操作报错(回环/绑定/--auth on/INSECURE_LISTEN 四条出路);二进制 listen guard 仍是权威。 +4. 日志泄漏对齐:启动/复用/旧产物过滤三处日志对 DSN 掩码(此前裸打密码,违背脚本自述"DSN 默认掩码"原则)。 + +同类排查结论(不改):`set --addr` 对 agent 拒绝并指向 restart;`db --clear`/`config --clear` 均同步改写 exec=,无漂移;非 dev 环境重建分支原本就带 --dsn/--auth,行为保持。 + +非目标:不改后端 listen guard 语义;不改 deploy 物化/构建链路。 ## 同步记录 diff --git a/scripts/svc.sh b/scripts/svc.sh index f46eaa43..23ecfeb7 100755 --- a/scripts/svc.sh +++ b/scripts/svc.sh @@ -401,9 +401,11 @@ dotenv 格式:KEY=VALUE,支持 # 注释、成对引号、export 前缀;只 播种幂等:设置持久化在 agent 数据目录,播过一次后续启动无需再传。 持久化语义: - - deploy/start 成功后把当前态写入 svc.env(600) + - deploy/start 成功(健康探测通过)后把当前态写入 svc.env(600);启动失败不覆盖 + 上次配置——裸 start 仍按上次可用参数重试 - 裸 start/restart 复用 exec=(上次完整参数);任何显式参数(或 --config 文件、 - SVC_* 变量)出现即整体重建参数 + SVC_* 变量)出现即整体重建参数——重建时 dbref 绑定的 --dsn 自动从实例登记 + 重建保留(mock 档或显式 --dsn 除外) - tags 随每次登记合并去重,跨重启保留 服务级配置文件(与上述 svc.sh dotenv 层不同——这是 agent 二进制自己的 JSON 配置): @@ -1172,6 +1174,41 @@ PY fi } +# dsn_from_dbref DBREF:由 dbref(pg实例/库名)从该实例登记重建连接串。 +# 实例未登记 / 非 postgres / 缺 addr·user·password 时返回非零且不输出。 +dsn_from_dbref() { + local dbref="$1" inst tdb taddr tuser tpass + inst="${dbref%%/*}"; tdb="${dbref#*/}" + { [ -n "$inst" ] && [ -n "$tdb" ] && [ "$inst" != "$dbref" ]; } || return 1 + [ -f "$RUNTIME/$inst/svc.env" ] || return 1 + [ "$(svc_kind "$inst")" = postgres ] || return 1 + taddr="$(env_kv_of "$inst" addr)" + tuser="$(env_kv_of "$inst" user)" + tpass="$(env_kv_of "$inst" password)" + { [ -n "$taddr" ] && [ -n "$tuser" ] && [ -n "$tpass" ]; } || return 1 + printf 'postgresql://%s:%s@%s:%s/%s' "$tuser" "$tpass" "${taddr%:*}" "${taddr##*:}" "$tdb" +} + +# addr_is_loopback HOST:回环写法白名单判定(127.x / ::1 / localhost)。 +# 只服务启动预检的快速拦截:其余形态一律按非回环处理,权威判定在二进制 listen guard。 +addr_is_loopback() { + case "$1" in + localhost|127.*|::1|[::1]) return 0 ;; + *) return 1 ;; + esac +} + +# agent_args_authed ARGS:按二进制 AuthEnabled 口径判断启动参数是否开启认证 +# (--auth on;或未显式 off 且带 --dsn——auto+PG 即开)。--mock 只影响存储档不影响认证。 +agent_args_authed() { + case "$1" in + *--auth[=\ ]on*) return 0 ;; + *--auth[=\ ]off*) return 1 ;; + *--dsn\ *) return 0 ;; + *) return 1 ;; + esac +} + agent_do_start() { mkdir -p "$ENV_DATA" "$ENV_DIR" check_port_free || return 1 @@ -1185,21 +1222,34 @@ agent_do_start() { local exec_args if ! agent_has_explicit_cfg && [ -n "$(svc_get exec)" ]; then exec_args="$(svc_get exec)" - c_info "[$ENV_NAME] 复用上次配置(svc.env exec=;显式参数可覆盖):$exec_args" + c_info "[$ENV_NAME] 复用上次配置(svc.env exec=;显式参数可覆盖):$(mask_dsn "$exec_args")" else local args="" if [ "$CLI_MOCK" = 1 ] || [ "$(env_var "$ENV_NAME" MOCK)" = "1" ]; then args="--mock" - elif [ "$ENV_NAME" != dev ]; then + else local dsn="${CLI_DSN:-$(env_var "$ENV_NAME" DSN)}" - [ -n "$dsn" ] && args="$args --dsn $dsn" local auth="${CLI_AUTH:-$(env_var "$ENV_NAME" AUTH)}" - [ -z "$auth" ] && auth=auto - args="$args --auth $auth" + # dbref 兜底:显式参数重建启动参数时,持久化的数据库绑定不再静默丢失 + #(2026-10-05 dev 事故:restart --addr 走重建分支丢 --dsn → auto 判认证关 → 守卫拒启)。 + if [ -z "$dsn" ] && [ -n "$(svc_get dbref)" ]; then + local bound_dsn + if bound_dsn="$(dsn_from_dbref "$(svc_get dbref)")"; then + dsn="$bound_dsn" + c_info "[$ENV_NAME] 数据库绑定 $(svc_get dbref) 随参数重建保留" + else + c_warn "[$ENV_NAME] dbref=$(svc_get dbref) 无法重建 DSN(实例缺失或登记不全),按无数据库绑定启动" + fi + fi + [ -n "$dsn" ] && args="$args --dsn $dsn" + if [ -n "$dsn" ] || [ -n "$auth" ] || [ "$ENV_NAME" != dev ]; then + [ -z "$auth" ] && auth=auto + args="$args --auth $auth" + fi fi local adjusted; adjusted="$(adjust_args_for_bin "$ENV_BIN" "$args")" if [ "$adjusted" != "$args" ]; then - c_warn "[$ENV_NAME] 该产物不支持 --dsn/--auth(旧版本二进制),已自动省略:${args:-<无>} → ${adjusted:-<无>}" + c_warn "[$ENV_NAME] 该产物不支持 --dsn/--auth(旧版本二进制),已自动省略:$(mask_dsn "${args:-<无>}") → $(mask_dsn "${adjusted:-<无>}")" fi args="$adjusted" exec_args="--addr $ENV_ADDR --data $ENV_DATA --plugins ${CLI_PLUGINS:-$ENV_DIR/plugins} $args $CLI_EXTRA" @@ -1212,7 +1262,19 @@ agent_do_start() { hosts="$(env_var "$ENV_NAME" ALLOWED_HOSTS)" [ -n "$insecure" ] && guard_env+=("AGENT_SYSTEM_INSECURE_LISTEN=$insecure") [ -n "$hosts" ] && guard_env+=("AGENT_SYSTEM_ALLOWED_HOSTS=$hosts") - c_info "[$ENV_NAME] 启动:$ENV_BIN serve $exec_args" + # 预检(快速拦截):非回环地址且认证判定为关时提前拒绝,报错可操作—— + # 不等二进制 listen guard 以"进程即退"暴露;二进制守卫仍是权威。 + local pf_addr; pf_addr="$(printf '%s' "$exec_args" | sed -n 's/.*--addr \([^ ]*\).*/\1/p')" + pf_addr="${pf_addr:-$ENV_ADDR}" + if ! addr_is_loopback "${pf_addr%:*}" && [ -z "$insecure" ] && ! agent_args_authed "$exec_args"; then + c_err "[$ENV_NAME] 拒绝启动:非回环地址 $pf_addr 且认证判定为关(auto 无 DSN 即关)。" + c_err " 任选其一:--addr 127.0.0.1:${pf_addr##*:};数据库绑定 scripts/svc.sh $ENV_NAME db ;" + c_err " 显式 --auth on;或环境 SVC_$(printf '%s' "$ENV_NAME" | tr 'a-z-' 'A-Z_')_INSECURE_LISTEN=1 显式放行。" + c_err " 登记未变更(svc.env 保留上次配置);二进制侧 listen guard 同样会拒绝。" + hist_event start fail "" "预检拒绝:非回环且未开认证" + return 1 + fi + c_info "[$ENV_NAME] 启动:$ENV_BIN serve $(mask_dsn "$exec_args")" if [ -n "$insecure" ] || [ -n "$hosts" ]; then c_info "[$ENV_NAME] 监听守卫:insecureListen=${insecure:-0} allowedHosts=${hosts:-无}" fi @@ -1224,7 +1286,6 @@ agent_do_start() { nohup "$ENV_BIN" serve $exec_args >> "$ENV_DIR/svc.log" 2>&1 & fi echo $! > "$ENV_PID" - record_state # 健康探测:取 exec 里的 --addr(复用持久化配置时可能与当前派生值不同)。 local probe="${ENV_ADDR}" case "$exec_args" in *--addr\ *) @@ -1234,18 +1295,23 @@ agent_do_start() { [ "$phost" = "0.0.0.0" ] || [ "$phost" = "::" ] && phost="127.0.0.1" for _ in $(seq 1 100); do if curl -s -o /dev/null -m 2 "http://$phost:${probe##*:}/" 2>/dev/null; then + # 健康通过才写 svc.env——启动失败不再用新参数覆盖上次的可用配置 + #(2026-10-05 dev 事故:失败后坏 exec= 持久化,裸 start 复用导致二次失败)。 + record_state c_ok "[$ENV_NAME] 已启动 pid=$(read_pid) → http://$phost:${probe##*:}(来源 ${SVC_SOURCE:-?},日志:$ENV_DIR/svc.log)" hist_event start ok "$(read_pid)" "http://$phost:${probe##*:}" seed_settings "$phost" "${probe##*:}" return 0 fi pid_alive "$(read_pid)" || { - c_err "[$ENV_NAME] 进程启动后即退出,查看日志:tail -40 $ENV_DIR/svc.log" + c_err "[$ENV_NAME] 进程启动后即退出(登记未变更,svc.env 保留上次 exec=),查看日志:tail -40 $ENV_DIR/svc.log" hist_event start fail "$(read_pid)" "进程即退(日志 svc.log)" return 1 } sleep 0.2 done + # 进程存活但未响应:按实际运行参数登记(进程确以新参数在跑,登记与现实一致)。 + record_state c_err "[$ENV_NAME] 20s 健康检查未通过(进程存活但未响应),查看日志:tail -40 $ENV_DIR/svc.log" hist_event start fail "$(read_pid)" "健康检查超时" return 1 @@ -1356,22 +1422,23 @@ static_do_start() { c_info "[$ENV_NAME] 启动静态服务:python3 http.server $port --bind $host --directory $htdocs" nohup python3 -m http.server "$port" --bind "$host" --directory "$htdocs" >> "$ENV_DIR/svc.log" 2>&1 & echo $! > "$ENV_PID" - record_state "htdocs=$htdocs" local probe_host="$host" [ "$probe_host" = "0.0.0.0" ] || [ "$probe_host" = "::" ] && probe_host="127.0.0.1" for _ in $(seq 1 50); do if curl -s -o /dev/null -m 2 "http://$probe_host:$port/" 2>/dev/null; then + record_state "htdocs=$htdocs" # 健康通过才写 svc.env(与 agent 路径同规) c_ok "[$ENV_NAME] 已启动 pid=$(read_pid) → http://$probe_host:$port/(目录 $htdocs)" hist_event start ok "$(read_pid)" "http://$probe_host:$port/" return 0 fi pid_alive "$(read_pid)" || { - c_err "[$ENV_NAME] 进程启动后即退出,查看日志:tail -40 $ENV_DIR/svc.log" + c_err "[$ENV_NAME] 进程启动后即退出(登记未变更,svc.env 保留上次配置),查看日志:tail -40 $ENV_DIR/svc.log" hist_event start fail "$(read_pid)" "进程即退" return 1 } sleep 0.2 done + record_state "htdocs=$htdocs" c_err "[$ENV_NAME] 10s 健康检查未通过" hist_event start fail "$(read_pid)" "健康检查超时" return 1 From 36a1b363adf6516cf7b509cf2933235d8544158a Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 02:16:28 +0000 Subject: [PATCH 18/53] Record the sync checkpoint --- .task/feature-svc-start-keep-db-binding.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-svc-start-keep-db-binding.md b/.task/feature-svc-start-keep-db-binding.md index a328f991..324cbd68 100644 --- a/.task/feature-svc-start-keep-db-binding.md +++ b/.task/feature-svc-start-keep-db-binding.md @@ -33,3 +33,4 @@ - 结果: - 验证: - 影响与剩余项: +| 同步前验收 | 4d59610fd17fb1a05cf55ff266f393cc007995e2 | 42151071263aa133520fe346b6b1929e1ecda008 | 2026-10-05T02:16:28Z | From f1ba22129e658b7ae75b289fcd24af109e1c5166 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 02:18:59 +0000 Subject: [PATCH 19/53] Close 1 merged task card(s) and archive them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: branches merged into main had left their task cards open; backfill status and archive to prevent bookkeeping debt. Evidence: feature-svc-start-keep-db-binding.md(PR#188) — merges verified via git log --merges against origin/main. Impact: .task/*.md moved to .task/archive/ with status backfilled; no code or submodule change. Refs: task.sh close (card-autoclose-r1) --- .../{ => archive}/feature-svc-start-keep-db-binding.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) rename .task/{ => archive}/feature-svc-start-keep-db-binding.md (80%) diff --git a/.task/feature-svc-start-keep-db-binding.md b/.task/archive/feature-svc-start-keep-db-binding.md similarity index 80% rename from .task/feature-svc-start-keep-db-binding.md rename to .task/archive/feature-svc-start-keep-db-binding.md index 324cbd68..1831831b 100644 --- a/.task/feature-svc-start-keep-db-binding.md +++ b/.task/archive/feature-svc-start-keep-db-binding.md @@ -1,6 +1,6 @@ # feature/svc-start-keep-db-binding 任务卡 -任务主记录:;状态:进行中;owner:weichen +任务主记录:PR #188 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/188(merge 73041b49fd);状态:已完成(回填);owner:weichen ## 基线与授权 @@ -28,9 +28,15 @@ |---|---|---|---| | 启动 | 4d59610fd17fb1a05cf55ff266f393cc007995e2 | 4d59610fd17fb1a05cf55ff266f393cc007995e2 | 2026-10-05T01:51:21Z | -## 结果与验证(完成后填写) +## 结果与验证 - 结果: - 验证: - 影响与剩余项: | 同步前验收 | 4d59610fd17fb1a05cf55ff266f393cc007995e2 | 42151071263aa133520fe346b6b1929e1ecda008 | 2026-10-05T02:16:28Z | + +## 闭合记录(card-autoclose 回填) + +- 依据:merge 73041b49fd8567aa02483a70bffed0ef8116bd22(PR #188)已包含于 origin/main,分支成果已落盘;本段为合入后回填。 +- 合并主题:Merge pull request 'Keep the DB binding and fail closed on svc.sh start rebuilds' (#188) from feature/svc-start-keep-db-binding into main +- 归档:随闭合移入 .task/archive/;任务执行期的过程证据见原任务记录与 PR。 From 42e32f15963e2e5db601c4ffdb71e25304d45f04 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 02:22:29 +0000 Subject: [PATCH 20/53] Record the task card for feature-svc-adjust-warn-fix --- .task/feature-svc-adjust-warn-fix.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .task/feature-svc-adjust-warn-fix.md diff --git a/.task/feature-svc-adjust-warn-fix.md b/.task/feature-svc-adjust-warn-fix.md new file mode 100644 index 00000000..62d4373e --- /dev/null +++ b/.task/feature-svc-adjust-warn-fix.md @@ -0,0 +1,25 @@ +# feature/svc-adjust-warn-fix 任务卡 + +任务主记录:;状态:进行中;owner:weichen + +## 基线与授权 + +- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 73041b49fd8567aa02483a70bffed0ef8116bd22 +- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-svc-adjust-warn-fix(worktree);分支:feature/svc-adjust-warn-fix +- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> + +## 目标与非目标 + +<预期结果、受影响入口/模块/契约;明确不做什么。> + +## 同步记录 + +| 节点 | sync_base_sha | tested_head_sha | checked_at | +|---|---|---|---| +| 启动 | 73041b49fd8567aa02483a70bffed0ef8116bd22 | 73041b49fd8567aa02483a70bffed0ef8116bd22 | 2026-10-05T02:22:29Z | + +## 结果与验证(完成后填写) + +- 结果: +- 验证: +- 影响与剩余项: From 421ee87d044b84c034be7f67a40e0864116c399d Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 02:23:32 +0000 Subject: [PATCH 21/53] Normalize the rebuild args comparison to stop spurious drop warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: adjust_args_for_bin strips the leading space of its return while the rebuilt args keep it, so every rebuild carrying --dsn/--auth compared unequal and warned that the legacy binary had the flags dropped even when nothing was dropped — misleading during incident triage. Evidence: bash -n clean; against the real dev binary the normalized comparison reports no drop and the flags survive intact; make test green. Impact: warning now fires only when flags are actually filtered; no behavioral change to start/deploy. Refs: PR #188 --- scripts/svc.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/svc.sh b/scripts/svc.sh index 23ecfeb7..2edcec38 100755 --- a/scripts/svc.sh +++ b/scripts/svc.sh @@ -1248,7 +1248,9 @@ agent_do_start() { fi fi local adjusted; adjusted="$(adjust_args_for_bin "$ENV_BIN" "$args")" - if [ "$adjusted" != "$args" ]; then + # adjust_args_for_bin 返回值已去首空格——比较前对 args 同样归一,否则每次 + # 带 --dsn/--auth 的重建都会误报"旧版本二进制已自动省略"(参数实际全保留)。 + if [ "$adjusted" != "${args# }" ]; then c_warn "[$ENV_NAME] 该产物不支持 --dsn/--auth(旧版本二进制),已自动省略:$(mask_dsn "${args:-<无>}") → $(mask_dsn "${adjusted:-<无>}")" fi args="$adjusted" From 5bd22e4ccdfd1f42db20925d73fe066ec27bca8d Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 02:23:33 +0000 Subject: [PATCH 22/53] Record the sync checkpoint --- .task/feature-svc-adjust-warn-fix.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-svc-adjust-warn-fix.md b/.task/feature-svc-adjust-warn-fix.md index 62d4373e..cbb67016 100644 --- a/.task/feature-svc-adjust-warn-fix.md +++ b/.task/feature-svc-adjust-warn-fix.md @@ -23,3 +23,4 @@ - 结果: - 验证: - 影响与剩余项: +| 同步前验收 | 73041b49fd8567aa02483a70bffed0ef8116bd22 | 421ee87d044b84c034be7f67a40e0864116c399d | 2026-10-05T02:23:33Z | From 69f464ffe4ca29d271e7bb344405557a345dcd88 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 02:24:37 +0000 Subject: [PATCH 23/53] Close 1 merged task card(s) and archive them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: branches merged into main had left their task cards open; backfill status and archive to prevent bookkeeping debt. Evidence: feature-svc-adjust-warn-fix.md(PR#189) — merges verified via git log --merges against origin/main. Impact: .task/*.md moved to .task/archive/ with status backfilled; no code or submodule change. Refs: task.sh close (card-autoclose-r1) --- .task/{ => archive}/feature-svc-adjust-warn-fix.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) rename .task/{ => archive}/feature-svc-adjust-warn-fix.md (59%) diff --git a/.task/feature-svc-adjust-warn-fix.md b/.task/archive/feature-svc-adjust-warn-fix.md similarity index 59% rename from .task/feature-svc-adjust-warn-fix.md rename to .task/archive/feature-svc-adjust-warn-fix.md index cbb67016..b19c378d 100644 --- a/.task/feature-svc-adjust-warn-fix.md +++ b/.task/archive/feature-svc-adjust-warn-fix.md @@ -1,6 +1,6 @@ # feature/svc-adjust-warn-fix 任务卡 -任务主记录:;状态:进行中;owner:weichen +任务主记录:PR #189 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/189(merge 40ee4a1112);状态:已完成(回填);owner:weichen ## 基线与授权 @@ -18,9 +18,15 @@ |---|---|---|---| | 启动 | 73041b49fd8567aa02483a70bffed0ef8116bd22 | 73041b49fd8567aa02483a70bffed0ef8116bd22 | 2026-10-05T02:22:29Z | -## 结果与验证(完成后填写) +## 结果与验证 - 结果: - 验证: - 影响与剩余项: | 同步前验收 | 73041b49fd8567aa02483a70bffed0ef8116bd22 | 421ee87d044b84c034be7f67a40e0864116c399d | 2026-10-05T02:23:33Z | + +## 闭合记录(card-autoclose 回填) + +- 依据:merge 40ee4a111274d090bf98b3c4e55a66f18d5e994b(PR #189)已包含于 origin/main,分支成果已落盘;本段为合入后回填。 +- 合并主题:Merge pull request 'Normalize the rebuild args comparison to stop spurious drop warnings' (#189) from feature/svc-adjust-warn-fix into main +- 归档:随闭合移入 .task/archive/;任务执行期的过程证据见原任务记录与 PR。 From 64e4388357f746a71e19b696755c80fcc071bc51 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 02:49:12 +0000 Subject: [PATCH 24/53] Record the task card for feature-store-pg-bool-dialect --- .task/feature-store-pg-bool-dialect.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .task/feature-store-pg-bool-dialect.md diff --git a/.task/feature-store-pg-bool-dialect.md b/.task/feature-store-pg-bool-dialect.md new file mode 100644 index 00000000..a95c787d --- /dev/null +++ b/.task/feature-store-pg-bool-dialect.md @@ -0,0 +1,25 @@ +# feature/store-pg-bool-dialect 任务卡 + +任务主记录:;状态:进行中;owner:weichen + +## 基线与授权 + +- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= dc42ceb36950a6d890d1e19676a0af6fd894d693 +- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-store-pg-bool-dialect(worktree);分支:feature/store-pg-bool-dialect +- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> + +## 目标与非目标 + +<预期结果、受影响入口/模块/契约;明确不做什么。> + +## 同步记录 + +| 节点 | sync_base_sha | tested_head_sha | checked_at | +|---|---|---|---| +| 启动 | dc42ceb36950a6d890d1e19676a0af6fd894d693 | dc42ceb36950a6d890d1e19676a0af6fd894d693 | 2026-10-05T02:49:12Z | + +## 结果与验证(完成后填写) + +- 结果: +- 验证: +- 影响与剩余项: From 0dc178aa81b36f82b1a47ae7ac29f079ebd4ee14 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 02:53:00 +0000 Subject: [PATCH 25/53] Pin the postgres boolean dialect fix in the backend store Why: the backend fix unblocks account management, login and conversation flags on the postgres tier (1/0 literals and int scans rejected with 42804). Evidence: backend PR #64 merged; live pg1 CLI verified (reset-password + user list OK); combined make test green. Impact: dev pins move to the fixed backend; no other surface changes. Refs: Agent-System-Backend#64 --- modules/backend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/backend b/modules/backend index c05832dd..14aa60b6 160000 --- a/modules/backend +++ b/modules/backend @@ -1 +1 @@ -Subproject commit c05832dd6a3624cfdbd528f23288b9c20dc76f24 +Subproject commit 14aa60b6985e6b1e40023e48d7bf27814ed6cf24 From ec060ec05e5a9954bd7c3a561902eef793e57ad1 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 02:54:20 +0000 Subject: [PATCH 26/53] Record the sync checkpoint --- .task/feature-store-pg-bool-dialect.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-store-pg-bool-dialect.md b/.task/feature-store-pg-bool-dialect.md index a95c787d..fdd048e4 100644 --- a/.task/feature-store-pg-bool-dialect.md +++ b/.task/feature-store-pg-bool-dialect.md @@ -23,3 +23,4 @@ - 结果: - 验证: - 影响与剩余项: +| 同步前验收 | dc42ceb36950a6d890d1e19676a0af6fd894d693 | 0dc178aa81b36f82b1a47ae7ac29f079ebd4ee14 | 2026-10-05T02:54:20Z | From 88d7b01cc8bd2ba2371d302da9a362b9007d2fe0 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 02:57:09 +0000 Subject: [PATCH 27/53] Close 1 merged task card(s) and archive them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: branches merged into main had left their task cards open; backfill status and archive to prevent bookkeeping debt. Evidence: feature-store-pg-bool-dialect.md(PR#192) — merges verified via git log --merges against origin/main. Impact: .task/*.md moved to .task/archive/ with status backfilled; no code or submodule change. Refs: task.sh close (card-autoclose-r1) --- .task/{ => archive}/feature-store-pg-bool-dialect.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) rename .task/{ => archive}/feature-store-pg-bool-dialect.md (59%) diff --git a/.task/feature-store-pg-bool-dialect.md b/.task/archive/feature-store-pg-bool-dialect.md similarity index 59% rename from .task/feature-store-pg-bool-dialect.md rename to .task/archive/feature-store-pg-bool-dialect.md index fdd048e4..7965161a 100644 --- a/.task/feature-store-pg-bool-dialect.md +++ b/.task/archive/feature-store-pg-bool-dialect.md @@ -1,6 +1,6 @@ # feature/store-pg-bool-dialect 任务卡 -任务主记录:;状态:进行中;owner:weichen +任务主记录:PR #192 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/192(merge 626373b8e8);状态:已完成(回填);owner:weichen ## 基线与授权 @@ -18,9 +18,15 @@ |---|---|---|---| | 启动 | dc42ceb36950a6d890d1e19676a0af6fd894d693 | dc42ceb36950a6d890d1e19676a0af6fd894d693 | 2026-10-05T02:49:12Z | -## 结果与验证(完成后填写) +## 结果与验证 - 结果: - 验证: - 影响与剩余项: | 同步前验收 | dc42ceb36950a6d890d1e19676a0af6fd894d693 | 0dc178aa81b36f82b1a47ae7ac29f079ebd4ee14 | 2026-10-05T02:54:20Z | + +## 闭合记录(card-autoclose 回填) + +- 依据:merge 626373b8e84e9c3da5f7762a59b7eedfb2cdf841(PR #192)已包含于 origin/main,分支成果已落盘;本段为合入后回填。 +- 合并主题:Merge pull request 'Pin the postgres boolean dialect fix in the backend store' (#192) from feature/store-pg-bool-dialect into main +- 归档:随闭合移入 .task/archive/;任务执行期的过程证据见原任务记录与 PR。 From 5b50956e4f5ff5a9b87f944e49bfd06685443596 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 03:15:37 +0000 Subject: [PATCH 28/53] Record the task card for feature-store-pg-archived-literal --- .task/feature-store-pg-archived-literal.md | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .task/feature-store-pg-archived-literal.md diff --git a/.task/feature-store-pg-archived-literal.md b/.task/feature-store-pg-archived-literal.md new file mode 100644 index 00000000..59623654 --- /dev/null +++ b/.task/feature-store-pg-archived-literal.md @@ -0,0 +1,25 @@ +# feature/store-pg-archived-literal 任务卡 + +任务主记录:;状态:进行中;owner:weichen + +## 基线与授权 + +- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 989ed378ddd83b3bc3f47d2b497857dfe024d87f +- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-store-pg-archived-literal(worktree);分支:feature/store-pg-archived-literal +- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> + +## 目标与非目标 + +<预期结果、受影响入口/模块/契约;明确不做什么。> + +## 同步记录 + +| 节点 | sync_base_sha | tested_head_sha | checked_at | +|---|---|---|---| +| 启动 | 989ed378ddd83b3bc3f47d2b497857dfe024d87f | 989ed378ddd83b3bc3f47d2b497857dfe024d87f | 2026-10-05T03:15:37Z | + +## 结果与验证(完成后填写) + +- 结果: +- 验证: +- 影响与剩余项: From e1ec73941eb3a98dfe25b516b1ede39b9d6c68c9 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 03:20:00 +0000 Subject: [PATCH 29/53] Pin the ListTasks archived boolean fix in the backend store Why: the default unarchived task list still compared a BOOLEAN column to the integer literal 0, so GET /api/conversations returned 500 on the postgres tier after the previous dialect fix. Evidence: backend PR #65 (8d82408). Before the fix, TestConversationFlagsAndTaskList on pg1 failed with SQLSTATE 42883; after, go test ./internal/store -count=1 passed on pg1. Dev make test passed on this pin. Impact: modules/backend gitlink moves to 8d82408. No other surface changes. Refs: Agent-System-Backend#65 Co-authored-by: Cursor --- .task/feature-store-pg-archived-literal.md | 13 +++++++------ modules/backend | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.task/feature-store-pg-archived-literal.md b/.task/feature-store-pg-archived-literal.md index 59623654..e09e4806 100644 --- a/.task/feature-store-pg-archived-literal.md +++ b/.task/feature-store-pg-archived-literal.md @@ -1,16 +1,17 @@ # feature/store-pg-archived-literal 任务卡 -任务主记录:;状态:进行中;owner:weichen +任务主记录:Agent-System-Backend PR #65 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Backend/pulls/65;状态:进行中;owner:weichen ## 基线与授权 - 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 989ed378ddd83b3bc3f47d2b497857dfe024d87f - 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-store-pg-archived-literal(worktree);分支:feature/store-pg-archived-literal -- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> +- 授权与交付终点:修复 postgres 档 `GET /api/conversations` 500,推进 backend 与 Dev gitlink PR。合入与 dev 部署在 PR 就绪后执行。不改 schema,不处理登录前 401。 ## 目标与非目标 -<预期结果、受影响入口/模块/契约;明确不做什么。> +- 目标:`ListTasks` 默认未归档视图把 `archived` 绑成 Go bool,消除 PG `boolean = integer`(42883)。 +- 非目标:不改迁移(PG BOOLEAN / SQLite INTEGER 保持),不改认证 401。 ## 同步记录 @@ -20,6 +21,6 @@ ## 结果与验证(完成后填写) -- 结果: -- 验证: -- 影响与剩余项: +- 结果:backend `8d82408` 将 `ListTasks` 的 `archived=0` 改为 `archived=?` 绑定 `false`;`openTestStore` 兼容 URL 与键值对 DSN,search_path 保留 public。 +- 验证:修复前 pg1 上 `TestConversationFlagsAndTaskList` 报 SQLSTATE 42883。修复后 `AGENT_PG_TEST_DSN= go test ./internal/store -count=1` 通过;backend `go vet ./... && go test ./... -count=1` 通过;Dev 仓 `make test` 通过(2026-10-05)。 +- 影响与剩余项:只推进 `modules/backend` gitlink。backend PR #65 与本仓 PR 待所有者合入;合入后重新部署 dev 并用 `GET /api/conversations` 验收。401 不在本次范围。 diff --git a/modules/backend b/modules/backend index 14aa60b6..8d82408b 160000 --- a/modules/backend +++ b/modules/backend @@ -1 +1 @@ -Subproject commit 14aa60b6985e6b1e40023e48d7bf27814ed6cf24 +Subproject commit 8d82408bb72c1cd3beab2051b83290ed735e6ae8 From 7af9b900b3740349c787bebea75a779b9db5ed94 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 03:20:05 +0000 Subject: [PATCH 30/53] Record the sync checkpoint --- .task/feature-store-pg-archived-literal.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-store-pg-archived-literal.md b/.task/feature-store-pg-archived-literal.md index e09e4806..110108cc 100644 --- a/.task/feature-store-pg-archived-literal.md +++ b/.task/feature-store-pg-archived-literal.md @@ -24,3 +24,4 @@ - 结果:backend `8d82408` 将 `ListTasks` 的 `archived=0` 改为 `archived=?` 绑定 `false`;`openTestStore` 兼容 URL 与键值对 DSN,search_path 保留 public。 - 验证:修复前 pg1 上 `TestConversationFlagsAndTaskList` 报 SQLSTATE 42883。修复后 `AGENT_PG_TEST_DSN= go test ./internal/store -count=1` 通过;backend `go vet ./... && go test ./... -count=1` 通过;Dev 仓 `make test` 通过(2026-10-05)。 - 影响与剩余项:只推进 `modules/backend` gitlink。backend PR #65 与本仓 PR 待所有者合入;合入后重新部署 dev 并用 `GET /api/conversations` 验收。401 不在本次范围。 +| 同步前验收 | 989ed378ddd83b3bc3f47d2b497857dfe024d87f | e1ec73941eb3a98dfe25b516b1ede39b9d6c68c9 | 2026-10-05T03:20:05Z | From 080de2dbd0fb658a9cc500f3fe51385a72676de4 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 03:21:05 +0000 Subject: [PATCH 31/53] Record the Dev pull request on the task card Why: the task card is the main record and needs the Dev PR link alongside the backend PR. Evidence: Dev PR #194 is open; make test already passed after task-sync. Impact: task card text only. Refs: Agent-System-Dev#194, Agent-System-Backend#65 Co-authored-by: Cursor --- .task/feature-store-pg-archived-literal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.task/feature-store-pg-archived-literal.md b/.task/feature-store-pg-archived-literal.md index 110108cc..bafe659f 100644 --- a/.task/feature-store-pg-archived-literal.md +++ b/.task/feature-store-pg-archived-literal.md @@ -1,6 +1,6 @@ # feature/store-pg-archived-literal 任务卡 -任务主记录:Agent-System-Backend PR #65 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Backend/pulls/65;状态:进行中;owner:weichen +任务主记录:PR #194 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/194;backend PR #65 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Backend/pulls/65;状态:进行中;owner:weichen ## 基线与授权 From 96d8ee39703a4a5f587c29d72199f8605a3ee495 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 03:24:02 +0000 Subject: [PATCH 32/53] Close 1 merged task card(s) and archive them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: branches merged into main had left their task cards open; backfill status and archive to prevent bookkeeping debt. Evidence: feature-store-pg-archived-literal.md(PR#194) — merges verified via git log --merges against origin/main. Impact: .task/*.md moved to .task/archive/ with status backfilled; no code or submodule change. Refs: task.sh close (card-autoclose-r1) --- .../{ => archive}/feature-store-pg-archived-literal.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) rename .task/{ => archive}/feature-store-pg-archived-literal.md (79%) diff --git a/.task/feature-store-pg-archived-literal.md b/.task/archive/feature-store-pg-archived-literal.md similarity index 79% rename from .task/feature-store-pg-archived-literal.md rename to .task/archive/feature-store-pg-archived-literal.md index bafe659f..c542d633 100644 --- a/.task/feature-store-pg-archived-literal.md +++ b/.task/archive/feature-store-pg-archived-literal.md @@ -1,6 +1,6 @@ # feature/store-pg-archived-literal 任务卡 -任务主记录:PR #194 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/194;backend PR #65 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Backend/pulls/65;状态:进行中;owner:weichen +任务主记录:PR #194 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/194;backend PR #65 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Backend/pulls/65;状态:已完成(回填);owner:weichen ## 基线与授权 @@ -19,9 +19,15 @@ |---|---|---|---| | 启动 | 989ed378ddd83b3bc3f47d2b497857dfe024d87f | 989ed378ddd83b3bc3f47d2b497857dfe024d87f | 2026-10-05T03:15:37Z | -## 结果与验证(完成后填写) +## 结果与验证 - 结果:backend `8d82408` 将 `ListTasks` 的 `archived=0` 改为 `archived=?` 绑定 `false`;`openTestStore` 兼容 URL 与键值对 DSN,search_path 保留 public。 - 验证:修复前 pg1 上 `TestConversationFlagsAndTaskList` 报 SQLSTATE 42883。修复后 `AGENT_PG_TEST_DSN= go test ./internal/store -count=1` 通过;backend `go vet ./... && go test ./... -count=1` 通过;Dev 仓 `make test` 通过(2026-10-05)。 - 影响与剩余项:只推进 `modules/backend` gitlink。backend PR #65 与本仓 PR 待所有者合入;合入后重新部署 dev 并用 `GET /api/conversations` 验收。401 不在本次范围。 | 同步前验收 | 989ed378ddd83b3bc3f47d2b497857dfe024d87f | e1ec73941eb3a98dfe25b516b1ede39b9d6c68c9 | 2026-10-05T03:20:05Z | + +## 闭合记录(card-autoclose 回填) + +- 依据:merge 1a033b41a679f991f282c7aea0de30084df0b3e9(PR #194)已包含于 origin/main,分支成果已落盘;本段为合入后回填。 +- 合并主题:Merge pull request 'Pin the ListTasks archived boolean fix in the backend store' (#194) from feature/store-pg-archived-literal into main +- 归档:随闭合移入 .task/archive/;任务执行期的过程证据见原任务记录与 PR。 From 38bf13c93daafd3407082c4d9e9cc607c76dca1e Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 03:54:31 +0000 Subject: [PATCH 33/53] Record the task card for feature-docx-paper-preview --- .task/feature-docx-paper-preview.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .task/feature-docx-paper-preview.md diff --git a/.task/feature-docx-paper-preview.md b/.task/feature-docx-paper-preview.md new file mode 100644 index 00000000..f2d7d031 --- /dev/null +++ b/.task/feature-docx-paper-preview.md @@ -0,0 +1,25 @@ +# feature/docx-paper-preview 任务卡 + +任务主记录:;状态:进行中;owner:weichen + +## 基线与授权 + +- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= eaae87e635ce31570159637cfe400f099b4daf5b +- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-docx-paper-preview(worktree);分支:feature/docx-paper-preview +- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> + +## 目标与非目标 + +<预期结果、受影响入口/模块/契约;明确不做什么。> + +## 同步记录 + +| 节点 | sync_base_sha | tested_head_sha | checked_at | +|---|---|---|---| +| 启动 | eaae87e635ce31570159637cfe400f099b4daf5b | eaae87e635ce31570159637cfe400f099b4daf5b | 2026-10-05T03:54:31Z | + +## 结果与验证(完成后填写) + +- 结果: +- 验证: +- 影响与剩余项: From b4390ef31335551a42d2441f61429a69744abf47 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 03:59:17 +0000 Subject: [PATCH 34/53] Preview docx on fixed paper instead of the theme background Why: The preview painted docx pages with the theme background, so black document text was unreadable in dark mode and the page overflowed the narrow column. Evidence: UI vitest 84 passed and tsc clean at b14c9c0; frontend vitest 81 passed and tsc -b clean at cf6f24e. Impact: DESIGN.md documents --paper and --paper-ink. Gitlinks pick up the UI and frontend paper-preview commits. Mammoth and fake-docx text fallbacks stay theme-styled. Refs: feature/docx-paper-preview Co-authored-by: Cursor --- .task/feature-docx-paper-preview.md | 14 ++++++++------ DESIGN.md | 11 +++++++++++ modules/frontend | 2 +- modules/ui | 2 +- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.task/feature-docx-paper-preview.md b/.task/feature-docx-paper-preview.md index f2d7d031..0868e38c 100644 --- a/.task/feature-docx-paper-preview.md +++ b/.task/feature-docx-paper-preview.md @@ -1,16 +1,18 @@ # feature/docx-paper-preview 任务卡 -任务主记录:;状态:进行中;owner:weichen +任务主记录:;状态:进行中;owner:weichen ## 基线与授权 - 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= eaae87e635ce31570159637cfe400f099b4daf5b - 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-docx-paper-preview(worktree);分支:feature/docx-paper-preview -- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> +- 授权与交付终点:实现 docx 纸面原貌预览(令牌、样式、栏宽缩放、测试、浏览器核对、子仓与 Dev PR)。合入 main 与 task-finish 等所有者合入后执行。不改写历史、不改分支保护、不发布版本。 ## 目标与非目标 -<预期结果、受影响入口/模块/契约;明确不做什么。> +- 目标:docx 预览固定白纸黑字,保留文档自带样式,窄预览栏整页等比缩小,全屏栏宽足够时保持 100%。 +- 受影响:`DESIGN.md`;UI 仓 tokens/ui.css/FilePreview;Frontend 仓 styles.css、previewsetup、previewfit。 +- 非目标:mammoth 与伪 docx 文本回退仍走主题化 `.doc-viewer`;不改 `renderAsync` 的分页选项;不改 xlsx/pptx 的解析路径。 ## 同步记录 @@ -20,6 +22,6 @@ ## 结果与验证(完成后填写) -- 结果: -- 验证: -- 影响与剩余项: +- 结果:UI `b14c9c0` 增加 `--paper` / `--paper-ink` 并允许预览加载器返回清理函数;Frontend `cf6f24e` 把 docx 页画到纸面令牌上并按栏宽缩放。 +- 验证:UI `npx vitest run` 84 通过、`npx tsc --noEmit` 通过;Frontend `npm test` 81 通过、`npx tsc -b` 通过。浏览器三主题与 `make test` 待补。 +- 影响与剩余项:深色主题下 docx 正文恢复可读。合入前需 task-sync、组合测试与浏览器核对。 diff --git a/DESIGN.md b/DESIGN.md index 75655853..19637ce9 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -75,6 +75,17 @@ Agent-System-Dev 是桌面优先、Web 兼容的 AI 工作台。界面应**冷 | `--accent` | `#165f49` | 交互强调(翠绿) | | `--primary` / `--primary-foreground` | `#082d4f` / `#f3f8f5` | 主按钮 | +### 2.6 文档纸面(主题不变量) + +Office 分页预览是**内容**,不是界面。纸面与默认墨色固定,三套主题同值: + +| 令牌 | 值 | 用途 | +|---|---|---| +| `--paper` | `#ffffff` | docx 页、幻灯片等文档纸面 | +| `--paper-ink` | `#000000` | 纸面上没有自带颜色的文字的默认墨色 | + +规则:保留文档自己的字号、颜色、表格和图片样式。禁止用 `--bg` / `--text` 等主题令牌覆盖这些内联样式。界面只负责纸面周围的底座(`--bg-inset`)和按栏宽等比缩放。 + ## 3. 字号标尺(唯一字号体系) 全局唯一可调变量 `--ui-font-size`(默认 14px),派生: diff --git a/modules/frontend b/modules/frontend index eb6502f0..cf6f24e5 160000 --- a/modules/frontend +++ b/modules/frontend @@ -1 +1 @@ -Subproject commit eb6502f0effd0d02d8a131930fbe60e61d651657 +Subproject commit cf6f24e58317922cbbd9c60be4a019929f7adb15 diff --git a/modules/ui b/modules/ui index 6b2589c1..b14c9c0e 160000 --- a/modules/ui +++ b/modules/ui @@ -1 +1 @@ -Subproject commit 6b2589c19873719c1c203ef7feb542b20a56799a +Subproject commit b14c9c0e0d744af1b8997b03bcd91701a67822bf From f36bac04c801a1f2dd8b8604b4d12c34dfe27f34 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 03:59:50 +0000 Subject: [PATCH 35/53] Point the frontend gitlink at the paper-preview tip Why: The frontend branch gained two follow-up commits that stop a typecheck artifact from dirtying the submodule. Evidence: modules/frontend HEAD is 9badbb1 and git status in that repo is clean. Impact: The Dev branch records the frontend tip that includes page scaling and the tsbuildinfo ignore. No other gitlinks move. Refs: feature/docx-paper-preview Co-authored-by: Cursor --- modules/frontend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/frontend b/modules/frontend index cf6f24e5..9badbb1f 160000 --- a/modules/frontend +++ b/modules/frontend @@ -1 +1 @@ -Subproject commit cf6f24e58317922cbbd9c60be4a019929f7adb15 +Subproject commit 9badbb1f85f4af4464561ba5fb311297847e972e From 06d2dd9d32576b6fb91b7582b508c47414a27ef1 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:00:00 +0000 Subject: [PATCH 36/53] Record the frontend tip on the task card Why: The card still named the frontend commit from before the tsbuildinfo follow-ups. Evidence: modules/frontend HEAD is 9badbb1. Impact: Task record only. No code or gitlink change. Refs: feature/docx-paper-preview Co-authored-by: Cursor --- .task/feature-docx-paper-preview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.task/feature-docx-paper-preview.md b/.task/feature-docx-paper-preview.md index 0868e38c..e33477fe 100644 --- a/.task/feature-docx-paper-preview.md +++ b/.task/feature-docx-paper-preview.md @@ -22,6 +22,6 @@ ## 结果与验证(完成后填写) -- 结果:UI `b14c9c0` 增加 `--paper` / `--paper-ink` 并允许预览加载器返回清理函数;Frontend `cf6f24e` 把 docx 页画到纸面令牌上并按栏宽缩放。 +- 结果:UI `b14c9c0` 增加 `--paper` / `--paper-ink` 并允许预览加载器返回清理函数;Frontend `9badbb1` 把 docx 页画到纸面令牌上并按栏宽缩放。 - 验证:UI `npx vitest run` 84 通过、`npx tsc --noEmit` 通过;Frontend `npm test` 81 通过、`npx tsc -b` 通过。浏览器三主题与 `make test` 待补。 - 影响与剩余项:深色主题下 docx 正文恢复可读。合入前需 task-sync、组合测试与浏览器核对。 From 10eaaeb8dc4f0e869847d3874a90793be3dfedf9 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:03:55 +0000 Subject: [PATCH 37/53] Record paper-preview verification on the task card Why: The card still said browser checks and the combined test were pending after both had passed. Evidence: make test exited 0 in this worktree. The harness measured white paper, black ink, preserved document colors, scale 0.496 at 420px, and transform none at 998px. Impact: Task record only. No code or gitlink change. Refs: feature/docx-paper-preview Co-authored-by: Cursor --- .task/feature-docx-paper-preview.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.task/feature-docx-paper-preview.md b/.task/feature-docx-paper-preview.md index e33477fe..c80010ba 100644 --- a/.task/feature-docx-paper-preview.md +++ b/.task/feature-docx-paper-preview.md @@ -23,5 +23,5 @@ ## 结果与验证(完成后填写) - 结果:UI `b14c9c0` 增加 `--paper` / `--paper-ink` 并允许预览加载器返回清理函数;Frontend `9badbb1` 把 docx 页画到纸面令牌上并按栏宽缩放。 -- 验证:UI `npx vitest run` 84 通过、`npx tsc --noEmit` 通过;Frontend `npm test` 81 通过、`npx tsc -b` 通过。浏览器三主题与 `make test` 待补。 -- 影响与剩余项:深色主题下 docx 正文恢复可读。合入前需 task-sync、组合测试与浏览器核对。 +- 验证:UI `npx vitest run` 84 通过、`npx tsc --noEmit` 通过;Frontend `npm test` 81 通过、`npx tsc -b` 通过。`make test` 于 2026-10-05 在本 worktree 通过(boundaries、pins、libs、core、backend、frontend 81、ui 84、agent-command)。浏览器核对页:深色窄栏 420px 纸面 `rgb(255,255,255)`、默认墨色 `rgb(0,0,0)`、标题保留文档蓝 `rgb(31,78,121)`、红句保留 `rgb(192,0,0)`,缩放 `matrix(0.496222)`(页宽 794);浅色主题纸面与墨色不变;墨绿主题底座 `rgb(224,224,219)`、纸面仍白;栏宽 998px 时 `transform=none`(100%)。 +- 影响与剩余项:深色主题下 docx 正文恢复可读。mammoth 与伪 docx 文本回退仍走主题化排版。合入权在所有者,合入后才能 task-finish。 From be844bedd2ac1f66d1cf14777f3fb209cdc36659 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:03:56 +0000 Subject: [PATCH 38/53] Record the sync checkpoint --- .task/feature-docx-paper-preview.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-docx-paper-preview.md b/.task/feature-docx-paper-preview.md index c80010ba..9e233df0 100644 --- a/.task/feature-docx-paper-preview.md +++ b/.task/feature-docx-paper-preview.md @@ -25,3 +25,4 @@ - 结果:UI `b14c9c0` 增加 `--paper` / `--paper-ink` 并允许预览加载器返回清理函数;Frontend `9badbb1` 把 docx 页画到纸面令牌上并按栏宽缩放。 - 验证:UI `npx vitest run` 84 通过、`npx tsc --noEmit` 通过;Frontend `npm test` 81 通过、`npx tsc -b` 通过。`make test` 于 2026-10-05 在本 worktree 通过(boundaries、pins、libs、core、backend、frontend 81、ui 84、agent-command)。浏览器核对页:深色窄栏 420px 纸面 `rgb(255,255,255)`、默认墨色 `rgb(0,0,0)`、标题保留文档蓝 `rgb(31,78,121)`、红句保留 `rgb(192,0,0)`,缩放 `matrix(0.496222)`(页宽 794);浅色主题纸面与墨色不变;墨绿主题底座 `rgb(224,224,219)`、纸面仍白;栏宽 998px 时 `transform=none`(100%)。 - 影响与剩余项:深色主题下 docx 正文恢复可读。mammoth 与伪 docx 文本回退仍走主题化排版。合入权在所有者,合入后才能 task-finish。 +| 同步前验收 | eaae87e635ce31570159637cfe400f099b4daf5b | 10eaaeb8dc4f0e869847d3874a90793be3dfedf9 | 2026-10-05T04:03:56Z | From f2c40412470af9752b5d56724f4e7b631f92fab2 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:04:47 +0000 Subject: [PATCH 39/53] Record the paper-preview pull requests on the task card Why: The task card is the main record and still had a placeholder where the pull request link belongs. Evidence: Dev pull request 196, UI pull request 35, frontend pull request 44. Impact: Task record only. No code or gitlink change. Refs: feature/docx-paper-preview Co-authored-by: Cursor --- .task/feature-docx-paper-preview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.task/feature-docx-paper-preview.md b/.task/feature-docx-paper-preview.md index 9e233df0..10876649 100644 --- a/.task/feature-docx-paper-preview.md +++ b/.task/feature-docx-paper-preview.md @@ -1,6 +1,6 @@ # feature/docx-paper-preview 任务卡 -任务主记录:;状态:进行中;owner:weichen +任务主记录:https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/196 ;状态:进行中;owner:weichen ## 基线与授权 From e6852872fe8587b4402eefb5ac509e29415d1abc Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:04:56 +0000 Subject: [PATCH 40/53] Link the submodule pull requests from the task card Why: The card named the UI and frontend commits but not the pull requests that carry them. Evidence: UI pull request 35 and frontend pull request 44 are open. Impact: Task record only. No code or gitlink change. Refs: feature/docx-paper-preview Co-authored-by: Cursor --- .task/feature-docx-paper-preview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.task/feature-docx-paper-preview.md b/.task/feature-docx-paper-preview.md index 10876649..57a35ab1 100644 --- a/.task/feature-docx-paper-preview.md +++ b/.task/feature-docx-paper-preview.md @@ -22,7 +22,7 @@ ## 结果与验证(完成后填写) -- 结果:UI `b14c9c0` 增加 `--paper` / `--paper-ink` 并允许预览加载器返回清理函数;Frontend `9badbb1` 把 docx 页画到纸面令牌上并按栏宽缩放。 +- 结果:UI `b14c9c0`(https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-UI/pulls/35)增加 `--paper` / `--paper-ink` 并允许预览加载器返回清理函数;Frontend `9badbb1`(https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Frontend/pulls/44)把 docx 页画到纸面令牌上并按栏宽缩放。 - 验证:UI `npx vitest run` 84 通过、`npx tsc --noEmit` 通过;Frontend `npm test` 81 通过、`npx tsc -b` 通过。`make test` 于 2026-10-05 在本 worktree 通过(boundaries、pins、libs、core、backend、frontend 81、ui 84、agent-command)。浏览器核对页:深色窄栏 420px 纸面 `rgb(255,255,255)`、默认墨色 `rgb(0,0,0)`、标题保留文档蓝 `rgb(31,78,121)`、红句保留 `rgb(192,0,0)`,缩放 `matrix(0.496222)`(页宽 794);浅色主题纸面与墨色不变;墨绿主题底座 `rgb(224,224,219)`、纸面仍白;栏宽 998px 时 `transform=none`(100%)。 - 影响与剩余项:深色主题下 docx 正文恢复可读。mammoth 与伪 docx 文本回退仍走主题化排版。合入权在所有者,合入后才能 task-finish。 | 同步前验收 | eaae87e635ce31570159637cfe400f099b4daf5b | 10eaaeb8dc4f0e869847d3874a90793be3dfedf9 | 2026-10-05T04:03:56Z | From 2723c73baef8748232d77c3c8ab9d49164a9374d Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:05:14 +0000 Subject: [PATCH 41/53] Put the sync checkpoint back in the task table Why: task-sync appends the checkpoint after the results section, so the row rendered as a loose line. Evidence: the checkpoint values are unchanged and now sit under the sync table header. Impact: Task record formatting only. Refs: feature/docx-paper-preview Co-authored-by: Cursor --- .task/feature-docx-paper-preview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.task/feature-docx-paper-preview.md b/.task/feature-docx-paper-preview.md index 57a35ab1..65699add 100644 --- a/.task/feature-docx-paper-preview.md +++ b/.task/feature-docx-paper-preview.md @@ -19,10 +19,10 @@ | 节点 | sync_base_sha | tested_head_sha | checked_at | |---|---|---|---| | 启动 | eaae87e635ce31570159637cfe400f099b4daf5b | eaae87e635ce31570159637cfe400f099b4daf5b | 2026-10-05T03:54:31Z | +| 同步前验收 | eaae87e635ce31570159637cfe400f099b4daf5b | 10eaaeb8dc4f0e869847d3874a90793be3dfedf9 | 2026-10-05T04:03:56Z | ## 结果与验证(完成后填写) - 结果:UI `b14c9c0`(https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-UI/pulls/35)增加 `--paper` / `--paper-ink` 并允许预览加载器返回清理函数;Frontend `9badbb1`(https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Frontend/pulls/44)把 docx 页画到纸面令牌上并按栏宽缩放。 - 验证:UI `npx vitest run` 84 通过、`npx tsc --noEmit` 通过;Frontend `npm test` 81 通过、`npx tsc -b` 通过。`make test` 于 2026-10-05 在本 worktree 通过(boundaries、pins、libs、core、backend、frontend 81、ui 84、agent-command)。浏览器核对页:深色窄栏 420px 纸面 `rgb(255,255,255)`、默认墨色 `rgb(0,0,0)`、标题保留文档蓝 `rgb(31,78,121)`、红句保留 `rgb(192,0,0)`,缩放 `matrix(0.496222)`(页宽 794);浅色主题纸面与墨色不变;墨绿主题底座 `rgb(224,224,219)`、纸面仍白;栏宽 998px 时 `transform=none`(100%)。 - 影响与剩余项:深色主题下 docx 正文恢复可读。mammoth 与伪 docx 文本回退仍走主题化排版。合入权在所有者,合入后才能 task-finish。 -| 同步前验收 | eaae87e635ce31570159637cfe400f099b4daf5b | 10eaaeb8dc4f0e869847d3874a90793be3dfedf9 | 2026-10-05T04:03:56Z | From d570c2ba6962d139746555dd5fa60edbed5e8f9e Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:07:07 +0000 Subject: [PATCH 42/53] Close 1 merged task card(s) and archive them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: branches merged into main had left their task cards open; backfill status and archive to prevent bookkeeping debt. Evidence: feature-docx-paper-preview.md(PR#196) — merges verified via git log --merges against origin/main. Impact: .task/*.md moved to .task/archive/ with status backfilled; no code or submodule change. Refs: task.sh close (card-autoclose-r1) --- .task/{ => archive}/feature-docx-paper-preview.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) rename .task/{ => archive}/feature-docx-paper-preview.md (82%) diff --git a/.task/feature-docx-paper-preview.md b/.task/archive/feature-docx-paper-preview.md similarity index 82% rename from .task/feature-docx-paper-preview.md rename to .task/archive/feature-docx-paper-preview.md index 65699add..8ea16448 100644 --- a/.task/feature-docx-paper-preview.md +++ b/.task/archive/feature-docx-paper-preview.md @@ -1,6 +1,6 @@ # feature/docx-paper-preview 任务卡 -任务主记录:https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/196 ;状态:进行中;owner:weichen +任务主记录:https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/196 ;状态:已完成(回填);owner:weichen ## 基线与授权 @@ -21,8 +21,14 @@ | 启动 | eaae87e635ce31570159637cfe400f099b4daf5b | eaae87e635ce31570159637cfe400f099b4daf5b | 2026-10-05T03:54:31Z | | 同步前验收 | eaae87e635ce31570159637cfe400f099b4daf5b | 10eaaeb8dc4f0e869847d3874a90793be3dfedf9 | 2026-10-05T04:03:56Z | -## 结果与验证(完成后填写) +## 结果与验证 - 结果:UI `b14c9c0`(https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-UI/pulls/35)增加 `--paper` / `--paper-ink` 并允许预览加载器返回清理函数;Frontend `9badbb1`(https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Frontend/pulls/44)把 docx 页画到纸面令牌上并按栏宽缩放。 - 验证:UI `npx vitest run` 84 通过、`npx tsc --noEmit` 通过;Frontend `npm test` 81 通过、`npx tsc -b` 通过。`make test` 于 2026-10-05 在本 worktree 通过(boundaries、pins、libs、core、backend、frontend 81、ui 84、agent-command)。浏览器核对页:深色窄栏 420px 纸面 `rgb(255,255,255)`、默认墨色 `rgb(0,0,0)`、标题保留文档蓝 `rgb(31,78,121)`、红句保留 `rgb(192,0,0)`,缩放 `matrix(0.496222)`(页宽 794);浅色主题纸面与墨色不变;墨绿主题底座 `rgb(224,224,219)`、纸面仍白;栏宽 998px 时 `transform=none`(100%)。 - 影响与剩余项:深色主题下 docx 正文恢复可读。mammoth 与伪 docx 文本回退仍走主题化排版。合入权在所有者,合入后才能 task-finish。 + +## 闭合记录(card-autoclose 回填) + +- 依据:merge 7e59377f1e12a6c00f867014f94d3acfe14896af(PR #196)已包含于 origin/main,分支成果已落盘;本段为合入后回填。 +- 合并主题:Merge pull request 'Preview docx on fixed paper instead of the theme background' (#196) from feature/docx-paper-preview into main +- 归档:随闭合移入 .task/archive/;任务执行期的过程证据见原任务记录与 PR。 From b6f05521bb4523c249bec9f6e4fc5dcda1239a37 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:25:22 +0000 Subject: [PATCH 43/53] Record the task card for feature-contrast-typography --- .task/feature-contrast-typography.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .task/feature-contrast-typography.md diff --git a/.task/feature-contrast-typography.md b/.task/feature-contrast-typography.md new file mode 100644 index 00000000..77342fd9 --- /dev/null +++ b/.task/feature-contrast-typography.md @@ -0,0 +1,25 @@ +# feature/contrast-typography 任务卡 + +任务主记录:;状态:进行中;owner:weichen + +## 基线与授权 + +- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 +- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-contrast-typography(worktree);分支:feature/contrast-typography +- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> + +## 目标与非目标 + +<预期结果、受影响入口/模块/契约;明确不做什么。> + +## 同步记录 + +| 节点 | sync_base_sha | tested_head_sha | checked_at | +|---|---|---|---| +| 启动 | 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 | 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 | 2026-10-05T04:25:22Z | + +## 结果与验证(完成后填写) + +- 结果: +- 验证: +- 影响与剩余项: From 8ba5f885c593560bcbe2bb588be63e4db224e09d Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:34:21 +0000 Subject: [PATCH 44/53] Record the task card for feature-preview-scroll-consolidate --- .task/feature-preview-scroll-consolidate.md | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .task/feature-preview-scroll-consolidate.md diff --git a/.task/feature-preview-scroll-consolidate.md b/.task/feature-preview-scroll-consolidate.md new file mode 100644 index 00000000..7df09349 --- /dev/null +++ b/.task/feature-preview-scroll-consolidate.md @@ -0,0 +1,25 @@ +# feature/preview-scroll-consolidate 任务卡 + +任务主记录:;状态:进行中;owner:weichen + +## 基线与授权 + +- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 +- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-preview-scroll-consolidate(worktree);分支:feature/preview-scroll-consolidate +- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> + +## 目标与非目标 + +<预期结果、受影响入口/模块/契约;明确不做什么。> + +## 同步记录 + +| 节点 | sync_base_sha | tested_head_sha | checked_at | +|---|---|---|---| +| 启动 | 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 | 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 | 2026-10-05T04:34:21Z | + +## 结果与验证(完成后填写) + +- 结果: +- 验证: +- 影响与剩余项: From 286670f1016c6fb06a6ccec9b14c28edac3e091e Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:37:18 +0000 Subject: [PATCH 45/53] Pair the contrast rules with the token change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: DESIGN.md and tokens.css have to change in the same pull request, and the host has to consume the new UI and frontend commits for the sidebar button and font-size setting to exist. Evidence: contrast-guard and both package test suites passed in the linked commits (UI 103 tests, frontend 81 tests). Dev make test follows before review. Impact: Text floors, text-grade semantic colors, molv sidebar tokens, xs at 11px, and the local font-size setting are now the written rules. §12.1 records the before/after values. Gitlinks move to the contrast-typography commits. Refs: feature/contrast-typography Co-authored-by: Cursor --- .task/feature-contrast-typography.md | 5 ++- DESIGN.md | 60 ++++++++++++++++++++++++---- modules/frontend | 2 +- modules/ui | 2 +- 4 files changed, 57 insertions(+), 12 deletions(-) diff --git a/.task/feature-contrast-typography.md b/.task/feature-contrast-typography.md index 77342fd9..bbcc6df2 100644 --- a/.task/feature-contrast-typography.md +++ b/.task/feature-contrast-typography.md @@ -6,11 +6,12 @@ - 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 - 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-contrast-typography(worktree);分支:feature/contrast-typography -- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> +- 授权与交付终点:实现对比度与字号治理(令牌、contrast-guard、DESIGN.md、消费端迁移、本机界面字号)。不改 Core 契约,不改后端 settings schema,不做 px→rem / prefers-contrast / 聚焦环加强。交付为 UI、Frontend、Dev 各一个 PR。 ## 目标与非目标 -<预期结果、受影响入口/模块/契约;明确不做什么。> +- 目标:三套主题的正文与文字档对比度 ≥ 4.5:1,装饰 faint 与图形语义色 ≥ 3:1;墨绿侧栏强调色与「新建任务」按钮可见;表头与决策性文字不再使用 faint + 10px;设置中心可调界面字号(13/14/16/18,仅本机)。 +- 非目标:账号级字号同步、rem 标尺、高对比媒体查询、聚焦环重做。 ## 同步记录 diff --git a/DESIGN.md b/DESIGN.md index 19637ce9..0506632a 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -44,21 +44,46 @@ Agent-System-Dev 是桌面优先、Web 兼容的 AI 工作台。界面应**冷 ### 2.3 文本 -`--text`(主读文本,深 `#d4d4d4` / 浅 `#262626`)、`--text-dim`(62%)、`--text-faint`(38%)。 +`--text`(主读文本,深 `#d4d4d4` / 浅 `#262626` / 墨绿 `#082d4f`)。 +`--text-dim`:深 66% / 浅 68% / 墨绿 70%。 +`--text-faint`:深 52% / 浅与墨绿 58%。 用文本层级制造信息密度,先于增加更多边框或颜色。 +门槛(`contrast-guard.test.ts`,WCAG 2.1): + +- `--text` 与 `--text-dim` 在主区表面(`--bg`、`--bg-panel`、`--bg-raised`、代码底 `--bg-inset`)不低于 **4.5:1**。 +- `--text-faint` 不低于 **3:1**,并且**只用于装饰**:占位符、chevron、kbd、关闭图标的默认色。 +- 承载决策或需要读完的文字从 `--text-dim` 起步:表头、确认详情、工具清单、空态说明、设置项描述、状态词。不要把 faint 当内容色。 + +侧栏另用 `--text-sidebar-dim`(墨绿 78%)与 `--text-sidebar-faint`(墨绿 62%),门槛与主区相同,只跟 `--bg-sidebar` 对拍。 +侧栏会把 `--text*` 重映射成侧栏色。挂在侧栏 DOM 里、但画在主区纸面上的浮层(账户菜单)改用 `--text-workspace*`,这是同一套文字的不被重映射的副本。 + ### 2.4 强调与语义色 - 交互强调蓝:`--accent`(深 `#4099ff` / 浅 `#0b7fff`)。**只用于**链接、选中指示、聚焦环、 进行中指示;不做大面积铺底、不做主按钮底色。 - 主按钮:单色系反色——`--primary`(深 `#ffffff` / 浅 `#0d0d0d`)配 `--primary-foreground` (反向黑/白)。品牌色保持克制。 -- 语义:`--ok #46bf72`、`--warn #ff8a30`、`--err #ff5c5c`(浅色 `#1e8a3e/#e07b00/#e03131`)。 - 语义色只表语义。 +- 语义图形色:`--ok #46bf72`、`--warn #ff8a30`、`--err #ff5c5c`(浅色与墨绿 `#1e8a3e` / `#d17300` / `#e03131`)。 + 语义色只表语义。图形色(状态点、描边、色条)在 `--bg` / `--bg-panel` / `--bg-raised` 上不低于 **3:1**。 + **图形色不作文字。** 链接、状态词、差异文字、空闲状态字用下面的文字档。 +- 文字档(同一色相,专门保证 4.5:1,含铺在 `*-soft` 上): + + | 令牌 | 深色 | 浅色 / 墨绿 | 用途 | + |---|---|---|---| + | `--accent-text` | `#58a6ff` | `#0858b0` | 链接、动作字 | + | `--warn-text` | `#ff8a30` | `#8d4d00` | 警告文字;也作警告徽标底 | + | `--err-text` | `#ff7272` | `#a92525` | 错误文字;也作错误徽标底 | + | `--ok-text` | `#46bf72` | `#17682f` | 成功状态字 | + | `--idle-text` | `#929292` | `#636363` | 空闲状态字 | + | `--diff-add-text` | `#7dcea0` | `#17682f` | 差异增加的文字 | + | `--diff-remove-text` | `#ff9b9b` | `#a92525` | 差异删除的文字 | + + 徽标:底用对应 `*-text`,字用 `--text-on-semantic`(深 `#101010` / 浅与墨绿 `#ffffff`)。 - 等你确认用 `--wait`(深 `#8b93ff` / 浅 `#3a46c8` / 墨绿 `#3d5a9a`)和 `--wait-soft`。 不借用成功绿,也不用红或橙装饰等待。 - 差异视图:增加用 `--diff-add` / `--diff-add-text`,删除用 `--diff-remove` / `--diff-remove-text`。 -- 空闲任务用 `--task-idle`,定时任务用 `--task-scheduled`。两者不要混成同一种灰。 +- 空闲任务的图形用 `--task-idle`,文字用 `--idle-text`。定时任务用 `--task-scheduled`。两者不要混成同一种灰。 ### 2.5 墨绿主题(可选,`data-theme='molv'`) @@ -72,8 +97,12 @@ Agent-System-Dev 是桌面优先、Web 兼容的 AI 工作台。界面应**冷 | `--bg-sidebar` | `#082d4f` | 左栏、顶栏 | | `--text` | `#082d4f` | 主读文本 | | `--text-sidebar` | `#e9f0f6` | 左栏与顶栏文字 | -| `--accent` | `#165f49` | 交互强调(翠绿) | -| `--primary` / `--primary-foreground` | `#082d4f` / `#f3f8f5` | 主按钮 | +| `--accent` | `#165f49` | 主区交互强调(翠绿)。不用于侧栏 | +| `--accent-sidebar` | `#8fd4b4` | 侧栏内的强调:active 图标、聚焦边、选中条 | +| `--primary` / `--primary-foreground` | `#082d4f` / `#f3f8f5` | 主区主按钮 | +| `--primary-sidebar` / `--primary-sidebar-foreground` | `#e9f0f6` / `#082d4f` | 侧栏上的主按钮(「新建任务」) | + +深色与浅色下,侧栏三令牌别名到主区:`--primary-sidebar` 同 `--primary`,深色 `--accent-sidebar` 同 `--accent`。浅色侧栏是白底,`--accent-sidebar` 改走 `--accent-text`(`#0b7fff` 在白底上不足 4.5:1)。侧栏内的 active、聚焦和主按钮只消费这组令牌,不直接用主区 `--accent` / `--primary`。 ### 2.6 文档纸面(主题不变量) @@ -97,12 +126,15 @@ Office 分页预览是**内容**,不是界面。纸面与默认墨色固定, | `--fs-ui-base` | = | 14 | 正文、常用按钮、区块标题 | | `--fs-ui-caption` | −1px | 13 | 紧凑辅助文案 | | `--fs-ui-sm` | −2px | 12 | 次要信息、行内代码 | -| `--fs-ui-xs` | −4px | 10 | 徽标、快捷键、极弱元数据 | +| `--fs-ui-xs` | −3px | 11 | 仅徽标与图标性字符 | | `--fs-ui-tooltip` | 同 `--fs-ui-sm` | 12 | 提示气泡。不另起字号 | +| `--fs-code` | −2px | 12 | 代码块、终端、Diff。随 `--ui-font-size` 缩放 | 规则:UI 组件一律用标尺令牌;禁止行内 `font-size` 数值与 Tailwind 式任意字号 (守护测试棘轮拦截)。用户调字号只改 `--ui-font-size`,不改根字号;图标、间距、圆角不随字号缩放。 -例外:代码/Diff/终端/文档正文用独立阅读字号(等宽 12–12.5px、文档 13.5px)。 +设置中心「界面字号」提供 13 / 14 / 16 / 18 四档,写入 `--ui-font-size`,只存在本机(`localStorage`),不进账号设置。 +表头用 `--fs-ui-sm` + `--text-dim`,不用 xs,也不要对中文做 `uppercase`。 +例外:文档正文保留自己的阅读字号(约 13.5px),不跟界面标尺走。 字体:`--font` 系统栈优先(-apple-system/PingFang SC…);路径、命令、代码、快捷键用 `--mono`。 @@ -245,9 +277,21 @@ Primary(`--primary` 反色)、Ghost(透明,hover 出表面)、Danger 6. 同一对象出现第二个预览落位(预览只在预览区,全屏是它的放大); 7. `
` 折叠——用 Collapsible。 8. 绕过 `safeHtml` 直接把 HTML 字符串写进页面(`dangerouslySetInnerHTML` 或非空的 `innerHTML` 赋值)。 +9. 文字与背景的对比度低于门槛(正文与文字档 4.5:1,装饰 faint 与图形语义色 3:1)——`contrast-guard.test.ts`。 ## 12. 演进规则 改风格 = `DESIGN.md` 与 `tokens.css`(必要时 `motion.css`)**同 PR 成对修改**,附前后值对照; 不允许只改代码不改文档。新增视觉规则先问:它属于结构、表面、交互还是状态? 拿不准时,选更安静的方案、用更强的信息层级。 + +### 12.1 对比度与字号(2026-10-05)前后值 + +| 令牌 | 之前 | 之后 | +|---|---|---| +| `--text-dim` | 三主题 62% | 深 66% / 浅 68% / 墨绿 70% | +| `--text-faint` | 深 38% / 浅与墨绿 42% | 深 52% / 浅与墨绿 58% | +| `--text-sidebar-dim` / `faint`(墨绿) | 72% / 46% | 78% / 62% | +| `--warn`(浅色、墨绿) | `#e07b00`(白底 2.99:1) | `#d17300` | +| `--fs-ui-xs` | −4px(10px) | −3px(11px),仅徽标 | +| 文字档 `*-text`、`--text-on-semantic`、`--accent-sidebar`、`--primary-sidebar`、`--fs-code`、`--idle-text` | 无 | 见 §2.4–§3。图形色不再当文字用 | diff --git a/modules/frontend b/modules/frontend index 9badbb1f..c401bfe1 160000 --- a/modules/frontend +++ b/modules/frontend @@ -1 +1 @@ -Subproject commit 9badbb1f85f4af4464561ba5fb311297847e972e +Subproject commit c401bfe1fe1de214cc92957d6321bfbffaae743c diff --git a/modules/ui b/modules/ui index b14c9c0e..53fdf9eb 160000 --- a/modules/ui +++ b/modules/ui @@ -1 +1 @@ -Subproject commit b14c9c0e0d744af1b8997b03bcd91701a67822bf +Subproject commit 53fdf9ebeb2f4e204ad2d60b0723559f6c07a45e From 17b502e5c0332607793a32240ae7c68ccf97915c Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:39:38 +0000 Subject: [PATCH 46/53] Record contrast verification on the task card Why: The task card is the review record, and it still had empty result fields after make test passed. Evidence: make test exited 0. Frontend 81 tests and UI 103 tests, including contrast-guard. Browser computed styles on the Vite preview confirmed the molv new-task button and the 18px font ramp. Impact: .task/feature-contrast-typography.md now states the result, the evidence, and the items left out (rem, prefers-contrast, focus ring). Refs: feature/contrast-typography Co-authored-by: Cursor --- .task/feature-contrast-typography.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.task/feature-contrast-typography.md b/.task/feature-contrast-typography.md index bbcc6df2..20aec4bd 100644 --- a/.task/feature-contrast-typography.md +++ b/.task/feature-contrast-typography.md @@ -21,6 +21,6 @@ ## 结果与验证(完成后填写) -- 结果: -- 验证: -- 影响与剩余项: +- 结果:三套主题的正文与文字档达到 4.5:1,装饰 faint 与图形语义色达到 3:1。墨绿侧栏的强调色与「新建任务」按钮分开用浅色令牌。设置中心可调本机界面字号(13/14/16/18)。 +- 验证:Dev 仓 `make test` 退出码 0(2026-10-05)。其中 frontend vitest 17 文件 81 项、knip 43 <= 43;ui vitest 14 文件 103 项(含 contrast-guard)、tsc、knip 55 <= 55。浏览器在 Vite(127.0.0.1:5175)上核对计算样式:墨绿新建任务按钮为 #e9f0f6 / #082d4f,active 图标为 #8fd4b4,表头无 uppercase 且走 --text-dim;`--ui-font-size: 18px` 时 xs 为 calc(18px - 3px)。后端 8787 未启动,设置弹窗本身没有点开。 +- 影响与剩余项:px→rem、prefers-contrast、聚焦环不在本次。子仓 PR 合入后 Dev 的 gitlink 才指向已合入提交。 From aeaaccc54cd3243c58e76d9a2eae3c7ab1d0dd6c Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:39:43 +0000 Subject: [PATCH 47/53] Record the sync checkpoint --- .task/feature-contrast-typography.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-contrast-typography.md b/.task/feature-contrast-typography.md index 20aec4bd..2c3fc08f 100644 --- a/.task/feature-contrast-typography.md +++ b/.task/feature-contrast-typography.md @@ -24,3 +24,4 @@ - 结果:三套主题的正文与文字档达到 4.5:1,装饰 faint 与图形语义色达到 3:1。墨绿侧栏的强调色与「新建任务」按钮分开用浅色令牌。设置中心可调本机界面字号(13/14/16/18)。 - 验证:Dev 仓 `make test` 退出码 0(2026-10-05)。其中 frontend vitest 17 文件 81 项、knip 43 <= 43;ui vitest 14 文件 103 项(含 contrast-guard)、tsc、knip 55 <= 55。浏览器在 Vite(127.0.0.1:5175)上核对计算样式:墨绿新建任务按钮为 #e9f0f6 / #082d4f,active 图标为 #8fd4b4,表头无 uppercase 且走 --text-dim;`--ui-font-size: 18px` 时 xs 为 calc(18px - 3px)。后端 8787 未启动,设置弹窗本身没有点开。 - 影响与剩余项:px→rem、prefers-contrast、聚焦环不在本次。子仓 PR 合入后 Dev 的 gitlink 才指向已合入提交。 +| 同步前验收 | 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 | 17b502e5c0332607793a32240ae7c68ccf97915c | 2026-10-05T04:39:43Z | From 358a062bfdf48a0fcad96e688a38f4c7612080c5 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:42:00 +0000 Subject: [PATCH 48/53] Close 1 merged task card(s) and archive them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: branches merged into main had left their task cards open; backfill status and archive to prevent bookkeeping debt. Evidence: feature-contrast-typography.md(PR#198) — merges verified via git log --merges against origin/main. Impact: .task/*.md moved to .task/archive/ with status backfilled; no code or submodule change. Refs: task.sh close (card-autoclose-r1) --- .task/{ => archive}/feature-contrast-typography.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) rename .task/{ => archive}/feature-contrast-typography.md (78%) diff --git a/.task/feature-contrast-typography.md b/.task/archive/feature-contrast-typography.md similarity index 78% rename from .task/feature-contrast-typography.md rename to .task/archive/feature-contrast-typography.md index 2c3fc08f..0313ebb4 100644 --- a/.task/feature-contrast-typography.md +++ b/.task/archive/feature-contrast-typography.md @@ -1,6 +1,6 @@ # feature/contrast-typography 任务卡 -任务主记录:;状态:进行中;owner:weichen +任务主记录:PR #198 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/198(merge cf998fe89b);状态:已完成(回填);owner:weichen ## 基线与授权 @@ -19,9 +19,15 @@ |---|---|---|---| | 启动 | 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 | 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 | 2026-10-05T04:25:22Z | -## 结果与验证(完成后填写) +## 结果与验证 - 结果:三套主题的正文与文字档达到 4.5:1,装饰 faint 与图形语义色达到 3:1。墨绿侧栏的强调色与「新建任务」按钮分开用浅色令牌。设置中心可调本机界面字号(13/14/16/18)。 - 验证:Dev 仓 `make test` 退出码 0(2026-10-05)。其中 frontend vitest 17 文件 81 项、knip 43 <= 43;ui vitest 14 文件 103 项(含 contrast-guard)、tsc、knip 55 <= 55。浏览器在 Vite(127.0.0.1:5175)上核对计算样式:墨绿新建任务按钮为 #e9f0f6 / #082d4f,active 图标为 #8fd4b4,表头无 uppercase 且走 --text-dim;`--ui-font-size: 18px` 时 xs 为 calc(18px - 3px)。后端 8787 未启动,设置弹窗本身没有点开。 - 影响与剩余项:px→rem、prefers-contrast、聚焦环不在本次。子仓 PR 合入后 Dev 的 gitlink 才指向已合入提交。 | 同步前验收 | 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 | 17b502e5c0332607793a32240ae7c68ccf97915c | 2026-10-05T04:39:43Z | + +## 闭合记录(card-autoclose 回填) + +- 依据:merge cf998fe89b2d44e673fd91d55038eb02c5806da5(PR #198)已包含于 origin/main,分支成果已落盘;本段为合入后回填。 +- 合并主题:Merge pull request 'Pair the contrast rules with the token change' (#198) from feature/contrast-typography into main +- 归档:随闭合移入 .task/archive/;任务执行期的过程证据见原任务记录与 PR。 From 5b88da8234b477b76968cba8a3acfe0cd5431fea Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:44:22 +0000 Subject: [PATCH 49/53] Advance UI and frontend pins for the single preview pane Why: The right-hand preview clipped docx instead of scrolling, and a second overlay viewer duplicated FilePreview. Both fixes are already on the module mains. Evidence: make test passed in the task worktree (boundaries, pins, libs, core, backend, frontend 82 tests, ui 103 tests, agent-command). Impact: modules/ui moves to 27d5adb (icons #36 and contrast #37). modules/frontend moves to 0a0b556 (preview scroll #46, including contrast #45). Refs: Agent-System-UI#36, Agent-System-Frontend#46, Agent-System-Dev#196 Co-authored-by: Cursor --- .task/feature-preview-scroll-consolidate.md | 11 ++++++----- modules/frontend | 2 +- modules/ui | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.task/feature-preview-scroll-consolidate.md b/.task/feature-preview-scroll-consolidate.md index 7df09349..972c784d 100644 --- a/.task/feature-preview-scroll-consolidate.md +++ b/.task/feature-preview-scroll-consolidate.md @@ -6,11 +6,12 @@ - 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 - 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-preview-scroll-consolidate(worktree);分支:feature/preview-scroll-consolidate -- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> +- 授权与交付终点:修复右侧预览滚动,并删除 DocViewer 弹窗,以预览栏展开态承接。终点是 Dev 仓 gitlink 合入 main。 ## 目标与非目标 -<预期结果、受影响入口/模块/契约;明确不做什么。> +- 目标:`.preview-pane-body` 成为唯一滚动容器;docx 页高变化时重算缩放高度;删除全屏弹窗;文本编辑/保存留在预览栏。 +- 非目标:不改 FilePreview 的格式分派,不改左右栏宽度偏好。 ## 同步记录 @@ -20,6 +21,6 @@ ## 结果与验证(完成后填写) -- 结果: -- 验证: -- 影响与剩余项: +- 结果:UI 图标 PR https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-UI/pulls/36 已合入;Frontend PR https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Frontend/pulls/46 已合入。本分支推进这两个 gitlink。 +- 验证:Frontend `npx vitest run`(17 files, 82 tests)与 `npx tsc --noEmit`;UI `npx vitest run`(13 files, 84 tests)与 `npx tsc --noEmit`。Headless Chromium:1400px docx 宿主在 764px 栏内由 pane-body 滚动,pdf iframe 撑满该栏。 +- 影响与剩余项:登录后的六格式手工矩阵(docx/xlsx/pptx/pdf/md/代码 × 常态/展开)尚未在真实会话里点过。展开态不写入本地偏好,刷新后回到分栏。 diff --git a/modules/frontend b/modules/frontend index 9badbb1f..0a0b5561 160000 --- a/modules/frontend +++ b/modules/frontend @@ -1 +1 @@ -Subproject commit 9badbb1f85f4af4464561ba5fb311297847e972e +Subproject commit 0a0b55612cbff1147f3f0f6920ba0e5d48b6fe7c diff --git a/modules/ui b/modules/ui index b14c9c0e..27d5adb5 160000 --- a/modules/ui +++ b/modules/ui @@ -1 +1 @@ -Subproject commit b14c9c0e0d744af1b8997b03bcd91701a67822bf +Subproject commit 27d5adb5c679101b596fbb7701b43e946674a8e6 From e6cdbe1d80fc0f54fd0025122e515baebf587087 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:44:26 +0000 Subject: [PATCH 50/53] Record the sync checkpoint --- .task/feature-preview-scroll-consolidate.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-preview-scroll-consolidate.md b/.task/feature-preview-scroll-consolidate.md index 972c784d..12baf6a2 100644 --- a/.task/feature-preview-scroll-consolidate.md +++ b/.task/feature-preview-scroll-consolidate.md @@ -24,3 +24,4 @@ - 结果:UI 图标 PR https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-UI/pulls/36 已合入;Frontend PR https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Frontend/pulls/46 已合入。本分支推进这两个 gitlink。 - 验证:Frontend `npx vitest run`(17 files, 82 tests)与 `npx tsc --noEmit`;UI `npx vitest run`(13 files, 84 tests)与 `npx tsc --noEmit`。Headless Chromium:1400px docx 宿主在 764px 栏内由 pane-body 滚动,pdf iframe 撑满该栏。 - 影响与剩余项:登录后的六格式手工矩阵(docx/xlsx/pptx/pdf/md/代码 × 常态/展开)尚未在真实会话里点过。展开态不写入本地偏好,刷新后回到分栏。 +| 同步前验收 | 581ca385596891b1c0f6cc170c5e62075079a27e | d95deca618710d49bc0beeed84a003ffcfc54dc5 | 2026-10-05T04:44:26Z | From 7e6f4bd5962742524c18981d5e3900b91885a241 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:45:15 +0000 Subject: [PATCH 51/53] Record the post-sync preview acceptance on the task card Why: task-sync appended the checkpoint outside the sync table, and the card still described the pre-sync test run. Evidence: make test passed after the origin/main merge (frontend 82 tests, ui 103 tests, backend and library tests). Impact: task card only. No code or gitlink change. Refs: feature/preview-scroll-consolidate Co-authored-by: Cursor --- .task/feature-preview-scroll-consolidate.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.task/feature-preview-scroll-consolidate.md b/.task/feature-preview-scroll-consolidate.md index 12baf6a2..79b6acd8 100644 --- a/.task/feature-preview-scroll-consolidate.md +++ b/.task/feature-preview-scroll-consolidate.md @@ -18,10 +18,10 @@ | 节点 | sync_base_sha | tested_head_sha | checked_at | |---|---|---|---| | 启动 | 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 | 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 | 2026-10-05T04:34:21Z | +| 同步前验收 | 581ca385596891b1c0f6cc170c5e62075079a27e | d95deca618710d49bc0beeed84a003ffcfc54dc5 | 2026-10-05T04:44:26Z | ## 结果与验证(完成后填写) - 结果:UI 图标 PR https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-UI/pulls/36 已合入;Frontend PR https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Frontend/pulls/46 已合入。本分支推进这两个 gitlink。 -- 验证:Frontend `npx vitest run`(17 files, 82 tests)与 `npx tsc --noEmit`;UI `npx vitest run`(13 files, 84 tests)与 `npx tsc --noEmit`。Headless Chromium:1400px docx 宿主在 764px 栏内由 pane-body 滚动,pdf iframe 撑满该栏。 +- 验证:同步后 `make test` 通过(frontend 17 files / 82 tests,ui 14 files / 103 tests,backend 与库测试通过)。Headless Chromium:1400px docx 宿主在 764px 栏内由 pane-body 滚动,pdf iframe 撑满该栏。 - 影响与剩余项:登录后的六格式手工矩阵(docx/xlsx/pptx/pdf/md/代码 × 常态/展开)尚未在真实会话里点过。展开态不写入本地偏好,刷新后回到分栏。 -| 同步前验收 | 581ca385596891b1c0f6cc170c5e62075079a27e | d95deca618710d49bc0beeed84a003ffcfc54dc5 | 2026-10-05T04:44:26Z | From 5d5321085cc009c9023d4d40dfe3c5cbf981fed8 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:48:24 +0000 Subject: [PATCH 52/53] Close 1 merged task card and archive it Why: PR #200 merged with a title that does not contain "from feature/preview-scroll-consolidate into main", so task-close could not see the card. Evidence: merge 795bff20f3 is origin/main and the card is now archived with status backfilled. Impact: .task card moved to .task/archive/. No code or submodule change. Refs: Agent-System-Dev#200 Co-authored-by: Cursor --- .task/{ => archive}/feature-preview-scroll-consolidate.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .task/{ => archive}/feature-preview-scroll-consolidate.md (100%) diff --git a/.task/feature-preview-scroll-consolidate.md b/.task/archive/feature-preview-scroll-consolidate.md similarity index 100% rename from .task/feature-preview-scroll-consolidate.md rename to .task/archive/feature-preview-scroll-consolidate.md From b56d337f4d42871f1a6eeac934e6ea62b60294c0 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 5 Oct 2026 04:48:48 +0000 Subject: [PATCH 53/53] Backfill the preview task card status and merge link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: The archive commit moved the card before the status and PR link were written into the file. Evidence: The working tree now records status 已完成 and PR #200 against merge 795bff20f3. Impact: archived task card text only. No code or submodule change. Refs: Agent-System-Dev#200 Co-authored-by: Cursor --- .task/archive/feature-preview-scroll-consolidate.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.task/archive/feature-preview-scroll-consolidate.md b/.task/archive/feature-preview-scroll-consolidate.md index 79b6acd8..ed202e44 100644 --- a/.task/archive/feature-preview-scroll-consolidate.md +++ b/.task/archive/feature-preview-scroll-consolidate.md @@ -1,6 +1,6 @@ # feature/preview-scroll-consolidate 任务卡 -任务主记录:;状态:进行中;owner:weichen +任务主记录:PR #200 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/200(merge 795bff20f3);状态:已完成(回填);owner:weichen ## 基线与授权 @@ -20,8 +20,14 @@ | 启动 | 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 | 34e82d53c1716f0075d510a5f7b6d72dd3fc9912 | 2026-10-05T04:34:21Z | | 同步前验收 | 581ca385596891b1c0f6cc170c5e62075079a27e | d95deca618710d49bc0beeed84a003ffcfc54dc5 | 2026-10-05T04:44:26Z | -## 结果与验证(完成后填写) +## 结果与验证 - 结果:UI 图标 PR https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-UI/pulls/36 已合入;Frontend PR https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Frontend/pulls/46 已合入。本分支推进这两个 gitlink。 - 验证:同步后 `make test` 通过(frontend 17 files / 82 tests,ui 14 files / 103 tests,backend 与库测试通过)。Headless Chromium:1400px docx 宿主在 764px 栏内由 pane-body 滚动,pdf iframe 撑满该栏。 - 影响与剩余项:登录后的六格式手工矩阵(docx/xlsx/pptx/pdf/md/代码 × 常态/展开)尚未在真实会话里点过。展开态不写入本地偏好,刷新后回到分栏。 + +## 闭合记录(card-autoclose 回填) + +- 依据:merge 795bff20f327cc515f5c269200c362d0af2ac14c(PR #200)已包含于 origin/main,分支成果已落盘;本段为合入后回填。 +- 合并主题:Advance UI and frontend pins for the single preview pane +- 归档:随闭合移入 .task/archive/;任务执行期的过程证据见原任务记录与 PR。