Skip to content

Commit acc2c77

Browse files
committed
feat(web): W2-09 goal/task/skill browser panels (v0.19.121)
Ship Goal/task controls over leased Code UI routes and A0-07 skill discovery validation until W3-01 exposes skill HTTP. Signed-off-by: Eli Ma <eli@patch.sh>
1 parent 9b0fe43 commit acc2c77

47 files changed

Lines changed: 1267 additions & 56 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
## [Unreleased]
44

5+
### Added (plan-20260715 W2-09, 2026-08-11)
6+
7+
- **W2-09 delivers browser Goal/task/skill controls.** Domain helpers under
8+
`web/src/lib/code-ui/goal-task-skill/` drive `SessionGoalTaskSkill` panels for
9+
Goal start/status/cancel, task dispatch (active controller lease), and A0-07
10+
curated skill discovery validation (runtime skill HTTP remains W3-01).
11+
`BrowserController.withLease` is exposed for domain writes; command docs
12+
clarify browser-capable `/task/dispatch`.
13+
514
### Added (plan-20260715 W2-08, 2026-08-11)
615

716
- **W2-08 delivers browser approval and `request_user_input` panels.** Domain

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libra"
3-
version = "0.19.120"
3+
version = "0.19.121"
44
edition = "2024"
55
license = "MIT"
66
description = "AI agent-native version control system with Git on-disk compatibility, SQLite-backed metadata, and tiered cloud storage"

docs/commands/code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Selecting `loopback` is rejected when `--host` is not a loopback address, and th
111111
- `POST /api/code/controller/attach` — loopback. `kind: "automation"` requests additionally require `X-Libra-Control-Token`. The handler **issues** the lease's `controllerToken` (it does not expect the caller to send one).
112112
- `POST /api/code/controller/detach`, `POST /api/code/messages`, `POST /api/code/interactions/{id}` — loopback + `X-Code-Controller-Token`; `Automation` leases additionally require `X-Libra-Control-Token`.
113113
- `POST /api/code/control/cancel` — loopback + `X-Code-Controller-Token`. `Automation` leases also require `X-Libra-Control-Token`; this is the only difference from the TUI `Esc` cancel path.
114-
- `POST /api/code/task/dispatch` — loopback + `X-Code-Controller-Token`; user-initiated sub-agent dispatch requires an automation lease.
114+
- `POST /api/code/task/dispatch` — loopback + `X-Code-Controller-Token`; user-initiated sub-agent dispatch requires an active controller write lease (browser or automation). Automation leases additionally require `X-Libra-Control-Token`.
115115
- `POST /api/code/goal/start`, `POST /api/code/goal/cancel` — loopback + `X-Code-Controller-Token`; goal mutation requires the active controller lease.
116116

117117
Browser write requests share the same 256 KiB body limit and audit-sink wiring as automation control. The browser persists the lease only in memory; reloading the page drops the lease and the next write reattaches.

docs/commands/zh-CN/code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Automation clients 使用 `POST /api/code/controller/attach` 连接,请求体
111111
- `POST /api/code/controller/attach` — loopback。`kind: "automation"` 请求还要求 `X-Libra-Control-Token`。handler **签发** lease 的 `controllerToken`(不期待调用方发送它)。
112112
- `POST /api/code/controller/detach``POST /api/code/messages``POST /api/code/interactions/{id}` — loopback + `X-Code-Controller-Token``Automation` leases 还要求 `X-Libra-Control-Token`
113113
- `POST /api/code/control/cancel` — loopback + `X-Code-Controller-Token``Automation` leases 也要求 `X-Libra-Control-Token`;这是与 TUI `Esc` cancel 路径的唯一区别。
114-
- `POST /api/code/task/dispatch` — loopback + `X-Code-Controller-Token`;用户发起的 sub-agent dispatch 需要 automation lease。
114+
- `POST /api/code/task/dispatch` — loopback + `X-Code-Controller-Token`;用户发起的 sub-agent dispatch 需要 active controller write lease(browser 或 automation)。Automation lease 额外要求 `X-Libra-Control-Token`
115115
- `POST /api/code/goal/start``POST /api/code/goal/cancel` — loopback + `X-Code-Controller-Token`;goal mutation 需要 active controller lease。
116116

117117
浏览器写请求共享与自动化控制相同的 256 KiB body limit 和 audit-sink wiring。浏览器只在内存中持久化 lease;重新加载页面会丢弃 lease,下一次写入会重新 attach。

docs/development/plan/plan-20260715.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,21 +1191,23 @@ command id、跨 adapter durable interaction source 和本卡完整 approval TTL
11911191
**Description:** 交付 goal/task 面板与 skill 搜索/激活组件,复用 W2-07 的 wire 适配层与 fixture 脚手架;usage 展示独立归 W2-13。
11921192

