@optima-chat/dev-skills 0.16.8 → 0.16.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/yzsgo-e2e/SKILL.md +6 -1
- package/.claude/skills/yzsgo-e2e/SYNC.md +39 -1
- package/.claude/skills/yzsgo-e2e/chat_driver.py +862 -64
- package/.claude/skills/yzsgo-e2e/run_e2e.py +7 -1
- package/.codex/skills/yzsgo-e2e/SKILL.md +6 -1
- package/.codex/skills/yzsgo-e2e/SYNC.md +39 -1
- package/.codex/skills/yzsgo-e2e/chat_driver.py +862 -64
- package/.codex/skills/yzsgo-e2e/run_e2e.py +7 -1
- package/bin/helpers/billing-http.ts +10 -13
- package/bin/helpers/cn-deploy.ts +2 -1
- package/bin/helpers/db-utils.ts +16 -10
- package/bin/helpers/infisical-secrets.ts +8 -7
- package/bin/helpers/query-db.ts +11 -4
- package/bin/helpers/safe-exec.ts +252 -0
- package/bin/helpers/show-env.ts +6 -5
- package/dist/bin/helpers/billing-http.js +7 -6
- package/dist/bin/helpers/cn-deploy.js +2 -1
- package/dist/bin/helpers/db-utils.js +15 -6
- package/dist/bin/helpers/infisical-secrets.js +8 -4
- package/dist/bin/helpers/query-db.js +9 -1
- package/dist/bin/helpers/safe-exec.js +321 -0
- package/dist/bin/helpers/show-env.js +6 -2
- package/package.json +1 -1
|
@@ -90,7 +90,13 @@ def main():
|
|
|
90
90
|
# ② 拿到确定的 sessionId,后面按它**确定性**定位 wire 对话,不靠 (时间,首句) 猜。
|
|
91
91
|
# 该环境 multi-tab 没开(flag 默认关,cn-stage 未验)时 auto 档自己会降级复用已有 tab
|
|
92
92
|
# 并打 warn —— 单 driver 复用是安全的,功能不减,只是 wire 定位退回启发式。
|
|
93
|
-
|
|
93
|
+
# ziniao 是 attach() 的必填关键字参数(上游 store-skills #611,漏传即 TypeError):
|
|
94
|
+
# 本 skill 测的是鸭嘴兽对话链路,这个 tab 不绑定任何紫鸟 profile,所以显式声明 None + 理由。
|
|
95
|
+
# 若 --message 正文里写了 `--ziniao-profile <id>`,send() 会抛 ZiniaoDeclarationConflict
|
|
96
|
+
# 拒发 —— 那是上游有意的闸,不是本脚本的 bug。装到 ~/.claude 后已知 profile 表为空
|
|
97
|
+
# (它读 store-skills 仓库里的 e2e/registry*.yaml),所以只认 `--ziniao-profile` 这种显式写法。
|
|
98
|
+
d = chat_driver.ChatDriver().attach(
|
|
99
|
+
ziniao=None, reason="yzsgo-e2e 驱动鸭嘴兽网页对话做端到端测试,本脚本不绑定任何紫鸟 profile")
|
|
94
100
|
session_id = d.session_id # attach 后立刻取:放在 try 里的话,中途抛异常会留下未绑定名
|
|
95
101
|
if not d.tab_isolated:
|
|
96
102
|
print("[warn] 未能独占 tab(该环境 multi-tab 未开)—— wire 定位退回 (时间,首句) 启发式")
|
|
@@ -33,7 +33,7 @@ allowed-tools: ["Bash", "Read", "Write", "Agent", "Workflow"]
|
|
|
33
33
|
跨 tab 可真并行,同 tab 内仍串行;上限按 plan:free 1 / starter 2 / pro 4 / enterprise 20)。
|
|
34
34
|
|
|
35
35
|
`chat_driver.attach()` **默认就自己开一个 tab**(`own_tab="auto"`)——平台既然支持多 tab,
|
|
36
|
-
独占一个 session 就是常态,共用别人的 tab 才是例外。所以 `run_e2e.py`
|
|
36
|
+
独占一个 session 就是常态,共用别人的 tab 才是例外。所以 `run_e2e.py` 不传 `own_tab`、用默认档即可,
|
|
37
37
|
不去抢用户已经开着的 chat tab。两个好处——① 不跟用户/别的跑测互相串台;② 拿到确定的 `sessionId`,
|
|
38
38
|
`locate_conversation(..., session_id=...)` 按它**确定性**定位 wire 对话,不再靠 (时间, 首句) 猜
|
|
39
39
|
(并发跑时多个会话时间戳交叠,启发式会挑错)。`meta.json` 里多了 `session_id` 字段。
|
|
@@ -42,6 +42,11 @@ allowed-tools: ["Bash", "Read", "Write", "Agent", "Workflow"]
|
|
|
42
42
|
cn-prod 已验开、cn-stage 未验)时 `"auto"` 档自己会降级复用已有 tab(`d.tab_isolated=False`)
|
|
43
43
|
并打 warn,功能不减,只是 wire 定位退回启发式。
|
|
44
44
|
|
|
45
|
+
🔴 **`attach()` 必须声明紫鸟 profile**(2026-09-17 同步上游 #611 起):`ziniao` 是必填关键字参数,
|
|
46
|
+
漏传直接 `TypeError`;`ziniao=None` 必须带非空 `reason`,否则 `ValueError`。`run_e2e.py` 传的是
|
|
47
|
+
`ziniao=None` + 理由,因为本 skill 测对话链路、不绑定任何店。**自己写脚本调 `chat_driver` 时照此声明。**
|
|
48
|
+
消息正文里出现 `--ziniao-profile <id>` 而声明是 `None`,`send()` 会抛 `ZiniaoDeclarationConflict` 拒发。
|
|
49
|
+
|
|
45
50
|
🔴 **绝不能让两个 driver 共用一个 tab**:实证会**静默串台**——两个线程写同一个 textarea,
|
|
46
51
|
后写的覆盖先写的,只有一条消息真到服务端,两边却都抓到同一份回复,还全程无报错。
|
|
47
52
|
细节见 `chat_driver.py` 模块 docstring。
|
|
@@ -2,13 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
| 本文件 | 上游 repo · 路径 | commit | 同步日期 |
|
|
4
4
|
|---|---|---|---|
|
|
5
|
-
| chat_driver.py | optima-store-skills · .claude/skills/operating-yzsgo-chat/chat_driver.py |
|
|
5
|
+
| chat_driver.py | optima-store-skills · .claude/skills/operating-yzsgo-chat/chat_driver.py | 010c578a(PR #1852,含 #1635) | 2026-09-17 |
|
|
6
6
|
| pull_wire.py | optima-store-skills · .claude/skills/pulling-yzsgo-session-wire/pull_wire.py | 3cfc2d6 | 2026-09-09 |
|
|
7
7
|
| prep_conversation.py | optima-gateway · .claude/skills/conversation-iq/prep_session.py(改编:+浏览器证据合并) | b75f575c | 2026-08-31 |
|
|
8
8
|
| judge_workflow.js | optima-gateway · .claude/skills/conversation-iq/workflow.js(改编:+前后端一致性维度) | b75f575c | 2026-08-31 |
|
|
9
9
|
|
|
10
10
|
> 注:judge_workflow.js 内联的 decideOutcome 是 judge_outcome.js(有 node 单测)的副本,改逻辑需同步两处。
|
|
11
11
|
|
|
12
|
+
## 2026-09-17 这次同步带了什么
|
|
13
|
+
|
|
14
|
+
`chat_driver.py` 逐字取自上游 `010c578a`(optima-store-skills#1852 合入 main 的那个 merge commit;
|
|
15
|
+
同步时上游 main 上该文件与它逐字节一致)。`3cfc2d6..010c578a` 之间上游动了这个文件 25 次,对本仓有影响的三组:
|
|
16
|
+
|
|
17
|
+
- **#1635 多张 question-card**:活卡按「有 確認/下一題/補充回答 按钮」认,不再取第一张可见卡;
|
|
18
|
+
`wait_reply` 回执带卡片原文与来源。这是本次同步的直接动机。
|
|
19
|
+
- **#611 / #666 紫鸟 profile 声明闸**:`attach(*, ziniao, reason=None, ...)` 的 `ziniao` 变成**必填**,
|
|
20
|
+
漏传 `TypeError`;`ziniao=None` 无理由 `ValueError`。`send()` / `send_and_wait()` 多了可选的
|
|
21
|
+
`ziniao=` 按条声明,并对账正文点名的 profile,不符抛 `ZiniaoDeclarationConflict`。
|
|
22
|
+
互斥锁本身 2026-09-14 已撤,只剩声明 + 对账;每次放行/拦截追加到 `~/.optima-locks/ziniao-gate.jsonl`(写失败不抛)。
|
|
23
|
+
- **#870 本轮开的 tab 本轮关**:新增 `keep_tab_for_human(reason)`(停手交人时保留 tab)和 `with` 用法
|
|
24
|
+
(`__enter__` / `__exit__`)。`close()` 只关自己开的 tab 是 09-09 那版就有的行为,不是这次新增。
|
|
25
|
+
|
|
26
|
+
**没接的**:`wait_reply` 新增的 `question` 回执(#1635,用来区分「读不到卡片」和「根本没问」)没有写进
|
|
27
|
+
`run_e2e.py` 的 turns / `meta.json`,判定层看不到它;要用得另改。`tool_trace` 末尾追加的十来个字段不影响现有读取。
|
|
28
|
+
|
|
29
|
+
**新增副作用**:每次 `attach()` 都会建 `~/.optima-locks/` 并往 `ziniao-gate.jsonl` 追加一行(写失败不抛)。
|
|
30
|
+
驱动报错提示里的 `scripts/ziniao-gate-report.py` 在 store-skills 仓库,本仓没有。
|
|
31
|
+
|
|
32
|
+
**本仓为此做的适配**(驱动本身仍逐字,不改):
|
|
33
|
+
|
|
34
|
+
1. `run_e2e.py` 改传 `attach(ziniao=None, reason=…)`。🔴 **不改会在第一步就崩**——2026-09-16 曾有人只把新驱动手工拷进
|
|
35
|
+
`~/.claude/skills/yzsgo-e2e/` 而没改调用方,结果本机这个 skill 一直是坏的。
|
|
36
|
+
2. 新增 `tests/yzsgo-e2e/test_attach_declaration.py`:从驱动的 ast 重建 `attach()` 的参数表,
|
|
37
|
+
把本 skill 每处 `attach()` 调用用 `inspect.Signature.bind` 绑一遍 ⇒ 缺必填参数、传了驱动不收的关键字、
|
|
38
|
+
位置参数不对,都会红。不需要 playwright。
|
|
39
|
+
原有的 `test_imports.py` 只在装了 playwright 时才导入驱动,而且只查 `ChatDriver` 类存在,挡不住签名变化。
|
|
40
|
+
3. `test.yml` 加一步 `python3 -m unittest discover -s tests/yzsgo-e2e`。🔴 **此前 CI 只跑 `npm test`,
|
|
41
|
+
`tests/yzsgo-e2e/*.py` 一条都不跑**,这些测试只在有人手动跑时才生效。runner 与 optima-store-skills
|
|
42
|
+
的 `publish-plugin.yml` 同一个标签,那边直接用 `python3`。
|
|
43
|
+
4. ⚠️ **装好后已知 profile 表恒为空**:`known_profile_ids()` 读的是「驱动所在目录再往上三层」的
|
|
44
|
+
`e2e/registry*.yaml`,那是 store-skills 仓库的布局;装到 `~/.claude/skills/yzsgo-e2e` 算出来是 `~`,
|
|
45
|
+
装到 `~/.codex/skills/optima-dev/yzsgo-e2e` 算出来是 `~/.codex`,都读不到 ⇒ 对账只认
|
|
46
|
+
`--ziniao-profile <id>` 这种显式写法,裸 14 位 profile id 认不出来。不影响本 skill(本来就声明 `None`)。
|
|
47
|
+
|
|
48
|
+
`pull_wire.py`:核过上游 `3cfc2d6..origin/main` 该文件无新提交,不用动。
|
|
49
|
+
|
|
12
50
|
## 2026-09-09 这次同步带了什么
|
|
13
51
|
|
|
14
52
|
上游把 e2e 改成**并发跑**(鸭嘴兽支持并发任务:一个 tab = 一个独立 gateway session)。
|