Add secret, injection, and message controls to the workbench #43

Merged
weichen merged 6 commits from feature/sillytavern-review into main 2026-10-04 19:44:56 +00:00
Owner

feature/sillytavern-review 任务卡

任务主记录:<PR 链接,task-finish 时填写>;状态:进行中;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
  • 授权与交付终点:调研记录、已核实的安全缺口,以及方案里的批次 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、删除消息、自动触发的快捷回复。

同步记录

节点 sync_base_sha tested_head_sha checked_at
启动 4fd03eee6230f82464def08f2543adab27aba948 4fd03eee6230f82464def08f2543adab27aba948 2026-10-04T17:06:46Z

结果与验证(完成后填写)

  • 结果:安全缺口 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 |
    | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ce551683256e770d96c18fdaf93df49df4e0e3b1 | 2026-10-04T18:45:12Z |
# feature/sillytavern-review 任务卡 任务主记录:<PR 链接,task-finish 时填写>;状态:进行中;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 - 授权与交付终点:调研记录、已核实的安全缺口,以及方案里的批次 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、删除消息、自动触发的快捷回复。 ## 同步记录 | 节点 | sync_base_sha | tested_head_sha | checked_at | |---|---|---|---| | 启动 | 4fd03eee6230f82464def08f2543adab27aba948 | 4fd03eee6230f82464def08f2543adab27aba948 | 2026-10-04T17:06:46Z | ## 结果与验证(完成后填写) - 结果:安全缺口 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 | | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ce551683256e770d96c18fdaf93df49df4e0e3b1 | 2026-10-04T18:45:12Z |
weichen added 5 commits 2026-10-04 18:46:26 +00:00
Why: The conversation and office fallbacks wrote marked output straight into the page, including converted docx HTML.
Evidence: html-sinks ratchet forbids new innerHTML writes outside @ui safeHtml.
Impact: Conversation keeps line-break rendering. Unsafe links are stripped after docx and pptx preview. dompurify is deduped with the UI package.
Refs: feature/sillytavern-review
Co-authored-by: Cursor <cursoragent@cursor.com>
Why: Keys must be added without writing masks back, and a turn needs copy, exclude, and regenerate without deleting history.
Evidence: npx tsc -b. Session notes and candidate switches call the new conversation and message routes.
Impact: Settings gains key, lore, and slash-template panels. Excluded messages stay visible and are dimmed.
Refs: docs/records/2026-10-04-sillytavern-review.md
Why: Preview setup clears a node with innerHTML = '' before appending sanitized children, and the ratchet treated that space as a write.
Evidence: npx vitest run test/html-sinks.test.ts. Non-empty assignments still match.
Impact: The preview path can keep clearing nodes. Writing HTML strings in components still fails the test.
Refs: docs/records/2026-10-04-sillytavern-review.md
Why: Core is the authority for the shared types, and the section shape no longer needs its own export.
Evidence: make contracts copied modules/core/ts/types.ts. Frontend knip stays at 43.
Impact: Callers still read sections on the observation object.
Refs: .task/feature-sillytavern-review.md
Co-authored-by: Cursor <cursoragent@cursor.com>
Why: tsc -b rewrote the tracked build info after the contract mirror changed.
Evidence: make build completed and left only tsconfig.tsbuildinfo dirty.
Impact: The feature branch working tree matches the production build.
Refs: .task/feature-sillytavern-review.md
Co-authored-by: Cursor <cursoragent@cursor.com>
weichen added 1 commit 2026-10-04 19:44:09 +00:00
weichen merged commit 2f599c84f8 into main 2026-10-04 19:44:56 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Frontend#43