11931193
**Acceptance criteria:**
1194-
- [ ] goal 面板、task 面板、skill 搜索/激活组件从 runtime 投影驱动;领域模块仅位于 `goal-task-skill/*`,不修改 W2-07 共享基础文件。
1195-
- [ ] vitest 覆盖 goal start/status/cancel、task dispatch 与 skill search/activation;skill registry 数据只来自 A0-07 projection。
1196-
- [ ] `pnpm --dir web lint``pnpm --dir web build` 通过;`web/out/` 不漂移。
1194+
- [x] goal 面板、task 面板、skill 搜索/激活组件从 runtime 投影驱动;领域模块仅位于 `goal-task-skill/*`,不修改 W2-07 共享基础文件。
1195+
- [x] vitest 覆盖 goal start/status/cancel、task dispatch 与 skill search/activation;skill registry 数据只来自 A0-07 projection。
1196+
- [x] `pnpm --dir web lint``pnpm --dir web build` 通过;`web/out/` 不漂移。
11971197

11981198
**Verification:**
1199-
- [ ] `pnpm --dir web lint && pnpm --dir web build`
1200-
- [ ] `pnpm --dir web test`
1201-
- [ ] `LIBRA_ENABLE_TEST_PROVIDER=1 cargo test --features test-provider --test code_ui_remote_state_matrix -- --test-threads=1`
1199+
- [x] `pnpm --dir web lint && pnpm --dir web build`
1200+
- [x] `pnpm --dir web test`
1201+
- [x] `LIBRA_ENABLE_TEST_PROVIDER=1 cargo test --features test-provider --test code_ui_remote_state_matrix -- --test-threads=1`
12021202

12031203
**Dependencies:** W2-06(goal/task/skill service), W2-07(适配层/脚手架)。
12041204

12051205
**Files likely touched:** `web/src/components/workspace/goal-task-skill/*`, `web/src/lib/code-ui/goal-task-skill/*` 及其 colocated `*.test.{ts,tsx}`(新增领域模块与 fixture)。
12061206

12071207
**Estimated scope:** M.
12081208

1209+
**已发布 v0.19.121(Codex gpt-5.6-terra PASS,r8 无 P0/P1)**:Goal/task 浏览器面板 + A0-07 skill 校验;`withLease` 域写入;mount-only goal probe;skill HTTP 仍归 W3-01。
1210+
12091211
### Task W2-10: Web 前端 session resume/cancel 生命周期
12101212

12111213
**Description:** 交付 session selection/resume/cancel UI,复用 W2-07 的 wire 适配层与 fixture 脚手架。Execution/repair 投影归 W2-14,SSE reconnect/resync 归 W2-15。

install.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $ErrorActionPreference = "Stop"
2222
# One of the release version surfaces. `compat_version_surface_sync` pins it
2323
# to Cargo.toml: this value is substituted verbatim into the download URL, so
2424
# a stale value silently installs an old binary when -Version is not given.
25-
$DefaultVersion = "v0.19.120"
25+
$DefaultVersion = "v0.19.121"
2626
$ExeName = "libra.exe"
2727
$ReleaseAsset = "libra-windows-amd64.exe"
2828

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ INSTALL_DIR="${LIBRA_INSTALL_DIR:-$LIBRA_HOME/bin}"
1818
# user opts in with LIBRA_ALLOW_FALLBACK=1. Default behaviour is fail-fast so
1919
# offline installs cannot silently regress to a stale version. Bump this on
2020
# every release so the opt-in fallback remains useful.
21-
DEFAULT_VERSION="v0.19.120"
21+
DEFAULT_VERSION="v0.19.121"
2222

2323
# ─── theme (Dusk) ────────────────────────────────────────────────────────────
2424
if [ -t 1 ] && [ -z "${NO_COLOR:-}" ] && [ -z "${LIBRA_NO_TUI:-}" ] && [ "${TERM:-dumb}" != "dumb" ]; then

