交付:完整承载 Agent 德州扑克项目并更新复验契约与环境说明
This commit is contained in:
parent
411cea6bd5
commit
fbd37c56a7
168
projects/agent-poker/README.md
Normal file
168
projects/agent-poker/README.md
Normal file
@ -0,0 +1,168 @@
|
||||
# Agent 德州扑克
|
||||
|
||||
## Issue 103 当前完整交付
|
||||
|
||||
当前任务为 [Issue #103](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/103),根任务 [Issue #102](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/102),需求版本 `1`。在完整基线 `411cea6bd5a55848791051f4c47da325626ecb76` 上交付整个 `projects/agent-poker`,采用指定候选 `c721a1ccb75119f575e06933b78c430e5db571c2` 的实现、测试和历史证据。运行源码与构建输入保持一致。本节是当前状态,下面各旧 Issue 的部署与验收状态仅作为历史记录保留。
|
||||
|
||||
[固定环境证据](https://gitea.d-robotics.cc/peng01.guo/ppanel/src/commit/3e87f818d79b8928dfd8cba749190f8ebbf55545/evidence/issue-35-c721)已经解释并解决此前构建差异:归档如果没有自己的 Git 边界、又嵌在外层忽略目录内,会改变 Tailwind 扫描结果。请在普通 clone 或具有独立 Git 边界的完整归档中执行 `npm ci --prefix projects/agent-poker` 和 `npm run build --prefix projects/agent-poker`。
|
||||
|
||||
环境方记录源站为 `127.0.0.1:4399`,Node PID `2303`,启动身份 `Sat Sep 12 06:59:02 2026`,隧道 PID `70644`。这些身份仅供部署者核对,业务开发不得操作环境服务。HTML SHA256 为 `44d05fc4255104e453f592a25b4fbeda8948ba86886caae4267e7d6852d5041b`;`index-BO_t9cEz.js` 为 `85e2f085961e7ecefd05c84890ab933a78d81a0a97c3f399849f3661969b42ad`;`index-CU526T7U.css` 为 `8a1d3de5a24abd65b2873a9e0cb04859b977adc46e68db1a4516743cdd58665c`。公网观测:[Agent 扑克](https://laws-forming-bare-remedies.trycloudflare.com)。它依赖本机、源站和临时隧道存活,持续运行方式见下文。
|
||||
|
||||
新规则真实对局采用[固定三手证据](https://gitea.d-robotics.cc/peng01.guo/ppanel/src/commit/044810adf30631167aae0b89793917d91bfed93c/evidence/issue-35-a073):新桌 `52e49afe-dd88-4d89-9cfa-e7b750c9e1e1`,三位真实 agent、DeepSeek/GLM,`24` 次成功响应、`23` 次应用、`1` 次暂停后未应用、`1` 次错误;每手和中间状态筹码均为 `3000`。第三手错误后经既有邀请 API 将玩家 1 切换到 DeepSeek 恢复同桌;第四手未完成,不计入。成功响应累计 `621850ms`、`109853 tokens`、并发 `1` 是历史调用记录,本轮新增模型调用 `0`。仅在 `server.mjs`、`game.mjs`、`persistence.mjs`、`models.mjs`、`package.json`、`package-lock.json`、`real-check.mjs` 与证据对应源码逐字一致时复用。
|
||||
|
||||
历史根 [Issue #38](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/38) 与 [Issue #72](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/72) 的失败、`blocked`、全部预算、原开发非 `pass` 与修正轮次耗尽均保留,不复活、不重置。短盲全下、河牌弃牌隐私、邀请 UI 修复,以及 [CR #78](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/78)、[CR #98](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/98) 和 QA 历史继续保留;旧 `470` / `a3` 三手不是新规则证据。本次预算默认 90 分钟、20 次执行、3 次修正,仅一次新页面目标。
|
||||
|
||||
### 实施契约九项对照
|
||||
|
||||
| 契约 | 实现与复核入口 |
|
||||
| --- | --- |
|
||||
| 1 产品编排交付 | 根 Issue → 开发 Issue → PR → 独立 CR/QA → 集成与合入后 QA;开发不代替其他角色 |
|
||||
| 2 虚拟筹码 | `game.mjs`、`ui.jsx`,初始每位 1000,无支付接口 |
|
||||
| 3 建桌与邀请 | `POST /api/tables`、邀请 fragment、`join` 接口;页面展示邀请地址和接入说明;使用 `modelId` 接入不同模型 |
|
||||
| 4 私有观察与合法行动 | Bearer 鉴权、`observation`、`action`、`version` 重放保护与 `legal` 校验 |
|
||||
| 5 规则与守恒 | `game.mjs` 的盲注、发牌、下注轮、牌型、边池、平分;规则与 HTTP 测试 |
|
||||
| 6 在线观测 | 上述公网地址;座位、筹码、公共牌、底池、行动者和时间线;默认底牌保密 |
|
||||
| 7 三位真实 agent / 三手 | 固定新规则证据和后端逐字等价核验;测试动作不算模型对局 |
|
||||
| 8 控制与安全 | 管理员开始/暂停/停止、已完成历史、独立服务;公网只开放扑克入口 |
|
||||
| 9 Git 与独立验收 | 本轮 PR 最终 SHA 和需求版本 `1` 供独立 CR、QA 绑定,合入后 QA 待控制面推进 |
|
||||
|
||||
实际安装、构建、规则、HTTP、浏览器、公网及身份核验结果见本 Issue 的开发报告。开发自测不代替独立 CR、QA,不宣布最终验收通过。
|
||||
|
||||
## 以下为历史交付记录
|
||||
|
||||
当前交付 Issue [#100](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/100),需求版本 `1`;本次只补文档与身份核验证据,运行源码及构建输入保持与 `d1a5f6734e751dca5b7e9d8a1388218b25310558` 逐字相同。虚拟筹码 No-Limit Texas Hold'em;服务器发牌、校验行动、比较牌型、分配边池及结算。没有支付功能。
|
||||
|
||||
## Issue 100 当前源码、构建与运行身份
|
||||
|
||||
本节取代下文各历史轮次的“当前部署”描述。新候选是包含本文的 Git 提交,准确 SHA 以本 Issue 的开发报告及 PR 为准;`d1a5f6734e751dca5b7e9d8a1388218b25310558` 是未改动的运行源码身份,不冒充本次文档提交 SHA。
|
||||
|
||||
[环境方评论 19435](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/72#issuecomment-19435) 与[固定 Git 部署证据](https://gitea.d-robotics.cc/peng01.guo/ppanel/src/commit/b2347b72abc8dac917003cf709637ca5cab370c7/evidence/issue-35-d1)报告:公网源为 `127.0.0.1:4399`,后端从 `a0737d41f02a8b38bc8c3f72fccfdf23e6d6d4bc` 部署,Node PID `2303`,启动身份 `Sat Sep 12 06:59:02 2026`;隧道 PID `70644`。静态资源由环境方从 `d1a5f673` 构建更新。本轮只经 Git 核验,没有访问源站、操作隧道或控制面,也未读取其他角色私有文件。进程身份是环境方采样事实,不能据此盲目停止或替换进程。
|
||||
|
||||
**源码绑定已核验,静态部署绑定仍有差异。** 本轮脚本证明 `server.mjs`、`game.mjs`、`persistence.mjs`、`models.mjs`、`package.json`、`package-lock.json` 及 `service.mjs` 在 `a0737d41`、`d1a5f673` 和工作树逐字一致;所有其他既有跟踪文件(本文除外)与 `d1a5f673` 一致。独立安装构建得到 `index-BO_t9cEz.js` 和 `index-CU526T7U.css`。但上述环境 Git 的 `build.log` 与 `deployment.json` 记录 `index-FU5_FpP1.js` 和 `index-BEOPO_nE.css`:JavaScript 内容 SHA256 相同,CSS 与 HTML 摘要不同。因此不能把“环境方称已对齐”写成已证实的完整构建一致;差异原始输出、完整摘要与复现命令见[本轮证据](evidence/issue-100-identity/README.md)。本轮未改变运行源码或构建输入,未因本轮返工使部署失效;既有部署的静态资源一致性仍待环境方解释或对齐,不能冒称最终候选已完整部署。
|
||||
|
||||
[公网观测地址](https://laws-forming-bare-remedies.trycloudflare.com)依赖本机、网络、独立源站及临时隧道存活,不承诺永久服务。部署与生命周期由环境方负责;本次返工不、也不能修改正在运行的公网部署与隧道。最终部署对齐由环境方按既有授权完成,独立 QA 须实际打开并绑定新候选 SHA 与需求版本 `1`。
|
||||
|
||||
真实对局证据只有后端源码及依赖锁文件逐字等价时才可复用,且仅证明对应规则/模型运行,不能替代新 UI、当前部署或独立验收。依据[评论 19429](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/72#issuecomment-19429)及[固定新规则对局证据](https://gitea.d-robotics.cc/peng01.guo/ppanel/src/commit/044810adf30631167aae0b89793917d91bfed93c/evidence/issue-35-a073),`a0737d41` 新桌 `52e49afe-dd88-4d89-9cfa-e7b750c9e1e1` 的三手、DeepSeek/GLM、`24` 次成功响应/`23` 次应用/`1` 次暂停后未应用/`1` 次错误与筹码 `3000`,可按本轮后端等价检查交独立角色复核。它们是环境方历史调用,本轮新增真实模型调用为 `0`,没有执行 `real-check.mjs`。
|
||||
|
||||
`0afa4df50967e881a700231022c13f4e30d9d2f1` 下的 `evidence/issue-35-final` 和 `470879a305438fc958acfc6486f1f86bcd94b681` 下的 `projects/agent-poker/evidence.json`(第一手含一次真实多人摊牌)保留为历史事实。该旧规则的 `game.mjs` 与当前不同,不能用其证明当前规则已实际摊牌、完成新调用或通过验收。后续独立全量 CR、QA 与合入后 QA 必须使用同一最终 SHA,开发不得自行宣布最终验收通过。
|
||||
|
||||
## 安装与启动
|
||||
|
||||
Node 24。在仓库根目录运行:
|
||||
|
||||
```sh
|
||||
cd projects/agent-poker
|
||||
npm ci
|
||||
npm run build
|
||||
# 由运行者设置自己的私有目录,禁止使用其他角色目录。
|
||||
export TMPDIR="<当前角色绝对路径>/tmp"
|
||||
export TMP="$TMPDIR" TEMP="$TMPDIR" POKER_DATA="$TMPDIR/service"
|
||||
mkdir -p "$POKER_DATA"
|
||||
POKER_PORT=18439 node service.mjs
|
||||
```
|
||||
|
||||
服务仅监听 `127.0.0.1:18439`,关闭浏览器或开发会话不终止独立后台进程。状态与完整模型证据存于 `POKER_DATA/state.json`、`POKER_DATA/evidence.jsonl`,权限 `0600`;服务重启恢复牌局且默认暂停,管理员核对后开始。停止服务使用自己保存的 PID。此版单进程、单本机文件持久化:同目录临时文件写入、`fsync`、原子替换并同步目录。中断时保留完整旧版或新版快照,重启忽略残留 `.pending`;不提供多实例或日志与快照之间的跨文件事务。物理断电受操作系统与存储硬件刷盘保证约束。
|
||||
|
||||
管理凭据在 `POKER_DATA/admin-token`,由本机管理员读取后填写页面密码框。页面仅在内存保存,不置入链接或浏览器持久化。公网观众无需管理凭据即可观测;控制操作需要管理凭据。请使用 HTTPS 公网地址。
|
||||
|
||||
## 邀请与真实模型
|
||||
|
||||
页面“建立牌桌”生成三张邀请链接。邀请凭据只放 URL fragment,不发送至静态服务器或 Referer;不要提交 Git 或公开转发。受邀玩家点击“接受邀请”,或者使用 API。模型配置仅从 `/Users/pptg/.d-sre-agent/config/sre-agent.yaml` 加载,复用 D-SRE 的 provider 与 compat 映射,使用 pi SDK `0.85.0`。
|
||||
|
||||
- `GET /api/tables`:公开牌桌、行动、历史与筹码。
|
||||
- `POST /api/tables`:管理员提交 `{ "names": ["甲", "乙", "丙"] }`,返回牌桌 `id` 与邀请链接。
|
||||
- `GET /api/models`:管理员读取安全模型列表。
|
||||
- `POST /api/tables/:id/join`:邀请 Bearer 凭据,空对象接入外部 API 玩家;`{ "modelId": "本机模型 id" }` 接入服务内真实 pi Agent 玩家。至少两种模型可分配至三位玩家。
|
||||
- `GET /api/tables/:id/observation`:邀请 Bearer 凭据,只返回该玩家底牌和公开观察,含 `version`、`legal` 与 `player`。
|
||||
- `POST /api/tables/:id/action`:邀请 Bearer 凭据,`{ "version": 1, "action": "call", "amount": 0 }`。`bet`/`raise` 的 `amount` 为本下注轮总额;合法范围以观察为准。
|
||||
- `POST /api/tables/:id/control`:管理员 Bearer 凭据,`{ "action": "start" }` 开始最多三手;`pause` 或 `stop` 停止继续执行。已在途模型响应保留证据,但暂停期间不应用动作。
|
||||
|
||||
所有玩家接受邀请后才可开始。模型按自己的私有观察独立调用,不配置固定动作或回退随机动作;非法模型输出使牌桌暂停。每个调用有 90 秒超时。外部玩家不行动会等待,不代替玩家行动。玩家破产导致不足两位时不能开始新手牌。单实例按桌串行调用模型,适用于本演示规模。
|
||||
|
||||
## 规则与验证
|
||||
|
||||
```sh
|
||||
npm test
|
||||
# 以下集成检查会创建独立测试牌桌;使用当前运行者自己的数据目录。
|
||||
node api-check.mjs
|
||||
node browser-check.mjs
|
||||
# 创建三位真实模型玩家,调用本机配置的 DeepSeek 与 GLM;服务每次开始最多三手。
|
||||
POKER_URL=http://127.0.0.1:18439 node real-check.mjs
|
||||
```
|
||||
|
||||
浏览器检查使用本机 Chrome 与 Playwright,截图写入 `TMPDIR`。`POKER_URL` 可指定 HTTPS 外网地址。规则测试覆盖牌型、轮次、all-in、短加注不重新开放行动、边池、平分、筹码守恒、非当前玩家、非法下注、过期请求与私有投影;HTTP 检查覆盖鉴权与并发重复动作。开发自测不等于独立 CR/QA。
|
||||
|
||||
牌型从最多七张牌枚举五张组合,最强牌型按类别及踢脚比较;奇数筹码从按钮左侧获胜玩家开始分配。每手轮转按钮,盲注 10/20,初始每位 1000。`legal.actions` 给出当前允许动作。单个不足最小加注的 all-in 不重新开放加注;累计差额达到最小加注时恢复加注权。弃牌底牌不在公开历史中披露;只有五张公共牌的已结束摊牌展示未弃牌者底牌。
|
||||
|
||||
## UI 复用
|
||||
|
||||
直接导入仓库 `apps/web/src/theme.css`、`page-layout.css`、`workbench.css`、`components/page-workspace.tsx` 与 `components/ui/button.tsx`;D-SRE 来源见 [复用清单](../../docs/frontend-reuse.md),许可见 [第三方声明](../../apps/web/THIRD_PARTY_NOTICES.md)。`style.css` 仅导入既有主题并用 `@source` 扫描根目录外复用组件的工具类,不含新增视觉规则;牌桌座位使用已有 Tailwind 网格、边框及主题 token,公共状态和历史使用原生语义元素。组件源码与许可未改动。
|
||||
|
||||
## 外网与交付限制
|
||||
|
||||
仅将本项目端口转发:
|
||||
|
||||
```sh
|
||||
cloudflared tunnel --url http://127.0.0.1:18439 --no-autoupdate
|
||||
```
|
||||
|
||||
先确认该端口响应为本扑克项目,再开隧道。不得转发 PPanel 控制面。临时地址随 cloudflared 生命周期失效,没有稳定域名或可用性保证。当前既有[公网观测地址](https://laws-forming-bare-remedies.trycloudflare.com)转发 `127.0.0.1:4399`,依赖本机、网络与隧道持续运行。源站 Node PID `43920`(2026-09-12 06:01:31 启动)、cloudflared PID `70644`(2026-09-12 01:23:26 启动)由部署者管理;这些是历史启动身份,不能仅凭 PID 停止或替换。开发者自测使用自己独立端口和运行目录。以上为 Issue 73 的历史部署身份,现已被本文开头 Issue 100 的环境记录取代;后续独立 CR/QA 与集成仍须绑定最终 SHA。
|
||||
|
||||
`evidence.json` 为三手真实对局的安全证据投影:保留模型身份、实际输出、动作、耗时、用量、结算和私有观察摘要,移除底牌;完整私有观察仍保存在开发运行目录,不能用其本机路径替代 Git/Gitea 交接。复现需自行建桌、分配模型并运行三手,不要求复现相同随机牌或模型动作。
|
||||
|
||||
## Issue 57 历史运行与限制(非当前部署状态)
|
||||
|
||||
本轮服务监听 `127.0.0.1:18459`,独立进程及启动身份、私有日志和状态目录详见 `evidence/verification.json`。`18460` 是独立 HTTP/重启测试服务。所有临时文件位于本角色 `tmp`。测试动作不计入真实对局。
|
||||
|
||||
已有[临时公网入口](https://laws-forming-bare-remedies.trycloudflare.com)直连 HTTP 返回 `200`,浏览器异步加载完成后显示另一张已有牌桌,停在第 5 手并提示模型调用或动作失败。指定探针 PID `70638` 已不存在;隧道 PID `70644` 启动身份仍匹配。按照 Issue 的失败分支,没有替换未知源站,没有改动隧道或控制面。该公网入口不代表本轮候选的部署,外网验收仍未完成;代理路径返回 `CONNECT 403`。公网截图与原始响应见 `evidence/issue-57/`。
|
||||
|
||||
本轮第三手河牌阶段 GLM 两次超时后,将玩家乙经自身邀请接口切换到 DeepSeek 继续真实决策,见 `evidence/issue-57/model-switch.json`;此前 GLM 的实际动作和失败事件均保留。模型超时不是成功响应。
|
||||
|
||||
本轮完成三手真实对局、一手真实摊牌(第三手河牌弃牌结束,不计摊牌),17 次成功模型响应、16 次应用动作,另一次暂停期间返回而未应用;两次超时另记错误事件。三手筹码总额均为 `3000`,重启后三手历史完整保留且默认暂停。
|
||||
|
||||
|
||||
## Issue 73 交付与证据复用
|
||||
|
||||
在完整基线 `411cea6bd5a55848791051f4c47da325626ecb76` 上仅采用候选的项目目录,保留基线控制面修复。运行源码、锁文件及直接复用的共享 UI 与候选逐字一致;本轮变更为本文和开发验证证据。核验详见 `evidence/issue-73/`。
|
||||
|
||||
[既有独立部署证据](https://gitea.d-robotics.cc/peng01.guo/ppanel/src/commit/0afa4df50967e881a700231022c13f4e30d9d2f1/evidence/issue-35-final)记录三手真实对局、三位 pi Agent、DeepSeek/GLM 两模型、20 次成功响应、19 次应用动作、1 次停止后未应用及 1 次错误,所有历史筹码总额 `3000`。第二手模型失败后通过邀请 API 切换模型继续。第四手停止且未完成,不计数。本轮只从 Git 读取并核对这些事件,无新增模型调用。项目原有 `evidence.json` 另有三手与一次真实摊牌,是 Issue 57 历史证据,不冒称本轮新对局。
|
||||
|
||||
本轮本地构建与公网 JavaScript 内容逐字一致,但 CSS 和 HTML 文件哈希不同;本地构建及公网资源摘要分别保留,不声称整个构建逐字一致。真实模型与规则证据复用限于相同运行源码,页面验收以本轮浏览器检查及后续独立 QA 为准。
|
||||
|
||||
历史邀请交互(已由下文 Issue 96 修复):在同一页面仅切换 `#join=` fragment 时,`joined` 是页面级布尔值,按钮可能继续显示前一玩家“已加入”。服务端仍按当前邀请凭据鉴权,不能凭显示状态读取其他玩家底牌;三个独立新页邀请可正常完成。影响是同页连续接入时可能误以为新玩家已加入,导致开始被全员加入门禁拒绝。开发建议后续按邀请身份重置显示状态;本 Issue 明确将是否修复交给产品决定,因此本次保留并报告,不将其隐去或自作最终产品验收结论。当前使用方式是每份邀请独立新页打开。
|
||||
|
||||
## Issue 88 规则与隐私返工
|
||||
|
||||
本次 [Issue #88](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/88) 根据 [独立 CR #78](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/78) 修正两项问题,需求版本仍为 `1`:
|
||||
|
||||
- 只剩一位可行动玩家时,跟注目标使用仍未弃牌玩家的实际投注。短大盲全下且小盲已覆盖时直接补齐公共牌并摊牌;仍欠筹码时可弃牌或跟注,不能向无人响应的边池加注。仍有多人可下注时保留名义大盲 `20`。
|
||||
- 结束后至少两位未弃牌玩家且公共牌完整才公开摊牌底牌。河牌弃牌获胜仍隐藏赢家底牌;赢家通过自己的邀请可看自己的牌。使用现有牌局状态推导,无新增持久化字段,旧快照加载后同样应用隐私规则。
|
||||
|
||||
新增规则回归覆盖短盲注、无人响应加注、多人转为全下对局、河牌弃牌公共/玩家投影、快照重载及正常多人摊牌;`api-check.mjs` 通过真实 HTTP 动作执行河牌弃牌结束,检查公共接口与每位玩家的观察。测试动作不是模型对局。
|
||||
|
||||
本次修改了 `game.mjs`,已有部署及真实模型记录不能证明修复后的代码已部署或通过验收。根据 [根任务环境更新](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/72#issuecomment-19196),公网此前已更新至 `a3fce77317c99cc68fb05fa0c1934fd62999cd3f`,源站 Node PID `59783`(2026-09-12 06:19:00 启动),替代上文历史 PID `43920`。本轮未操作该源站、隧道或控制面;最终部署需由授权部署者从新候选更新并重新核验,不能只凭历史 PID 操作服务。
|
||||
|
||||
本轮新增模型调用 `0`。旧真实对局仅作为可追溯历史事实;模型适配、邀请接口和 UI 源码保持不变,但规则文件有上述修正,不能宣称与旧运行源码逐字一致。最终独立 CR、QA、部署核验及合入后 QA 必须绑定新 SHA。当时同页切换邀请 fragment 的显示问题交产品决定;现已按 Issue 96 的修复决定完成修改,见下文。
|
||||
|
||||
|
||||
## Issue 96 邀请状态修复(需求版本 `1`)
|
||||
|
||||
产品在 [Issue #96](https://gitea.d-robotics.cc/peng01.guo/ppanel/issues/96) 决定修复同页切换邀请后“已加入”残留。页面现在监听 `hashchange`,成功接受的邀请按完整 `#join=` 身份保存在当前页面内存中;切换到尚未接受的邀请显示“接受邀请”,移除片段隐藏邀请区域。异步加入响应只标记发起该请求的邀请,不能把新邀请标为已加入。刷新页面后可重新接受邀请,服务器原有幂等加入接口不变。无新增依赖、样式或服务端权限变更。
|
||||
|
||||
`browser-check.mjs` 在本机真实 Chrome 与项目 HTTP 服务间验证:玩家 1 加入后同页切换玩家 2,按钮恢复“接受邀请”,服务端仍为 `[true,false,false]`;接受玩家 2 后变为 `[true,true,false]`;另建新桌,三份邀请各自独立新页加入,席位最终为 `[true,true,true]`。脚本不配置模型、不启动模型对局。原始失败、通过输出与规则测试见 `evidence/issue-96-invitation/`。
|
||||
|
||||
复现时先将 `TMPDIR`、`TMP`、`TEMP` 指向执行者自己的临时目录,`POKER_DATA` 指向该目录内的独立私有数据目录;为测试服务选择空闲本机端口,并令 `POKER_URL` 对应它。执行:
|
||||
|
||||
```sh
|
||||
npm ci --prefix projects/agent-poker
|
||||
npm --prefix projects/agent-poker run build
|
||||
node projects/agent-poker/server.mjs
|
||||
# 另一个终端,沿用上述环境变量:
|
||||
node projects/agent-poker/browser-check.mjs
|
||||
node --test projects/agent-poker/test.mjs projects/agent-poker/persistence.test.mjs
|
||||
node projects/agent-poker/api-check.mjs
|
||||
```
|
||||
|
||||
本轮新增真实模型调用为 `0`。相对前候选 `a0737d41f02a8b38bc8c3f72fccfdf23e6d6d4bc` 未修改 `game.mjs`,保留 Issue 88 的 `R1`/`R2` 修复;相对历史真实对局候选 `470879a305438fc958acfc6486f1f86bcd94b681`,规则源码已经变化,因此旧真实对局只证明历史运行,不证明当前候选已完成真实对局或最终验收。
|
||||
|
||||
根据 Issue 96 当时正式任务的历史环境事实,[公网观测](https://laws-forming-bare-remedies.trycloudflare.com) 的源站仍为 `127.0.0.1:4399` 上旧候选 `a3fce773`(Node PID `59783`,启动身份 `Sat Sep 12 06:19:00 2026`),`cloudflared` PID `70644`。本轮未操作源站、隧道或 `4498`/`4497` 控制面,未宣称公网已更新到本候选;最终 SHA 的公网部署及核验由环境方在合并后执行。临时地址依赖本机与隧道存活,不承诺永久服务。独立 CR 与 QA 必须重新绑定同一最终 SHA 和需求版本 `1`,开发验证不能代替最终验收。
|
||||
98
projects/agent-poker/api-check.mjs
Normal file
98
projects/agent-poker/api-check.mjs
Normal file
@ -0,0 +1,98 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
const admin = readFileSync(
|
||||
resolve(process.env.POKER_DATA, "admin-token"),
|
||||
"utf8",
|
||||
);
|
||||
const base = process.env.POKER_URL ?? "http://127.0.0.1:18439";
|
||||
const request = async (path, body, token) => {
|
||||
const r = await fetch(base + "/api/" + path, {
|
||||
method: body ? "POST" : "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...(token ? { Authorization: "Bearer " + token } : {}),
|
||||
},
|
||||
...(body ? { body: JSON.stringify(body) } : {}),
|
||||
});
|
||||
return { status: r.status, data: await r.json() };
|
||||
};
|
||||
assert.equal((await request("models")).status, 403);
|
||||
assert.equal((await request("tables", { names: ["a", "b"] })).status, 403);
|
||||
const created = await request(
|
||||
"tables",
|
||||
{ names: ["测试甲", "测试乙", "测试丙"] },
|
||||
admin,
|
||||
);
|
||||
assert.equal(created.status, 201);
|
||||
const { id, invitations } = created.data;
|
||||
const tokens = invitations.map((i) => i.url.split(".")[1]);
|
||||
const path = "tables/" + id + "/";
|
||||
assert.equal((await request(path + "observation", null, "wrong")).status, 403);
|
||||
assert.equal(
|
||||
(await request(path + "control", { action: "start" }, tokens[0])).status,
|
||||
403,
|
||||
);
|
||||
for (const token of tokens)
|
||||
assert.equal((await request(path + "join", {}, token)).status, 200);
|
||||
assert.equal(
|
||||
(await request(path + "control", { action: "start" }, admin)).status,
|
||||
200,
|
||||
);
|
||||
await new Promise((r) => setTimeout(r, 1200));
|
||||
const own = (await request(path + "observation", null, tokens[0])).data;
|
||||
assert.equal(own.players[0].cards.length, 2);
|
||||
assert.equal(own.players[1].cards.length, 0);
|
||||
const publicBefore = (await request("tables")).data;
|
||||
const serialized = JSON.stringify(publicBefore);
|
||||
assert(!serialized.includes(admin));
|
||||
for (const token of tokens) assert(!serialized.includes(token));
|
||||
assert.equal(
|
||||
(
|
||||
await request(
|
||||
path + "action",
|
||||
{ action: "fold", version: own.version },
|
||||
tokens[1],
|
||||
)
|
||||
).status,
|
||||
400,
|
||||
);
|
||||
assert.deepEqual((await request("tables")).data, publicBefore);
|
||||
const results = await Promise.all(
|
||||
[1, 2].map(() =>
|
||||
request(
|
||||
path + "action",
|
||||
{ action: "call", version: own.version },
|
||||
tokens[0],
|
||||
),
|
||||
),
|
||||
);
|
||||
assert.deepEqual(results.map((r) => r.status).sort(), [200, 400]);
|
||||
// 通过真实 HTTP 动作走到河牌,再弃牌结束;不调用模型。
|
||||
let state = (await request(path + "observation", null, tokens[0])).data;
|
||||
while (state.stage !== "river") {
|
||||
const acting = (await request(path + "observation", null, tokens[state.actor])).data;
|
||||
const result = await request(path + "action", {
|
||||
action: acting.legal.actions.includes("check") ? "check" : "call",
|
||||
version: acting.version,
|
||||
}, tokens[state.actor]);
|
||||
assert.equal(result.status, 200);
|
||||
state = result.data;
|
||||
}
|
||||
while (state.stage !== "complete") {
|
||||
const result = await request(path + "action", {
|
||||
action: "fold", version: state.version,
|
||||
}, tokens[state.actor]);
|
||||
assert.equal(result.status, 200);
|
||||
state = result.data;
|
||||
}
|
||||
const winner = state.players.find((p) => !p.folded).id;
|
||||
const publicFinished = (await request("tables")).data.tables.find((t) => t.id === id);
|
||||
assert.deepEqual(publicFinished.players.map((p) => p.cards), [[], [], []]);
|
||||
for (let i = 0; i < tokens.length; i++) {
|
||||
const observation = (await request(path + "observation", null, tokens[i])).data;
|
||||
assert.equal(observation.players[winner].cards.length, i === winner ? 2 : 0);
|
||||
}
|
||||
assert.equal(publicFinished.history.at(-1).total, 3000);
|
||||
await request(path + "control", { action: "pause" }, admin);
|
||||
console.log("HTTP 鉴权、隐私、非当前玩家、并发重复动作与河牌弃牌获胜隐私检查通过");
|
||||
92
projects/agent-poker/browser-check.mjs
Normal file
92
projects/agent-poker/browser-check.mjs
Normal file
@ -0,0 +1,92 @@
|
||||
import { chromium, expect } from "@playwright/test";
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import assert from "node:assert/strict";
|
||||
const tmp = process.env.TMPDIR;
|
||||
if (!tmp) throw Error("请设置 TMPDIR");
|
||||
const browser = await chromium.launch({ channel: "chrome", headless: true });
|
||||
const page = await browser.newPage();
|
||||
const checks = [];
|
||||
try {
|
||||
const errors = [];
|
||||
page.on("pageerror", (e) => errors.push(e.message));
|
||||
const origin = process.env.POKER_URL ?? "http://127.0.0.1:18439";
|
||||
await page.goto(origin);
|
||||
await page.getByRole("heading", { name: "在线观测" }).waitFor();
|
||||
|
||||
await page.screenshot({ path: resolve(tmp, "observer.png"), fullPage: true });
|
||||
assert.deepEqual(errors, []);
|
||||
if (process.env.POKER_DATA) {
|
||||
const admin = readFileSync(
|
||||
resolve(process.env.POKER_DATA, "admin-token"),
|
||||
"utf8",
|
||||
);
|
||||
await page.getByLabel("管理凭据").fill(admin);
|
||||
await page.getByRole("button", { name: "建立牌桌", exact: true }).click();
|
||||
const invitations = [];
|
||||
for (let i = 1; i <= 3; i++) {
|
||||
const link = page.getByRole("link", { name: `玩家 ${i} 邀请地址` });
|
||||
await link.waitFor();
|
||||
invitations.push(await link.getAttribute("href"));
|
||||
}
|
||||
const tableId = invitations[0].split("#join=")[1].split(".")[0];
|
||||
const seats = async () => {
|
||||
const data = await (await fetch(origin + "/api/tables")).json();
|
||||
return data.tables.find((t) => t.id === tableId).models.map((s) => s.joined);
|
||||
};
|
||||
const guest = await browser.newPage();
|
||||
guest.on("pageerror", (e) => errors.push(e.message));
|
||||
await guest.goto(origin + invitations[0]);
|
||||
await guest.getByRole("button", { name: "接受邀请", exact: true }).click();
|
||||
await expect(guest.getByRole("button", { name: "已加入", exact: true })).toBeVisible();
|
||||
await guest.evaluate((href) => { location.hash = href.split("#")[1]; }, invitations[1]);
|
||||
assert.deepEqual(await seats(), [true, false, false]);
|
||||
await expect(guest.getByRole("button", { name: "接受邀请", exact: true })).toBeVisible();
|
||||
await expect(guest.getByRole("button", { name: "已加入", exact: true })).toHaveCount(0);
|
||||
console.log("同页切换玩家 1 → 玩家 2:接受邀请;服务端席位 [true,false,false]");
|
||||
checks.push("同页切换邀请后不残留已加入");
|
||||
await guest.getByRole("button", { name: "接受邀请", exact: true }).click();
|
||||
await expect(guest.getByRole("button", { name: "已加入", exact: true })).toBeVisible();
|
||||
assert.deepEqual(await seats(), [true, true, false]);
|
||||
await guest.evaluate((href) => { location.hash = href.split("#")[1]; }, invitations[0]);
|
||||
await expect(guest.getByRole("button", { name: "已加入", exact: true })).toBeVisible();
|
||||
await guest.getByText("已完成手牌", { exact: true }).waitFor();
|
||||
await guest.screenshot({ path: resolve(tmp, "invitation.png"), fullPage: true });
|
||||
await guest.evaluate(() => { location.hash = ""; });
|
||||
await expect(guest.getByRole("heading", { name: "接受玩家邀请" })).toHaveCount(0);
|
||||
await guest.close();
|
||||
|
||||
// 新牌桌保证每份独立新页邀请均从未加入状态开始。
|
||||
await page.getByRole("button", { name: "建立牌桌", exact: true }).click();
|
||||
await expect(page.getByRole("link", { name: "玩家 1 邀请地址" })).not.toHaveAttribute("href", invitations[0]);
|
||||
let freshId;
|
||||
for (let i = 1; i <= 3; i++) {
|
||||
const href = await page.getByRole("link", { name: `玩家 ${i} 邀请地址` }).getAttribute("href");
|
||||
freshId = href.split("#join=")[1].split(".")[0];
|
||||
const fresh = await browser.newPage();
|
||||
fresh.on("pageerror", (e) => errors.push(e.message));
|
||||
await fresh.goto(origin + href);
|
||||
await fresh.getByRole("button", { name: "接受邀请", exact: true }).click();
|
||||
await expect(fresh.getByRole("button", { name: "已加入", exact: true })).toBeVisible();
|
||||
await fresh.close();
|
||||
}
|
||||
const state = await (await fetch(origin + "/api/tables")).json();
|
||||
assert.deepEqual(state.tables.find((t) => t.id === freshId).models.map((s) => s.joined), [true, true, true]);
|
||||
console.log("三份独立新页邀请成功:服务端席位 [true,true,true]");
|
||||
checks.push("三份独立新页邀请成功");
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
writeFileSync(
|
||||
resolve(tmp, "browser.json"),
|
||||
JSON.stringify({
|
||||
origin,
|
||||
errors,
|
||||
checks,
|
||||
passed: true,
|
||||
time: new Date().toISOString(),
|
||||
}),
|
||||
);
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
console.log("浏览器观测、邀请流程通过");
|
||||
6578
projects/agent-poker/evidence.json
Normal file
6578
projects/agent-poker/evidence.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
projects/agent-poker/evidence/invitation.png
Normal file
BIN
projects/agent-poker/evidence/invitation.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 74 KiB |
56
projects/agent-poker/evidence/issue-100-identity/README.md
Normal file
56
projects/agent-poker/evidence/issue-100-identity/README.md
Normal file
@ -0,0 +1,56 @@
|
||||
# Issue 100 身份核验与部署差异
|
||||
|
||||
本报告非 `pass` 时评审拒绝是正确门禁。
|
||||
|
||||
需求版本 `1`;范围仅 `projects/agent-poker/README.md` 和本目录。本次返工不、也不能修改正在运行的公网部署与隧道,最终部署对齐由环境方按既有授权完成。`dispatchPhase = launching` 属登记现象,不构成缺陷。新增真实模型调用 `0`,没有运行 `real-check.mjs`。
|
||||
|
||||
## 复现命令
|
||||
|
||||
从本候选独立 clone 的仓库根目录运行;先将 `TMPDIR` 设为当前角色专属临时目录的绝对路径,所有测试输出先写入其中。
|
||||
|
||||
```sh
|
||||
export TMP="$TMPDIR" TEMP="$TMPDIR"
|
||||
git fetch origin evidence/issue-35-control-2e920
|
||||
npm ci --prefix projects/agent-poker > "$TMPDIR/install.log" 2>&1
|
||||
npm run build --prefix projects/agent-poker > "$TMPDIR/build.log" 2>&1
|
||||
node --test projects/agent-poker/test.mjs projects/agent-poker/persistence.test.mjs > "$TMPDIR/test.log" 2>&1
|
||||
node projects/agent-poker/evidence/issue-100-identity/verify.mjs > "$TMPDIR/identity.log"
|
||||
```
|
||||
|
||||
每条命令分别检查退出码;不能用最后一条命令的成功掩盖前面的失败。`verify.mjs` 只使用 Node 标准库和当前 clone 的 Git,禁止跨角色私有目录输入。`frozen-files.json` 原样摘自正式 `worker.js read` 的 `frozenAcceptance`,核对 `31` 个工作树 blob 以及基线 blob;不是修改或替代冻结要求。脚本还核对基线祖先关系与所有既有文件的字节。
|
||||
|
||||
本目录的 `install.log`、`build.log`、`test.log`、`identity.log` 为实际原始输出;其中执行时的 `checkedHead` 为文档提交前的 `d1a5f6734e751dca5b7e9d8a1388218b25310558`,`working` 摘要来自已修改文档后的工作树。最终提交 SHA 在 PR 和角色报告中绑定,后续可在该 SHA 重跑。
|
||||
|
||||
## 源码与构建结果
|
||||
|
||||
后端七个文件在 `a0737d41f02a8b38bc8c3f72fccfdf23e6d6d4bc`、`d1a5f6734e751dca5b7e9d8a1388218b25310558` 与本工作树逐字相同;依赖未变。指定规则/持久化测试 `11/11`,冻结 `31/31` 匹配,安装审计无已知漏洞。构建产物如下:
|
||||
|
||||
| 文件 | SHA256 |
|
||||
| --- | --- |
|
||||
| `assets/index-BO_t9cEz.js` | `85e2f085961e7ecefd05c84890ab933a78d81a0a97c3f399849f3661969b42ad` |
|
||||
| `assets/index-CU526T7U.css` | `8a1d3de5a24abd65b2873a9e0cb04859b977adc46e68db1a4516743cdd58665c` |
|
||||
| `index.html` | `44d05fc4255104e453f592a25b4fbeda8948ba86886caae4267e7d6852d5041b` |
|
||||
|
||||
[环境 Git 证据](https://gitea.d-robotics.cc/peng01.guo/ppanel/src/commit/b2347b72abc8dac917003cf709637ca5cab370c7/evidence/issue-35-d1)的 `deployment.json` 与 `build.log` 却记录 `index-FU5_FpP1.js` / `index-BEOPO_nE.css`。前者 JS 内容摘要与本地相同;CSS 摘要为 `2caad2edf3d2f0067b92a1c035a888592249a03b2a37d12c96309700dc0c3348`,HTML 摘要为 `0e856f8477c1c91c6b71750b863d0a4f5278b92a1444195d4567b5cb5d1e9538`,均与本地不同。不能仅凭源码身份或资源名推断整个构建一致。
|
||||
|
||||
`environmentBuildMatch: false` 为实际核验差异,不是脚本错误。脚本退出成功只表示源码/冻结断言成立,不能当成部署通过。完整环境原始记录可复读:
|
||||
|
||||
```sh
|
||||
git show b2347b72abc8dac917003cf709637ca5cab370c7:evidence/issue-35-d1/deployment.json
|
||||
git show b2347b72abc8dac917003cf709637ca5cab370c7:evidence/issue-35-d1/build.log
|
||||
```
|
||||
|
||||
未更改任何运行逻辑或构建输入;当前构建符合任务指定资源名,但固定环境证据不能证明静态部署与之相同。没有进入环境目录排查,也没有访问或修改 `4399`、隧道与 `4498`/`4497` 控制面。公网此刻状态未在本轮实测,需环境方与独立 QA 核验;不声称现有部署完整适用,也不把差异归因于未经核实的构建原因。
|
||||
|
||||
## 历史真实对局的适用范围
|
||||
|
||||
- [旧部署证据](https://gitea.d-robotics.cc/peng01.guo/ppanel/src/commit/0afa4df50967e881a700231022c13f4e30d9d2f1/evidence/issue-35-final):部署源码为 `470879a305438fc958acfc6486f1f86bcd94b681`,三手、`20` 次成功响应、`19` 次应用、一次停止后未应用、一次错误;三手都不是多人摊牌。
|
||||
- [原开发对局证据](https://gitea.d-robotics.cc/peng01.guo/ppanel/src/commit/470879a305438fc958acfc6486f1f86bcd94b681/projects/agent-poker/evidence.json):三手,第一手有两名未弃牌玩家、五张公共牌、全下及跟注后结算,是真实多人摊牌;第三手河牌弃牌结束不能计入摊牌。
|
||||
- 上述两份证据均为历史事实。旧 `game.mjs` 摘要 `89e1f2ea76032921344a741a25d45ab05534cc74cd54de742b40009cbb2648ee`,当前为 `72af91d398ac360ef11b28fe5e88e7d1b03dc2ad92e2d77a2a9d743cf1043746`,不满足后端逐字等价判据,不能证明当前规则的实际对局或摊牌通过。
|
||||
- [新规则环境三手证据](https://gitea.d-robotics.cc/peng01.guo/ppanel/src/commit/044810adf30631167aae0b89793917d91bfed93c/evidence/issue-35-a073):对应 `a0737d41` 后端,本次与 `d1a5f673` 和工作树逐字核验成立,因此可交独立 CR/QA 按相同后端复核。环境方报告新桌 `52e49afe-dd88-4d89-9cfa-e7b750c9e1e1` 三手,DeepSeek/GLM,`24` 成功/`23` 应用/`1` 暂停后未应用/`1` 错误,筹码始终 `3000`;第四手暂停且未完成,不计数。该历史调用不是本轮新调用,不替代 UI 与最终部署验证。
|
||||
|
||||
本轮只核对固定 Git 证据身份和后端适用范围,不访问原始私有模型日志。开发未宣布最终验收通过,最终仍需同一新 SHA、需求版本 `1` 的独立全量 CR、QA、集成与合入后 QA。
|
||||
|
||||
## 开发结论
|
||||
|
||||
本轮文档、源码身份比对、指定回归及冻结检查已完成,公开文件扫描见 `security-scan.json`,未发现凭据实值。报告结论为 `changes_requested`,原因是环境固定证据中的 CSS/HTML 摘要与本候选构建不同;这是环境部署绑定待核验项,不是新增运行代码缺陷,也不授权开发者修改运行代码或部署。控制面应交环境方补齐固定 Git 证据后再决定后续同 SHA 门禁,不应为消除此差异擅改冻结要求或无意义重跑真实模型。
|
||||
14
projects/agent-poker/evidence/issue-100-identity/build.log
Normal file
14
projects/agent-poker/evidence/issue-100-identity/build.log
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
> build
|
||||
> vite build
|
||||
|
||||
vite v8.2.2 building client environment for production...
|
||||
transforming...
|
||||
✓ 2018 modules transformed.
|
||||
rendering chunks...
|
||||
computing gzip size...
|
||||
dist/index.html 0.33 kB │ gzip: 0.26 kB
|
||||
dist/assets/index-CU526T7U.css 91.05 kB │ gzip: 18.12 kB
|
||||
dist/assets/index-BO_t9cEz.js 288.26 kB │ gzip: 92.79 kB
|
||||
|
||||
✓ built in 166ms
|
||||
@ -0,0 +1,161 @@
|
||||
{
|
||||
"baseSha": "411cea6bd5a55848791051f4c47da325626ecb76",
|
||||
"files": [
|
||||
{
|
||||
"path": "acceptance/control-plane/README.md",
|
||||
"blob": "2baa132e00c37c61f089e63f705db0f687f29eba",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "acceptance/control-plane/REPORT-079d0aa.md",
|
||||
"blob": "c34ac840b243af299c3946393f256906a4048069",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "acceptance/control-plane/REPORT-6da1c76.md",
|
||||
"blob": "75237b10a2ab14716f2f60c97440f0ccf37d3295",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "acceptance/control-plane/REPORT.md",
|
||||
"blob": "26d3e0e744b3875835bbb8224f522f3b62f70ca7",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "acceptance/FROZEN.sha256",
|
||||
"blob": "116f9c284d943d90fb56db37cd8320cb05fe1056",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "acceptance/FROZEN.v2.sha256",
|
||||
"blob": "3196d46453a9f33f842ddf59e911a5ab3f7d9b65",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "acceptance/README.md",
|
||||
"blob": "ef364891e31b6662d28168492963bb882eaf3ac1",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "acceptance/tasklist/ACCEPTANCE.md",
|
||||
"blob": "eb809bc3537ad134c86cb80225aaeb5d0483f188",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "acceptance/tasklist/test_tasklist_browser.py",
|
||||
"blob": "4f995b0a3aedec7fbd569946700295472b1cd2d8",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "acceptance/tasklist/test_tasklist.py",
|
||||
"blob": "cf1c34e9a8717ccc735cc8fd77f22dbfbdd7810e",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "acceptance/tasks/task-01-filter-total.md",
|
||||
"blob": "caaa39b4848f937f86140ece7bc049eb5eb86e03",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "acceptance/tasks/task-02-pagination.md",
|
||||
"blob": "6cde3e6a16687b21a96110849bcb4494ac9d6f89",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "acceptance/tasks/task-03-rework-candidate.md",
|
||||
"blob": "83b96d39bee04a66305eb217abbb42e86a138650",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/server/test/api.test.ts",
|
||||
"blob": "ef23d64339d0f60e76fbdd20a153677bff722a49",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/server/test/core.test.ts",
|
||||
"blob": "05c6278eea3e1b9b0909de958db335e316313410",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/server/test/engine.test.ts",
|
||||
"blob": "548ffbd959f6556b48695dd216d9bf50a0490a95",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/server/test/frozen.test.ts",
|
||||
"blob": "d9549b5a74ce351d06c903623db6c20c343c91c3",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/server/test/workspace.test.ts",
|
||||
"blob": "f887e99e2cdfc95f615dab5ec6e176f1addad2dc",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/web/e2e/issue-marker.spec.ts",
|
||||
"blob": "60f430f9b20515a7afe7c413250d5ea6d916f7de",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/web/e2e/stub-server.mjs",
|
||||
"blob": "0056324a1803211e1bde493e5d51f48389ec5f5a",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/web/e2e/workbench.spec.ts",
|
||||
"blob": "43577e8ca28b5abaa8824855eeadb4842b2f12cb",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/features/markdown.test.tsx",
|
||||
"blob": "a54959377221c075497e58e22607472836102808",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/features/workbench/issue-marker.test.ts",
|
||||
"blob": "c773629a8ea02d3b2a1318bf4f3e5e61ffcdd7d9",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/features/workbench/protocol.test.ts",
|
||||
"blob": "0b23f440b39119a1e76b2f5e9f41caad85cc5a96",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/features/workbench/router.test.tsx",
|
||||
"blob": "f487b413820f900b301be7cfd9b25a7b80a80c0f",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/features/workbench/workbench.test.tsx",
|
||||
"blob": "fc7093204663256a7ec432587c1caf17a4d55f20",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/lib/api.test.ts",
|
||||
"blob": "16e69bbd4b406118a53398202a71a323dac2063a",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/lib/status-labels.test.ts",
|
||||
"blob": "b04e26f4718274ce95000f879cb77cb8ab740e78",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "docs/specs/2026-09-12-connectivity-verification.md",
|
||||
"blob": "9f27d7959991ee18a96093c8f2784e734f7e332f",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "docs/specs/2026-09-12-mvp-plan-and-acceptance.md",
|
||||
"blob": "fbf3dc357153794fce0b6608d6c93ff7b88344f3",
|
||||
"mode": "100644"
|
||||
},
|
||||
{
|
||||
"path": "evidence/issue-25-a05/test.log",
|
||||
"blob": "91eb2e1a9ad90d577c54be69897a96e0b868cc64",
|
||||
"mode": "100644"
|
||||
}
|
||||
],
|
||||
"digest": "5039de0473a141bda8f978cad51b531ca619f017eb43b5151850b9069fa0bcdf"
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
{"source":"d1a5f6734e751dca5b7e9d8a1388218b25310558","old":"a0737d41f02a8b38bc8c3f72fccfdf23e6d6d4bc","historical":"470879a305438fc958acfc6486f1f86bcd94b681","environment":"b2347b72abc8dac917003cf709637ca5cab370c7","checkedHead":"d1a5f6734e751dca5b7e9d8a1388218b25310558","node":"v24.19.0"}
|
||||
{"path":"projects/agent-poker/server.mjs","a073":"853ed7b9fe650c18e1db6be251ac679ec8a28529e28aa5592aadc38c002d0561","d1":"853ed7b9fe650c18e1db6be251ac679ec8a28529e28aa5592aadc38c002d0561","working":"853ed7b9fe650c18e1db6be251ac679ec8a28529e28aa5592aadc38c002d0561","historical":"853ed7b9fe650c18e1db6be251ac679ec8a28529e28aa5592aadc38c002d0561","equal":true,"historicalEqual":true}
|
||||
{"path":"projects/agent-poker/game.mjs","a073":"72af91d398ac360ef11b28fe5e88e7d1b03dc2ad92e2d77a2a9d743cf1043746","d1":"72af91d398ac360ef11b28fe5e88e7d1b03dc2ad92e2d77a2a9d743cf1043746","working":"72af91d398ac360ef11b28fe5e88e7d1b03dc2ad92e2d77a2a9d743cf1043746","historical":"89e1f2ea76032921344a741a25d45ab05534cc74cd54de742b40009cbb2648ee","equal":true,"historicalEqual":false}
|
||||
{"path":"projects/agent-poker/persistence.mjs","a073":"b6dcce720ca30bf53ebb86f55df7b3e75ea79344c4ae765f853ef36ab19f1387","d1":"b6dcce720ca30bf53ebb86f55df7b3e75ea79344c4ae765f853ef36ab19f1387","working":"b6dcce720ca30bf53ebb86f55df7b3e75ea79344c4ae765f853ef36ab19f1387","historical":"b6dcce720ca30bf53ebb86f55df7b3e75ea79344c4ae765f853ef36ab19f1387","equal":true,"historicalEqual":true}
|
||||
{"path":"projects/agent-poker/models.mjs","a073":"761525ddb254965534e67ed1d9d240a6666f03f1b9a65e9e4d208133b6b56a12","d1":"761525ddb254965534e67ed1d9d240a6666f03f1b9a65e9e4d208133b6b56a12","working":"761525ddb254965534e67ed1d9d240a6666f03f1b9a65e9e4d208133b6b56a12","historical":"761525ddb254965534e67ed1d9d240a6666f03f1b9a65e9e4d208133b6b56a12","equal":true,"historicalEqual":true}
|
||||
{"path":"projects/agent-poker/package.json","a073":"0a14c2e807cd6d8ddc6739561f6becd9ac53378be885c693b90412d94c1a7e91","d1":"0a14c2e807cd6d8ddc6739561f6becd9ac53378be885c693b90412d94c1a7e91","working":"0a14c2e807cd6d8ddc6739561f6becd9ac53378be885c693b90412d94c1a7e91","historical":"0a14c2e807cd6d8ddc6739561f6becd9ac53378be885c693b90412d94c1a7e91","equal":true,"historicalEqual":true}
|
||||
{"path":"projects/agent-poker/package-lock.json","a073":"a57b4ebc89faa8fd4e88ed65e548b68078b9e96d8dad6f308ad2c548bc7c9d2f","d1":"a57b4ebc89faa8fd4e88ed65e548b68078b9e96d8dad6f308ad2c548bc7c9d2f","working":"a57b4ebc89faa8fd4e88ed65e548b68078b9e96d8dad6f308ad2c548bc7c9d2f","historical":"a57b4ebc89faa8fd4e88ed65e548b68078b9e96d8dad6f308ad2c548bc7c9d2f","equal":true,"historicalEqual":true}
|
||||
{"path":"projects/agent-poker/service.mjs","a073":"72d2e6d427215aca70e47929ecd259e56df40732658f9424be5b06d8f1f7d06f","d1":"72d2e6d427215aca70e47929ecd259e56df40732658f9424be5b06d8f1f7d06f","working":"72d2e6d427215aca70e47929ecd259e56df40732658f9424be5b06d8f1f7d06f","historical":"72d2e6d427215aca70e47929ecd259e56df40732658f9424be5b06d8f1f7d06f","equal":true,"historicalEqual":true}
|
||||
全部既有跟踪文件(本轮 README 与新证据除外)与 d1 逐字相同
|
||||
{"frozen":"acceptance/control-plane/README.md","blob":"2baa132e00c37c61f089e63f705db0f687f29eba","match":true}
|
||||
{"frozen":"acceptance/control-plane/REPORT-079d0aa.md","blob":"c34ac840b243af299c3946393f256906a4048069","match":true}
|
||||
{"frozen":"acceptance/control-plane/REPORT-6da1c76.md","blob":"75237b10a2ab14716f2f60c97440f0ccf37d3295","match":true}
|
||||
{"frozen":"acceptance/control-plane/REPORT.md","blob":"26d3e0e744b3875835bbb8224f522f3b62f70ca7","match":true}
|
||||
{"frozen":"acceptance/FROZEN.sha256","blob":"116f9c284d943d90fb56db37cd8320cb05fe1056","match":true}
|
||||
{"frozen":"acceptance/FROZEN.v2.sha256","blob":"3196d46453a9f33f842ddf59e911a5ab3f7d9b65","match":true}
|
||||
{"frozen":"acceptance/README.md","blob":"ef364891e31b6662d28168492963bb882eaf3ac1","match":true}
|
||||
{"frozen":"acceptance/tasklist/ACCEPTANCE.md","blob":"eb809bc3537ad134c86cb80225aaeb5d0483f188","match":true}
|
||||
{"frozen":"acceptance/tasklist/test_tasklist_browser.py","blob":"4f995b0a3aedec7fbd569946700295472b1cd2d8","match":true}
|
||||
{"frozen":"acceptance/tasklist/test_tasklist.py","blob":"cf1c34e9a8717ccc735cc8fd77f22dbfbdd7810e","match":true}
|
||||
{"frozen":"acceptance/tasks/task-01-filter-total.md","blob":"caaa39b4848f937f86140ece7bc049eb5eb86e03","match":true}
|
||||
{"frozen":"acceptance/tasks/task-02-pagination.md","blob":"6cde3e6a16687b21a96110849bcb4494ac9d6f89","match":true}
|
||||
{"frozen":"acceptance/tasks/task-03-rework-candidate.md","blob":"83b96d39bee04a66305eb217abbb42e86a138650","match":true}
|
||||
{"frozen":"apps/server/test/api.test.ts","blob":"ef23d64339d0f60e76fbdd20a153677bff722a49","match":true}
|
||||
{"frozen":"apps/server/test/core.test.ts","blob":"05c6278eea3e1b9b0909de958db335e316313410","match":true}
|
||||
{"frozen":"apps/server/test/engine.test.ts","blob":"548ffbd959f6556b48695dd216d9bf50a0490a95","match":true}
|
||||
{"frozen":"apps/server/test/frozen.test.ts","blob":"d9549b5a74ce351d06c903623db6c20c343c91c3","match":true}
|
||||
{"frozen":"apps/server/test/workspace.test.ts","blob":"f887e99e2cdfc95f615dab5ec6e176f1addad2dc","match":true}
|
||||
{"frozen":"apps/web/e2e/issue-marker.spec.ts","blob":"60f430f9b20515a7afe7c413250d5ea6d916f7de","match":true}
|
||||
{"frozen":"apps/web/e2e/stub-server.mjs","blob":"0056324a1803211e1bde493e5d51f48389ec5f5a","match":true}
|
||||
{"frozen":"apps/web/e2e/workbench.spec.ts","blob":"43577e8ca28b5abaa8824855eeadb4842b2f12cb","match":true}
|
||||
{"frozen":"apps/web/src/features/markdown.test.tsx","blob":"a54959377221c075497e58e22607472836102808","match":true}
|
||||
{"frozen":"apps/web/src/features/workbench/issue-marker.test.ts","blob":"c773629a8ea02d3b2a1318bf4f3e5e61ffcdd7d9","match":true}
|
||||
{"frozen":"apps/web/src/features/workbench/protocol.test.ts","blob":"0b23f440b39119a1e76b2f5e9f41caad85cc5a96","match":true}
|
||||
{"frozen":"apps/web/src/features/workbench/router.test.tsx","blob":"f487b413820f900b301be7cfd9b25a7b80a80c0f","match":true}
|
||||
{"frozen":"apps/web/src/features/workbench/workbench.test.tsx","blob":"fc7093204663256a7ec432587c1caf17a4d55f20","match":true}
|
||||
{"frozen":"apps/web/src/lib/api.test.ts","blob":"16e69bbd4b406118a53398202a71a323dac2063a","match":true}
|
||||
{"frozen":"apps/web/src/lib/status-labels.test.ts","blob":"b04e26f4718274ce95000f879cb77cb8ab740e78","match":true}
|
||||
{"frozen":"docs/specs/2026-09-12-connectivity-verification.md","blob":"9f27d7959991ee18a96093c8f2784e734f7e332f","match":true}
|
||||
{"frozen":"docs/specs/2026-09-12-mvp-plan-and-acceptance.md","blob":"fbf3dc357153794fce0b6608d6c93ff7b88344f3","match":true}
|
||||
{"frozen":"evidence/issue-25-a05/test.log","blob":"91eb2e1a9ad90d577c54be69897a96e0b868cc64","match":true}
|
||||
冻结 31/31 匹配;候选包含基线
|
||||
{"evidence":"0afa4df50967e881a700231022c13f4e30d9d2f1:evidence/issue-35-final/real-evidence.json","sha256":"5e4009f3f6136be0e9b93c1c91f4aed00b849ff8e87775644ab227ab5de1920f"}
|
||||
{"evidence":"0afa4df50967e881a700231022c13f4e30d9d2f1:evidence/issue-35-final/source-verification.json","sha256":"036c2ef8da42385f50c22930abe6baebd9677732dacc797d71a3116a32b1a7b3"}
|
||||
{"evidence":"470879a305438fc958acfc6486f1f86bcd94b681:projects/agent-poker/evidence.json","sha256":"9d59e63092940b894a2e39ba3f235991d1357f97919387cc833ff179de720d89"}
|
||||
{"evidence":"044810adf30631167aae0b89793917d91bfed93c:evidence/issue-35-a073/real-evidence.json","sha256":"3081ce9b3838d01e73268b6230ad5bf424d485ae9226ee0d441d7808cdd6f2c7"}
|
||||
{"evidence":"b2347b72abc8dac917003cf709637ca5cab370c7:evidence/issue-35-d1/deployment.json","sha256":"82dbb1c71fc81a1096c3b7f2dedc41fa10b6f891380554deede7c968293aafba"}
|
||||
{"build":"assets/index-BO_t9cEz.js","sha256":"85e2f085961e7ecefd05c84890ab933a78d81a0a97c3f399849f3661969b42ad","environmentSha256":null,"environmentMatch":false}
|
||||
{"build":"assets/index-CU526T7U.css","sha256":"8a1d3de5a24abd65b2873a9e0cb04859b977adc46e68db1a4516743cdd58665c","environmentSha256":null,"environmentMatch":false}
|
||||
{"build":"index.html","sha256":"44d05fc4255104e453f592a25b4fbeda8948ba86886caae4267e7d6852d5041b","environmentSha256":"0e856f8477c1c91c6b71750b863d0a4f5278b92a1444195d4567b5cb5d1e9538","environmentMatch":false}
|
||||
{"environmentBuildMatch":false,"note":"只比对固定 Git 环境记录,不证明公网此刻状态;差异需部署方与 QA 核验"}
|
||||
15
projects/agent-poker/evidence/issue-100-identity/install.log
Normal file
15
projects/agent-poker/evidence/issue-100-identity/install.log
Normal file
@ -0,0 +1,15 @@
|
||||
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
|
||||
|
||||
added 152 packages, and audited 153 packages in 3s
|
||||
|
||||
21 packages are looking for funding
|
||||
run `npm fund` for details
|
||||
|
||||
found 0 vulnerabilities
|
||||
npm warn allow-scripts 4 packages have install scripts not yet covered by allowScripts:
|
||||
npm warn allow-scripts @google/genai@1.52.0 (preinstall: echo 'preinstall: no-op')
|
||||
npm warn allow-scripts esbuild@0.28.1 (postinstall: node install.js)
|
||||
npm warn allow-scripts fsevents@2.3.3 (install: (install scripts present))
|
||||
npm warn allow-scripts protobufjs@7.6.6 (postinstall: node scripts/postinstall)
|
||||
npm warn allow-scripts
|
||||
npm warn allow-scripts Run `npm approve-scripts --allow-scripts-pending` to review, or `npm approve-scripts <pkg>` to allow.
|
||||
@ -0,0 +1,21 @@
|
||||
{
|
||||
"scope": [
|
||||
"projects/agent-poker/README.md",
|
||||
"projects/agent-poker/evidence/issue-100-identity/test.log",
|
||||
"projects/agent-poker/evidence/issue-100-identity/identity.log",
|
||||
"projects/agent-poker/evidence/issue-100-identity/verify.mjs",
|
||||
"projects/agent-poker/evidence/issue-100-identity/README.md",
|
||||
"projects/agent-poker/evidence/issue-100-identity/install.log",
|
||||
"projects/agent-poker/evidence/issue-100-identity/frozen-files.json",
|
||||
"projects/agent-poker/evidence/issue-100-identity/build.log"
|
||||
],
|
||||
"checks": [
|
||||
"长 Bearer 凭据",
|
||||
"模型密钥前缀",
|
||||
"赋值形式管理或邀请凭据",
|
||||
"邀请 fragment 实值",
|
||||
"私钥块"
|
||||
],
|
||||
"findings": [],
|
||||
"manualReview": "本轮新增文件人工检查:仅文档、脚本、源码摘要、冻结身份与安装构建测试输出;未加载凭据或模型配置。模式扫描不构成任意格式密钥不存在的数学证明。"
|
||||
}
|
||||
19
projects/agent-poker/evidence/issue-100-identity/test.log
Normal file
19
projects/agent-poker/evidence/issue-100-identity/test.log
Normal file
@ -0,0 +1,19 @@
|
||||
✔ 快照替换完整且私有;替换前进程被杀仍保留旧历史 (49.562125ms)
|
||||
✔ 牌型、轮子顺子及踢脚比较 (0.485708ms)
|
||||
✔ 边池与平分奇数筹码 (2.28175ms)
|
||||
✔ 轮次、隐私、重复动作与非法输入均不变更状态 (2.33525ms)
|
||||
✔ 短 all-in 不重新开放加注;全下自动摊牌守恒 (0.768917ms)
|
||||
✔ 连续 50 手合法行动筹码守恒 (6.848208ms)
|
||||
✔ 短大盲全下且小盲已覆盖时直接摊牌,不再允许弃牌 (0.495084ms)
|
||||
✔ 唯一可行动者只需跟齐实际全下额,不能向无人响应的边池加注 (0.173042ms)
|
||||
✔ 多人短大盲保留名义大盲;其他玩家弃牌后按实际投注自动摊牌 (0.137667ms)
|
||||
✔ 河牌弃牌获胜后公开和其他玩家投影隐藏赢家底牌,重载仍隐藏 (0.306541ms)
|
||||
✔ 真实多人摊牌仍公开未弃牌者底牌 (0.187458ms)
|
||||
ℹ tests 11
|
||||
ℹ suites 0
|
||||
ℹ pass 11
|
||||
ℹ fail 0
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 82.0945
|
||||
53
projects/agent-poker/evidence/issue-100-identity/verify.mjs
Normal file
53
projects/agent-poker/evidence/issue-100-identity/verify.mjs
Normal file
@ -0,0 +1,53 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { readFileSync, readdirSync } from 'node:fs';
|
||||
import assert from 'node:assert/strict';
|
||||
const git = (...args) => execFileSync('git', args);
|
||||
const hash = data => createHash('sha256').update(data).digest('hex');
|
||||
const old = 'a0737d41f02a8b38bc8c3f72fccfdf23e6d6d4bc';
|
||||
const source = 'd1a5f6734e751dca5b7e9d8a1388218b25310558';
|
||||
const historical = '470879a305438fc958acfc6486f1f86bcd94b681';
|
||||
const environment = 'b2347b72abc8dac917003cf709637ca5cab370c7';
|
||||
const prefix = 'projects/agent-poker/';
|
||||
const blob = (sha, path) => git('show', `${sha}:${path}`);
|
||||
console.log(JSON.stringify({source, old, historical, environment, checkedHead:git('rev-parse','HEAD').toString().trim(), node:process.version}));
|
||||
const deployment = JSON.parse(blob(environment, 'evidence/issue-35-d1/deployment.json'));
|
||||
for (const name of ['server.mjs','game.mjs','persistence.mjs','models.mjs','package.json','package-lock.json','service.mjs']) {
|
||||
const current = readFileSync(prefix+name), a = blob(old,prefix+name), d = blob(source,prefix+name), h = blob(historical,prefix+name);
|
||||
console.log(JSON.stringify({path:prefix+name, a073:hash(a), d1:hash(d), working:hash(current), historical:hash(h), equal:a.equals(d)&&d.equals(current), historicalEqual:h.equals(d)}));
|
||||
assert(a.equals(d) && d.equals(current));
|
||||
if (deployment.runtimeEqual[name]) assert.equal(hash(current),deployment.runtimeEqual[name]);
|
||||
}
|
||||
const allowed = path => path === prefix+'README.md' || path.startsWith(prefix+'evidence/issue-100-identity/');
|
||||
for (const path of git('ls-tree','-r','--name-only',source).toString().trim().split('\n')) {
|
||||
if (!allowed(path)) assert(readFileSync(path).equals(blob(source,path)), `发生范围外变化: ${path}`);
|
||||
}
|
||||
console.log('全部既有跟踪文件(本轮 README 与新证据除外)与 d1 逐字相同');
|
||||
const frozen = JSON.parse(readFileSync(new URL('./frozen-files.json', import.meta.url)));
|
||||
assert.equal(frozen.files.length,31);
|
||||
for (const file of frozen.files) {
|
||||
const actual = git('hash-object',file.path).toString().trim();
|
||||
assert.equal(actual,file.blob);
|
||||
assert.equal(git('rev-parse',`${frozen.baseSha}:${file.path}`).toString().trim(),file.blob);
|
||||
console.log(JSON.stringify({frozen:file.path,blob:actual,match:true}));
|
||||
}
|
||||
git('merge-base','--is-ancestor',frozen.baseSha,'HEAD');
|
||||
console.log('冻结 31/31 匹配;候选包含基线');
|
||||
for (const [sha,path] of [
|
||||
['0afa4df50967e881a700231022c13f4e30d9d2f1','evidence/issue-35-final/real-evidence.json'],
|
||||
['0afa4df50967e881a700231022c13f4e30d9d2f1','evidence/issue-35-final/source-verification.json'],
|
||||
[historical,prefix+'evidence.json'],
|
||||
['044810adf30631167aae0b89793917d91bfed93c','evidence/issue-35-a073/real-evidence.json'],
|
||||
[environment,'evidence/issue-35-d1/deployment.json']
|
||||
]) console.log(JSON.stringify({evidence:`${sha}:${path}`,sha256:hash(blob(sha,path))}));
|
||||
let environmentMatch = true;
|
||||
for (const path of readdirSync(prefix+'dist',{recursive:true}).sort()) {
|
||||
if (!path.endsWith('.html')&&!path.endsWith('.js')&&!path.endsWith('.css')) continue;
|
||||
const digest = hash(readFileSync(prefix+'dist/'+path));
|
||||
const resource = path==='index.html'?'/':'/'+path;
|
||||
const recorded = deployment.resources[resource]?.sha256;
|
||||
const match = recorded===digest;
|
||||
environmentMatch &&= match;
|
||||
console.log(JSON.stringify({build:path,sha256:digest,environmentSha256:recorded??null,environmentMatch:match}));
|
||||
}
|
||||
console.log(JSON.stringify({environmentBuildMatch:environmentMatch, note:'只比对固定 Git 环境记录,不证明公网此刻状态;差异需部署方与 QA 核验'}));
|
||||
1
projects/agent-poker/evidence/issue-57/api-isolated.log
Normal file
1
projects/agent-poker/evidence/issue-57/api-isolated.log
Normal file
@ -0,0 +1 @@
|
||||
HTTP 鉴权、隐私、非当前玩家与并发重复动作检查通过
|
||||
19
projects/agent-poker/evidence/issue-57/api.log
Normal file
19
projects/agent-poker/evidence/issue-57/api.log
Normal file
@ -0,0 +1,19 @@
|
||||
node:internal/modules/run_main:107
|
||||
triggerUncaughtException(
|
||||
^
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
|
||||
0 !== 2
|
||||
|
||||
at file:///Users/pptg/workspace/demo/ppanel/.ppanel/build/poker-driver/.ppanel/issue-35-control/tasks/c5ce8c73-9e72-4520-be35-cc8453d1521f/developer/d041536b-f1d1-47f3-9ba5-5c6e666cc5be/repo/projects/agent-poker/api-check.mjs:44:8
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5) {
|
||||
generatedMessage: true,
|
||||
code: 'ERR_ASSERTION',
|
||||
actual: 0,
|
||||
expected: 2,
|
||||
operator: 'strictEqual',
|
||||
diff: 'simple'
|
||||
}
|
||||
|
||||
Node.js v24.19.0
|
||||
20
projects/agent-poker/evidence/issue-57/browser.json
Normal file
20
projects/agent-poker/evidence/issue-57/browser.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"time": "2026-09-11T21:43:01.646Z",
|
||||
"public": {
|
||||
"url": "https://laws-forming-bare-remedies.trycloudflare.com/",
|
||||
"empty": false,
|
||||
"candidateDeployment": false,
|
||||
"observedTable": "08d7e8dd-9b13-4cb6-b46e-b716be677693",
|
||||
"stage": "flop",
|
||||
"hand": 5,
|
||||
"running": false,
|
||||
"error": "模型调用或动作失败;已暂停,请检查私有证据后重试",
|
||||
"note": "首次 DOM 读取早于异步加载;最终截图为已加载状态"
|
||||
},
|
||||
"local": {
|
||||
"url": "http://127.0.0.1:18459/",
|
||||
"pauseResume": true,
|
||||
"invitation": true,
|
||||
"privateCardsHidden": true
|
||||
}
|
||||
}
|
||||
14
projects/agent-poker/evidence/issue-57/build.log
Normal file
14
projects/agent-poker/evidence/issue-57/build.log
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
> build
|
||||
> vite build
|
||||
|
||||
vite v8.2.2 building client environment for production...
|
||||
transforming...
|
||||
✓ 2018 modules transformed.
|
||||
rendering chunks...
|
||||
computing gzip size...
|
||||
dist/index.html 0.33 kB │ gzip: 0.26 kB
|
||||
dist/assets/index-jRWxiGdW.css 45.36 kB │ gzip: 10.18 kB
|
||||
dist/assets/index-BITE0LBo.js 288.06 kB │ gzip: 92.73 kB
|
||||
|
||||
✓ built in 452ms
|
||||
50
projects/agent-poker/evidence/issue-57/local-dom.txt
Normal file
50
projects/agent-poker/evidence/issue-57/local-dom.txt
Normal file
@ -0,0 +1,50 @@
|
||||
- complementary "Agent 扑克":
|
||||
- heading "Agent 扑克" [level=2]
|
||||
- button "收起Agent 扑克侧栏":
|
||||
- paragraph: 虚拟筹码 · 无真钱交易
|
||||
- button "牌桌 6396f95e · 第 3 手"
|
||||
- button "牌桌 f3aa163b · 第 1 手"
|
||||
- text: 管理凭据
|
||||
- textbox "管理凭据"
|
||||
- button "建立牌桌"
|
||||
- paragraph: 管理凭据由本机服务管理员提供,不存入浏览器。
|
||||
- banner:
|
||||
- heading "在线观测" [level=1]
|
||||
- button "开始三手" [disabled]
|
||||
- button "暂停" [disabled]
|
||||
- button "停止" [disabled]
|
||||
- main:
|
||||
- alert
|
||||
- heading "第 3 手 · complete · 已暂停" [level=2]
|
||||
- paragraph
|
||||
- paragraph: 公共牌:Js 3c 2s 3d 2c
|
||||
- paragraph: 底池 0 · 当前行动者 —
|
||||
- article:
|
||||
- heading "真实甲" [level=2]
|
||||
- paragraph: 筹码 1160 · 本轮投入 240
|
||||
- paragraph: 7s Ts
|
||||
- paragraph: 已接受邀请 · deepseek-v4-flash-openai
|
||||
- article:
|
||||
- heading "真实乙" [level=2]
|
||||
- paragraph: 筹码 1840 · 本轮投入 0
|
||||
- paragraph: 已弃牌
|
||||
- paragraph: 已接受邀请 · deepseek-v4-flash-openai
|
||||
- article:
|
||||
- heading "真实丙" [level=2]
|
||||
- paragraph: 筹码 0 · 本轮投入 0
|
||||
- paragraph: 已弃牌
|
||||
- paragraph: 已接受邀请 · deepseek-v4-flash-openai
|
||||
- heading "动作时间线" [level=2]
|
||||
- paragraph: 2026-09-11T21:43:51.825Z · 真实甲 · raise · 60
|
||||
- paragraph: 2026-09-11T21:44:23.726Z · 真实乙 · call · 60
|
||||
- paragraph: 2026-09-11T21:44:48.666Z · 真实乙 · bet · 60
|
||||
- paragraph: 2026-09-11T21:45:00.666Z · 真实甲 · call · 60
|
||||
- paragraph: 2026-09-11T21:46:18.531Z · 真实乙 · bet · 120
|
||||
- paragraph: 2026-09-11T21:47:02.336Z · 真实甲 · call · 120
|
||||
- paragraph: 2026-09-11T21:51:29.538Z · 真实乙 · check · 0
|
||||
- paragraph: 2026-09-11T21:52:24.411Z · 真实甲 · bet · 240
|
||||
- paragraph: 2026-09-11T21:52:46.811Z · 真实乙 · fold · 0
|
||||
- heading "已完成手牌" [level=2]
|
||||
- generic "第 1 手 · 筹码核对 3000 · 5s 4d Ts Kd 8d"
|
||||
- generic "第 2 手 · 筹码核对 3000 ·"
|
||||
- generic "第 3 手 · 筹码核对 3000 · Js 3c 2s 3d 2c"
|
||||
9
projects/agent-poker/evidence/issue-57/model-switch.json
Normal file
9
projects/agent-poker/evidence/issue-57/model-switch.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"time": "2026-09-11T21:51:02.447Z",
|
||||
"table": "6396f95e-025f-461d-b637-bae4ad620267",
|
||||
"player": 1,
|
||||
"from": "66f54b63-ba93-4261-a31a-84347072f5ed",
|
||||
"to": "deepseek-v4-flash-openai",
|
||||
"reason": "GLM 河牌连续两次超时;改用另一真实模型依据同一玩家私有观察决策",
|
||||
"status": 200
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
PID STARTED COMM
|
||||
30934 Sat Sep 12 05:42:29 2026 /Users/pptg/.nvm/versions/node/v24.19.0/bin/node
|
||||
37899 Sat Sep 12 05:53:01 2026 /Users/pptg/.nvm/versions/node/v24.19.0/bin/node
|
||||
70644 Sat Sep 12 01:23:26 2026 cloudflared
|
||||
@ -0,0 +1,4 @@
|
||||
<!doctype html><html lang="zh-CN">
|
||||
<script type="module" crossorigin src="/assets/index-BITE0LBo.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-jRWxiGdW.css">
|
||||
<meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Agent 扑克观测</title><div id="root"></div></html>
|
||||
@ -0,0 +1,10 @@
|
||||
HTTP/2 200
|
||||
date: Fri, 11 Sep 2026 21:40:49 GMT
|
||||
content-type: text/html; charset=utf-8
|
||||
cf-ray: a399d53e288d9dfc-LAX
|
||||
cf-cache-status: DYNAMIC
|
||||
cache-control: no-store
|
||||
server: cloudflare
|
||||
referrer-policy: no-referrer
|
||||
x-content-type-options: nosniff
|
||||
|
||||
48
projects/agent-poker/evidence/issue-57/public-dom.txt
Normal file
48
projects/agent-poker/evidence/issue-57/public-dom.txt
Normal file
@ -0,0 +1,48 @@
|
||||
- complementary "Agent 扑克":
|
||||
- heading "Agent 扑克" [level=2]
|
||||
- button "收起Agent 扑克侧栏":
|
||||
- paragraph: 虚拟筹码 · 无真钱交易
|
||||
- button "牌桌 08d7e8dd · 第 5 手"
|
||||
- button "牌桌 75f77e5a · 第 1 手"
|
||||
- button "牌桌 93638aa3 · 第 0 手"
|
||||
- text: 管理凭据
|
||||
- textbox "管理凭据"
|
||||
- button "建立牌桌"
|
||||
- paragraph: 管理凭据由本机服务管理员提供,不存入浏览器。
|
||||
- banner:
|
||||
- heading "在线观测" [level=1]
|
||||
- button "开始三手" [disabled]
|
||||
- button "暂停" [disabled]
|
||||
- button "停止" [disabled]
|
||||
- main:
|
||||
- alert
|
||||
- heading "第 5 手 · flop · 已暂停" [level=2]
|
||||
- paragraph: 模型调用或动作失败;已暂停,请检查私有证据后重试
|
||||
- paragraph: 公共牌:Ts 8d 8s
|
||||
- paragraph: 底池 280 · 当前行动者 真实 Agent 乙
|
||||
- article:
|
||||
- heading "真实 Agent 甲" [level=2]
|
||||
- paragraph: 筹码 1020 · 本轮投入 100
|
||||
- paragraph: 底牌保密
|
||||
- paragraph: 已接受邀请 · deepseek-v4-flash-openai
|
||||
- article:
|
||||
- heading "真实 Agent 乙 · 行动中" [level=2]
|
||||
- paragraph: 筹码 840 · 本轮投入 0
|
||||
- paragraph: 底牌保密
|
||||
- paragraph: 已接受邀请 · 66f54b63-ba93-4261-a31a-84347072f5ed
|
||||
- article:
|
||||
- heading "真实 Agent 丙" [level=2]
|
||||
- paragraph: 筹码 860 · 本轮投入 0
|
||||
- paragraph: 底牌保密
|
||||
- paragraph: 已接受邀请 · deepseek-v4-flash-openai
|
||||
- heading "动作时间线" [level=2]
|
||||
- paragraph: 2026-09-11T21:36:16.834Z · 真实 Agent 乙 · raise · 60
|
||||
- paragraph: 2026-09-11T21:36:42.429Z · 真实 Agent 丙 · call · 60
|
||||
- paragraph: 2026-09-11T21:37:07.618Z · 真实 Agent 甲 · call · 60
|
||||
- paragraph: 2026-09-11T21:37:16.855Z · 真实 Agent 丙 · check · 0
|
||||
- paragraph: 2026-09-11T21:37:43.342Z · 真实 Agent 甲 · bet · 100
|
||||
- heading "已完成手牌" [level=2]
|
||||
- generic "第 1 手 · 筹码核对 3000 · 7h 4c Qh"
|
||||
- generic "第 2 手 · 筹码核对 3000 ·"
|
||||
- generic "第 3 手 · 筹码核对 3000 · Kc 9h 2h"
|
||||
- generic "第 4 手 · 筹码核对 3000 · 5h 2c Jd"
|
||||
1
projects/agent-poker/evidence/issue-57/public-error.txt
Normal file
1
projects/agent-poker/evidence/issue-57/public-error.txt
Normal file
@ -0,0 +1 @@
|
||||
curl: (56) CONNECT tunnel failed, response 403
|
||||
13
projects/agent-poker/evidence/issue-57/public-headers.txt
Normal file
13
projects/agent-poker/evidence/issue-57/public-headers.txt
Normal file
@ -0,0 +1,13 @@
|
||||
HTTP/1.1 403 Forbidden
|
||||
Server: squid/3.5.20
|
||||
Mime-Version: 1.0
|
||||
Date: Fri, 11 Sep 2026 21:40:03 GMT
|
||||
Content-Type: text/html;charset=utf-8
|
||||
Content-Length: 3605
|
||||
X-Squid-Error: ERR_ACCESS_DENIED 0
|
||||
Vary: Accept-Language
|
||||
Content-Language: en
|
||||
X-Cache: MISS from proxy1080254
|
||||
X-Cache-Lookup: NONE from proxy1080254:8838
|
||||
Connection: keep-alive
|
||||
|
||||
@ -0,0 +1 @@
|
||||
{"error":"需要管理凭据"}
|
||||
@ -0,0 +1,10 @@
|
||||
HTTP/2 403
|
||||
date: Fri, 11 Sep 2026 21:47:37 GMT
|
||||
content-type: application/json; charset=utf-8
|
||||
cf-ray: a399df36acf7ad7f-LAX
|
||||
cf-cache-status: DYNAMIC
|
||||
cache-control: no-store
|
||||
server: cloudflare
|
||||
referrer-policy: no-referrer
|
||||
x-content-type-options: nosniff
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,10 @@
|
||||
HTTP/2 200
|
||||
date: Fri, 11 Sep 2026 21:47:38 GMT
|
||||
content-type: application/json; charset=utf-8
|
||||
cf-ray: a399df3cdafd170b-LAX
|
||||
cf-cache-status: DYNAMIC
|
||||
cache-control: no-store
|
||||
server: cloudflare
|
||||
referrer-policy: no-referrer
|
||||
x-content-type-options: nosniff
|
||||
|
||||
BIN
projects/agent-poker/evidence/issue-57/public.png
Normal file
BIN
projects/agent-poker/evidence/issue-57/public.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 85 KiB |
@ -0,0 +1 @@
|
||||
{"hands":3,"showdowns":1,"calls":17,"applied":16,"conserved":3000}
|
||||
1
projects/agent-poker/evidence/issue-57/restart.log
Normal file
1
projects/agent-poker/evidence/issue-57/restart.log
Normal file
@ -0,0 +1 @@
|
||||
测试服务重启后公共牌桌、行动与筹码完全一致,默认暂停。
|
||||
14
projects/agent-poker/evidence/issue-57/tests-final.log
Normal file
14
projects/agent-poker/evidence/issue-57/tests-final.log
Normal file
@ -0,0 +1,14 @@
|
||||
✔ 快照替换完整且私有;替换前进程被杀仍保留旧历史 (49.173333ms)
|
||||
✔ 牌型、轮子顺子及踢脚比较 (0.412791ms)
|
||||
✔ 边池与平分奇数筹码 (1.681ms)
|
||||
✔ 轮次、隐私、重复动作与非法输入均不变更状态 (1.657291ms)
|
||||
✔ 短 all-in 不重新开放加注;全下自动摊牌守恒 (1.4125ms)
|
||||
✔ 连续 50 手合法行动筹码守恒 (7.56375ms)
|
||||
ℹ tests 6
|
||||
ℹ suites 0
|
||||
ℹ pass 6
|
||||
ℹ fail 0
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 82.398125
|
||||
@ -0,0 +1,2 @@
|
||||
PID STARTED COMM
|
||||
70644 Sat Sep 12 01:23:26 2026 cloudflared
|
||||
1
projects/agent-poker/evidence/issue-73/api.log
Normal file
1
projects/agent-poker/evidence/issue-73/api.log
Normal file
@ -0,0 +1 @@
|
||||
HTTP 鉴权、隐私、非当前玩家与并发重复动作检查通过
|
||||
1
projects/agent-poker/evidence/issue-73/browser.json
Normal file
1
projects/agent-poker/evidence/issue-73/browser.json
Normal file
@ -0,0 +1 @@
|
||||
{"origin":"http://127.0.0.1:18473","errors":[],"passed":true,"time":"2026-09-11T22:12:44.804Z"}
|
||||
1
projects/agent-poker/evidence/issue-73/browser.log
Normal file
1
projects/agent-poker/evidence/issue-73/browser.log
Normal file
@ -0,0 +1 @@
|
||||
浏览器观测、邀请流程通过
|
||||
@ -0,0 +1,8 @@
|
||||
{
|
||||
"javascriptBytesEqual": true,
|
||||
"localJs": "index-BITE0LBo.js",
|
||||
"publicJs": "index-BwNhEx3M.js",
|
||||
"sha256": "df87f0196d551fa33dafb8eb106da6f851f853e4bfa8f0e3e21edb257505911e",
|
||||
"cssBytesEqual": false,
|
||||
"note": "CSS 扫描产物不同,不能将现有部署声称为最终 SHA 完整构建;运行源码和 JS 一致。"
|
||||
}
|
||||
1871
projects/agent-poker/evidence/issue-73/build-diff.txt
Normal file
1871
projects/agent-poker/evidence/issue-73/build-diff.txt
Normal file
File diff suppressed because it is too large
Load Diff
14
projects/agent-poker/evidence/issue-73/build.log
Normal file
14
projects/agent-poker/evidence/issue-73/build.log
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
> build
|
||||
> vite build
|
||||
|
||||
vite v8.2.2 building client environment for production...
|
||||
transforming...
|
||||
✓ 2018 modules transformed.
|
||||
rendering chunks...
|
||||
computing gzip size...
|
||||
dist/index.html 0.33 kB │ gzip: 0.26 kB
|
||||
dist/assets/index-jRWxiGdW.css 45.36 kB │ gzip: 10.18 kB
|
||||
dist/assets/index-BITE0LBo.js 288.06 kB │ gzip: 92.73 kB
|
||||
|
||||
✓ built in 418ms
|
||||
1
projects/agent-poker/evidence/issue-73/flow.log
Normal file
1
projects/agent-poker/evidence/issue-73/flow.log
Normal file
@ -0,0 +1 @@
|
||||
三个独立邀请、未全员加入门禁、开始/暂停/恢复/停止及公网三手历史与禁用控制通过
|
||||
39
projects/agent-poker/evidence/issue-73/public-check.json
Normal file
39
projects/agent-poker/evidence/issue-73/public-check.json
Normal file
@ -0,0 +1,39 @@
|
||||
[
|
||||
{
|
||||
"path": "/",
|
||||
"status": 200,
|
||||
"sha256": "b2240cfd6130bfa43c0159ae00518c3d9855d5a356aace80096ca50ef7113367"
|
||||
},
|
||||
{
|
||||
"path": "/assets/index-BwNhEx3M.js",
|
||||
"sha256": "df87f0196d551fa33dafb8eb106da6f851f853e4bfa8f0e3e21edb257505911e"
|
||||
},
|
||||
{
|
||||
"path": "/assets/index-B8wKFYrG.css",
|
||||
"sha256": "0cd7944b5e82789f068f8683e1808bb3f5ee29c2d58baf3d88b271b7ebcc3dec"
|
||||
},
|
||||
{
|
||||
"path": "/api/models",
|
||||
"status": 403,
|
||||
"sha256": "9a05b7731db5086eb3ae2565d33126186b1cc1a0facf9ea0e6f82512f710b3d7"
|
||||
},
|
||||
{
|
||||
"path": "/api/tables",
|
||||
"status": 200,
|
||||
"sha256": "6ba068fe5c5768136f4d2e6a46578ad5d329152d0b3f0de60330cd1c1a9fc5cf"
|
||||
},
|
||||
{
|
||||
"tables": [
|
||||
{
|
||||
"id": "70adbf3c-412c-45e1-8e82-a18cc539ffb8",
|
||||
"hands": 3,
|
||||
"running": false,
|
||||
"totals": [
|
||||
3000,
|
||||
3000,
|
||||
3000
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
BIN
projects/agent-poker/evidence/issue-73/public.png
Normal file
BIN
projects/agent-poker/evidence/issue-73/public.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
236
projects/agent-poker/evidence/issue-73/reuse-check.json
Normal file
236
projects/agent-poker/evidence/issue-73/reuse-check.json
Normal file
@ -0,0 +1,236 @@
|
||||
{
|
||||
"candidate": "470879a305438fc958acfc6486f1f86bcd94b681",
|
||||
"fileChecks": [
|
||||
{
|
||||
"path": "projects/agent-poker/README.md",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/api-check.mjs",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/browser-check.mjs",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence.json",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/invitation.png",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/api-isolated.log",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/api.log",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/browser.json",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/build.log",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/local-dom.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/model-switch.json",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/processes-final.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public-direct-body.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public-direct-error.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public-direct-headers.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public-dom.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public-error.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public-headers.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public-models-body.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public-models-error.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public-models-headers.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public-tables-body.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public-tables-error.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public-tables-headers.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/public.png",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/real-verification.log",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/restart.log",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/tests-final.log",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/issue-57/tunnel-process.txt",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/observer.png",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/evidence/verification.json",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/game.mjs",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/index.html",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/models.mjs",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/package-lock.json",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/package.json",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/persistence.mjs",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/persistence.test.mjs",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/real-check.mjs",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/server.mjs",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/service.mjs",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/style.css",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/test.mjs",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/ui.jsx",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "projects/agent-poker/vite.config.mjs",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/theme.css",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/page-layout.css",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/workbench.css",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/components/page-workspace.tsx",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/components/ui/button.tsx",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "apps/web/src/lib/utils.ts",
|
||||
"matches": true
|
||||
},
|
||||
{
|
||||
"path": "apps/web/THIRD_PARTY_NOTICES.md",
|
||||
"matches": true
|
||||
}
|
||||
],
|
||||
"allMatch": true,
|
||||
"historicalReal": {
|
||||
"calls": 20,
|
||||
"applied": 19,
|
||||
"historyTotals": [
|
||||
3000,
|
||||
3000,
|
||||
3000
|
||||
],
|
||||
"models": [
|
||||
"deepseek-v4-flash",
|
||||
"glm-5.3"
|
||||
]
|
||||
},
|
||||
"newModelCalls": 0,
|
||||
"note": "45 个候选文件在 README 编辑前全部匹配;最终仅 README 与本轮新增证据不同。",
|
||||
"historicalIssue57": {
|
||||
"calls": 17,
|
||||
"hands": 3,
|
||||
"showdownHands": [
|
||||
1
|
||||
]
|
||||
}
|
||||
}
|
||||
18
projects/agent-poker/evidence/issue-73/test.log
Normal file
18
projects/agent-poker/evidence/issue-73/test.log
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
> test
|
||||
> node --test test.mjs persistence.test.mjs
|
||||
|
||||
✔ 快照替换完整且私有;替换前进程被杀仍保留旧历史 (63.833542ms)
|
||||
✔ 牌型、轮子顺子及踢脚比较 (0.391959ms)
|
||||
✔ 边池与平分奇数筹码 (1.483875ms)
|
||||
✔ 轮次、隐私、重复动作与非法输入均不变更状态 (1.317917ms)
|
||||
✔ 短 all-in 不重新开放加注;全下自动摊牌守恒 (0.554667ms)
|
||||
✔ 连续 50 手合法行动筹码守恒 (7.397042ms)
|
||||
ℹ tests 6
|
||||
ℹ suites 0
|
||||
ℹ pass 6
|
||||
ℹ fail 0
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 95.279
|
||||
16
projects/agent-poker/evidence/issue-96-invitation/README.md
Normal file
16
projects/agent-poker/evidence/issue-96-invitation/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Issue 96 开发回归证据
|
||||
|
||||
需求版本 `1`;修复前候选 `a0737d41f02a8b38bc8c3f72fccfdf23e6d6d4bc`;基线 `411cea6bd5a55848791051f4c47da325626ecb76`。本目录随修复提交,`source-sha256.json` 标识被测试源码;本报告非 `pass` 时评审拒绝是正确门禁。本开发证据不代表最终独立验收。
|
||||
|
||||
- `browser-before.log`:先扩展回归脚本,在原 UI 构建上运行,同页切换后找不到“接受邀请”按钮;错误附带的页面状态仍显示“已加入”。
|
||||
- `browser-after.log`、`browser.json`:修复后真实本机 Chrome 检查通过。同页玩家 1 → 玩家 2,接受前服务端席位 `[true,false,false]`,按钮显示“接受邀请”;接受后 `[true,true,false]`;切回玩家 1 保留该身份“已加入”;移除片段隐藏邀请区。另建桌三份独立新页邀请后 `[true,true,true]`。无页面运行错误。
|
||||
- `unit.log`:规则及持久化 `11/11`;包含 Issue 88 的 `R1`/`R2` 回归。
|
||||
- `api.log`:真实 HTTP 鉴权、隐私、并发重复动作、非当前玩家及河牌弃牌隐私检查通过。
|
||||
- `build-before.log`、`build-after.log`:修复前后生产构建。
|
||||
- `frozen.log`:正式任务给定的冻结 blob 全部匹配,`31/31`。
|
||||
|
||||
执行命令见项目 `README.md`,测试服务仅为本角色在 `127.0.0.1:18596` 启动的独立服务,私有状态及临时输出均在角色自身的临时目录。本目录仅复制可公开的原始输出;运行状态、管理凭据、邀请 token、依赖和构建产物不提交。
|
||||
|
||||
本轮真实模型调用 `0`:浏览器只接受外部 API 邀请,不设置 `modelId`;HTTP 检查使用确定性动作。没有执行 `real-check.mjs`。历史模型证据不能冒称本轮调用;历史候选的 `game.mjs` 与当前候选已有差异,本轮相对 `a0737d4` 未改规则或服务端。
|
||||
|
||||
公网仍按正式任务记录为旧候选 `a3fce773`,本地测试不证明最终候选已部署。独立 CR、QA 及环境方部署核验仍待执行。
|
||||
@ -0,0 +1 @@
|
||||
HTTP 鉴权、隐私、非当前玩家、并发重复动作与河牌弃牌获胜隐私检查通过
|
||||
@ -0,0 +1,3 @@
|
||||
同页切换玩家 1 → 玩家 2:接受邀请;服务端席位 [true,false,false]
|
||||
三份独立新页邀请成功:服务端席位 [true,true,true]
|
||||
浏览器观测、邀请流程通过
|
||||
@ -0,0 +1,84 @@
|
||||
node:internal/modules/run_main:107
|
||||
triggerUncaughtException(
|
||||
^
|
||||
|
||||
ExpectError: expect(locator).toBeVisible() failed
|
||||
|
||||
Locator: getByRole('button', { name: '接受邀请', exact: true })
|
||||
Expected: visible
|
||||
Timeout: 5000ms
|
||||
Error: element(s) not found
|
||||
|
||||
Call log:
|
||||
- Expect "toBeVisible" getByRole('button', { name: '接受邀请', exact: true }) with timeout 5000ms
|
||||
- waiting for getByRole('button', { name: '接受邀请', exact: true })
|
||||
|
||||
at captureRawStack (/Users/pptg/workspace/demo/ppanel/.ppanel/build/poker-driver/.ppanel/issue-35-control/tasks/71c1c0f7-69c9-487e-98a2-776bd0872c4f/developer/2afaed02-52d1-4f7e-9e5e-df3710fe6392/repo/projects/agent-poker/node_modules/playwright-core/lib/coreBundle.js:8588:17)
|
||||
at callMatcherAsStep (/Users/pptg/workspace/demo/ppanel/.ppanel/build/poker-driver/.ppanel/issue-35-control/tasks/71c1c0f7-69c9-487e-98a2-776bd0872c4f/developer/2afaed02-52d1-4f7e-9e5e-df3710fe6392/repo/projects/agent-poker/node_modules/playwright/lib/matchers/expect.js:13310:57)
|
||||
at Object.toBeVisible (/Users/pptg/workspace/demo/ppanel/.ppanel/build/poker-driver/.ppanel/issue-35-control/tasks/71c1c0f7-69c9-487e-98a2-776bd0872c4f/developer/2afaed02-52d1-4f7e-9e5e-df3710fe6392/repo/projects/agent-poker/node_modules/playwright/lib/matchers/expect.js:13302:23)
|
||||
at /Users/pptg/workspace/demo/ppanel/.ppanel/build/poker-driver/.ppanel/issue-35-control/tasks/71c1c0f7-69c9-487e-98a2-776bd0872c4f/developer/2afaed02-52d1-4f7e-9e5e-df3710fe6392/repo/projects/agent-poker/browser-check.mjs:44:74 {
|
||||
matcherResult: {
|
||||
message: 'expect(locator).toBeVisible() failed\n' +
|
||||
'\n' +
|
||||
"Locator: getByRole('button', { name: '接受邀请', exact: true })\n" +
|
||||
'Expected: visible\n' +
|
||||
'Timeout: 5000ms\n' +
|
||||
'Error: element(s) not found\n' +
|
||||
'\n' +
|
||||
'Call log:\n' +
|
||||
` - Expect "toBeVisible" getByRole('button', { name: '接受邀请', exact: true }) with timeout 5000ms\n` +
|
||||
" - waiting for getByRole('button', { name: '接受邀请', exact: true })\n",
|
||||
pass: false,
|
||||
actual: undefined,
|
||||
name: 'toBeVisible',
|
||||
expected: 'visible',
|
||||
log: [
|
||||
` - Expect "toBeVisible" getByRole('button', { name: '接受邀请', exact: true }) with timeout 5000ms`,
|
||||
" - waiting for getByRole('button', { name: '接受邀请', exact: true })"
|
||||
],
|
||||
timeout: 5000,
|
||||
ariaSnapshot: '- complementary "Agent 扑克":\n' +
|
||||
' - heading "Agent 扑克" [level=2]\n' +
|
||||
' - button "收起Agent 扑克侧栏"\n' +
|
||||
' - paragraph: 虚拟筹码 · 无真钱交易\n' +
|
||||
' - button "牌桌 bbca0c9d · 第 0 手"\n' +
|
||||
' - text: 管理凭据\n' +
|
||||
' - textbox "管理凭据"\n' +
|
||||
' - button "建立牌桌"\n' +
|
||||
' - paragraph: 管理凭据由本机服务管理员提供,不存入浏览器。\n' +
|
||||
'- banner:\n' +
|
||||
' - heading "在线观测" [level=1]\n' +
|
||||
' - button "开始三手" [disabled]\n' +
|
||||
' - button "暂停" [disabled]\n' +
|
||||
' - button "停止" [disabled]\n' +
|
||||
'- main:\n' +
|
||||
' - alert\n' +
|
||||
' - heading "接受玩家邀请" [level=2]\n' +
|
||||
' - paragraph: 邀请凭据仅在地址片段中,请勿转发。接入后可用受控 API 获取自己的观察。\n' +
|
||||
' - button "已加入"\n' +
|
||||
' - text: "GET /api/tables/bbca0c9d-9de6-4ade-8a40-a044f9e523d0/observation POST /api/tables/bbca0c9d-9de6-4ade-8a40-a044f9e523d0/action Authorization: Bearer <邀请凭据> 动作字段:version、action、amount"\n' +
|
||||
' - heading "第 0 手 · waiting · 已暂停" [level=2]\n' +
|
||||
' - paragraph\n' +
|
||||
' - paragraph: 公共牌:尚未发出\n' +
|
||||
' - paragraph: 底池 0 · 当前行动者 —\n' +
|
||||
' - article:\n' +
|
||||
' - heading "Agent A" [level=2]\n' +
|
||||
' - paragraph: 筹码 1000 · 本轮投入 0\n' +
|
||||
' - paragraph: 底牌保密\n' +
|
||||
' - paragraph: 已接受邀请 · 外部 API 玩家\n' +
|
||||
' - article:\n' +
|
||||
' - heading "Agent B" [level=2]\n' +
|
||||
' - paragraph: 筹码 1000 · 本轮投入 0\n' +
|
||||
' - paragraph: 底牌保密\n' +
|
||||
' - paragraph: 等待邀请 · 外部 API 玩家\n' +
|
||||
' - article:\n' +
|
||||
' - heading "Agent C" [level=2]\n' +
|
||||
' - paragraph: 筹码 1000 · 本轮投入 0\n' +
|
||||
' - paragraph: 底牌保密\n' +
|
||||
' - paragraph: 等待邀请 · 外部 API 玩家\n' +
|
||||
' - heading "动作时间线" [level=2]\n' +
|
||||
' - heading "已完成手牌" [level=2]'
|
||||
}
|
||||
}
|
||||
|
||||
Node.js v24.19.0
|
||||
@ -0,0 +1 @@
|
||||
{"origin":"http://127.0.0.1:18596","errors":[],"checks":["同页切换邀请后不残留已加入","三份独立新页邀请成功"],"passed":true,"time":"2026-09-11T23:11:09.564Z"}
|
||||
@ -0,0 +1,14 @@
|
||||
|
||||
> build
|
||||
> vite build
|
||||
|
||||
vite v8.2.2 building client environment for production...
|
||||
transforming...
|
||||
✓ 2018 modules transformed.
|
||||
rendering chunks...
|
||||
computing gzip size...
|
||||
dist/index.html 0.33 kB │ gzip: 0.26 kB
|
||||
dist/assets/index-CU526T7U.css 91.05 kB │ gzip: 18.12 kB
|
||||
dist/assets/index-BO_t9cEz.js 288.26 kB │ gzip: 92.79 kB
|
||||
|
||||
✓ built in 165ms
|
||||
@ -0,0 +1,14 @@
|
||||
|
||||
> build
|
||||
> vite build
|
||||
|
||||
vite v8.2.2 building client environment for production...
|
||||
transforming...
|
||||
✓ 2018 modules transformed.
|
||||
rendering chunks...
|
||||
computing gzip size...
|
||||
dist/index.html 0.33 kB │ gzip: 0.26 kB
|
||||
dist/assets/index-CU526T7U.css 91.05 kB │ gzip: 18.12 kB
|
||||
dist/assets/index-DdXzWjAN.js 288.06 kB │ gzip: 92.73 kB
|
||||
|
||||
✓ built in 483ms
|
||||
@ -0,0 +1 @@
|
||||
冻结验收 blob 匹配:31/31
|
||||
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ui.jsx": "cd392b4139b00ac452638b00878a45281502ff4a6e7e97e5f2ed5ace661412ab",
|
||||
"browser-check.mjs": "82c2891c3fe0522a90b3f836507b9e15d4959930f1beac976a575371e441954e",
|
||||
"game.mjs": "72af91d398ac360ef11b28fe5e88e7d1b03dc2ad92e2d77a2a9d743cf1043746",
|
||||
"server.mjs": "853ed7b9fe650c18e1db6be251ac679ec8a28529e28aa5592aadc38c002d0561",
|
||||
"test.mjs": "f0c2dfb13d9b96d83fa50d75e3b75273b71744c2996e676af57a3709e452d28d",
|
||||
"persistence.test.mjs": "3d803c86c1acfeb54c827d3b0692df9777c8497b3127076bb0ce12bbadcb08e2",
|
||||
"package-lock.json": "a57b4ebc89faa8fd4e88ed65e548b68078b9e96d8dad6f308ad2c548bc7c9d2f"
|
||||
}
|
||||
19
projects/agent-poker/evidence/issue-96-invitation/unit.log
Normal file
19
projects/agent-poker/evidence/issue-96-invitation/unit.log
Normal file
@ -0,0 +1,19 @@
|
||||
✔ 快照替换完整且私有;替换前进程被杀仍保留旧历史 (46.932375ms)
|
||||
✔ 牌型、轮子顺子及踢脚比较 (0.42425ms)
|
||||
✔ 边池与平分奇数筹码 (1.426125ms)
|
||||
✔ 轮次、隐私、重复动作与非法输入均不变更状态 (1.365125ms)
|
||||
✔ 短 all-in 不重新开放加注;全下自动摊牌守恒 (0.603125ms)
|
||||
✔ 连续 50 手合法行动筹码守恒 (7.023709ms)
|
||||
✔ 短大盲全下且小盲已覆盖时直接摊牌,不再允许弃牌 (0.490042ms)
|
||||
✔ 唯一可行动者只需跟齐实际全下额,不能向无人响应的边池加注 (0.176458ms)
|
||||
✔ 多人短大盲保留名义大盲;其他玩家弃牌后按实际投注自动摊牌 (0.137625ms)
|
||||
✔ 河牌弃牌获胜后公开和其他玩家投影隐藏赢家底牌,重载仍隐藏 (0.301ms)
|
||||
✔ 真实多人摊牌仍公开未弃牌者底牌 (0.282375ms)
|
||||
ℹ tests 11
|
||||
ℹ suites 0
|
||||
ℹ pass 11
|
||||
ℹ fail 0
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 76.156541
|
||||
BIN
projects/agent-poker/evidence/observer.png
Normal file
BIN
projects/agent-poker/evidence/observer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
61
projects/agent-poker/evidence/verification.json
Normal file
61
projects/agent-poker/evidence/verification.json
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"issue": 57,
|
||||
"revision": 1,
|
||||
"baseSha": "46dca1a8eaf45e67477d2e27d8a3ad44abdd7aba",
|
||||
"localUrl": "http://127.0.0.1:18459",
|
||||
"publicUrl": "https://laws-forming-bare-remedies.trycloudflare.com",
|
||||
"publicCandidateDeployment": false,
|
||||
"checks": {
|
||||
"rules": "✔ 快照替换完整且私有;替换前进程被杀仍保留旧历史 (49.173333ms)\n✔ 牌型、轮子顺子及踢脚比较 (0.412791ms)\n✔ 边池与平分奇数筹码 (1.681ms)\n✔ 轮次、隐私、重复动作与非法输入均不变更状态 (1.657291ms)\n✔ 短 all-in 不重新开放加注;全下自动摊牌守恒 (1.4125ms)\n✔ 连续 50 手合法行动筹码守恒 (7.56375ms)\nℹ tests 6\nℹ suites 0\nℹ pass 6\nℹ fail 0\nℹ cancelled 0\nℹ skipped 0\nℹ todo 0\nℹ duration_ms 82.398125\n",
|
||||
"api": "HTTP 鉴权、隐私、非当前玩家与并发重复动作检查通过\n",
|
||||
"initialApiFailure": "node:internal/modules/run_main:107\n triggerUncaughtException(\n ^\n\nAssertionError [ERR_ASSERTION]: Expected values to be strictly equal:\n\n0 !== 2\n\n at file:///Users/pptg/workspace/demo/ppanel/.ppanel/build/poker-driver/.ppanel/issue-35-control/tasks/c5ce8c73-9e72-4520-be35-cc8453d1521f/developer/d041536b-f1d1-47f3-9ba5-5c6e666cc5be/repo/projects/agent-poker/api-check.mjs:44:8\n at process.processTicksAndRejections (node:internal/process/task_queues:104:5) {\n generatedMessage: true,\n code: 'ERR_ASSERTION',\n actual: 0,\n expected: 2,\n operator: 'strictEqual',\n diff: 'simple'\n}\n\nNode.js v24.19.0\n",
|
||||
"restart": "测试服务重启后公共牌桌、行动与筹码完全一致,默认暂停。\n",
|
||||
"build": "\n> build\n> vite build\n\nvite v8.2.2 building client environment for production...\ntransforming...\n✓ 2018 modules transformed.\nrendering chunks...\ncomputing gzip size...\ndist/index.html 0.33 kB │ gzip: 0.26 kB\ndist/assets/index-jRWxiGdW.css 45.36 kB │ gzip: 10.18 kB\ndist/assets/index-BITE0LBo.js 288.06 kB │ gzip: 92.73 kB\n\n✓ built in 452ms\n",
|
||||
"publicUnauthorizedModels": "公网 GET /api/models 返回 403,需要管理凭据;原始响应见 evidence/issue-57/public-models-headers.txt 与 public-models-body.txt"
|
||||
},
|
||||
"browser": {
|
||||
"time": "2026-09-11T21:43:01.646Z",
|
||||
"public": {
|
||||
"url": "https://laws-forming-bare-remedies.trycloudflare.com/",
|
||||
"empty": false,
|
||||
"candidateDeployment": false,
|
||||
"observedTable": "08d7e8dd-9b13-4cb6-b46e-b716be677693",
|
||||
"stage": "flop",
|
||||
"hand": 5,
|
||||
"running": false,
|
||||
"error": "模型调用或动作失败;已暂停,请检查私有证据后重试",
|
||||
"note": "首次 DOM 读取早于异步加载;最终截图为已加载状态"
|
||||
},
|
||||
"local": {
|
||||
"url": "http://127.0.0.1:18459/",
|
||||
"pauseResume": true,
|
||||
"invitation": true,
|
||||
"privateCardsHidden": true
|
||||
}
|
||||
},
|
||||
"processes": " PID STARTED COMM\n30934 Sat Sep 12 05:42:29 2026 /Users/pptg/.nvm/versions/node/v24.19.0/bin/node\n37899 Sat Sep 12 05:53:01 2026 /Users/pptg/.nvm/versions/node/v24.19.0/bin/node\n70644 Sat Sep 12 01:23:26 2026 cloudflared\n",
|
||||
"privateData": "/Users/pptg/workspace/demo/ppanel/.ppanel/build/poker-driver/.ppanel/issue-35-control/tasks/c5ce8c73-9e72-4520-be35-cc8453d1521f/developer/d041536b-f1d1-47f3-9ba5-5c6e666cc5be/tmp/service",
|
||||
"privateLog": "/Users/pptg/workspace/demo/ppanel/.ppanel/build/poker-driver/.ppanel/issue-35-control/tasks/c5ce8c73-9e72-4520-be35-cc8453d1521f/developer/d041536b-f1d1-47f3-9ba5-5c6e666cc5be/tmp/server.log",
|
||||
"sourceSha256": {
|
||||
"server.mjs": "853ed7b9fe650c18e1db6be251ac679ec8a28529e28aa5592aadc38c002d0561",
|
||||
"persistence.mjs": "b6dcce720ca30bf53ebb86f55df7b3e75ea79344c4ae765f853ef36ab19f1387",
|
||||
"models.mjs": "761525ddb254965534e67ed1d9d240a6666f03f1b9a65e9e4d208133b6b56a12",
|
||||
"game.mjs": "89e1f2ea76032921344a741a25d45ab05534cc74cd54de742b40009cbb2648ee",
|
||||
"real-check.mjs": "98ac0870c3b1a60f18546f274fb97072a486b4ec20cc2d16a45b859e7845c8dc"
|
||||
},
|
||||
"limitations": [
|
||||
"指定源站探针 PID 70638 已不存在,未替换未知源站;公网为另一已有牌桌,不是本轮候选部署",
|
||||
"独立 CR 与 QA 尚待控制面分派",
|
||||
"单进程快照;不提供日志与状态跨文件事务,物理断电仍受操作系统与存储硬件保证约束"
|
||||
],
|
||||
"real": {
|
||||
"hands": 3,
|
||||
"showdowns": 1,
|
||||
"calls": 17,
|
||||
"applied": 16,
|
||||
"total": 3000,
|
||||
"restartHistoryPreserved": true,
|
||||
"fiveCardBoards": 2
|
||||
},
|
||||
"realVerification": "{\"hands\":3,\"showdowns\":1,\"calls\":17,\"applied\":16,\"conserved\":3000}\n"
|
||||
}
|
||||
299
projects/agent-poker/game.mjs
Normal file
299
projects/agent-poker/game.mjs
Normal file
@ -0,0 +1,299 @@
|
||||
import { randomInt } from "node:crypto";
|
||||
export function rank(cards) {
|
||||
let best = [];
|
||||
const compare = (a, b) => {
|
||||
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
||||
if ((a[i] ?? 0) !== (b[i] ?? 0)) return (a[i] ?? 0) - (b[i] ?? 0);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
for (let a = 0; a < cards.length - 4; a++)
|
||||
for (let b = a + 1; b < cards.length - 3; b++)
|
||||
for (let c = b + 1; c < cards.length - 2; c++)
|
||||
for (let d = c + 1; d < cards.length - 1; d++)
|
||||
for (let e = d + 1; e < cards.length; e++) {
|
||||
const hand = [a, b, c, d, e].map((i) => cards[i]),
|
||||
values = hand
|
||||
.map((c) => "23456789TJQKA".indexOf(c[0]) + 2)
|
||||
.sort((a, b) => b - a);
|
||||
const groups = [...new Set(values)]
|
||||
.map((v) => [values.filter((x) => x === v).length, v])
|
||||
.sort((a, b) => b[0] - a[0] || b[1] - a[1]);
|
||||
const flush = hand.every((c) => c[1] === hand[0][1]);
|
||||
const straight =
|
||||
new Set(values).size === 5
|
||||
? values[0] - values[4] === 4
|
||||
? values[0]
|
||||
: values.join() === "14,5,4,3,2"
|
||||
? 5
|
||||
: 0
|
||||
: 0;
|
||||
const g = groups;
|
||||
const score =
|
||||
flush && straight
|
||||
? [8, straight]
|
||||
: g[0][0] === 4
|
||||
? [7, g[0][1], g[1][1]]
|
||||
: g[0][0] === 3 && g[1][0] === 2
|
||||
? [6, g[0][1], g[1][1]]
|
||||
: flush
|
||||
? [5, ...values]
|
||||
: straight
|
||||
? [4, straight]
|
||||
: g[0][0] === 3
|
||||
? [3, ...g.map((x) => x[1])]
|
||||
: g[0][0] === 2 && g[1][0] === 2
|
||||
? [2, ...g.map((x) => x[1])]
|
||||
: g[0][0] === 2
|
||||
? [1, ...g.map((x) => x[1])]
|
||||
: [0, ...values];
|
||||
if (compare(score, best) > 0) best = score;
|
||||
}
|
||||
return best.reduce((n, v) => n * 15 + v, 0) * 15 ** (6 - best.length);
|
||||
}
|
||||
export function settle(players, board, button) {
|
||||
const awards = players.map(() => 0),
|
||||
pots = [];
|
||||
let previous = 0;
|
||||
for (const level of [
|
||||
...new Set(players.map((p) => p.total).filter(Boolean)),
|
||||
].sort((a, b) => a - b)) {
|
||||
const contributors = players
|
||||
.map((p, i) => ({ p, i }))
|
||||
.filter((x) => x.p.total >= level);
|
||||
const amount = (level - previous) * contributors.length;
|
||||
previous = level;
|
||||
const eligible = contributors.filter((x) => !x.p.folded);
|
||||
// Uncalled excess belongs to its sole contributor, even after a fold.
|
||||
const candidates = eligible.length ? eligible : contributors;
|
||||
const score = (x) =>
|
||||
board.length === 5 ? rank([...x.p.cards, ...board]) : 0;
|
||||
const maximum = Math.max(...candidates.map(score));
|
||||
const winners = candidates
|
||||
.filter((x) => score(x) === maximum)
|
||||
.map((x) => x.i)
|
||||
.sort(
|
||||
(a, b) =>
|
||||
((a - button - 1 + players.length) % players.length) -
|
||||
((b - button - 1 + players.length) % players.length),
|
||||
);
|
||||
winners.forEach(
|
||||
(i, k) =>
|
||||
(awards[i] +=
|
||||
Math.floor(amount / winners.length) +
|
||||
(k < amount % winners.length ? 1 : 0)),
|
||||
);
|
||||
pots.push({ amount, winners });
|
||||
}
|
||||
return { awards, pots };
|
||||
}
|
||||
export class Game {
|
||||
constructor(names, stacks = names.map(() => 1000)) {
|
||||
if (names.length < 2 || names.length > 6) throw Error("需要 2–6 位玩家");
|
||||
this.players = names.map((name, i) => ({
|
||||
id: i,
|
||||
name,
|
||||
stack: stacks[i],
|
||||
cards: [],
|
||||
total: 0,
|
||||
bet: 0,
|
||||
folded: false,
|
||||
}));
|
||||
this.initial = stacks.reduce((a, b) => a + b, 0);
|
||||
this.hand = 0;
|
||||
this.version = 0;
|
||||
this.button = -1;
|
||||
this.stage = "waiting";
|
||||
this.board = [];
|
||||
this.history = [];
|
||||
this.timeline = [];
|
||||
this.actor = null;
|
||||
}
|
||||
next(i, predicate) {
|
||||
for (let k = 1; k <= this.players.length; k++) {
|
||||
const j = (i + k) % this.players.length;
|
||||
if (predicate(this.players[j], j)) return j;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
start(deck) {
|
||||
if (!["waiting", "complete"].includes(this.stage))
|
||||
throw Error("牌局进行中");
|
||||
if (this.players.filter((p) => p.stack > 0).length < 2)
|
||||
throw Error("不足两位有筹码玩家");
|
||||
this.hand++;
|
||||
this.version++;
|
||||
this.board = [];
|
||||
this.timeline = [];
|
||||
this.current = 20;
|
||||
this.minRaise = 20;
|
||||
this.button = this.next(this.button, (p) => p.stack > 0);
|
||||
this.players.forEach((p) =>
|
||||
Object.assign(p, {
|
||||
cards: [],
|
||||
total: 0,
|
||||
bet: 0,
|
||||
folded: p.stack === 0,
|
||||
actedAt: null,
|
||||
}),
|
||||
);
|
||||
this.deck = deck
|
||||
? [...deck]
|
||||
: [..."23456789TJQKA"].flatMap((v) => [..."shdc"].map((s) => v + s));
|
||||
if (!deck)
|
||||
for (let i = this.deck.length - 1; i > 0; i--) {
|
||||
const j = randomInt(i + 1);
|
||||
[this.deck[i], this.deck[j]] = [this.deck[j], this.deck[i]];
|
||||
}
|
||||
for (let k = 0; k < 2; k++)
|
||||
this.players.forEach((p) => {
|
||||
if (!p.folded) p.cards.push(this.deck.pop());
|
||||
});
|
||||
const sb =
|
||||
this.players.filter((p) => !p.folded).length === 2
|
||||
? this.button
|
||||
: this.next(this.button, (p) => !p.folded),
|
||||
bb = this.next(sb, (p) => !p.folded);
|
||||
this.pay(sb, 10);
|
||||
this.pay(bb, 20);
|
||||
this.stage = "preflop";
|
||||
this.actor = this.next(bb, (p) => !p.folded && p.stack > 0);
|
||||
this.advance();
|
||||
}
|
||||
pay(i, n) {
|
||||
const p = this.players[i],
|
||||
amount = Math.min(n, p.stack);
|
||||
p.stack -= amount;
|
||||
p.bet += amount;
|
||||
p.total += amount;
|
||||
}
|
||||
legal(i) {
|
||||
const p = this.players[i];
|
||||
if (i !== this.actor || !p || p.folded || !p.stack) return null;
|
||||
const call = Math.max(0, this.current - p.bet),
|
||||
canRaise =
|
||||
(p.actedAt === null || this.current - p.actedAt >= this.minRaise) &&
|
||||
this.players.some((other) => other !== p && !other.folded && other.stack > 0);
|
||||
const max = p.bet + p.stack,
|
||||
min = this.current + this.minRaise;
|
||||
return {
|
||||
actions: [
|
||||
"fold",
|
||||
...(call ? ["call"] : ["check"]),
|
||||
...(canRaise && max >= min ? [this.current ? "raise" : "bet"] : []),
|
||||
...(max <= this.current || canRaise ? ["all-in"] : []),
|
||||
],
|
||||
call: Math.min(call, p.stack),
|
||||
min,
|
||||
max,
|
||||
};
|
||||
}
|
||||
act(i, action, amount, version) {
|
||||
if (version !== this.version) throw Error("重复或过期动作");
|
||||
const l = this.legal(i);
|
||||
if (!l || !l.actions.includes(action)) throw Error("非法或非当前玩家动作");
|
||||
const p = this.players[i];
|
||||
let target = p.bet;
|
||||
if (action === "call") target = p.bet + l.call;
|
||||
if (action === "all-in") target = l.max;
|
||||
if (["bet", "raise"].includes(action)) {
|
||||
if (!Number.isSafeInteger(amount) || amount < l.min || amount > l.max)
|
||||
throw Error("非法下注");
|
||||
target = amount;
|
||||
}
|
||||
if (action === "fold") p.folded = true;
|
||||
else this.pay(i, target - p.bet);
|
||||
if (target > this.current) {
|
||||
const delta = target - this.current;
|
||||
if (delta >= this.minRaise) this.minRaise = delta;
|
||||
this.current = target;
|
||||
}
|
||||
p.actedAt = this.current;
|
||||
this.timeline.push({
|
||||
hand: this.hand,
|
||||
version: this.version,
|
||||
player: i,
|
||||
action,
|
||||
amount: target,
|
||||
time: new Date().toISOString(),
|
||||
});
|
||||
this.version++;
|
||||
this.actor = this.next(
|
||||
i,
|
||||
(p) =>
|
||||
!p.folded &&
|
||||
p.stack > 0 &&
|
||||
(p.actedAt === null || p.bet < this.current),
|
||||
);
|
||||
this.advance();
|
||||
}
|
||||
advance() {
|
||||
const alive = this.players.filter((p) => !p.folded),
|
||||
active = alive.filter((p) => p.stack > 0);
|
||||
if (alive.length === 1) return this.finish();
|
||||
// 无人能响应加注时,只需覆盖仍在牌局中的实际投注(短盲注可能不足 20)。
|
||||
if (active.length <= 1) this.current = Math.max(...alive.map((p) => p.bet));
|
||||
if (active.length <= 1 && active.every((p) => p.bet >= this.current)) {
|
||||
while (this.board.length < 5) this.board.push(this.deck.pop());
|
||||
return this.finish();
|
||||
}
|
||||
if (this.actor !== null) return;
|
||||
if (this.stage === "river") return this.finish();
|
||||
this.stage = { preflop: "flop", flop: "turn", turn: "river" }[this.stage];
|
||||
for (let k = 0; k < (this.stage === "flop" ? 3 : 1); k++)
|
||||
this.board.push(this.deck.pop());
|
||||
this.current = 0;
|
||||
this.minRaise = 20;
|
||||
this.players.forEach((p) => {
|
||||
p.bet = 0;
|
||||
p.actedAt = null;
|
||||
});
|
||||
this.actor = this.next(this.button, (p) => !p.folded && p.stack > 0);
|
||||
if (this.actor === null) this.advance();
|
||||
}
|
||||
finish() {
|
||||
const result = settle(this.players, this.board, this.button);
|
||||
this.players.forEach((p, i) => (p.stack += result.awards[i]));
|
||||
this.stage = "complete";
|
||||
this.actor = null;
|
||||
this.history.push({
|
||||
hand: this.hand,
|
||||
board: [...this.board],
|
||||
...result,
|
||||
stacks: this.players.map((p) => p.stack),
|
||||
total: this.players.reduce((n, p) => n + p.stack, 0),
|
||||
actions: [...this.timeline],
|
||||
});
|
||||
if (this.history.at(-1).total !== this.initial) throw Error("筹码不守恒");
|
||||
}
|
||||
view(id) {
|
||||
return {
|
||||
hand: this.hand,
|
||||
version: this.version,
|
||||
stage: this.stage,
|
||||
button: this.button,
|
||||
actor: this.actor,
|
||||
board: this.board,
|
||||
pot:
|
||||
this.stage === "complete"
|
||||
? 0
|
||||
: this.players.reduce((n, p) => n + p.total, 0),
|
||||
players: this.players.map((p) => ({
|
||||
id: p.id,
|
||||
name: p.name,
|
||||
stack: p.stack,
|
||||
bet: p.bet,
|
||||
folded: p.folded,
|
||||
cards:
|
||||
p.id === id ||
|
||||
(this.stage === "complete" && this.board.length === 5 &&
|
||||
this.players.filter((player) => !player.folded).length > 1 && !p.folded)
|
||||
? p.cards
|
||||
: [],
|
||||
})),
|
||||
legal: this.legal(id),
|
||||
history: this.history,
|
||||
timeline: this.timeline,
|
||||
};
|
||||
}
|
||||
}
|
||||
1
projects/agent-poker/index.html
Normal file
1
projects/agent-poker/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!doctype html><html lang="zh-CN"><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Agent 扑克观测</title><div id="root"></div><script type="module" src="/ui.jsx"></script></html>
|
||||
90
projects/agent-poker/models.mjs
Normal file
90
projects/agent-poker/models.mjs
Normal file
@ -0,0 +1,90 @@
|
||||
// Adapted from apps/server/src/config.ts (D-SRE provider mapping).
|
||||
import { readFileSync } from "node:fs";
|
||||
import { parse } from "yaml";
|
||||
import { createModels, createProvider } from "@earendil-works/pi-ai";
|
||||
import { openAICompletionsApi } from "@earendil-works/pi-ai/api/openai-completions.lazy";
|
||||
import { openAIResponsesApi } from "@earendil-works/pi-ai/api/openai-responses.lazy";
|
||||
import { anthropicMessagesApi } from "@earendil-works/pi-ai/api/anthropic-messages.lazy";
|
||||
import { Agent } from "@earendil-works/pi-agent-core";
|
||||
export function loadModels() {
|
||||
const items = parse(
|
||||
readFileSync("/Users/pptg/.d-sre-agent/config/sre-agent.yaml", "utf8"),
|
||||
).llm.items;
|
||||
const models = createModels();
|
||||
for (const item of items) {
|
||||
const c = item.compat ?? {};
|
||||
const api = {
|
||||
"openai-completions": openAICompletionsApi,
|
||||
"openai-responses": openAIResponsesApi,
|
||||
"anthropic-messages": anthropicMessagesApi,
|
||||
}[item.api];
|
||||
if (!api) continue;
|
||||
models.setProvider(
|
||||
createProvider({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
baseUrl: item.api_base,
|
||||
auth: {
|
||||
apiKey: {
|
||||
name: item.name,
|
||||
resolve: async () => ({
|
||||
auth: { apiKey: item.api_key },
|
||||
source: "本机 YAML",
|
||||
}),
|
||||
},
|
||||
},
|
||||
models: [
|
||||
{
|
||||
id: item.model,
|
||||
name: item.name,
|
||||
api: item.api,
|
||||
provider: item.id,
|
||||
baseUrl: item.api_base,
|
||||
reasoning: item.reasoning ?? false,
|
||||
input: ["text"],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: item.context_window ?? 128000,
|
||||
maxTokens: Math.min(item.max_tokens ?? 4096, 4096),
|
||||
compat: {
|
||||
supportsDeveloperRole: c.supportsDeveloperRole,
|
||||
supportsReasoningEffort: c.supportsReasoningEffort,
|
||||
supportsUsageInStreaming: c.supportsStreamingUsage,
|
||||
supportsStrictMode: c.supportsStrictToolSchema,
|
||||
},
|
||||
},
|
||||
],
|
||||
api: api(),
|
||||
}),
|
||||
);
|
||||
}
|
||||
return { items, models };
|
||||
}
|
||||
export async function decide(cfg, item, observation) {
|
||||
const agent = new Agent({
|
||||
streamFn: (model, context, options) =>
|
||||
cfg.models.streamSimple(model, context, options),
|
||||
initialState: {
|
||||
systemPrompt:
|
||||
'你是一位虚拟筹码德州扑克玩家。仅根据私有观察自主决策,不知道其他底牌。只输出 JSON 对象 {"action":"合法动作名称","amount":整数}。amount 是本轮下注总额,仅 bet/raise 需要。务必选择 legal.actions 内的动作,遵守 min/max。',
|
||||
model: cfg.models.getModel(item.id, item.model),
|
||||
thinkingLevel: "off",
|
||||
tools: [],
|
||||
},
|
||||
});
|
||||
const timer = setTimeout(() => agent.abort(), 90000);
|
||||
try {
|
||||
await agent.prompt(JSON.stringify(observation));
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
const messages = agent.state.messages;
|
||||
const last = messages.filter((m) => m.role === "assistant").at(-1);
|
||||
const output =
|
||||
last?.content
|
||||
?.filter((c) => c.type === "text")
|
||||
.map((c) => c.text)
|
||||
.join("\n") ?? "";
|
||||
const match = output.match(/\{[\s\S]*\}/);
|
||||
if (!match) throw Error("模型未返回动作 JSON");
|
||||
return { action: JSON.parse(match[0]), output, usage: last.usage };
|
||||
}
|
||||
3475
projects/agent-poker/package-lock.json
generated
Normal file
3475
projects/agent-poker/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
29
projects/agent-poker/package.json
Normal file
29
projects/agent-poker/package.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "agent-poker",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "node --test test.mjs persistence.test.mjs",
|
||||
"start": "node server.mjs",
|
||||
"build": "vite build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@base-ui/react": "1.8.0",
|
||||
"@earendil-works/pi-agent-core": "0.85.0",
|
||||
"@earendil-works/pi-ai": "0.85.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-react": "^1.42.0",
|
||||
"react": "19.2.8",
|
||||
"react-dom": "19.2.8",
|
||||
"tailwind-merge": "^3.6.0",
|
||||
"yaml": "^2.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.63.0",
|
||||
"@tailwindcss/vite": "^4.3.3",
|
||||
"@vitejs/plugin-react": "6.1.1",
|
||||
"tailwindcss": "^4.3.3",
|
||||
"vite": "8.2.2"
|
||||
}
|
||||
}
|
||||
21
projects/agent-poker/persistence.mjs
Normal file
21
projects/agent-poker/persistence.mjs
Normal file
@ -0,0 +1,21 @@
|
||||
import {openSync, writeFileSync, fsyncSync, closeSync, renameSync, rmSync} from 'node:fs';
|
||||
import {dirname} from 'node:path';
|
||||
|
||||
// 单进程快照:同目录临时文件刷盘后替换,读者只看到完整旧版或新版。
|
||||
export function atomicWrite(file, content) {
|
||||
const temporary = file + '.pending';
|
||||
let fd;
|
||||
try {
|
||||
fd = openSync(temporary, 'w', 0o600);
|
||||
writeFileSync(fd, content);
|
||||
fsyncSync(fd);
|
||||
closeSync(fd);
|
||||
fd = undefined;
|
||||
renameSync(temporary, file);
|
||||
fd = openSync(dirname(file), 'r');
|
||||
fsyncSync(fd);
|
||||
} finally {
|
||||
if (fd !== undefined) closeSync(fd);
|
||||
rmSync(temporary, {force:true});
|
||||
}
|
||||
}
|
||||
29
projects/agent-poker/persistence.test.mjs
Normal file
29
projects/agent-poker/persistence.test.mjs
Normal file
@ -0,0 +1,29 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {mkdtempSync, readFileSync, statSync, rmSync} from 'node:fs';
|
||||
import {join} from 'node:path';
|
||||
import {spawnSync} from 'node:child_process';
|
||||
import {atomicWrite} from './persistence.mjs';
|
||||
|
||||
test('快照替换完整且私有;替换前进程被杀仍保留旧历史', () => {
|
||||
assert(process.env.TMPDIR, '必须设置角色私有 TMPDIR');
|
||||
const dir = mkdtempSync(join(process.env.TMPDIR, 'snapshot-'));
|
||||
const file = join(dir, 'state.json');
|
||||
try {
|
||||
const old = JSON.stringify([{history: [{hand: 1}]}]);
|
||||
atomicWrite(file, old);
|
||||
assert.equal(statSync(file).mode & 0o777, 0o600);
|
||||
const child = spawnSync(process.execPath, ['--input-type=module', '-e', `
|
||||
import fs from 'node:fs';
|
||||
import {syncBuiltinESMExports} from 'node:module';
|
||||
fs.renameSync = () => process.kill(process.pid, 'SIGKILL');
|
||||
syncBuiltinESMExports();
|
||||
const {atomicWrite} = await import(${JSON.stringify(new URL('./persistence.mjs', import.meta.url).href)});
|
||||
atomicWrite(process.argv[1], JSON.stringify([{history: [{hand: 1}, {hand: 2}]}]));
|
||||
`, file]);
|
||||
assert.equal(child.signal, 'SIGKILL');
|
||||
assert.equal(readFileSync(file, 'utf8'), old);
|
||||
atomicWrite(file, '[{"history":[1,2,3]}]');
|
||||
assert.deepEqual(JSON.parse(readFileSync(file, 'utf8')), [{history:[1,2,3]}]);
|
||||
} finally { rmSync(dir, {recursive:true, force:true}); }
|
||||
});
|
||||
33
projects/agent-poker/real-check.mjs
Normal file
33
projects/agent-poker/real-check.mjs
Normal file
@ -0,0 +1,33 @@
|
||||
import { readFileSync, writeFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
if (!process.env.POKER_DATA || !process.env.TMPDIR)
|
||||
throw Error('必须设置私有 POKER_DATA 与 TMPDIR');
|
||||
const base = (process.env.POKER_URL ?? 'http://127.0.0.1:18459') + '/api/';
|
||||
const admin = readFileSync(resolve(process.env.POKER_DATA, 'admin-token'), 'utf8');
|
||||
async function request(path, body, token = admin) {
|
||||
const response = await fetch(base + path, {
|
||||
method: body ? 'POST' : 'GET',
|
||||
headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + token },
|
||||
...(body ? { body: JSON.stringify(body) } : {}),
|
||||
});
|
||||
const data = await response.json();
|
||||
if (!response.ok) throw Error(JSON.stringify(data));
|
||||
return data;
|
||||
}
|
||||
const { models } = await request('models');
|
||||
const selected = models.filter(m => /deepseek|glm/i.test(m.model)).slice(0, 2);
|
||||
if (new Set(selected.map(m => m.model)).size < 2)
|
||||
throw Error('缺少两种目标模型');
|
||||
const table = await request('tables', { names: ['真实甲', '真实乙', '真实丙'] });
|
||||
writeFileSync(
|
||||
resolve(process.env.TMPDIR, 'real-table.json'),
|
||||
JSON.stringify({ id: table.id, models: selected }),
|
||||
{ mode: 0o600 },
|
||||
);
|
||||
for (let i = 0; i < 3; i++) {
|
||||
await request('tables/' + table.id + '/join',
|
||||
{ modelId: selected[i % 2].id }, table.invitations[i].url.split('.')[1]);
|
||||
}
|
||||
await request('tables/' + table.id + '/control', { action: 'start' });
|
||||
console.log('真实对局已开始', table.id, selected.map(m => m.model));
|
||||
243
projects/agent-poker/server.mjs
Normal file
243
projects/agent-poker/server.mjs
Normal file
@ -0,0 +1,243 @@
|
||||
import { createServer } from "node:http";
|
||||
import { randomBytes, randomUUID } from "node:crypto";
|
||||
import {
|
||||
readFileSync,
|
||||
mkdirSync,
|
||||
existsSync,
|
||||
appendFileSync,
|
||||
} from "node:fs";
|
||||
import { resolve, extname } from "node:path";
|
||||
import { atomicWrite } from "./persistence.mjs";
|
||||
import { Game } from "./game.mjs";
|
||||
import { loadModels, decide } from "./models.mjs";
|
||||
const data = process.env.POKER_DATA;
|
||||
if (!data) throw Error("必须设置私有 POKER_DATA");
|
||||
mkdirSync(data, { recursive: true, mode: 0o700 });
|
||||
const privateFile = resolve(data, "state.json");
|
||||
let cfg;
|
||||
const tables = new Map();
|
||||
const adminFile = resolve(data, "admin-token");
|
||||
const admin = existsSync(adminFile)
|
||||
? readFileSync(adminFile, "utf8")
|
||||
: randomBytes(32).toString("hex");
|
||||
atomicWrite(adminFile, admin);
|
||||
if (existsSync(privateFile))
|
||||
for (const t of JSON.parse(readFileSync(privateFile, "utf8"))) {
|
||||
t.game = Object.assign(new Game(["恢复", "状态"]), t.game);
|
||||
t.running = false;
|
||||
tables.set(t.id, t);
|
||||
}
|
||||
const save = () =>
|
||||
atomicWrite(privateFile, JSON.stringify([...tables.values()]));
|
||||
const publicTable = (t) => ({
|
||||
id: t.id,
|
||||
running: t.running,
|
||||
error: t.error,
|
||||
models: t.seats.map((s) => ({
|
||||
name: s.name,
|
||||
model: s.modelId,
|
||||
joined: s.joined,
|
||||
})),
|
||||
...t.game.view(),
|
||||
});
|
||||
const audit = (value) =>
|
||||
appendFileSync(
|
||||
resolve(data, "evidence.jsonl"),
|
||||
JSON.stringify({ time: new Date().toISOString(), ...value }) + "\n",
|
||||
{ mode: 0o600 },
|
||||
);
|
||||
let busy = false;
|
||||
setInterval(async () => {
|
||||
if (busy) return;
|
||||
busy = true;
|
||||
try {
|
||||
for (const t of tables.values()) {
|
||||
if (!t.running) continue;
|
||||
if (t.game.stage === "complete" || t.game.stage === "waiting") {
|
||||
if (t.game.history.length >= t.limit) {
|
||||
t.running = false;
|
||||
save();
|
||||
continue;
|
||||
}
|
||||
try { t.game.start(); } catch { t.running = false; t.error = "不足两位有筹码玩家,演示已停止"; save(); continue; }
|
||||
save();
|
||||
}
|
||||
const seat = t.seats[t.game.actor];
|
||||
if (!seat?.modelId) continue;
|
||||
cfg ??= loadModels();
|
||||
const item = cfg.items.find((i) => i.id === seat.modelId);
|
||||
const observation = t.game.view(t.game.actor),
|
||||
version = t.game.version,
|
||||
id = t.game.actor;
|
||||
try {
|
||||
const start = Date.now();
|
||||
const result = await decide(cfg, item, observation);
|
||||
audit({
|
||||
table: t.id,
|
||||
kind: "model",
|
||||
player: id,
|
||||
model: item.model,
|
||||
provider: item.id,
|
||||
observation,
|
||||
...result,
|
||||
durationMs: Date.now() - start,
|
||||
});
|
||||
if (!t.running || t.game.version !== version) continue;
|
||||
t.game.act(id, result.action.action, result.action.amount, version);
|
||||
audit({ table: t.id, kind: "state", state: publicTable(t) });
|
||||
save();
|
||||
} catch {
|
||||
t.running = false;
|
||||
t.error = "模型调用或动作失败;已暂停,请检查私有证据后重试";
|
||||
audit({ table: t.id, kind: "error", version });
|
||||
save();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
busy = false;
|
||||
}
|
||||
}, 1000);
|
||||
export const server = createServer(async (req, res) => {
|
||||
res.setHeader("Cache-Control", "no-store");
|
||||
res.setHeader("Referrer-Policy", "no-referrer");
|
||||
res.setHeader("X-Content-Type-Options", "nosniff");
|
||||
const json = (code, obj) => {
|
||||
res.writeHead(code, { "Content-Type": "application/json; charset=utf-8" });
|
||||
res.end(JSON.stringify(obj));
|
||||
};
|
||||
try {
|
||||
const url = new URL(req.url, "http://localhost");
|
||||
let body = {};
|
||||
if (req.method === "POST") {
|
||||
let raw = "";
|
||||
for await (const chunk of req) {
|
||||
raw += chunk;
|
||||
if (raw.length > 16384) return json(413, { error: "请求过大" });
|
||||
}
|
||||
body = JSON.parse(raw || "{}");
|
||||
}
|
||||
const token = (req.headers.authorization ?? "").replace(/^Bearer /, "");
|
||||
const isAdmin = token === admin;
|
||||
const parts = url.pathname.split("/").filter(Boolean);
|
||||
if (parts[0] === "api") {
|
||||
if (req.method === "GET" && url.pathname === "/api/tables")
|
||||
return json(200, { tables: [...tables.values()].map(publicTable) });
|
||||
if (req.method === "GET" && url.pathname === "/api/models") {
|
||||
if (!isAdmin) return json(403, { error: "需要管理凭据" });
|
||||
cfg ??= loadModels();
|
||||
return json(200, {
|
||||
models: cfg.items.map((i) => ({
|
||||
id: i.id,
|
||||
name: i.name,
|
||||
model: i.model,
|
||||
})),
|
||||
});
|
||||
}
|
||||
if (req.method === "POST" && url.pathname === "/api/tables") {
|
||||
if (!isAdmin) return json(403, { error: "需要管理凭据" });
|
||||
if (
|
||||
!Array.isArray(body.names) ||
|
||||
body.names.length < 2 ||
|
||||
body.names.length > 6 ||
|
||||
body.names.some(
|
||||
(n) => typeof n !== "string" || !n.trim() || n.length > 40,
|
||||
)
|
||||
)
|
||||
return json(400, { error: "需要 2–6 个玩家名称" });
|
||||
const id = randomUUID();
|
||||
const t = {
|
||||
id,
|
||||
game: new Game(body.names),
|
||||
running: false,
|
||||
limit: 3,
|
||||
seats: body.names.map((name) => ({
|
||||
name,
|
||||
token: randomBytes(32).toString("hex"),
|
||||
joined: false,
|
||||
})),
|
||||
};
|
||||
tables.set(id, t);
|
||||
save();
|
||||
return json(201, {
|
||||
id,
|
||||
invitations: t.seats.map((s, i) => ({
|
||||
player: i,
|
||||
url: `/#join=${id}.${s.token}`,
|
||||
instructions:
|
||||
"使用 Bearer 凭据 POST /api/tables/" +
|
||||
id +
|
||||
"/join,然后 GET observation,POST action 携带 version/action/amount",
|
||||
})),
|
||||
});
|
||||
}
|
||||
const t = tables.get(parts[2]);
|
||||
if (!t) return json(404, { error: "牌桌不存在" });
|
||||
const seat = t.seats.findIndex((s) => s.token === token);
|
||||
const action = parts[3];
|
||||
if (req.method === "GET" && action === "observation") {
|
||||
if (seat < 0) return json(403, { error: "邀请凭据无效" });
|
||||
return json(200, { ...t.game.view(seat), player: seat });
|
||||
}
|
||||
if (req.method === "POST" && action === "join") {
|
||||
if (seat < 0) return json(403, { error: "邀请凭据无效" });
|
||||
if (body.modelId) {
|
||||
cfg ??= loadModels();
|
||||
if (!cfg.items.some((i) => i.id === body.modelId))
|
||||
return json(400, { error: "模型不存在" });
|
||||
}
|
||||
t.seats[seat].joined = true;
|
||||
t.seats[seat].modelId = body.modelId ?? null;
|
||||
save();
|
||||
return json(200, { player: seat });
|
||||
}
|
||||
if (req.method === "POST" && action === "action") {
|
||||
if (seat < 0 || !t.seats[seat].joined)
|
||||
return json(403, { error: "邀请凭据无效" });
|
||||
if (!t.running) return json(409, { error: "牌桌已暂停" });
|
||||
t.game.act(seat, body.action, body.amount, body.version);
|
||||
audit({ table: t.id, kind: "external-action", state: publicTable(t) });
|
||||
save();
|
||||
return json(200, t.game.view(seat));
|
||||
}
|
||||
if (req.method === "POST" && action === "control") {
|
||||
if (!isAdmin) return json(403, { error: "需要管理凭据" });
|
||||
if (!["start", "pause", "stop"].includes(body.action))
|
||||
return json(400, { error: "未知控制动作" });
|
||||
if (body.action === "start") {
|
||||
if (!t.seats.every((s) => s.joined))
|
||||
return json(409, { error: "等待所有玩家接受邀请" });
|
||||
t.limit = t.game.history.length + 3;
|
||||
t.error = null;
|
||||
t.running = true;
|
||||
} else t.running = false;
|
||||
save();
|
||||
return json(200, publicTable(t));
|
||||
}
|
||||
return json(404, { error: "接口不存在" });
|
||||
}
|
||||
if (req.method !== "GET") return json(405, { error: "方法不允许" });
|
||||
const path = url.pathname === "/" ? "index.html" : url.pathname.slice(1);
|
||||
const root = resolve(import.meta.dirname, "dist"),
|
||||
file = resolve(root, path);
|
||||
if (!file.startsWith(root + "/")) return json(403, { error: "禁止访问" });
|
||||
const content = readFileSync(file);
|
||||
res.writeHead(200, {
|
||||
"Content-Type":
|
||||
{
|
||||
".html": "text/html; charset=utf-8",
|
||||
".js": "text/javascript",
|
||||
".css": "text/css",
|
||||
}[extname(file)] ?? "application/octet-stream",
|
||||
});
|
||||
res.end(content);
|
||||
} catch (e) {
|
||||
json(400, {
|
||||
error: e.message?.includes("ENOENT")
|
||||
? "页面不存在"
|
||||
: (e.message?.slice(0, 120) ?? "请求失败"),
|
||||
});
|
||||
}
|
||||
});
|
||||
server.listen(Number(process.env.POKER_PORT ?? 18439), "127.0.0.1", () =>
|
||||
console.log("扑克服务就绪;管理凭据仅在私有运行目录。"),
|
||||
);
|
||||
11
projects/agent-poker/service.mjs
Normal file
11
projects/agent-poker/service.mjs
Normal file
@ -0,0 +1,11 @@
|
||||
// Start an independent process and keep credentials/logs in the caller's private directory.
|
||||
import {spawn} from 'node:child_process';
|
||||
import {mkdirSync,openSync,writeFileSync} from 'node:fs';
|
||||
import {resolve} from 'node:path';
|
||||
const tmp=process.env.TMPDIR,data=process.env.POKER_DATA;
|
||||
if(!tmp||!data)throw Error('必须设置 TMPDIR 和 POKER_DATA');
|
||||
mkdirSync(data,{recursive:true,mode:0o700});
|
||||
const fd=openSync(resolve(tmp,'server.log'),'a',0o600);
|
||||
const child=spawn(process.execPath,[resolve(import.meta.dirname,'server.mjs')],{cwd:import.meta.dirname,env:process.env,detached:true,stdio:['ignore',fd,fd]});
|
||||
child.unref();writeFileSync(resolve(tmp,'server.pid'),String(child.pid),{mode:0o600});
|
||||
console.log(`已启动独立扑克进程 ${child.pid};使用 HTTP 检查确认服务就绪。`);
|
||||
3
projects/agent-poker/style.css
Normal file
3
projects/agent-poker/style.css
Normal file
@ -0,0 +1,3 @@
|
||||
@import "../../apps/web/src/theme.css";
|
||||
/* Include reused component utility classes outside this Vite root. No new visual rules. */
|
||||
@source "../../apps/web/src/components";
|
||||
164
projects/agent-poker/test.mjs
Normal file
164
projects/agent-poker/test.mjs
Normal file
@ -0,0 +1,164 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { Game, rank, settle } from "./game.mjs";
|
||||
test("牌型、轮子顺子及踢脚比较", () => {
|
||||
assert(
|
||||
rank(["As", "Ks", "Qs", "Js", "Ts"]) > rank(["Ah", "Ad", "Ac", "As", "Kh"]),
|
||||
);
|
||||
assert(
|
||||
rank(["As", "2d", "3c", "4s", "5h"]) > rank(["As", "Ad", "Kc", "Qs", "Jh"]),
|
||||
);
|
||||
assert(
|
||||
rank(["As", "Ad", "Kc", "Qs", "Jh"]) > rank(["As", "Ad", "Kc", "Qs", "Th"]),
|
||||
);
|
||||
});
|
||||
test("边池与平分奇数筹码", () => {
|
||||
const p = [
|
||||
{ total: 50, cards: ["As", "Ad"] },
|
||||
{ total: 100, cards: ["Ks", "Kd"] },
|
||||
{ total: 100, cards: ["Qs", "Qd"] },
|
||||
];
|
||||
assert.deepEqual(
|
||||
settle(p, ["2s", "3d", "7c", "8s", "9h"], 0).awards,
|
||||
[150, 100, 0],
|
||||
);
|
||||
const split = settle(p, ["Ts", "Js", "Qs", "Ks", "As"], 0);
|
||||
assert.equal(
|
||||
split.awards.reduce((a, b) => a + b),
|
||||
250,
|
||||
);
|
||||
assert.deepEqual(split.awards, [50, 100, 100]);
|
||||
});
|
||||
test("轮次、隐私、重复动作与非法输入均不变更状态", () => {
|
||||
const g = new Game(["a", "b", "c"]);
|
||||
g.start();
|
||||
assert.equal(g.actor, 0);
|
||||
assert.deepEqual(
|
||||
g.view().players.map((p) => p.cards),
|
||||
[[], [], []],
|
||||
);
|
||||
assert.equal(g.view(1).players[1].cards.length, 2);
|
||||
for (const args of [
|
||||
[1, "fold", 0, g.version],
|
||||
[0, "raise", 21, g.version],
|
||||
[0, "check", 0, g.version],
|
||||
[0, "call", 0, 0],
|
||||
]) {
|
||||
const before = JSON.stringify(g);
|
||||
assert.throws(() => g.act(...args));
|
||||
assert.equal(JSON.stringify(g), before);
|
||||
}
|
||||
const v = g.version;
|
||||
g.act(0, "call", 0, v);
|
||||
assert.throws(() => g.act(0, "call", 0, v));
|
||||
while (g.stage !== "complete") {
|
||||
const l = g.legal(g.actor);
|
||||
g.act(
|
||||
g.actor,
|
||||
l.actions.includes("check") ? "check" : "call",
|
||||
0,
|
||||
g.version,
|
||||
);
|
||||
}
|
||||
assert.equal(g.board.length, 5);
|
||||
assert.equal(g.history[0].total, 3000);
|
||||
});
|
||||
test("短 all-in 不重新开放加注;全下自动摊牌守恒", () => {
|
||||
const g = new Game(["a", "b", "c"], [100, 100, 45]);
|
||||
g.start();
|
||||
g.act(0, "raise", 40, g.version);
|
||||
g.act(1, "call", 0, g.version);
|
||||
g.act(2, "all-in", 0, g.version);
|
||||
assert(!g.legal(0).actions.includes("raise"));
|
||||
g.act(0, "call", 0, g.version);
|
||||
g.act(1, "call", 0, g.version);
|
||||
while (g.stage !== "complete") {
|
||||
g.act(g.actor, "all-in", 0, g.version);
|
||||
}
|
||||
assert.equal(g.history[0].total, 245);
|
||||
});
|
||||
test("连续 50 手合法行动筹码守恒", () => {
|
||||
const g = new Game(["a", "b", "c"]);
|
||||
for (let h = 0; h < 50 && g.players.filter((p) => p.stack).length > 1; h++) {
|
||||
g.start();
|
||||
while (g.stage !== "complete") {
|
||||
const l = g.legal(g.actor);
|
||||
g.act(
|
||||
g.actor,
|
||||
l.actions.includes("check") ? "check" : "call",
|
||||
0,
|
||||
g.version,
|
||||
);
|
||||
}
|
||||
assert.equal(g.history.at(-1).total, 3000);
|
||||
}
|
||||
});
|
||||
|
||||
test("短大盲全下且小盲已覆盖时直接摊牌,不再允许弃牌", () => {
|
||||
for (const stacks of [[100, 5], [100, 10], [10, 5]]) {
|
||||
const g = new Game(["甲", "乙"], stacks);
|
||||
g.start();
|
||||
assert.equal(g.stage, "complete");
|
||||
assert.equal(g.actor, null);
|
||||
assert.equal(g.board.length, 5);
|
||||
assert.equal(g.history[0].total, stacks[0] + stacks[1]);
|
||||
const before = JSON.stringify(g);
|
||||
assert.throws(() => g.act(0, "fold", 0, g.version));
|
||||
assert.equal(JSON.stringify(g), before);
|
||||
}
|
||||
});
|
||||
|
||||
test("唯一可行动者只需跟齐实际全下额,不能向无人响应的边池加注", () => {
|
||||
const g = new Game(["甲", "乙"], [100, 15]);
|
||||
g.start();
|
||||
assert.equal(g.actor, 0);
|
||||
assert.equal(g.legal(0).call, 5);
|
||||
assert.deepEqual(g.legal(0).actions, ["fold", "call"]);
|
||||
const before = JSON.stringify(g);
|
||||
assert.throws(() => g.act(0, "raise", 40, g.version));
|
||||
assert.throws(() => g.act(0, "all-in", 0, g.version));
|
||||
assert.equal(JSON.stringify(g), before);
|
||||
g.act(0, "call", 0, g.version);
|
||||
assert.equal(g.stage, "complete");
|
||||
assert.deepEqual(g.players.map((p) => p.total), [15, 15]);
|
||||
assert.equal(g.history[0].total, 115);
|
||||
});
|
||||
|
||||
test("多人短大盲保留名义大盲;其他玩家弃牌后按实际投注自动摊牌", () => {
|
||||
const g = new Game(["甲", "乙", "丙"], [100, 100, 5]);
|
||||
g.start();
|
||||
assert.equal(g.legal(0).call, 20);
|
||||
g.act(0, "fold", 0, g.version);
|
||||
assert.equal(g.stage, "complete");
|
||||
assert.equal(g.board.length, 5);
|
||||
assert.equal(g.history[0].total, 205);
|
||||
});
|
||||
|
||||
test("河牌弃牌获胜后公开和其他玩家投影隐藏赢家底牌,重载仍隐藏", () => {
|
||||
const g = new Game(["甲", "乙", "丙"]);
|
||||
g.start();
|
||||
while (g.stage !== "river") {
|
||||
g.act(g.actor, g.legal(g.actor).actions.includes("check") ? "check" : "call", 0, g.version);
|
||||
}
|
||||
g.act(g.actor, "fold", 0, g.version);
|
||||
g.act(g.actor, "fold", 0, g.version);
|
||||
assert.equal(g.stage, "complete");
|
||||
const winner = g.players.find((p) => !p.folded).id;
|
||||
const restored = Object.assign(new Game(["恢复", "状态"]), JSON.parse(JSON.stringify(g)));
|
||||
for (const game of [g, restored]) {
|
||||
assert.deepEqual(game.view().players.map((p) => p.cards), [[], [], []]);
|
||||
for (const p of game.players) {
|
||||
assert.equal(game.view(p.id).players[winner].cards.length, p.id === winner ? 2 : 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("真实多人摊牌仍公开未弃牌者底牌", () => {
|
||||
const g = new Game(["甲", "乙", "丙"]);
|
||||
g.start();
|
||||
g.act(g.actor, "fold", 0, g.version);
|
||||
while (g.stage !== "complete") {
|
||||
g.act(g.actor, g.legal(g.actor).actions.includes("check") ? "check" : "call", 0, g.version);
|
||||
}
|
||||
assert.deepEqual(g.view().players.map((p) => p.cards.length), [0, 2, 2]);
|
||||
});
|
||||
220
projects/agent-poker/ui.jsx
Normal file
220
projects/agent-poker/ui.jsx
Normal file
@ -0,0 +1,220 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { Button } from "../../apps/web/src/components/ui/button";
|
||||
import {
|
||||
PageWorkspace,
|
||||
PanelHeader,
|
||||
} from "../../apps/web/src/components/page-workspace";
|
||||
import "./style.css";
|
||||
import "../../apps/web/src/page-layout.css";
|
||||
import "../../apps/web/src/workbench.css";
|
||||
function App() {
|
||||
const [tables, setTables] = useState([]),
|
||||
[selected, select] = useState(""),
|
||||
[admin, setAdmin] = useState(""),
|
||||
[error, setError] = useState(""),
|
||||
[invites, setInvites] = useState([]),
|
||||
[joined, setJoined] = useState(() => new Set()),
|
||||
[fragment, setFragment] = useState(() => location.hash);
|
||||
const join = fragment.startsWith("#join=")
|
||||
? fragment.slice(6).split(".")
|
||||
: null;
|
||||
useEffect(() => {
|
||||
const onHashChange = () => setFragment(location.hash);
|
||||
window.addEventListener("hashchange", onHashChange);
|
||||
return () => window.removeEventListener("hashchange", onHashChange);
|
||||
}, []);
|
||||
async function api(path, body, token = admin) {
|
||||
const r = await fetch("/api/" + path, {
|
||||
method: body ? "POST" : "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...(token ? { Authorization: "Bearer " + token } : {}),
|
||||
},
|
||||
...(body ? { body: JSON.stringify(body) } : {}),
|
||||
});
|
||||
const data = await r.json();
|
||||
if (!r.ok) throw Error(data.error);
|
||||
return data;
|
||||
}
|
||||
async function refresh() {
|
||||
try {
|
||||
setTables((await api("tables")).tables);
|
||||
} catch (e) {
|
||||
setError(e.message);
|
||||
}
|
||||
}
|
||||
useEffect(() => {
|
||||
refresh();
|
||||
const timer = setInterval(refresh, 1500);
|
||||
return () => clearInterval(timer);
|
||||
}, []);
|
||||
const table = tables.find((t) => t.id === selected) ?? tables[0];
|
||||
const run = async (fn) => {
|
||||
try {
|
||||
setError("");
|
||||
await fn();
|
||||
await refresh();
|
||||
} catch (e) {
|
||||
setError(e.message);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<PageWorkspace
|
||||
title="Agent 扑克"
|
||||
sidebarLabel="牌桌列表"
|
||||
sidebar={
|
||||
<div className="p-4 space-y-4">
|
||||
<p>虚拟筹码 · 无真钱交易</p>
|
||||
{tables.map((t) => (
|
||||
<Button key={t.id} variant="ghost" onClick={() => select(t.id)}>
|
||||
牌桌 {t.id.slice(0, 8)} · 第 {t.hand} 手
|
||||
</Button>
|
||||
))}
|
||||
<label className="block">
|
||||
管理凭据
|
||||
<input
|
||||
aria-label="管理凭据"
|
||||
type="password"
|
||||
className="border rounded p-2 w-full"
|
||||
value={admin}
|
||||
onChange={(e) => setAdmin(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<Button
|
||||
onClick={() =>
|
||||
run(async () => {
|
||||
const r = await api("tables", {
|
||||
names: ["Agent A", "Agent B", "Agent C"],
|
||||
});
|
||||
setInvites(r.invitations);
|
||||
select(r.id);
|
||||
})
|
||||
}
|
||||
>
|
||||
建立牌桌
|
||||
</Button>
|
||||
<p>管理凭据由本机服务管理员提供,不存入浏览器。</p>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<PanelHeader
|
||||
title="在线观测"
|
||||
actions={
|
||||
table && (
|
||||
<>
|
||||
{["start", "pause", "stop"].map((a, i) => (
|
||||
<Button
|
||||
key={a}
|
||||
disabled={!admin}
|
||||
onClick={() =>
|
||||
run(() =>
|
||||
api("tables/" + table.id + "/control", { action: a }),
|
||||
)
|
||||
}
|
||||
>
|
||||
{["开始三手", "暂停", "停止"][i]}
|
||||
</Button>
|
||||
))}
|
||||
</>
|
||||
)
|
||||
}
|
||||
/>
|
||||
<main className="p-6 space-y-6 overflow-auto">
|
||||
<p role="alert">{error}</p>
|
||||
{join && (
|
||||
<section>
|
||||
<h2>接受玩家邀请</h2>
|
||||
<p>
|
||||
邀请凭据仅在地址片段中,请勿转发。接入后可用受控 API
|
||||
获取自己的观察。
|
||||
</p>
|
||||
<Button
|
||||
onClick={() =>
|
||||
run(async () => {
|
||||
await api("tables/" + join[0] + "/join", {}, join[1]);
|
||||
setJoined((accepted) => new Set(accepted).add(fragment));
|
||||
})
|
||||
}
|
||||
>
|
||||
{joined.has(fragment) ? "已加入" : "接受邀请"}
|
||||
</Button>
|
||||
<pre className="whitespace-pre-wrap">{`GET /api/tables/${join[0]}/observation\nPOST /api/tables/${join[0]}/action\nAuthorization: Bearer <邀请凭据>\n动作字段:version、action、amount`}</pre>
|
||||
</section>
|
||||
)}
|
||||
{invites.map((i) => (
|
||||
<section key={i.player}>
|
||||
<a className="underline" href={i.url}>
|
||||
玩家 {i.player + 1} 邀请地址
|
||||
</a>
|
||||
<p>{i.instructions}</p>
|
||||
</section>
|
||||
))}
|
||||
{table ? (
|
||||
<>
|
||||
<section>
|
||||
<h2>
|
||||
第 {table.hand} 手 · {table.stage} ·{" "}
|
||||
{table.running ? "运行中" : "已暂停"}
|
||||
</h2>
|
||||
<p>{table.error}</p>
|
||||
<p className="text-2xl">
|
||||
公共牌:{table.board.join(" ") || "尚未发出"}
|
||||
</p>
|
||||
<p>
|
||||
底池 {table.pot} · 当前行动者{" "}
|
||||
{table.actor === null ? "—" : table.players[table.actor].name}
|
||||
</p>
|
||||
</section>
|
||||
<section className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
{table.players.map((p) => (
|
||||
<article
|
||||
key={p.id}
|
||||
className="border border-border rounded-lg p-4"
|
||||
>
|
||||
<h2>
|
||||
{p.name}
|
||||
{p.id === table.actor ? " · 行动中" : ""}
|
||||
</h2>
|
||||
<p>
|
||||
筹码 {p.stack} · 本轮投入 {p.bet}
|
||||
</p>
|
||||
<p>{p.folded ? "已弃牌" : p.cards.join(" ") || "底牌保密"}</p>
|
||||
<p>
|
||||
{table.models[p.id].joined ? "已接受邀请" : "等待邀请"} ·{" "}
|
||||
{table.models[p.id].model ?? "外部 API 玩家"}
|
||||
</p>
|
||||
</article>
|
||||
))}
|
||||
</section>
|
||||
<section>
|
||||
<h2>动作时间线</h2>
|
||||
{table.timeline.map((a) => (
|
||||
<p key={a.version}>
|
||||
{a.time} · {table.players[a.player].name} · {a.action} ·{" "}
|
||||
{a.amount}
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
<section>
|
||||
<h2>已完成手牌</h2>
|
||||
{table.history.map((h) => (
|
||||
<details key={h.hand}>
|
||||
<summary>
|
||||
第 {h.hand} 手 · 筹码核对 {h.total} · {h.board.join(" ")}
|
||||
</summary>
|
||||
<pre className="whitespace-pre-wrap">
|
||||
{JSON.stringify(h, null, 2)}
|
||||
</pre>
|
||||
</details>
|
||||
))}
|
||||
</section>
|
||||
</>
|
||||
) : (
|
||||
<p>尚无牌桌。管理员可创建并分享邀请。</p>
|
||||
)}
|
||||
</main>
|
||||
</PageWorkspace>
|
||||
);
|
||||
}
|
||||
createRoot(document.getElementById("root")).render(<App />);
|
||||
20
projects/agent-poker/vite.config.mjs
Normal file
20
projects/agent-poker/vite.config.mjs
Normal file
@ -0,0 +1,20 @@
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
import { resolve } from "node:path";
|
||||
export default defineConfig({
|
||||
plugins: [react(), tailwindcss()],
|
||||
resolve: {
|
||||
dedupe: ["react", "react-dom"],
|
||||
alias: {
|
||||
"@base-ui/react": resolve("node_modules/@base-ui/react"),
|
||||
"lucide-react": resolve("node_modules/lucide-react"),
|
||||
"class-variance-authority": resolve(
|
||||
"node_modules/class-variance-authority",
|
||||
),
|
||||
clsx: resolve("node_modules/clsx"),
|
||||
"tailwind-merge": resolve("node_modules/tailwind-merge"),
|
||||
},
|
||||
},
|
||||
build: { outDir: "dist" },
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user