feat(cli): agent bridge

This commit is contained in:
rcmerci
2026-05-19 20:04:39 +08:00
parent a50407846f
commit 507a39fff4
20 changed files with 2297 additions and 7 deletions

View File

@@ -1307,6 +1307,65 @@ PY"
:server ["--graph"]}},
:tags [:server],
:extends :non-sync/graph-json-env}
{:id "agent-bridge-routes-assigned-task",
:setup
["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert task --graph {{graph-arg}} --target-page AgentBridgeE2E --content '测试 agent bridge 功能把当前task status设置为done' --status todo >/dev/null"],
:cmds
["python3 '{{repo-root}}/cli-e2e/scripts/agent_bridge_e2e.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{root-dir}}' --config '{{config-path}}' --graph '{{graph}}' --tmp-dir '{{tmp-dir}}' --repo-root '{{repo-root}}' --assign-after-start"],
:expect {:exit 0, :stdout-contains ["agent bridge routed task to thread-e2e-agent-bridge"]},
:covers
{:commands ["agent bridge"],
:options
{:global ["--config" "--graph" "--root-dir" "--output"],
:agent []}},
:cleanup
["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"],
:tags [:agent],
:extends :non-sync/graph-json-env}
{:id "agent-bridge-demo-script",
:cmds
["bash '{{repo-root}}/cli-e2e/scripts/agent_bridge_demo.sh' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{tmp-dir}}/demo-root' --graph cli-e2e-agent-bridge-demo --repo-root '{{repo-root}}'"],
:expect
{:exit 0,
:stdout-contains ["agent bridge demo completed"
"task status: done"
"agent-session-id: thread-agent-bridge-demo"]},
:covers
{:commands ["agent bridge"],
:options
{:global ["--config" "--graph" "--root-dir" "--output"],
:agent []}},
:tags [:agent]}
{:id "agent-bridge-dry-run-json",
:setup
["python3 '{{repo-root}}/cli-e2e/scripts/agent_bridge_e2e.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{root-dir}}' --config '{{config-path}}' --graph '{{graph}}' --tmp-dir '{{tmp-dir}}' --repo-root '{{repo-root}}' --prepare-fake-codex-only"
"{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert task --graph {{graph-arg}} --target-page AgentBridgeE2E --content '测试 agent bridge 功能把当前task status设置为done' --status todo >/dev/null"
"TASK_ID=\"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"测试 agent bridge 功能把当前task status设置为done\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\"; {{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --id \"$TASK_ID\" --update-properties \"{\\\"Assignee\\\" \\\"$(hostname)\\\"}\" >/dev/null"],
:cmds
["CODEX_FAKE_LOG={{tmp-dir-arg}}/dry-run-codex.jsonl PATH={{tmp-dir-arg}}/fake-bin:$PATH {{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json agent bridge --graph {{graph-arg}} --dry-run"],
:expect
{:exit 0,
:stdout-json-paths {[:status] "ok", [:data :mode] "dry-run"},
:stdout-contains ["测试 agent bridge 功能把当前task status设置为done"]},
:covers
{:commands ["agent bridge"],
:options
{:global ["--config" "--graph" "--root-dir" "--output"],
:agent ["--dry-run"]}},
:cleanup
["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"],
:tags [:agent],
:extends :non-sync/graph-json-env}
{:id "agent-bridge-list-all-json",
:cmds
["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json agent bridge list --all"],
:expect {:exit 0, :stdout-json-paths {[:status] "ok", [:data :sessions] []}},
:covers
{:commands ["agent bridge list"],
:options
{:global ["--config" "--root-dir" "--output"],
:agent ["--all"]}},
:tags [:agent]}
{:id "skill-show-human",
:cmds ["{{cli}} skill show"],
:expect

View File

@@ -154,6 +154,12 @@
{:commands ["doctor"]
:options ["--dev-script"]}
:agent
{:commands ["agent bridge"
"agent bridge list"]
:options ["--dry-run"
"--all"]}
:completion
{:commands ["completion"]
:options ["bash"