Repository navigation
Conversation
页面说明原来只按 endpoint.operate 显示「只读」或「也可以接着聊」,与按协议表 (POST /agent/sessions/<key>/leaf,agent.configure)显示的「从这里继续」可能不一致。 改为由 sessionsPageDescription 按两种能力组合:能接着聊、能从其他消息继续、两者都能, 两样都没有时才说「只读」。readOnly 对轨迹读取的作用不变。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SLUGBDtJbRzDTQgkyE1mGh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SLUGBDtJbRzDTQgkyE1mGh
Deploying zhin-demo-console with
|
| Latest commit: |
5744b6e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5451a33c.console-axj.pages.dev |
| Branch Preview URL: | https://console-sessions-description.console-axj.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 #64:
sessions-description-permission-mismatch问题
聊天记录页的页面说明只看
endpoint.operate(readOnly):有这个权限显示「也可以接着聊」,没有就显示「(只读)」。而 #215 之后,「从这里继续」按协议表判断(POST /agent/sessions/<key>/leaf,1.10 为agent.configure)。两者可能对不上:agent.configure的角色看到「(只读)」,页面上却有「从这里继续」;endpoint.operate的 operator 看到「也可以接着聊」,却没有「从这里继续」——这一点本身没错,但说明和按钮没有共同的依据。确认问题存在的依据:在 feat 上,
console-ui/src/pages/agent-sessions.tsx:296的说明是readOnly ? '…(只读)。' : '…,也可以接着聊。';同一文件第 56–57 行的canSwitchLeaf来自httpRouteAccess('POST', '/agent/sessions/_/leaf', …)。新测试在修复前失败:只给agent.configure时,页面说明是「(只读)」。改法
新增纯函数
sessionsPageDescription({ canChat, canBranch })(pages/agent-sessions-description.mjs+.d.mts),四种组合各一句:页面用
canChat: !readOnly、canBranch: canSwitchLeaf。canSwitchLeaf与「从这里继续」按钮和确认框用的是同一个值,所以说明不会再和按钮不一致。readOnly对轨迹读取的作用不变(useConversationTraces(readOnly ? '' : …))。两句新文案都有英文条目。
验证
npx tsc --noEmit、pnpm test(1967 通过)、pnpm lint:css、pnpm build全部通过(首屏 JS 507.1KB gzip)。测试:
tests/sessions-description-permission-mismatch.test.mjs(修复前失败):按协议表算canBranch,检查四种组合各不相同;只有两样都没有时才出现「只读」;每句都有英文;页面仍用readOnly控制轨迹读取。tests/conversation-page.test.mjs新增渲染层测试:按四组权限渲染页面,断言PageHeader的说明。Playwright:用预览 Host 打开
/agent/sessions,改写/api/auth/me模拟四组权限(都没有 / 只有 endpoint.operate / 只有 agent.configure / 两者都有)。浅色 / 深色、375 / 1280 都看过,说明与上表一致,均无横向滚动。独立审查(只读子 Agent,只看条目原文和 diff):没有发现明显问题。它确认了以下几点:
canSwitchLeaf;readOnly对轨迹读取的作用没变;它提了两个小问题,均已采纳:英文由 “an earlier message” 改为与现有条目一致的 “another message”;补了上面的渲染层测试。
本次没有改动样式(没有新增或修改 CSS 规则,也没有改元素的 class),遵守样式冻结(#125)。
#111:说明仍是页头的一句话,按实际能力只写一次,不重复;不新增控件,不影响任何宽度下的布局。
Generated by Claude Code