From 420a9a9e85f8d7a0e976d4060c1c24af9e145fa2 Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 10 Jun 2026 14:20:42 +0000 Subject: [PATCH] fix: expose AgentRun aipod bridge --- .agents/skills/unidesk-code-queue/SKILL.md | 22 ++++++++++++++++++--- scripts/src/agentrun.ts | 23 +++++++++++++++++----- scripts/src/help.ts | 5 ++++- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/.agents/skills/unidesk-code-queue/SKILL.md b/.agents/skills/unidesk-code-queue/SKILL.md index 795e12c2..bdd6e36b 100644 --- a/.agents/skills/unidesk-code-queue/SKILL.md +++ b/.agents/skills/unidesk-code-queue/SKILL.md @@ -1,11 +1,11 @@ --- name: unidesk-code-queue -description: UniDesk legacy Code Queue archive CLI — `codex` 子命令只保留历史任务只读查看、未读积压、trace/output 分页、read、interrupt/cancel 残留任务和本地 prompt-lint;新任务提交、steer、resume、queue mutation 和 move 已冻结,必须使用 `agentrun v01 queue|sessions`。用户提到 codex、Code Queue、submit、steer、resume、tasks、unread、code-queue 时使用。 +description: UniDesk AgentRun-backed Code Queue CLI — legacy `codex` 子命令只保留历史只读/残留停止/prompt-lint;新任务提交、Aipod/Artificer 派单、steer、resume、queue mutation、session trace/output/read/cancel 和 HWLAB Code Agent/CaseRun follow-up 必须使用 `agentrun v01 queue|sessions|aipod-specs`。用户提到 codex、Code Queue、submit、steer、resume、tasks、unread、code-queue、aipod、Artificer、HWLAB Code Agent 时使用。 --- -# UniDesk Legacy Code Queue CLI +# UniDesk Code Queue / AgentRun CLI -旧 Code Queue 已冻结新任务和写入口。`bun scripts/cli.ts codex ...` 现在只作为历史归档、只读排障、残留任务停止和 prompt-lint 入口;新的指挥官派单、trace/output、read/cancel、steer/reuse 必须走 AgentRun Queue/Sessions。 +旧 Code Queue 已冻结新任务和写入口。`bun scripts/cli.ts codex ...` 现在只作为历史归档、只读排障、残留任务停止和 prompt-lint 入口;新的指挥官派单、Aipod/Artificer 执行、trace/output、read/cancel、steer/reuse 必须走 AgentRun Queue/Sessions/AipodSpec。 **固定入口前缀**: `cd /root/unidesk && bun scripts/cli.ts codex ...` @@ -17,6 +17,11 @@ description: UniDesk legacy Code Queue archive CLI — `codex` 子命令只保 # 查看 AgentRun 指挥官队列 bun scripts/cli.ts agentrun v01 queue commander --reader-id +# 查看 / 渲染 AipodSpec(Artificer 是默认分布式开发 agent) +bun scripts/cli.ts agentrun v01 aipod-specs list +bun scripts/cli.ts agentrun v01 aipod-specs show Artificer +bun scripts/cli.ts agentrun v01 aipod-specs render Artificer --prompt-stdin + # 提交 AgentRun Queue payload bun scripts/cli.ts agentrun v01 queue submit --json-stdin <<'JSON' { @@ -30,18 +35,29 @@ bun scripts/cli.ts agentrun v01 queue submit --json-stdin <<'JSON' } JSON +# 用 AipodSpec 提交,优先用于新任务和 Artificer +bun scripts/cli.ts agentrun v01 queue submit --aipod Artificer \ + --prompt-stdin --idempotency-key + # 查看/控制 AgentRun session bun scripts/cli.ts agentrun v01 sessions trace bun scripts/cli.ts agentrun v01 sessions output bun scripts/cli.ts agentrun v01 sessions read +bun scripts/cli.ts agentrun v01 sessions turn --aipod Artificer --prompt-stdin bun scripts/cli.ts agentrun v01 sessions steer --prompt-stdin bun scripts/cli.ts agentrun v01 sessions cancel ``` 日常一次性 JSON、prompt 和 runner JSON 输入优先使用 quoted heredoc/stdin:`--json-stdin`、`--prompt-stdin`、`--runner-json-stdin` 或 `--*-file -`。UniDesk bridge 会把 stdin 直通 G14 `/root/agentrun-v01` 官方 `./scripts/agentrun --manager-url auto` CLI,不先落 dump 文件;`--json-file`、`--prompt-file` 和 `--runner-json-file` 只用于已审阅且可复用的受控文件。它不是旧 Code Queue adapter,不双写,也不迁移旧历史。 +`AipodSpec` 是 AgentRun v0.1 的声明式 agent 装配:模型 profile、gitbundle、skills/tools、SecretRef 和 tool credential 都从 YAML 规格渲染。`Artificer` 默认用于 UniDesk 分布式开发任务,使用 `sub2api` provider、`gpt-5.5`、`reasoningEffort=xhigh`,并通过 SecretRef 注入 GitHub PR token、GitHub SSH 和 UniDesk SSH 透传能力。更新规格时使用 `agentrun v01 aipod-specs apply --yaml-stdin --dry-run` 先看计划,确认后再去掉 `--dry-run`;不得把 API key、SSH key 或 token 写入 prompt、payload、YAML 或 issue。 + AgentRun Queue payload 需要 runner 内使用 UniDesk SSH 透传时,只通过 `executionPolicy.secretScope.toolCredentials[].tool=unidesk-ssh` 请求 `agentrun-v01-tool-unidesk-ssh/UNIDESK_SSH_CLIENT_TOKEN` SecretRef;不要把 token 写入 prompt、payload 或 `transientEnv`。非敏感 endpoint 使用 `UNIDESK_MAIN_SERVER_IP`、`UNIDESK_MAIN_SERVER_HOST` 或 `UNIDESK_FRONTEND_URL`,可由 runner-job `transientEnv` 显式提供;G14 `agentrun-v01` manager 也会在缺省时按受控默认值自动补齐,并在 trace 中只显示 env name/count/hash 与 `valuesPrinted=false`。 +## HWLAB Code Agent 入口整合 + +HWLAB Code Agent / CaseRun follow-up 的日常派单也归入 AgentRun Queue/Sessions:新任务用 `queue submit --aipod Artificer` 或包含 HWLAB gitbundle 的 `queue submit --json-stdin`;运行中纠偏用 `sessions steer` 或 `sessions turn --aipod Artificer`。需要验证 HWLAB Web/Cloud API 原入口时,仍按 `$hwlab-code-agent` 使用 G14 `/root/hwlab-v02` 的 `hwlab-cli client agent ...` 拉取同一 trace/result/inspect;不要回到旧 `codex submit/resume/steer`。 + --- ## 冻结的旧写入口 diff --git a/scripts/src/agentrun.ts b/scripts/src/agentrun.ts index 6025c94f..bb580724 100644 --- a/scripts/src/agentrun.ts +++ b/scripts/src/agentrun.ts @@ -23,13 +23,19 @@ const mirrorToolsImage = "127.0.0.1:5000/hwlab/hwlab-ci-node-tools:node22-alpine export function agentRunHelp(): unknown { return { - command: "agentrun v01 control-plane status|trigger-current|refresh|cleanup-runs|cleanup-released-pvs | git-mirror status|sync|flush | queue submit|list|show|stats|commander|read|cancel|dispatch|refresh | sessions ps|show|turn|steer|cancel|output|trace|read", + command: "agentrun v01 control-plane status|trigger-current|refresh|cleanup-runs|cleanup-released-pvs | git-mirror status|sync|flush | aipod-specs list|show|render|apply|delete | queue submit|list|show|stats|commander|read|cancel|dispatch|refresh | sessions ps|show|turn|steer|cancel|output|trace|read", output: "json", usage: [ "bun scripts/cli.ts agentrun v01 queue commander --reader-id cli", "bun scripts/cli.ts agentrun v01 queue commander --reader-id cli --limit 20", + "bun scripts/cli.ts agentrun v01 aipod-specs list", + "bun scripts/cli.ts agentrun v01 aipod-specs show Artificer", + "bun scripts/cli.ts agentrun v01 aipod-specs render Artificer --prompt-stdin", + "bun scripts/cli.ts agentrun v01 aipod-specs apply --yaml-stdin --dry-run", "bun scripts/cli.ts agentrun v01 queue submit --json-stdin <<'JSON'", "bun scripts/cli.ts agentrun v01 queue submit --json-stdin --dry-run <<'JSON'", + "bun scripts/cli.ts agentrun v01 queue submit --aipod Artificer --prompt-stdin --idempotency-key ", + "bun scripts/cli.ts agentrun v01 queue submit --aipod Artificer --prompt-stdin --dry-run", "bun scripts/cli.ts agentrun v01 queue submit --json-file # reusable reviewed file fallback", "bun scripts/cli.ts agentrun v01 queue dispatch --json-stdin <<'JSON'", "bun scripts/cli.ts agentrun v01 queue dispatch --json-stdin --dry-run <<'JSON'", @@ -37,6 +43,7 @@ export function agentRunHelp(): unknown { "bun scripts/cli.ts agentrun v01 queue cancel --reason --dry-run", "bun scripts/cli.ts agentrun v01 sessions trace --after-seq 0 --limit 100", "bun scripts/cli.ts agentrun v01 sessions output --after-seq 0 --limit 100", + "bun scripts/cli.ts agentrun v01 sessions turn --aipod Artificer --prompt-stdin", "bun scripts/cli.ts agentrun v01 sessions steer --prompt-stdin", "bun scripts/cli.ts agentrun v01 sessions read --reader-id cli", "bun scripts/cli.ts agentrun v01 control-plane status", @@ -54,7 +61,7 @@ export function agentRunHelp(): unknown { "bun scripts/cli.ts agentrun v01 git-mirror sync --confirm", "bun scripts/cli.ts agentrun v01 git-mirror flush --confirm", ], - description: "Operate AgentRun v0.1 Queue and Sessions through the official G14 /root/agentrun-v01 CLI, plus bounded Tekton/Argo control-plane and devops-infra git mirror actions through UniDesk routes. Queue/session commands are direct AgentRun CLI calls, not a UniDesk Code Queue adapter or double-write path.", + description: "Operate AgentRun v0.1 Queue, Sessions, and AipodSpec through the official G14 /root/agentrun-v01 CLI, plus bounded Tekton/Argo control-plane and devops-infra git mirror actions through UniDesk routes. Queue/session/aipod-spec commands are direct AgentRun CLI calls, not a UniDesk Code Queue adapter or double-write path.", }; } @@ -76,12 +83,16 @@ export async function runAgentRunCommand(config: UniDeskConfig, args: string[]): return await runGitMirrorJob(config, action, options); } } - if (group === "queue" || group === "sessions") { + if (isOfficialAgentRunCliBridgeGroup(group)) { return await runOfficialAgentRunCli(config, group, args.slice(2)); } return unsupported(args); } +function isOfficialAgentRunCliBridgeGroup(group: string | undefined): group is AgentRunOfficialCliBridgeGroup { + return group === "queue" || group === "sessions" || group === "aipod-specs" || group === "aipods"; +} + interface TriggerOptions { confirm: boolean; dryRun: boolean; @@ -1458,7 +1469,9 @@ interface PreparedAgentRunCliArgs { stdinPayload: AgentRunCliForwardedStdin | null; } -async function runOfficialAgentRunCli(config: UniDeskConfig, group: "queue" | "sessions", args: string[]): Promise> { +type AgentRunOfficialCliBridgeGroup = "queue" | "sessions" | "aipod-specs" | "aipods"; + +async function runOfficialAgentRunCli(config: UniDeskConfig, group: AgentRunOfficialCliBridgeGroup, args: string[]): Promise> { const prepared = prepareOfficialAgentRunCliArgs([group, ...args]); const command = `agentrun v01 ${prepared.args.join(" ")}`.trim(); const bridge = agentRunQueueBridgeMetadata(prepared.materializedFiles, prepared.stdinPayload); @@ -1784,6 +1797,6 @@ function unsupported(args: string[]): Record { ok: false, command: `agentrun ${args.join(" ")}`.trim(), degradedReason: "unsupported-command", - message: "supported commands: agentrun v01 queue submit|list|show|stats|commander|read|cancel|dispatch|refresh; agentrun v01 sessions ps|show|turn|steer|cancel|output|trace|read; agentrun v01 control-plane status|trigger-current|refresh; agentrun v01 git-mirror status|sync|flush", + message: "supported commands: agentrun v01 aipod-specs list|show|render|apply|delete; agentrun v01 queue submit|list|show|stats|commander|read|cancel|dispatch|refresh; agentrun v01 sessions ps|show|turn|steer|cancel|output|trace|read; agentrun v01 control-plane status|trigger-current|refresh; agentrun v01 git-mirror status|sync|flush", }; } diff --git a/scripts/src/help.ts b/scripts/src/help.ts index 4d267dc5..12a5b995 100644 --- a/scripts/src/help.ts +++ b/scripts/src/help.ts @@ -62,7 +62,7 @@ export function rootHelp(): unknown { { command: "commander contract|plan --dry-run|smoke --dry-run|approval request --dry-run|prompt-lint --kind gpt55-pr", description: "Host Codex commander skeleton contract, no-daemon smoke plan, dry-run approval preview, and advisory GPT-5.5 PR prompt boundary lint without live bridges, message sends, or submit gating." }, { command: "hwlab nodes control-plane|git-mirror|secret --node G14 --lane v03", description: "Manage HWLAB node/lane runtime prerequisites for v0.3+ with the node identity passed as data instead of a command family." }, { command: "hwlab g14 monitor-prs | hwlab g14 control-plane status|apply|trigger-current|runtime-migration|cleanup-runs|cleanup-released-pvs | hwlab g14 git-mirror status|apply|sync|flush | hwlab g14 tools-image status|build", description: "Start the legacy G14 PR monitor, run bounded v0.2 Tekton/Argo control-plane, manual PipelineRun trigger, runtime migration, CI workspace retention, manual devops-infra git mirror/relay maintenance, or fixed HWLAB CI tools image actions; long confirmed trigger/sync/flush actions return async jobs by default." }, - { command: "agentrun v01 queue|sessions|control-plane|git-mirror", description: "Use AgentRun v0.1 Queue and Sessions as the active commander entry through the official G14 CLI bridge, plus bounded Tekton/Argo and git-mirror operations." }, + { command: "agentrun v01 aipod-specs|queue|sessions|control-plane|git-mirror", description: "Use AgentRun v0.1 AipodSpec, Queue, and Sessions as the active commander entry through the official G14 CLI bridge, plus bounded Tekton/Argo and git-mirror operations." }, { command: "platform-infra sub2api plan|apply|status|validate|codex-pool", description: "Deploy Sub2API in G14 platform-infra, manage the YAML-controlled Codex upstream pool, expose the unified API through FRP when needed, and configure master ~/.codex without printing API keys." }, { command: "hwlab cd audit --env dev | hwlab cd status --env dev | hwlab cd apply --env dev --dry-run", description: "Legacy D601 HWLAB DEV CD wrapper kept for explicit old-path diagnostics; current HWLAB rollout uses G14 GitOps." }, { command: "code-agent-sandbox", description: "Independent Code Agent Sandbox service skeleton for adapter, mode, and credential-boundary diagnostics." }, @@ -391,6 +391,8 @@ function codexHelp(): unknown { "bun scripts/cli.ts codex deploy # disabled legacy deployment entry", "bun scripts/cli.ts codex prompt-lint [prompt|--prompt-file path|--prompt-stdin]", "bun scripts/cli.ts agentrun v01 queue commander --reader-id cli", + "bun scripts/cli.ts agentrun v01 aipod-specs show Artificer", + "bun scripts/cli.ts agentrun v01 queue submit --aipod Artificer --prompt-stdin", "bun scripts/cli.ts agentrun v01 queue submit --json-stdin <<'JSON'", "bun scripts/cli.ts agentrun v01 sessions trace --after-seq 0 --limit 100", "bun scripts/cli.ts codex submit # frozen legacy write entry; returns legacy-code-queue-frozen", @@ -457,6 +459,7 @@ function codexHelp(): unknown { examples: { promptLint: "bun scripts/cli.ts codex prompt-lint --prompt-file /tmp/code-queue-prompt.md", agentRunCommander: "bun scripts/cli.ts agentrun v01 queue commander --reader-id cli", + agentRunAipod: "bun scripts/cli.ts agentrun v01 queue submit --aipod Artificer --prompt-stdin", agentRunSubmit: "bun scripts/cli.ts agentrun v01 queue submit --json-stdin <<'JSON'", agentRunTrace: "bun scripts/cli.ts agentrun v01 sessions trace --after-seq 0 --limit 100", frozenLegacySubmit: "bun scripts/cli.ts codex submit --prompt-file /tmp/code-queue-prompt.md",