From f8e06090e6ab59e052572ff7c43fd1dd62dfebfa Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 4 Oct 2026 18:21:17 +0000 Subject: [PATCH] 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' \