ohos-devloop 0.1.2__py3-none-any.whl
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.
- ohos_devloop/__init__.py +2 -0
- ohos_devloop/_version.py +24 -0
- ohos_devloop/agents/skills/collab-delegate/SKILL.md +79 -0
- ohos_devloop/agents/skills/loop-iterate/SKILL.md +54 -0
- ohos_devloop/agents/skills/openharmony-ci/SKILL.md +71 -0
- ohos_devloop/agents/skills/openharmony-ci/agents/openai.yaml +4 -0
- ohos_devloop/agents/skills/openharmony-ci/scripts/openharmony_ci.py +520 -0
- ohos_devloop/agents/skills/pool-status/SKILL.md +47 -0
- ohos_devloop/config/e2e-cases.yaml +31 -0
- ohos_devloop/config/e2e-hap.yaml +54 -0
- ohos_devloop/config/inventory-template.yaml +35 -0
- ohos_devloop/config/inventory.yaml +68 -0
- ohos_devloop/config/report-templates/analysis-report.md +48 -0
- ohos_devloop/config/report-templates/impl-report.md +47 -0
- ohos_devloop/config/task-template.md +21 -0
- ohos_devloop/config/tdd-board.yaml +31 -0
- ohos_devloop/config/tdd-coverage.yaml +47 -0
- ohos_devloop/config/tdd-emulator.yaml +36 -0
- ohos_devloop/config/tdd-host.yaml +26 -0
- ohos_devloop/config/tdd-suites.yaml +34 -0
- ohos_devloop/config/templates/agents-user.md +11 -0
- ohos_devloop/config/templates/quickstart.md +82 -0
- ohos_devloop/config/verify.yaml +45 -0
- ohos_devloop/examples/anchor-e2e.yaml +55 -0
- ohos_devloop/examples/assert-smoke.yaml +33 -0
- ohos_devloop/examples/diffcov-fixture/cov.json +6688 -0
- ohos_devloop/examples/diffcov-fixture/diff.txt +24 -0
- ohos_devloop/examples/diffcov-smoke.yaml +32 -0
- ohos_devloop/examples/e2e-emu-smoke.yaml +45 -0
- ohos_devloop/examples/layout-fixture.norm.json +1 -0
- ohos_devloop/examples/smoke.yaml +27 -0
- ohos_devloop/ohos_cli.py +131 -0
- ohos_devloop/scripts/agent-run-v3.sh +149 -0
- ohos_devloop/scripts/apply.py +1448 -0
- ohos_devloop/scripts/check_env.py +284 -0
- ohos_devloop/scripts/collab.py +303 -0
- ohos_devloop/scripts/diffcov.py +211 -0
- ohos_devloop/scripts/flash.py +511 -0
- ohos_devloop/scripts/mount_ws.py +192 -0
- ohos_devloop/scripts/release.py +2645 -0
- ohos_devloop/scripts/release_audit.py +260 -0
- ohos_devloop/scripts/release_metadata.py +397 -0
- ohos_devloop/scripts/release_smoke.py +287 -0
- ohos_devloop/scripts/report_draft.py +234 -0
- ohos_devloop/scripts/server_init.py +310 -0
- ohos_devloop/scripts/sgrep.py +82 -0
- ohos_devloop/scripts/sign_hap.py +256 -0
- ohos_devloop/scripts/telemetry.py +260 -0
- ohos_devloop/scripts/ui_probe.py +396 -0
- ohos_devloop/scripts/verify_frame_diff.py +138 -0
- ohos_devloop/scripts/ws_init.py +131 -0
- ohos_devloop/scripts/wsroot.py +192 -0
- ohos_devloop-0.1.2.dist-info/METADATA +177 -0
- ohos_devloop-0.1.2.dist-info/RECORD +58 -0
- ohos_devloop-0.1.2.dist-info/WHEEL +5 -0
- ohos_devloop-0.1.2.dist-info/entry_points.txt +2 -0
- ohos_devloop-0.1.2.dist-info/licenses/LICENSE +202 -0
- ohos_devloop-0.1.2.dist-info/top_level.txt +1 -0
ohos_devloop/__init__.py
ADDED
ohos_devloop/_version.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '0.1.2'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 1, 2)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = 'g3026bc139'
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: collab-delegate
|
|
3
|
+
description: 修改服务器侧代码(OpenHarmony 大仓工作区)前的强制判定与远端 code-worker 任务派发流程——主 Agent(轻模型)不做代码修改,一律组任务契约交给服务器 code-worker(重模型,代码与构建同机)执行。当即将修改服务器代码、用户说"交给 agent / 派生 / 委派 / 定位修改代码"、或收到"违反了修改原则"类反馈时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 代码修改委派判定(collab-delegate)
|
|
7
|
+
|
|
8
|
+
**铁律**:主 Agent(轻模型,负责设备侧取证与视觉验证)**不直接修改服务器代码**。动手前先过判定清单,确定派发路径。
|
|
9
|
+
|
|
10
|
+
## 架构(2026-11-09 回切:远端 code-worker)
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
主 Agent(flash 级:截图判读、hilog 分析、设备编排)
|
|
14
|
+
├── 组任务契约 → collab.py push/run → 服务器 code-worker(重模型 opencode,
|
|
15
|
+
│ 直接读写大仓 + git commit + 触发构建)→ status/log 轮询 → fetch 回收
|
|
16
|
+
└── 设备侧验证:取产物 → 推板 → 截图/板端 TDD → 判定 → close(自动释放工作区)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
改码单一通道:**含 ≤2 文件机械微修补在内,一切代码修改都走远端 code-worker**。
|
|
20
|
+
W: SSHFS 挂载已降级为应急人工通道(详见 RUNBOOK「W: 应急通道」),不是改码路径。
|
|
21
|
+
|
|
22
|
+
## 判定清单
|
|
23
|
+
|
|
24
|
+
| 条件 | 路径 |
|
|
25
|
+
|---|---|
|
|
26
|
+
| 常规修复(≤5 文件、机制已收敛、有设备证据链) | **collab.py 任务契约 → 远端 code-worker** |
|
|
27
|
+
| 大规模/探索性(多仓、根因不明、需独立视角) | 同上,goal 里写清分段策略,多轮迭代(budget 控制) |
|
|
28
|
+
| ≤2 文件纯机械小修补 | **同上**(单一改码通道;一轮任务往返约几分钟,别为省这点时间绕过协议) |
|
|
29
|
+
| 只读分析/定位(不改文件) | 同上,约束节标注"只读分析,不改代码"(worker 会跳过 commit/构建) |
|
|
30
|
+
|
|
31
|
+
**不确定 → 走任务契约**(错误派发的代价是一次 worker 调用;错误直改的代价是质量风险 + 协议违规)。
|
|
32
|
+
|
|
33
|
+
## 派发流程(collab.py 任务契约)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# 0. 领工作区(新工作项;已在池里登记过本任务则跳过)
|
|
37
|
+
python scripts/flash.py sync-repo [工作区] <task-id>
|
|
38
|
+
|
|
39
|
+
# 1. 建任务(repo 自动从工作区池回填)→ 编辑 tasks/<task-id>/task.md
|
|
40
|
+
python scripts/collab.py new <task-id>
|
|
41
|
+
# task.md 关键字段:goal / 现象 / 预期 / 证据 / build_targets / tdd_targets / 约束
|
|
42
|
+
# 证据(截图/hilog 片段)放 tasks/<task-id>/context/ 并在证据节登记
|
|
43
|
+
|
|
44
|
+
# 2. 推任务 + 异步启动 worker(立即返回,断 ssh 不死)
|
|
45
|
+
python scripts/collab.py push <task-id>
|
|
46
|
+
python scripts/collab.py run <task-id> # 可选第二参换模型
|
|
47
|
+
|
|
48
|
+
# 3. 轮询(建议 3-5 分钟一次;构建类任务 15-40 分钟)
|
|
49
|
+
python scripts/collab.py status <task-id> # RUNNING/FINISHED + status.json 摘要
|
|
50
|
+
python scripts/collab.py log <task-id> # 最近日志尾部 80 行
|
|
51
|
+
|
|
52
|
+
# 4. 回收
|
|
53
|
+
python scripts/collab.py fetch <task-id> # report.md + status.json + artifacts.txt
|
|
54
|
+
python scripts/collab.py artifacts <task-id> # TDD 二进制等产物目录(如有)
|
|
55
|
+
|
|
56
|
+
# 5. 验证通过后收尾(记 device_verified + 自动释放工作区)
|
|
57
|
+
python scripts/collab.py close <task-id>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
worker 完成后 fetch 到的 report.md 含:根因、改动清单、构建与测试结果、遗留风险、设备侧验证建议。**主 Agent 必须独立抽查**(git show 提交、diff 范围、产物 sha256),不盲信转述;验证未过则把新证据追加进 task.md 证据节,push 后重跑(budget 控制)。
|
|
61
|
+
|
|
62
|
+
## 任务书写作要点
|
|
63
|
+
|
|
64
|
+
- goal 一句话可验收;现象/预期写实测事实,不写猜测
|
|
65
|
+
- 证据给本地文件路径并 scp 由 push 自动上推;hilog 只贴关键片段
|
|
66
|
+
- build_targets / tdd_targets 尽量给准(target 名查 test/<域>/BUILD.gn 的 ace_unittest 名);不确定就留空让 worker 自查并在报告回填
|
|
67
|
+
- 约束节写明:不许动的文件、只读标注、已知雷区相关限制
|
|
68
|
+
|
|
69
|
+
## 分支与提交规范(worker 侧已内联,主 Agent 抽查时核对)
|
|
70
|
+
|
|
71
|
+
- 新工作项基于当前 HEAD 新建 `fix/<短描述>` 分支,**不改已推 PR 的分支**
|
|
72
|
+
- 提交带 `Signed-off-by` + `AI[100%] ... AI Adopted[100%]` + `Co-authored-by` + `Change-Id`(I+40hex)
|
|
73
|
+
- **禁止一切 git push**(上游与 fork)——推 fork 是设备验证通过后由主 Agent 执行的独立步骤(`--force-with-lease`)
|
|
74
|
+
|
|
75
|
+
## 相关
|
|
76
|
+
|
|
77
|
+
- 改码纪律正本:`scripts/agent-run-v3.sh` 内联 prompt(服务器 `~/collab/bin/` 部署副本)
|
|
78
|
+
- pool-status skill:领工作区前必查
|
|
79
|
+
- RUNBOOK「远端 code-worker 任务契约」「一轮标准迭代」节
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: loop-iterate
|
|
3
|
+
description: Agent Loop 标准迭代驱动——把 RUNBOOK「一轮标准迭代」固化为可执行流程:改码判定 → 任务契约派发 → 轮询回收 → 小循环 tdd_host 快反馈 → 大循环推板 + tdd_board 门 + hap e2e 判定 → 失败证据自动回填 → 收敛控制。当用户要求"跑一轮迭代 / 调试这个任务 / Agent Loop / 验证修复 / 走标准迭代",或收到 collab worker FINISHED 回收后需要继续验证链时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# loop-iterate:Agent Loop 标准迭代(ROADMAP M2 落地)
|
|
7
|
+
|
|
8
|
+
把 RUNBOOK「一轮标准迭代」从纪律变成流程。改码路径判定仍先过 `collab-delegate` skill;
|
|
9
|
+
本 skill 负责**之后的验证链编排**与**收敛控制**。大原则:证据落盘可追溯、失败自动回填、
|
|
10
|
+
连续无进展即停机升级人工,不无限烧 budget。
|
|
11
|
+
|
|
12
|
+
## 输入
|
|
13
|
+
|
|
14
|
+
- `<task-id>`:已有任务契约(`collab.py new` 已建、task.md 已填),或用户口述的新问题(先走 collab-delegate 建契约)。
|
|
15
|
+
- 可选:`e2e_case`(config/e2e-cases.yaml 用例名,涉及 UI 特性时)、`marker`(应用侧 hilog 埋点)。
|
|
16
|
+
|
|
17
|
+
## 流程(每轮)
|
|
18
|
+
|
|
19
|
+
1. **派发**(未派发时):`flash.py sync-repo [工作区] <task-id>` 领工作区 → `collab.py push/run <task-id>`。
|
|
20
|
+
2. **轮询回收**:3-5 分钟一次 `collab.py status`;FINISHED 后 `fetch` 回收 report.md/status.json/artifacts.txt,并**独立抽查**(git show 单文件/规范、产物 sha256)——不盲信报告转述。
|
|
21
|
+
3. **小循环(快反馈,改码轮必跑)**:
|
|
22
|
+
```bash
|
|
23
|
+
python scripts/apply.py config/tdd-host.yaml run --params tdd_targets=<targets> ohos_root=<WS>/code
|
|
24
|
+
```
|
|
25
|
+
(无独立 spec 时用 `--only` 拼 shell 亦可:核心是 `tdd_host` 步骤出红绿。)
|
|
26
|
+
红 → 失败输出摘录直接进入第 6 步回填,跳过大循环(省 15-40 分钟设备构建)。
|
|
27
|
+
4. **大循环(地面真值)**:
|
|
28
|
+
- 部署物推板:`apply.py config/verify.yaml run --params artifacts=tasks/<tid>/artifacts.txt reboot_after_push=true`
|
|
29
|
+
- 铁律 8 TDD 门:`apply.py config/tdd-board.yaml run --params tdd_targets=<别名>`(别名查 config/tdd-suites.yaml,如 ph-list=List 占位 24 例钉数;裸 target 亦可);
|
|
30
|
+
- UI 特性加 hap e2e:`apply.py config/e2e-hap.yaml run --params case=<名> marker=<埋点>`。
|
|
31
|
+
- **每跑一个 run,把 run-id 追加进 `tasks/<tid>/runs.txt`**(一行一个;close 自动汇编报告靠它关联验证档案)。
|
|
32
|
+
5. **判定**:以 `runs/<id>/results.json` 的 assert/tdd 步骤 `status` 为准(ok=fail= 逐字段读,不凭印象)。
|
|
33
|
+
6. **证据回填**(失败或 PARTIAL 时):把本轮地面真值摘录追加进 task.md 证据节再重跑——
|
|
34
|
+
- TDD 失败:`runs/<id>/tdd_*/<target>.log` 里首个 `[ FAILED ]` 用例名 + 断言行(≤10 行);
|
|
35
|
+
- e2e 断言失败:`results.json` 对应 assertion 条目(kind/期望/实际值)+ evidence/ 截图文件名;
|
|
36
|
+
- 应用崩溃:faultlogger 里最新 jscrash 文件名 + 首段堆栈(≤15 行)。
|
|
37
|
+
然后 `collab.py push && collab.py run`,进入下一轮。
|
|
38
|
+
7. **收敛控制**(任一触发即停,向用户汇报已落树改动):
|
|
39
|
+
- budget 耗尽;
|
|
40
|
+
- 连续 2 次 BLOCKED/NEED_INFO;
|
|
41
|
+
- 同一断言/同一用例连续 2 轮失败且错误文本无变化(修复无进展)。
|
|
42
|
+
|
|
43
|
+
## 通过出口
|
|
44
|
+
|
|
45
|
+
`collab.py close <task-id>`(记 device_verified + 自动释放工作区 + **自动汇编报告 draft** 到
|
|
46
|
+
tasks/<tid>/report-draft.md)。close 前核对三件齐:① tdd_board 全绿(钉数吻合)② e2e assert 全过
|
|
47
|
+
(或任务不涉及 UI)③ runs.txt 已登记本轮 run。close 后主 Agent 填 draft 的 `<TODO>` 节
|
|
48
|
+
(根因/方案/影响面——机器不知道的部分)→ 定稿改名 report-final.md。收敛遥测看 `collab.py stats`。
|
|
49
|
+
|
|
50
|
+
## 禁止
|
|
51
|
+
|
|
52
|
+
- 不跳过抽查直接信 worker 报告;不拿宿主机 tdd_host 绿替代 tdd_board(铁律 8);
|
|
53
|
+
- 不在无新证据的情况下重跑同一任务(浪费 budget,等价于原地打转);
|
|
54
|
+
- 纯执行(重编译已知分支/推板/取证)不派 worker——直连 apply.py。
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openharmony-ci
|
|
3
|
+
description: Use when investigating OpenHarmony PR CI status from `openharmony_ci` comments, DCP event IDs, build labels, artifact links, or CI log URLs.
|
|
4
|
+
source: openharmonyinsight/openharmony-skills
|
|
5
|
+
source-path: skills/openharmony-ci
|
|
6
|
+
source-ref: main
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# OpenHarmony CI
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
Use the bundled script first. It resolves the latest DCP event from an OpenHarmony PR, summarizes per-job CI status, and fetches logs only for failed jobs unless explicitly told otherwise.
|
|
13
|
+
|
|
14
|
+
## Permission Preflight
|
|
15
|
+
- Treat this workflow as network-required by default.
|
|
16
|
+
- Before running the bundled script for `--pr`, `--pr-url`, `--event-id`, artifact paths, or CI log URLs, request network permission up front.
|
|
17
|
+
- Mention the likely endpoints in the permission request when helpful: GitCode via `oh-gc`, `dcp.openharmony.cn`, and `cidownload.openharmony.cn`.
|
|
18
|
+
- Do not intentionally run a first attempt just to confirm that network is required. The failure is usually predictable from the workflow itself.
|
|
19
|
+
|
|
20
|
+
## Primary Path
|
|
21
|
+
Run the bundled script:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
python3 scripts/openharmony_ci.py --pr <pr_number> --repo <repo>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The script sets `XDG_CACHE_HOME=/tmp/openharmony-ci-cache` for `oh-gc` by default so it does not try to write under `~/.cache` in sandboxed environments. If you already need a different cache location, set `XDG_CACHE_HOME` before invoking the script and the script will respect it.
|
|
28
|
+
|
|
29
|
+
Supported inputs:
|
|
30
|
+
- `--pr <number>`
|
|
31
|
+
- `--pr-url <gitcode_pr_url>`
|
|
32
|
+
- `--event-id <dcp_event_id>`
|
|
33
|
+
|
|
34
|
+
Useful flags:
|
|
35
|
+
- `--log-mode auto`
|
|
36
|
+
Only fetch logs for failed jobs. This is the default and should remain the normal mode.
|
|
37
|
+
- `--log-mode never`
|
|
38
|
+
Status only.
|
|
39
|
+
- `--log-mode always`
|
|
40
|
+
Fetch logs for every job that exposes artifacts or log links.
|
|
41
|
+
- `--json`
|
|
42
|
+
Machine-readable output.
|
|
43
|
+
- `--download-dir <dir>`
|
|
44
|
+
Save downloaded log archives/files locally.
|
|
45
|
+
|
|
46
|
+
## Expectations
|
|
47
|
+
- Prefer `--pr` or `--pr-url` when the task starts from a GitCode PR.
|
|
48
|
+
- The script reads `openharmony_ci` comments with `oh-gc`, extracts the newest DCP event id, then queries DCP APIs.
|
|
49
|
+
- In sandboxed or restricted environments, request network access before invoking the script because the primary path depends on external services.
|
|
50
|
+
- In restricted environments, prefer the bundled script over raw `oh-gc` calls because it already redirects the `oh-gc` cache to a writable temporary directory.
|
|
51
|
+
- Judge pass/fail from DCP event data, not labels alone.
|
|
52
|
+
- If there are multiple failed jobs, report all of them.
|
|
53
|
+
- Treat jobs with a start time but no end result as `running`, not failed.
|
|
54
|
+
- On failures, follow artifact listings to logs automatically. `build.log` may redirect to another URL, and `build.log.zip` may actually be a tar archive.
|
|
55
|
+
- In the final answer, report both the DCP `overall` result and the per-job failures. If `overall=success` but some jobs are marked `skip` or `failed`, say that explicitly instead of flattening it into a single verdict.
|
|
56
|
+
- If a failed job shows `skip build` or a similar reason, include that reason verbatim and avoid implying that the whole PR failed unless the DCP overall result is also failed.
|
|
57
|
+
|
|
58
|
+
## Fallback
|
|
59
|
+
If the script cannot be used, fall back to the manual workflow:
|
|
60
|
+
1. Extract the DCP event id from the latest `openharmony_ci` build-start comment.
|
|
61
|
+
2. Query `https://dcp.openharmony.cn/api/codecheckAccess/ci-portal/v1/event/<event_id>`.
|
|
62
|
+
3. If a failed job has `Artifacts`, query `https://dcp.openharmony.cn/api/dataService/ci-portal/v1/files?directoryUrl=<ArtifactsPath>`.
|
|
63
|
+
4. Download the chosen log from `https://cidownload.openharmony.cn/<path>`.
|
|
64
|
+
|
|
65
|
+
## Quick Examples
|
|
66
|
+
```bash
|
|
67
|
+
python3 scripts/openharmony_ci.py --pr 82764 --repo openharmony/arkui_ace_engine
|
|
68
|
+
python3 scripts/openharmony_ci.py --pr-url 'https://gitcode.com/openharmony/arkui_ace_engine/pull/82764' --json
|
|
69
|
+
python3 scripts/openharmony_ci.py --event-id 69c51ede64650f998b1d01a4 --log-mode auto
|
|
70
|
+
XDG_CACHE_HOME=/tmp/custom-oh-gc-cache python3 scripts/openharmony_ci.py --pr 82764 --repo openharmony/arkui_ace_engine
|
|
71
|
+
```
|