Skip to content

v6.7.0 — see every dispatched job

Choose a tag to compare

@moerasermax moerasermax released this 09 Oct 02:24
· 159 commits to master since this release
claude mcp add ai-cli -s user -- npx -y @tkflyc/ai-cli-mcp

See every dispatched job, from any session

Each Claude Code or Codex session runs its own ai-cli MCP server, and jobs lived only in that server's memory: list_processes could not see another session's jobs, and an MCP reconnect wiped them. Codex as a coordinator has no plugin API at all — its status line takes built-in items only — so there was no place to watch progress.

Every ai-cli process now publishes the jobs it tracks to ${AI_CLI_STATE_DIR}/live-jobs/<pid>-<start-time>.json (default ~/.local/state/ai-cli/live-jobs/), and a new command reads them all:

ai-cli jobs            # one table: every session, MCP and CLI jobs alike
ai-cli jobs --watch    # redraw every 2 seconds; keep it in a side terminal
ai-cli jobs --json     # machine-readable
ai-cli jobs --running  # running jobs only
  • Small and private. A snapshot holds a 40-character task summary and an 80-character last event, never the prompt. Writes are atomic (temp file + rename), immediate on state changes and at most every 2 seconds while running. Finished jobs stay for 10 minutes.
  • Stale files are recognised, not trusted. The writer is identified by PID and process creation time (Windows CIM, Linux boot ID + start ticks, macOS ps lstart), so a dead owner or a reused PID is skipped. Each writer collects snapshots whose owner is proven gone.
  • Read-only. jobs works inside a worker (AI_CLI_WORKER=1) and never dispatches.

Faster ai-cli run on Windows

The dispatcher lookup is now cached and the post-spawn identity query runs in the background. Measured on Windows: the PID is printed after 0.27–0.53 s instead of 2.1–2.7 s; the process exits once its metadata is written.

Acceptance tool fixes

  • A timeout on its own is now a capability failure, not a safety failure; it still counts as safety when it comes with monitor errors, unconfirmed cleanup, peak > 1 or an unblocked ai-cli call.
  • The installed-hook comparison ignores line endings only (git on Windows turns the repo copy into CRLF), so it stops reporting identical files as different.

Compatibility

One visible change: on Windows, ai-cli run prints the PID first and exits after writing metadata. Everything else is additive.

An independent audit found nothing of high severity; all four medium and nine low findings were fixed before release. CI is green on Windows, Linux and macOS with Node 20.19 and 22.

Full details: CHANGELOG.


繁體中文

任何 session 派出的 job 都看得到

每個 Claude Code 或 Codex session 都有自己的 ai-cli MCP server,job 只存在那個 server 的記憶體裡:list_processes 看不到別的 session 的 job,MCP 重連後就清空。Codex 當主導者時完全沒有外掛 API,狀態列只能選內建項目,沒有地方看進度。

現在每個 ai-cli 行程都會把自己追蹤的 job 寫到 ${AI_CLI_STATE_DIR}/live-jobs/<pid>-<建立時間>.json(預設 ~/.local/state/ai-cli/live-jobs/),新的指令會把它們全部讀出來:

ai-cli jobs            # 一張表:所有 session、MCP 與 CLI 派的 job
ai-cli jobs --watch    # 每 2 秒重畫,適合開在旁邊的終端機
ai-cli jobs --json     # 機器可讀
ai-cli jobs --running  # 只看執行中
  • 小而不外洩。 快照只存 40 字任務摘要與 80 字最後事件,不存 prompt。原子寫入(暫存檔+rename),狀態改變立即寫、執行中最多每 2 秒一次;結束的 job 保留 10 分鐘。
  • 過期檔會被辨認,不會被誤信。 寫入者以 PID 加上行程建立時間識別(Windows CIM、Linux boot ID+start ticks、macOS ps lstart),已結束的 owner 與被重用的 PID 都會略過;每個寫入者會回收已證實失效的快照。
  • 唯讀。 jobs 在 worker 裡(AI_CLI_WORKER=1)也能用,而且不會派工。

Windows 上 ai-cli run 變快

派工端查詢改為快取,spawn 後的身分查詢改在背景進行。Windows 實測:拿到 PID 由 2.1~2.7 秒縮短為 0.27~0.53 秒;行程會在寫完 metadata 後結束。

驗收工具修正

  • 單純的逾時改判為能力類失敗,不再算安全性失敗;若同時有監控錯誤、收尾未確認、峰值 > 1 或未被擋的 ai-cli 呼叫,仍判安全性失敗。
  • 已安裝 hook 的比對只忽略換行差異(Windows 上 git 會把 repo 版轉成 CRLF),不再把內容相同的檔案誤報為不一致。

相容性

看得到的變化一處:Windows 上 ai-cli run 先印出 PID,寫完 metadata 才結束。其餘皆為新增。

獨立稽核沒有發現高嚴重度問題;4 個中度、9 個低度發現都在發佈前修正。CI 在 Windows、Linux、macOS 的 Node 20.19 與 22 全部通過。

完整內容見 CHANGELOG。