From e9171208e6af0d4bd65d75941c80566ec9104237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=A8=E9=B1=BC=E8=BE=A3=E6=A4=92?= Date: Tue, 13 Oct 2026 17:56:11 +0800 Subject: [PATCH] Hide recharge entry from account menu --- .../20261013-hide-wallet-entry-8c3eaf71.md | 75 ++++++++++++++++++ README.md | 2 +- src/components/account/PointWallet.tsx | 4 +- src/components/layout/Sidebar.tsx | 2 +- tests/e2e/permanent-point-wallet.spec.ts | 78 ++++++------------- tests/unit/sidebar-token-points.test.tsx | 12 ++- 6 files changed, 112 insertions(+), 61 deletions(-) create mode 100644 .project-docs/30-worklog/tasks/20261013-hide-wallet-entry-8c3eaf71.md diff --git a/.project-docs/30-worklog/tasks/20261013-hide-wallet-entry-8c3eaf71.md b/.project-docs/30-worklog/tasks/20261013-hide-wallet-entry-8c3eaf71.md new file mode 100644 index 00000000..eac499a8 --- /dev/null +++ b/.project-docs/30-worklog/tasks/20261013-hide-wallet-entry-8c3eaf71.md @@ -0,0 +1,75 @@ +# Task: Hide point wallet recharge entry from account menu + +## Identity + +- Task ID: 20261013-hide-wallet-entry-8c3eaf71 +- Mode: Feature +- Branch: codex/20261013-hide-wallet-entry-8c3eaf71-hide-wallet-entry +- Worktree: /Users/chillishark/Makelore 麦洛/.codex-worktrees/makelore/20261013-hide-wallet-entry-8c3eaf71 +- Base commit: 10da39341ead9e3db17ea4395d66181f6fe4433d +- Owner: codex +- Status: Ready for Integration + +## Scope + +- Hide the screenshot-marked “词元点数与充值” menu item. Retain personal balance, reserved points, retries and existing recharge implementation. + +## Intent And Constraints + +- User authorizes hiding this menu entry. Preserve billing contracts and all account controls. Primary checkout is occupied and remains untouched; changes and verification stay in the owned isolated worktree. No live app update or main integration is included. + +## Outcome + +- Sidebar hides “词元点数与充值” via PointWallet.showRechargeEntry=false. Own balance/reservations, retry, shared-funding privacy, account controls and refresh remain. Existing recharge/dialog/Main/API implementation is retained. README and the account-menu unit/Electron expectations match. +- Independent read-only review found no actionable issue; visual screenshot confirms the entry is absent and other controls remain visible. Primary checkout and current running application are unchanged. + +## Verification + +- Pinned pnpm 10.33.4 (npx wrapper): typecheck passed; focused Sidebar/PointWallet unit files passed (14 tests); scoped ESLint passed; full build:vite passed (Renderer/Main/Preload/utility); permanent-point-wallet Electron spec passed (1 test). +- Electron verifies absent entry/dialog, preserved account controls, refreshed 0→500 fixture balance after reopen and reload, and zero recharge/history requests. No real payment or model call. +- Screenshot: test-results/permanent-point-wallet-Per-f6563--and-refreshing-the-balance/account-menu-recharge-hidden.png (ignored local QA output). +- git diff --check passed; task-aware documentation drift check passed. + +## Follow-ups + +- Integrate this feature branch and activate the intended client when requested. No running-trial update, main merge or push performed. + +## Promotion Candidates + +- Target: current-state and permanent-points UI architecture at serialized integration. Proposal: keep account balance/reservations visible while hiding “词元点数与充值”. Evidence: user-marked screenshot, focused source diff, unit/Electron/visual verification. Future impact: account-menu work should preserve this visibility decision. Semantic conflict: earlier visible-entry description is superseded only for this entry by the explicit request; billing rules and API remain unchanged. Further human confirmation is not required for the accepted visibility change. + +## Project Context Loaded + +Task context: +- Task ID: 20261013-hide-wallet-entry-8c3eaf71 +- Mode: feature +- Branch: codex/20261013-hide-wallet-entry-8c3eaf71-hide-wallet-entry +- Worktree: /Users/chillishark/Makelore 麦洛/.codex-worktrees/makelore/20261013-hide-wallet-entry-8c3eaf71 +- Base commit: 10da39341ead9e3db17ea4395d66181f6fe4433d +- Ownership: official start exited 0; status matches task, branch, path and mode. +- Other active local tasks: registry peer records reviewed read-only through Scope, Intent And Constraints and Promotion Candidates. Peers concern teacher, Agent configuration, knowledge, channel and trial work. +- Overlap: legacy Sidebar styling/account-control work is separate and completed; no peer requests a conflicting recharge entry. Child-language record retains undefined scope (unknown coordination state) without a concrete dependency here. + +Read: +- AGENTS.md; 05-agent-entry/{read-before-planning,memory-index,planning-gate,read-before-coding}.md +- Own task record; 00-brief/{project-positioning,success-criteria}.md +- 30-worklog/current-state.md (integrated metadata and task-relevant account sections) +- 10-decisions/decision-index.md; 20-architecture/{system-overview,community-collaboration}.md (task-relevant sections) +- 40-domain/business-rules.md (permanent token points); evidence/reflection/commitment indexes (relevant sections) + +Relevant understanding: +- Goal: creation client with Main-owned authentication and server-authoritative permanent points. +- Integrated focus: current-account recharge; no course client. +- Scope: hide the recharge menu item while showing current balance. +- Constraints: account identity, precise own balance, shared-wallet privacy, billing and payment-result safety remain. +- Decision: the explicit current user request supersedes the earlier visible-entry presentation only. +- Evidence/commitments: real payment/install smoke remains separate; this task needs no payment or model invocation. +- Files: Sidebar, PointWallet, focused unit/Electron specs, README. +- Unknowns: running trial may differ from main; no trial activation is requested in this turn. +- Concurrent Task Gate: Passed. Planning Gate: Passed. + +## Implementation Plan + +- Add an explicit recharge-entry visibility prop and disable it in Sidebar, retaining existing wallet behavior for direct component coverage. +- Update Sidebar/Electron expectations and README to match the hidden entry. +- Run focused units, typecheck, scoped lint, Vite build and the account-menu Electron scenario; record review and handoff. diff --git a/README.md b/README.md index 54bbe990..f274e019 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Makelore 是一个面向软件、视觉创作、智能机器人与个人云智 - AI 编程核心对话运行时:Electron Main 按需启动一个长驻 Pi Agent Server,同一进程内为每条 Conversation 建立独立的 Runtime、Session、凭证视图、扩展上下文和 JSONL 通道,同时复用 Pi 模块与进程启动成本;Server 异常退出时所有旧通道统一失效,下一次恢复只重启一个 Server。正式包中的 Agent Server 从明确传入的 `resources/pi-runtime` 根定位依赖清单与包入口,不从脚本所在目录或应用 `node_modules` 猜测解析。Renderer 不直接启动或调用 Pi,也不读取其 wire 类型。项目与 Conversation 元数据先从本地读取,选中对话后才按需准备对应逻辑线程;输入框不等待运行时准备完成。同一助手工具批次中,会取得项目写租约的 `bash`、`edit`、`write` 与动态产品工具按顺序执行,避免批次在命令启动前自锁;纯只读工具仍可并行。子 Agent 仍使用独立的短生命周期进程,以保留并发配额、故障和写入边界;macOS 上两类后台进程都使用 Electron 自带的 Helper,不在 Dock 中创建额外应用图标。 - AI 编程默认入口:进入 Code 后保持在 `/chat`。顶部返回箭头与侧栏收起图标同排,与右侧项目/会话名称对齐;折叠时保留返回和展开入口。macOS 为原生窗口按钮保留安全空间,窄侧栏仍可使用。下方麦洛品牌与“操作对话/作品”标签行对齐;更浅底色的“作品广场”与“新建项目”采用相同高度、圆角、边框与阴影,并位于品牌和新建项目之间,上下各留 10px;“我的项目”和项目列表紧接新建项目;项目配置及其资源子页不再重复显示此侧栏入口,保留配置页自身的返回操作。尚未选择本地项目时,页面以麦洛 M 标识和居中引导语建立焦点,下方提供独立的“新增项目”主操作以及可横向浏览、直接进入的已有项目卡片;项目创建和进入仍复用侧栏现有流程。已有项目的新 Conversation 在可编辑 Composer 上方沿用同一品牌引导,第一条消息出现后切换为正常时间线。 - AI 编程历史与配额反馈:Pi 上下文压缩不删除用户可见的 active-branch 历史,压缩摘要保持 Main-private;Renderer 首次渲染最近 120 个节点,向上滚动时按 100 个节点追加更早内容并保持阅读位置。Main 精确识别 `token_point_balance_exhausted` / `词元点数余额不足`,只向 Renderer 投影不可重试的稳定配额错误和安全中文提示,重开会话后仍可见且不暴露上游原始错误或 request id。 -- 账号词元点数:左下角账户菜单显示本人永久余额和预占,提供充值、充值订单与分页收支记录。真正新注册赠送 100 点,1 元充值 50 点,永久有效;旧账户不补送,旧会员/订阅/周额度/重置卡入口已移除。家长为孩子充值时登录孩子的账号,页面显示当前昵称和账号,点数进入该账号自己的钱包;无需将孩子身份改为家长。当前有效账号可给本人充值,青少年可查看自己的精确余额;使用他人共享钱包时仅显示可用状态,不显示付款人的余额或记录。Main 持有凭据并转发充值请求;付款结果未知时沿用原请求并核查原订单,只有服务端确认才显示到账。扫码信息缺失时可到网页账户页继续原订单,付款来源也由网页账户页管理,充值不会自动切换共享/个人来源。需配套部署 Works Square 当前账号充值资格更新(本次无需新迁移,原永久点数基础为 0094);本地模拟验收不代表真实支付通过。 +- 账号词元点数:左下角账户菜单显示本人永久余额和预占;“词元点数与充值”入口暂时隐藏,充值、充值订单与分页收支记录的既有实现保留。真正新注册赠送 100 点,1 元充值 50 点,永久有效;旧账户不补送,旧会员/订阅/周额度/重置卡入口已移除。家长为孩子充值时登录孩子的账号,页面显示当前昵称和账号,点数进入该账号自己的钱包;无需将孩子身份改为家长。当前有效账号可给本人充值,青少年可查看自己的精确余额;使用他人共享钱包时仅显示可用状态,不显示付款人的余额或记录。Main 持有凭据并转发充值请求;付款结果未知时沿用原请求并核查原订单,只有服务端确认才显示到账。扫码信息缺失时可到网页账户页继续原订单,付款来源也由网页账户页管理,充值不会自动切换共享/个人来源。需配套部署 Works Square 当前账号充值资格更新(本次无需新迁移,原永久点数基础为 0094);本地模拟验收不代表真实支付通过。 - 桌面性能策略:应用窗口使用不透明浅色表面并默认保留硬件合成;仅在显式安全模式或短时间内重复 GPU 进程崩溃时启用软件渲染,并把故障原因保存在用户数据目录。启动关键路径只创建本地应用壳,认证、代理、同步、更新和遥测在首帧后延迟初始化;开发版可通过 `app:performance` 快照观察 GPU、进程、WebContents、事件循环与 Renderer Long Task 聚合指标。 - 后台生命周期:Main 统一维护模块活动状态与任务租约。隐藏窗口、离开模块和关闭开发浏览器会释放非必要连接;生成、Code 执行、下载与发布构建持有租约并在完成后释放。已写入 Pi 的 prompt 或上下文整理即使确认超过 10 秒,也会继续持有运行所有权与后台租约,直到迟到响应、权威事件、明确失败或用户清理使其收敛;此时同一 Conversation 不接受重叠 mutation,其他 Conversation 不受影响。各模块的后台连接、轮询和子进程必须通过同一生命周期入口登记。 - 共享开发浏览器:AI 编程右侧提供项目级浏览器,用户与 Agent 查看并调试同一实时页面、Console 和 Network,支持本地与公网开发地址。 diff --git a/src/components/account/PointWallet.tsx b/src/components/account/PointWallet.tsx index f4a31b27..7fd21814 100644 --- a/src/components/account/PointWallet.tsx +++ b/src/components/account/PointWallet.tsx @@ -21,7 +21,7 @@ const money = (cents: number) => `¥${(cents / 100).toFixed(2)}`; const time = (value: string) => new Date(value).toLocaleString('zh-CN'); const unresolved = (order: WorksRechargeOrder) => order.status === 'pending' || order.status === 'manual_review'; -export function PointWallet({ active = true, accountName = '当前登录账号', accountUsername }: { active?: boolean; accountName?: string; accountUsername?: string }) { +export function PointWallet({ active = true, accountName = '当前登录账号', accountUsername, showRechargeEntry = true }: { active?: boolean; accountName?: string; accountUsername?: string; showRechargeEntry?: boolean }) { const [summary, setSummary] = useState(null); const [summaryError, setSummaryError] = useState(false); const [open, setOpen] = useState(false); @@ -169,7 +169,7 @@ export function PointWallet({ active = true, accountName = '当前登录账号', {isWorksTokenPointBalanceExhausted(own) && !usingShared &&

{summary?.can_recharge ? '点数已用尽,请由家长完成当前账号充值。' : '点数已用尽,当前账号暂不能充值,请联系支持。'}

} {summaryError && } - + {showRechargeEntry && } diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx index 53ba75c9..59dd2a78 100644 --- a/src/components/layout/Sidebar.tsx +++ b/src/components/layout/Sidebar.tsx @@ -872,7 +872,7 @@ export function Sidebar({
- {authUser && } + {authUser && }