web/README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,21 @@ pnpm test # vitest unit tests for the browser foundation
1515
pnpm build # static export → web/out/
1616
```
1717

18-
## Current UI status (W2-07 + W2-08)
18+
## Current UI status (W2-07 + W2-08 + W2-09)
1919

2020
The shipped page mounts the shared session/SSE store and browser-controller
21-
lease provider, shows the current session title and phase, and renders the
21+
lease provider, shows the current session title and phase, renders the
2222
pending approval / `request_user_input` panel when the snapshot has one
23-
(`SessionInteractions``InteractionsHost`). It does not yet ship a
24-
three-pane workspace, composer, thread sidebar, terminal, or workflow tabs.
23+
(`SessionInteractions``InteractionsHost`), and mounts goal/task/skill
24+
controls (`SessionGoalTaskSkill`). It does not yet ship a three-pane
25+
workspace, composer, thread sidebar, terminal, or workflow tabs.
2526

2627
W2-07 owns the shared wire foundation under `web/src/lib/code-ui/`. W2-08 owns
2728
approval and structured user-input under `web/src/lib/code-ui/interactions/`
28-
and `web/src/components/workspace/interactions/`. Later domain panels remain
29+
and `web/src/components/workspace/interactions/`. W2-09 owns goal/task/skill
30+
under `web/src/lib/code-ui/goal-task-skill/` and
31+
`web/src/components/workspace/goal-task-skill/` (skills use the A0-07 curated
32+
registry until W3-01 exposes Code UI skill HTTP). Later domain panels remain
2933
with later W2 cards (usage W2-13, workflow review W2-16, etc.).
3034

3135
## Live API contract
@@ -46,6 +50,10 @@ The browser only talks to its same-origin server. The Rust side enforces loopbac
4650
| `/api/code/messages` | POST | Submit a user message (header `X-Code-Controller-Token`, body ≤256 KiB). |
4751
| `/api/code/interactions/{id}` | POST | Resolve a pending `CodeUiInteractionRequest`. |
4852
| `/api/code/control/cancel` | POST | Cancel the active turn. Browser leases need only the controller token; automation leases additionally require `X-Libra-Control-Token`. |
53+
| `/api/code/goal/start` | POST | Start a Goal (`{ objective }`, header `X-Code-Controller-Token`) → `{ accepted, status }`. |
54+
| `/api/code/goal/status` | GET | Observe the active Goal status text (`{ status }`). No controller token; empty sessions return a no-active-Goal error treated as empty UI state. |
55+
| `/api/code/goal/cancel` | POST | Cancel the active Goal (`{ reason }`, header `X-Code-Controller-Token`) → `{ accepted, status }`. |
56+
| `/api/code/task/dispatch` | POST | Dispatch a user-initiated sub-agent task (`{ agent, prompt }`, header `X-Code-Controller-Token`) → `{ accepted, result }`. |
4957

5058
The wire types are pinned in two places — keep them in lock-step:
5159

@@ -56,22 +64,26 @@ The wire types are pinned in two places — keep them in lock-step:
5664

5765
```
5866
web/src/
59-
├── app/ # Next.js app router entry (mounts SessionInteractions)
67+
├── app/ # Next.js app router entry (mounts domain panels)
6068
├── components/workspace/
61-
│ └── interactions/ # Approval + request_user_input panels (W2-08)
69+
│ ├── interactions/ # Approval + request_user_input panels (W2-08)
70+
│ └── goal-task-skill/ # Goal / task / skill panels (W2-09)
6271
└── lib/
6372
└── code-ui/ # Shared wire types, client, store, controller (W2-07)
64-
└── interactions/ # Approval/user-input helpers + fixtures (W2-08)
73+
├── interactions/ # Approval/user-input helpers + fixtures (W2-08)
74+
└── goal-task-skill/ # Goal/task API + A0-07 skill helpers (W2-09)
6575
```
6676

67-
`web/src/lib/code-ui/store.tsx` owns the `CodeUiSessionSnapshot` and the SSE reconnect loop. `web/src/lib/code-ui/controller.tsx` owns the browser controller lease. `app/page.tsx` mounts both providers once and renders `SessionInteractions` so pending approval/user-input prompts resolve through the leased controller.
77+
`web/src/lib/code-ui/store.tsx` owns the `CodeUiSessionSnapshot` and the SSE reconnect loop. `web/src/lib/code-ui/controller.tsx` owns the browser controller lease. `app/page.tsx` mounts both providers once and renders `SessionInteractions` plus `SessionGoalTaskSkill` so pending prompts and goal/task/skill controls resolve through the leased controller.
6878

6979
## Browser write surface
7080

7181
Composer and other domain writers will continue to land in later W2 cards.
72-
Approval and `request_user_input` already flow through `useBrowserController()`
73-
via `SessionInteractions`: `respond` posts to `/api/code/interactions/{id}` and
74-
`cancel` posts to `/api/code/control/cancel`. On the first write the hook calls
82+
Approval, `request_user_input`, Goal start/cancel, and task dispatch already flow
83+
through `useBrowserController()` via `SessionInteractions` /
84+
`SessionGoalTaskSkill`: writes post with `X-Code-Controller-Token` after
85+
`withLease` recovery. Skill buttons only validate the A0-07 curated registry
86+
until W3-01 exposes skill HTTP. On the first write the hook calls
7587
`POST /api/code/controller/attach`, caches `controllerToken` + `leaseExpiresAt`
7688
in memory, and replays the original request. The browser `clientId` is
7789
persisted in `sessionStorage` so an unexpected reload can renew the same

0 commit comments

Comments
 (0)