|
|
311441dab0
|
feat(sdk): 新增 e2e_helpers 共享模块,沉淀 desktop E2E 通用能力
把 disburse-payroll-icbc 实战出来的 6 个 desktop E2E 通用 helper 抽到
src/jiangchang_desktop_sdk/e2e_helpers.py,所有 skill 共用:
- drop_file_into_composer: DataTransfer 拖拽附件(绕开 SDK send_file
在 v2.0.17+ 抛 NotImplementedError 的限制)
- wait_for_attachment_ready: 轮询附件 chip 出现
- wait_for_composer_enabled: 等输入框可见且非 disabled,避免 canSend=false 静默 no-op
- send_prompt_via_composer: fill + press_sequentially + Enter 发送
- wait_for_user_message: 60s 宽容找 user 节点(绕开 SDK ask() user_idx<0
15s 死循环 bug,对脏 session 鲁棒)
- wait_for_agent_complete: 4 信号合流等 agent 完成
(chat-page data-sending / window.__jc_sending / 无展开 execution-graph /
末位 assistant has-body 且非 streaming + 文本稳定)
不抽业务断言(normalize_money / assert_zero_failures),那些是各 skill 自己的事。
所有 helper 只接受 Playwright Page 入口,不依赖 SDK client 实例。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
2026-05-25 11:13:47 +08:00 |
|
|
|
6e3f79dde9
|
feat(sdk): 抽出 window_win32 共享模块,client 激活方法薄壳化
把 _activate_and_maximize_windows 内嵌的 50+ 行 ctypes 实现抽到独立的 SDK 子模块
src/jiangchang_desktop_sdk/window_win32.py,暴露公开函数
activate_and_maximize_jiangchang_window,给 screencast 工具也复用(见后续 commit)。
client.py 的 _activate_and_maximize_windows 退化为 6 行薄壳,调用新模块。
设计:
- window_win32 是 SDK 子模块(放 src/jiangchang_desktop_sdk/ 下),不放 tools/,
避免 SDK 反向依赖工具层
- ctypes EnumWindows + ShowWindow(SW_MAXIMIZE) + SetForegroundWindow 逻辑不变
- 跨平台行为不变:Windows 真执行,其他系统返回 False
- bring_to_front 调用方完全不感知变化(向后兼容)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
2026-05-25 11:13:27 +08:00 |
|
|
|
c8d136fb79
|
feat(sdk): bring_to_front 用 Win32 API 激活并最大化主窗口
新增 _activate_and_maximize_windows 私有方法:用 ctypes 调 EnumWindows
找匠厂主窗口(标题含 匠厂/Jiangchang/ClawX/OpenClaw),
ShowWindow(SW_MAXIMIZE) + SetForegroundWindow 让窗口铺满桌面。
bring_to_front 改 OS 分支:
- Windows: 优先 ctypes 激活+最大化(dev / 安装版通吃,比 jiangchang://
协议在 dev 模式下因 cwd 解析失败而报错可靠);失败时退回协议作为兜底
- macOS / Linux: 维持原协议激活路径(open / xdg-open)
适用场景:录屏 / 自动化测试需要 OS 级窗口前置。page.bring_to_front()
只切 Playwright tab 不影响 z-order,必须 OS 级 API 才能把 Electron
主窗口拉到桌面最前。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
2026-05-25 10:13:43 +08:00 |
|
|
|
4fc4cfb802
|
refactor(sdk): drop data-jcid, switch to semantic anchors + ClawX testids
- Introduce centralized SELECTOR constant table at top of client.py
- Replace all [data-jcid=...] selectors with:
* Semantic anchors (data-role / data-message-id / data-streaming /
data-sending / data-message-count) guarded by jiangchang main repo
* ClawX upstream data-testids (chat-page / chat-composer-* / etc.)
- _latest_assistant_after: has_body now judged by inner_text non-empty
(no longer depends on message-body sub-element)
- _gateway_state: degrade to window.__jc_gateway_state__ readback,
returns 'unknown' until host exposes it
- new_task: rely solely on data-message-count==0 (welcome-screen no
longer has a testid)
- wait_gateway_ready: degrade to chat-page selector wait
- send_file: raise NotImplementedError (Electron IPC hook missing)
Public API signatures unchanged. window.__jc_sending__ remains the
core sending signal.
Compatibility: jiangchang v2.0.17+ only.
Refs: jiangchang/docs/sdk-migration-discovery.md
jiangchang/docs/JIANGCHANG_CUSTOM_ANCHORS.md
Co-authored-by: Cursor <cursoragent@cursor.com>
|
2026-05-18 16:05:04 +08:00 |
|
|
|
d2dbb5f61e
|
重构项目路径
Publish Python Package to Gitea / publish (push) Failing after 59s
|
2026-05-06 17:16:09 +08:00 |
|