Files
pikasTech-unidesk/.agents/skills/unidesk-code-queue/SKILL.md
T

68 lines
5.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: unidesk-code-queue
description: UniDesk AgentRun-backed Code Queue CLI — Skill(cli-spec)。legacy `codex` 子命令只保留历史只读和残留停止;新任务提交、Aipod/Artificer 派单、session follow-up、events/logs/result、attempts/retry、ack/cancel、dispatch、run/command/runner 状态 drill-down 和 HWLAB Code Agent/CaseRun follow-up 必须使用 `agentrun get|describe|events|logs|result|retry|ack|cancel|dispatch|create|apply|send` 资源原语。用户提到 codex、Code Queue、submit、send、resume、retry、tasks、unread、code-queue、aipod、Artificer、HWLAB Code Agent 时使用。
---
# UniDesk Code Queue / AgentRun CLI
新任务、Aipod/Artificer 派单、session follow-up、events/logs/result、attempts/retry、ack/cancel、dispatch 和 run/command/runner drill-down 走 AgentRun 资源原语。legacy `codex` 只保留历史只读、未读积压和残留任务停止。
## 高频入口
```bash
bun scripts/cli.ts agentrun get tasks --limit 20
bun scripts/cli.ts agentrun describe task/<taskId>
bun scripts/cli.ts agentrun describe task/<taskId> --input -o json
bun scripts/cli.ts agentrun describe aipodspec/<name>
bun scripts/cli.ts agentrun events run/<runId> --limit 20
bun scripts/cli.ts agentrun events run/<runId> --detail-seq <seq> -o json
bun scripts/cli.ts agentrun logs session/<sessionId> --tail 120
bun scripts/cli.ts agentrun result run/<runId> --command <commandId>
bun scripts/cli.ts agentrun get attempts --task <taskId>
bun scripts/cli.ts agentrun retry task/<taskId> --idempotency-key <key> --reason <text> --dry-run
bun scripts/cli.ts agentrun send <session> --prompt-stdin
```
资源命令未传 `--node/--lane` 时固定使用 `config/agentrun.yaml#controlPlane.default`,当前为 `NC01/nc01-v02`;只有查询非默认 lane 时才显式传目标参数。主机 direct HTTP auth 只保留独立诊断,固定 Secret 文件路径为 `/root/.unidesk/.env/agentrun.env`,不得回退到 worktree 或旧 `/root/.config/hwlab-*` 路径。
AipodSpec/Artificer、task manifest 和 queue 渐进披露见 [references/resources.md](references/resources.md)session 控制、HWLAB Code Agent 整合、trace/output 分页、judge、中断/取消见 [references/sessions.md](references/sessions.md);旧队列归档见 [references/legacy.md](references/legacy.md)。
## P0 边界
- AgentRun 与调用方之间的契约版本、源码/镜像版本和 `commitId` 对齐只能产生非阻塞 warning;可安全归一化的请求继续 admission/dispatch,不得因版本或契约漂移阻止用户任务、session、run、command 或 runner。
- 新写入口不要用 `codex submit/steer/resume`;这些 legacy mutation 已冻结。
- Artificer 的 primary source workspace 与远端 tool target 必须分开判定:
- task prompt 引用待修改源码时,默认写 primary workspace `.`,需要子目录时写相对路径;
- 禁止把宿主 `/root/unidesk`、主代理 worktree 或其他 task 外部绝对路径当成 source workspace
- 用户明确授权的 `trans <route> ...` 远端范围属于 `unidesk-ssh` tool target,不是旁路 source workspace
- 访问远端 tool target 必须使用已投影的受控 `trans`,并继续遵守 route allowlist、SecretRef、脱敏和短连接边界;
- primary source 路径不可见时,先用 `agentrun events run/<runId> --detail-seq <seq>` 核对 durable workspace 物化事实,不让 Artificer 搜索或切换到旁路仓库。
- 默认输出保持低噪声表格/摘要;机器消费显式 `-o json|yaml``--raw`
- 读取 task 的可重建输入:
- 使用 `agentrun describe task/<taskId> --input -o json`
- 该入口只投影 task create 字段、AipodSpec identity、资源引用和脱敏 provenance
- 不打印 Secret value
- `--input``--full``--raw` 互斥,非法组合必须在请求服务端前返回 `validation-failed`
- 读取 AipodSpec
- 默认 `describe aipodspec/<name>` 的 human、JSON 和 YAML 使用同一有界摘要;
- 摘要至少包含:
- identity/hash 与 runtime
- workspace 与主 resource bundle source identity
- 引用计数和脱敏 provenance
- credential 只显示 SecretRef 并固定 `valuesPrinted=false`
- 完整服务端对象只通过显式 `--full -o json``--raw` 下钻。
- Session follow-up 使用 `agentrun send`,由服务端决定内部 steer vs turn。
- Session follow-up 的默认 text、显式 JSON 和 YAML 使用同一有界投影:
- dry-run 直接展示 `decision``reuseRun``createRunner`、session/run/command/runner identity、`mutation=false` 和语义化 `Next`
- live 失败保留 manager 返回的 typed failure、资源 identity、`mutation` / `partialWrite` 与只读下钻命令;
- CLI 不补做 retry、cleanup、runner 调度或 session 状态机,partial write 时禁止盲目重发。
- 终态失败重试只使用 `agentrun retry task/<taskId>`:保持同一 task,新增不可变 attempt;先用 `--dry-run` 完成服务端全校验,再以同一幂等键执行真实重试。
- retry 只接受 Queue 已处于 `failed``blocked``completed``cancelled` 和其他状态必须 fail closed。不得复制 task、重置 task、引入本地 scheduler/backoff/judge 或直接创建 runner Job 来模拟重试。
- HWLAB Code Agent/CaseRun follow-up 也优先落到 AgentRun resource primitive,不绕过队列状态。
## 何时读取 reference
- 创建/应用 AgentRun task 或 AipodSpec:读 [references/resources.md](references/resources.md)。
- 查历史 `codex tasks/unread/output/trace`:读 [references/legacy.md](references/legacy.md)。
- 需要 judge、取消、中断、Dev Ready 或 PR preflight:读 [references/sessions.md](references/sessions.md)。