diff --git a/.changeset/relax-rivus-agent-peer-range.md b/.changeset/relax-rivus-agent-peer-range.md new file mode 100644 index 00000000..1e8999ad --- /dev/null +++ b/.changeset/relax-rivus-agent-peer-range.md @@ -0,0 +1,5 @@ +--- +'@rivus/agent-task-loop': patch +--- + +Relax optional `@rivus/agent` peer dependency to `>=0.17.0` instead of pinning an upper minor ceiling. diff --git a/AGENTS.md b/AGENTS.md index ac907b1d..8f26dabb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -50,15 +50,15 @@ Do not claim implementation work is complete until the relevant commands pass, o ## Development Workflow -Check the [Change Design Gate](CONTRIBUTING.md#change-design-gate) before starting work. Bugfixes and routine changes need only a clear PR summary and validation. For non-trivial changes that meet the gate, write or review the active Plan in `docs/plans/` before implementation, and do not start a Plan that is blocked on an unresolved decision. When the code lands on `main`, migrate lasting non-code constraints to `docs/` (and local `Why:` comments), move unfinished follow-ups to issues, and delete the Plan in the final PR. +Check the [Change Design Gate](CONTRIBUTING.md#change-design-gate) before starting work. Bugfixes and routine changes need only a clear PR summary and validation. For non-trivial changes that meet the gate, write or review the active Plan in `docs/plans/` before implementation, and do not start a Plan that is blocked on an unresolved decision. Retire a completed Plan in its final delivery PR per [`docs/AGENTS.md` §4](docs/AGENTS.md#4-retiring-a-plan). Respect the package boundaries in [`docs/architecture/overview.md`](docs/architecture/overview.md); the package-boundary and room-isolation tests enforce them. ## Documentation +- Read [`docs/AGENTS.md`](docs/AGENTS.md) before writing non-code knowledge: adding or changing a file under `docs/`, choosing between a doc and a `Why:` comment, or retiring a Plan. - Use `CONTRIBUTING.md` for contribution workflow. -- Use `docs/plans/` for active implementation plans while non-trivial work is in flight, and retire completed plans when code lands. Current-state documentation owns implemented behavior. -- Use `docs/` for durable current-state knowledge that code alone cannot express: architecture (`docs/architecture/`), guides, and development/release runbooks. See `docs/README.md`. +- Use `docs/plans/` for active implementation plans while non-trivial work is in flight, and retire completed plans in their final delivery PR. See `docs/README.md`. - Keep README focused on orientation and quick start. - Record user-facing changes to published packages with a changeset (`pnpm changeset`) in the same PR; do not edit generated `CHANGELOG.md` files or add a hand-written root `CHANGELOG.md`. @@ -98,7 +98,7 @@ rg --hidden --no-ignore -n "internal-domain.example|/Users/|private-token|secret --glob '!node_modules/**' \ --glob '!**/node_modules/**' \ --glob '!.git/**' \ - --glob '!AGENTS.md' \ - --glob '!CONTRIBUTING.md' \ - --glob '!SECURITY.md' + --glob '!/AGENTS.md' \ + --glob '!/CONTRIBUTING.md' \ + --glob '!/SECURITY.md' ``` diff --git a/CONTEXT.md b/CONTEXT.md deleted file mode 100644 index 7c22193e..00000000 --- a/CONTEXT.md +++ /dev/null @@ -1,25 +0,0 @@ -# Agent Task Loop Domain - -This context describes the task orchestration language shared by the command-line interface and external Agent integrations. - -## Language - -**Task**: -A unit of requested work whose authoritative business fields and lifecycle are owned by one Task Backend. -_Avoid_: Job, ticket - -**Task Backend**: -The system of record that stores Tasks and authorizes reads and mutations for them. -_Avoid_: Task cache, Rivus Memory - -**Task Run**: -One execution and review workflow for a Task, including recovery, rework, acceptance, and publication state. -_Avoid_: Rivus run, chat session - -**Task Manager**: -An Agent-facing application boundary that lists, reads, creates, and starts Tasks without exposing backend credentials or Task Run internals. -_Avoid_: Task Backend, worker - -**External Worker**: -The configured coding-agent process that performs a Task Run under agent-task-loop orchestration. -_Avoid_: Rivus subagent, Task Manager diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 03ee2abd..9b8664a1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -108,7 +108,7 @@ Only published packages get changesets. Private workspace packages (`private: tr 1. When changesets land on `main`, `.github/workflows/publish.yml` calls the shared npm release workflow of PerfectPan/gh-repo-checks, which opens or updates the draft release PR `chore(release): version packages` on the branch `changeset-release/main` by running `pnpm version-packages` (Changesets bumps and changelogs). Later changesets fold into the same PR. 2. Each update returns the release PR to Draft. Review the version changes, mark it Ready for review, and approve workflow runs if GitHub requests approval. Verify that `test` and Review passed for the current head before merging. Manual publish retries run only from `main`. -3. Merging the release PR runs `publish.yml` again: a read-only job runs the gates (`pnpm test`, `pnpm build`, `pnpm typecheck`), the production audit and `pnpm pack`, then the only job with the OIDC permission publishes the packed versions to npm through trusted publishing with provenance. See [`docs/npm-publish.md`](docs/npm-publish.md). +3. Merging the release PR runs `publish.yml` again: a read-only job runs the gates (`pnpm test`, `pnpm build`, `pnpm typecheck`), the production audit and `pnpm pack`, then the only job with the OIDC permission publishes the packed versions to npm through trusted publishing with provenance. See [`docs/development/npm-publish.md`](docs/development/npm-publish.md). ### Bot Pull Requests @@ -149,19 +149,16 @@ Only published packages get changesets. Private workspace packages (`private: tr checkboxes to retry or recreate an update. Configuration validation and a token-free local extraction/lookup are not evidence that the hosted app is authorized or has run successfully. -- **Security updates are a separate handoff**: keep the GitHub dependency graph and Dependabot alerts enabled; - removing `.github/dependabot.yml` only changes routine version updates. Repository security settings and GitHub - App permissions are managed separately, and this configuration does not enable either of them. If alerts or - the graph are disabled, the owner must enable them in a separately confirmed step before claiming coverage. - The 2026-11-03 rollout audit found dependency graph, Dependabot alerts, and Dependabot security updates disabled - in [repository security settings](https://github.com/PerfectPan/agent-task-loop/settings/security_analysis). - Recheck these settings before handoff; this migration does not change them. +- **Security updates are a separate handoff**: dependency graph and Dependabot alerts are managed separately in + [repository security settings](https://github.com/PerfectPan/agent-task-loop/settings/security_analysis); + `renovate.json` does not enable them and removing `.github/dependabot.yml` only changes routine version updates. Existing `osvVulnerabilityAlerts` and `vulnerabilityAlerts.rangeStrategy: "bump"` request Renovate security fixes, which can bypass release-age and schedule limits, but OSV checks do not prove access to GitHub alerts. - Before selecting Renovate as the sole security-PR owner, verify the installation's Dependabot alerts read - permission and record a hosted run that reads repository alerts and produces the applicable fix with passing - CI. Keep any enabled Dependabot security updates in place until that evidence exists, then change the separate - security-update setting only with owner confirmation. An empty alert list alone does not prove fix coverage. + Before selecting Renovate as the sole security-PR owner, enable dependency graph and alerts, verify the + installation's Dependabot alerts read permission, and record a hosted run that reads repository alerts and + produces the applicable fix with passing CI. Keep any enabled Dependabot security updates in place until that + evidence exists, then change the separate security-update setting only with owner confirmation. An empty alert + list alone does not prove fix coverage. - **Changesets**: bot PRs carry none. Dependency updates that do not change a published package's behavior need no changeset. If a bot PR changes published behavior (for example a bundled dependency changed), the reviewer adds a @@ -170,17 +167,14 @@ Only published packages get changesets. Private workspace packages (`private: tr ## Plan Lifecycle And Retirement 1. Draft a plan from [`docs/plans/0000-template.md`](docs/plans/0000-template.md) only when triggered by the [Change Design Gate](#change-design-gate). Keep `Status: blocked` while a material scope, interface, data, or rollout decision is unresolved. -2. Review the goals, boundaries, and key decisions before implementing; update the plan if design choices change mid-flight. +2. Review the goals, boundaries, and key decisions before implementing; update an active plan mid-flight only when remaining multi-PR or multi-session work still needs re-alignment. 3. Implement within that scope, adding tests and updating current-state `docs/` in the same change. -4. Retire the plan as soon as its code scope lands on the default branch. Do not keep a completed plan in `docs/plans/` waiting on deferred manual checks or future polish. In the final delivery PR: - - Move any remaining manual verification or follow-up work to issues. - - Migrate lasting knowledge that code cannot express (invariants, ownership/trust boundaries, tradeoffs, external quirks, validation limits) into current-state `docs/` (and local `Why:` comments in code). - - Delete the completed plan file. Git history and the delivery PR keep the full execution record. +4. Retire the plan in its final delivery PR as soon as its code scope lands on the default branch; move deferred manual checks and future polish to issues rather than keeping the plan open. Follow [`docs/AGENTS.md` §4](docs/AGENTS.md#4-retiring-a-plan). 5. When the owner decides that a long-blocked, unfinished Plan should not stay active, move its scope to an issue that states the goal, the blocker, and the independent parts, link the file at a fixed commit, and delete the plan file. ## Change Design Gate -Most changes need only a clear PR description (`## Summary` and `## Validation`), not a separate document. +Most changes need only a clear PR description (`## Summary` and `## Validation`), not a separate document. Write a Plan only when upfront alignment with a human is needed before implementing. Do not write a Plan for adjustments requested during implementation or review—reflect those directly in code, durable docs, and the PR description. | Change scope | Required artifact | | ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------- | @@ -203,7 +197,7 @@ Keep unknown owners, dates, and interfaces marked "unconfirmed". A plan may make - Use `docs/plans/` for active implementation plans while non-trivial work is in flight; retire them when code lands. - Use `docs/` for durable current-state knowledge that code alone cannot express; `docs/architecture/` describes the current system shape. -Follow [`docs/README.md`](docs/README.md) when adding or reorganizing documentation. +Follow [`docs/AGENTS.md`](docs/AGENTS.md) for category placement, writing standards, and retiring plans, and list new documents in [`docs/README.md`](docs/README.md). ## Pull Request Expectations diff --git a/README.md b/README.md index a77e6ba6..8ed36856 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,21 @@ Agent Task Loop is a monorepo for AI coding agent task delivery workflows. -The core package provides a local CLI that drives tasks from assignment through execution, review, rework, and publish-ready handoff. It is an integration layer over your existing trackers rather than a system of record: tasks are read from their owning backend (Feishu Base today, GitHub Issues optionally) and writes route back to that source. The repository layout leaves room for future apps such as a website or documentation portal. +The core package provides a local CLI that drives tasks from assignment through execution, review, rework, and publish-ready handoff. It is an integration layer over your existing trackers rather than a system of record: tasks are read from their owning backend (Feishu Base today, GitHub Issues optionally) and writes route back to that source. ## Documentation -- Getting started (install, first run, common commands): [docs/getting-started.md](./docs/getting-started.md) -- Configuration reference: [docs/configuration.md](./docs/configuration.md) -- Workflow & task lifecycle (diagrams): [docs/workflow.md](./docs/workflow.md) +- Getting started (install, first run, common commands): [docs/guides/getting-started.md](./docs/guides/getting-started.md) +- Configuration reference: [docs/reference/configuration.md](./docs/reference/configuration.md) +- Workflow & task lifecycle (diagrams): [docs/guides/workflow.md](./docs/guides/workflow.md) - Architecture (packages, boundaries, subsystems): [docs/architecture/overview.md](./docs/architecture/overview.md) ## Monorepo Layout -- `packages/agent-task-loop`: CLI package and task loop runtime +- `packages/agent-task-loop`: CLI package, task loop runtime, and Rivus Task Manager Plugin +- `packages/agent-finder-cli`: local coding-agent discovery and session browser CLI (`@rivus/agent-finder-cli`, MIT) +- `packages/agent-room`: internal Room collaboration protocol package (`@rivus/agent-room`) +- `apps/room-web`: local multi-agent collaboration workspace and read-only task board (React Router) - `apps/web`: marketing/landing site (Next.js) ## Workspace Commands @@ -37,10 +40,9 @@ Tools and libraries use MIT; applications use GPL-3.0-only. See [CONTRIBUTING.md - Contribution workflow: [CONTRIBUTING.md](./CONTRIBUTING.md) - Agent guidelines: [AGENTS.md](./AGENTS.md) -- Workflow & task lifecycle (diagrams): [docs/workflow.md](./docs/workflow.md) - Active plans: [docs/plans/](./docs/plans/) - Documentation map: [docs/README.md](./docs/README.md) -- npm publishing: [docs/npm-publish.md](./docs/npm-publish.md) +- npm publishing: [docs/development/npm-publish.md](./docs/development/npm-publish.md) ## Local CLI diff --git a/apps/room-web/.impeccable/surfaces/apps-room-web-app-routes-room-roomid-tsx.md b/apps/room-web/.impeccable/surfaces/apps-room-web-app-routes-room-roomid-tsx.md deleted file mode 100644 index 3e4a75bd..00000000 --- a/apps/room-web/.impeccable/surfaces/apps-room-web-app-routes-room-roomid-tsx.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -version: 1 -slug: 'apps-room-web-app-routes-room-roomid-tsx' -primary_target: 'apps/room-web/app/routes/room.$roomId.tsx' -related_targets: ['apps/room-web/app/routes/room._index.tsx', 'apps/room-web/app/routes/room.agents.tsx'] ---- - -# Room surface (room.$roomId, room._index, room.agents) - -Mode: Operate. One person, several local agents, one shared stream. The task is to keep talking while replies arrive one at a time over 30–120 s each. - -Audience/job: developer at their own machine, often late at night. Job: say something, watch who answers, know who is up next and how long this one has taken, keep going. - -Constraints: no task UI this round (no 升级为任务, task composer, Task gate banner, board nav). No fake controls: no stop-round, no per-agent retry unless a HELD draft exists. HELD draft text never enters the 房间对话 region. Human is 「你」. Copy follows `.tmp-bin/rivus-copy.txt` §1 and §7. - -Unresolved: none blocking. Avatars are two-letter monograms on a tinted disc (no image generation available; third-party anime art not sourceable/licensable). - -## Direction contract - -THESIS: A working stream, not a chat bubble app. The centre column is the stream; the left rail and right column are chrome that reads as chrome. It refuses the category default (cream paper, photo wash, mascot, rounded bubbles, "thinking…" dots) and the other default (dark neon terminal). - -OWN-WORLD: 宣纸 — warm white paper, written in shadcn's token vocabulary. The values are the comp's; the names are shadcn's, and the controls are shadcn components from `app/components/ui` (new-york, neutral, cssVariables, phosphor icons, per components.json). The page is a sheet and the text is the subject. The rails are --sidebar (#f7f7f5 / #202020), one step darker than --background (#ffffff / #191919) and told apart from it by a single 1px --sidebar-border (#e9e9e7 / #2f2f2f), not by a field of colour; the centre is the paper itself. There is no solid field of colour anywhere, no stacked shadows, and exactly one object that floats: the composer card, which carries the single --shadow-card value and takes the focus ring as a whole block because the card is the field. Three mappings carry the world: --chart-1…5 are the members' identity colours, each drawn at random when that member's row is created and stored on it, colouring the author name and the two capitals in a shadcn Avatar whose fill is that hue at 15%, so identity rides shadcn's own categorical ramp instead of a set of invented --id-* names; --accent (#efefec / #2a2a2a) is the hover and selected fill, the solid equivalent of the 8% ink wash the previous round used, so rows read as text with a tint behind them rather than as filled chips; and --info / --warning / --success / --destructive-soft are four added pairs written the way shadcn writes its own — the token is the wash, -foreground is the ink on it — so a state pill is exactly `bg-warning text-warning-foreground` and one Badge variant name settles a state's whole appearance. --destructive keeps shadcn's meaning, the solid red under white text on 确认清空; the soft error wash is the separate --destructive-soft. One accent, blue #1a6fd1 / #529cca, carries links, @-mentions, the focus ring, the brand mark and the primary button. The middle grey the previous round called --ink-2 has no shadcn counterpart and is written as foreground/75; muted-foreground is the lightest colour allowed to be text and muted-foreground/60 is decoration only. Two self-hosted faces on one boundary: Inter carries every interface word and Noto Serif SC carries the prose — message bodies, the composer's editable area, the held-draft preview and the empty state — at 16px/1.7, because a serif needs more leading than a sans and because a long reply should read like an article while the labels around it still read like an interface. Both are sliced by unicode-range and swap rather than block, so the CJK the page actually uses is the only CJK it downloads. ui-monospace for timers and ids with Tailwind's built-in tabular-nums. Type steps 12 / 13 / 14 / 16 / 24, with 18 allowed once for the empty-state title and 11/10 for the mark letters; section labels are 12px/500 Chinese, never uppercase and never tracked out. Radius derives from shadcn's --radius: 0.5rem, and its three steps land exactly on the comp's — rounded-sm 4px on controls and pills, rounded-md 6px on rows and menu items, rounded-lg 8px on the things that float. Marks are 30px in the thread, 22px in lists, 36px on the desk. Below 1180px the members column stops being a grid column and becomes a shadcn Sheet on the --sidebar fill behind a foreground/20 scrim (not shadcn's black/50, which is a foreign object on this palette); only one of the two is ever mounted, chosen by matchMedia, so the document never holds a second copy of the panel's ids. Contrast was re-measured over both families shadcn cares about — every / -foreground pair, and every text token against every surface it actually lands on in both themes, with /75, /15 and /10 composited first: 134 pairs, minimum 4.53:1. The composer is a Tiptap editor whose schema is only Document > Paragraph+ > (Text | Mention | HardBreak): a mention is one object you delete in one keystroke and select as a chip, rendered with the member's own --chart-N at 15%, identical whether it is still being written or already posted — and it still leaves as the string `@codex`, so the server's parser is untouched. The theme is a `dark` class on , shadcn's convention: the rail footer cycles follow-system / light / dark, and because there is no prefers-color-scheme query left in the CSS, follow-system resolves the query in JS and restamps the class when the system flips. - -STORY: the visitor sees who is talking and for how long, who is behind them, whose draft is waiting and whose run failed, and understands that typing now is always allowed and only affects order. They act by sending, @-ing one member, waking a held draft, or checking connections. - -FIRST VIEWPORT: three columns 240 / fluid / 300. Left: wordmark, nav (房间, 智能体), room list, footer line. Centre: header row with room title and one status sentence (N 位成员 · 轮到 X,后面还有 M 位), 管理成员 button; the thread; a run strip (member order as a step row, done filled, now lit with elapsed timer, queued outlined); the composer with a one-line hint and 发送. Right: 成员 with the same five states as the thread (held draft text and its one action 读取更新并重答 live here and nowhere else; the thread row for a held member is status only), then 检查连接. The room facts line the prototype put at the top of this column is deliberately dropped: the header already carries title, member count, goal and the round sentence, and a repeated title under a kicker is the eyebrow pattern the craft floor bans. Below 1180 px the right column leaves the grid and becomes a shadcn Sheet, min(320px,100%) on the sidebar fill with the card shadow behind a foreground/20 scrim; below 820 px the rail becomes a top bar. - -FORM: user-pinned. The visual world was fixed by the user picking comp B (宣纸) out of three (scratchpad rivus-comps.html); the earlier 两岸 direction it replaces came from seven prototype rounds. Seed key dd3ee4c7 (assigned index 4) acknowledged; the pinned direction beats the roll. Raise taken from the dealt hand: the drum-machine step row's discipline that "the chase light always tells you where now is" is carried by the run strip; the centre-rail setting's discipline that states are printed marks (outline / filled / struck) is carried by the queue dots and member dots. - -FINISH: unreviewed and undocumented is unfinished; this build ends with the finish review, the verdict, DESIGN.md, and every shipping raster carrying its provenance. diff --git a/apps/room-web/DESIGN.md b/apps/room-web/DESIGN.md index d0007d21..213f3743 100644 --- a/apps/room-web/DESIGN.md +++ b/apps/room-web/DESIGN.md @@ -245,15 +245,11 @@ components: borderColor: '{colors.input}' textColor: '{colors.sidebar-foreground}' width: 'min(320px, 100%)' - count-off-block: - backgroundColor: '{colors.sidebar-accent}' - rounded: '{rounded.lg}' - padding: '10px' --- # Design System: Rivus room-web -本文件由已上线的代码反推得出,不是设计意图的记录。Token 的唯一来源是 `app/styles/global.css`,组件来自 `app/components/ui/*`(shadcn new-york,`components.json` 记录了配置),状态与文案的映射在 `agent-status.ts` 和 `round.ts`。前置 YAML 里的值是规范值(亮色主题);正文只解释它们放在哪、为什么。 +本文件由已上线的代码反推得出,不是设计意图的记录。Token 的唯一来源是 `app/styles/global.css`,组件来自 `app/components/ui/*`(shadcn new-york,`components.json` 记录了配置),状态与文案的映射在 `app/room-lab/copy.ts` 和 `app/room-lab/presentation/agent-status.ts`。前置 YAML 里的值是规范值(亮色主题);正文只解释它们放在哪、为什么。 ## Overview @@ -279,7 +275,7 @@ components: - 唯一浮起的物件是输入卡片;菜单、抽屉、新消息胶囊共用同一个 `shadow-card`,没有第二个阴影值。 - 一个强调色(`primary`)管交互,四对状态色以药丸形态管「现在怎么了」,五个 `chart-*` 只管头像与作者名。 - 头像是 shadcn 的 `Avatar`:`bg-chart-N/15` 的淡染底 + 两个大写字母,字母在自己的底上清 4.5:1。 -- 状态是印出来的记号:空心 = 排队中,实心 = 已回复,亮色实心 + 计时 = 生成中。 +- 状态是印出来的记号:静止实心绿点 = 在场 / 已发言 / 未发言,脉冲蓝点 + 计时 = 阅读中 / 工作中,红色实心点 = 超时 / 失败。 - 界面上没有后端不存在的动作:没有「停下这一轮」,没有对失败成员的单独重试。 ## Colors @@ -292,11 +288,11 @@ components: | ---------------- | --------------------- | ------------------------------------------------- | | `background` | `#ffffff` / `#191919` | body、对话流、创建页与错误页、智能体页 | | `card` | `#ffffff` / `#252525` | 输入卡片、新建房间表单、智能体页的卡片 | -| `popover` | `#ffffff` / `#252525` | 房间菜单、提及菜单、跳转链接、草稿预览 | +| `popover` | `#ffffff` / `#252525` | 房间菜单、提及菜单、跳转链接 | | `sidebar` | `#f7f7f5` / `#202020` | 左栏、右栏、≤1180 的成员抽屉 | | `muted` | `#f7f7f5` / `#202020` | 与 `secondary` 同值;`/board` 与 `/task` 的卡片底 | | `accent` | `#efefec` / `#2a2a2a` | 中栏的悬停与选中底 | -| `sidebar-accent` | `#ebebe8` / `#2a2a2a` | 栏里的悬停、当前项、报数记录块 | +| `sidebar-accent` | `#ebebe8` / `#2a2a2a` | 栏里的悬停与当前项 | 两档发丝线:`border` 画栏与栏之间和同栏内部的分隔,`input` 画控件边和卡片边。`sidebar-border` 与 `border` 同值,分开定义是为了让栏可以单独调。 @@ -306,7 +302,7 @@ components: - **`foreground`**(`#37352f` / `#d4d4d4`):标题、消息正文、成员 id、输入内容、人的头像底。 - **`foreground/75`**:副标题、说明段、次要按钮文字、导航项静止态。它替代上一轮的 `--ink-2`;不另开 token,因为 shadcn 词表里没有中间灰这一档,而半透明在任何表面上都成立。最差 5.07 / 5.22。 -- **`muted-foreground`**(`#676664` / `#9e9e9e`):节标签、时间戳、元信息、占位符、排队中的文字、「已回复」的状态词。**它是允许作为文字的最浅一档**,最差 4.80 / 4.55(落在 `sidebar-accent` 上)。 +- **`muted-foreground`**(`#676664` / `#9e9e9e`):节标签、时间戳、元信息、占位符、「在场 / 已发言 / 未发言」的状态词。**它是允许作为文字的最浅一档**,最差 4.80 / 4.55(落在 `sidebar-accent` 上)。 - **`muted-foreground/60`**:**只做装饰**——禁用态、空心圆点。任何情况下都不能当文字色,它不在对比度表里(在纸上只有 2.52 / 3.19)。 ### 强调与状态 @@ -315,12 +311,12 @@ components: - **`destructive`**(`#b0322d` / `#e88080`):错误文字、发送失败外框、「确认清空」的实色底(配 `destructive-foreground`)。 - 四对状态洗底: -| 对 | 墨(浅 / 深) | 洗底(浅 / 深) | 用在 | -| ------------------ | --------------------- | --------------------- | ------------------------------------------------------------------------------------------ | -| `info` | `#2b6c92` / `#7fb6dc` | `#e7f3f8` / `#1c2b35` | 生成中:脉冲点、页头「当前 X」、发言顺序条亮项、报数「回复中」;Badge `info` 标 CLI 可运行 | -| `warning` | `#8a5a10` / `#d9a94a` | `#fbeedc` / `#33290f` | 草稿待更新:时间线药丸、成员栏草稿块与其按钮 | -| `success` | `#3d7a56` / `#6fb58b` | `#ebf6f1` / `#1c2f25` | 静止状态的实心点。洗底目前只作为 Badge `success` 变体存在,房间界面未用到 | -| `destructive-soft` | `#b0322d` / `#e88080` | `#fbe4e4` / `#3a1f1f` | 错误横幅、成员错误块、时间线错误药丸、报数「回复失败」 | +| 对 | 墨(浅 / 深) | 洗底(浅 / 深) | 用在 | +| ------------------ | --------------------- | --------------------- | ---------------------------------------------------------------------------- | +| `info` | `#2b6c92` / `#7fb6dc` | `#e7f3f8` / `#1c2b35` | 运行中(阅读中 / 工作中):脉冲点与运行中状态字色;Badge `info` 标「可入座」 | +| `warning` | `#8a5a10` / `#d9a94a` | `#fbeedc` / `#33290f` | Badge `warning` 标智能体探测「待登录」 | +| `success` | `#3d7a56` / `#6fb58b` | `#ebf6f1` / `#1c2f25` | 静止状态的实心点;Badge `success` 标「已入座」 | +| `destructive-soft` | `#b0322d` / `#e88080` | `#fbe4e4` / `#3a1f1f` | 错误横幅、时间线错误药丸 | ### 身份色 @@ -368,8 +364,8 @@ components: | token | 字 | 用在 | | -------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | | `--font-sans` | `Inter, -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif` | 除正文外的一切:标题、作者名、时间、按钮、导航、节标签、药丸、提示行、提及胶囊 | -| `--font-serif` | `"Noto Serif SC", "Songti SC", "STSong", Georgia, serif` | 消息正文、输入框编辑区、右栏草稿预览、空状态那句说明 | -| `--font-mono` | `ui-monospace, "SF Mono", Menlo, Consolas, monospace` | 数字要对齐的地方:计时器、用时、报数序号、命令行路径、提及菜单的 `↵` | +| `--font-serif` | `"Noto Serif SC", "Songti SC", "STSong", Georgia, serif` | 消息正文、输入框编辑区、空状态那句说明 | +| `--font-mono` | `ui-monospace, "SF Mono", Menlo, Consolas, monospace` | 数字要对齐的地方:计时器、命令行路径、提及菜单的 `↵` | 宋体正文 16px / **1.7**(黑体是 1.65:宋体笔画细、字面小,多给一点行距才不挤)。两款字都自托管,来自 `@fontsource/inter`(400 / 500 / 600 / 700)和 `@fontsource/noto-serif-sc`(400 / 600),在 `global.css` 顶部 `@import`。 @@ -384,18 +380,18 @@ components: - **Body**(宋体,400,16px,1.7,66ch):消息正文与输入卡片的编辑区。 - **Name**(600,14px):消息作者名,颜色取 `chart-N`;人的一方取 `foreground`。 - **Secondary**(400,14px):页头副标题、导航项、房间列表项标题、成员栏里的 id、说明段、按钮文字(500)、字段内容。 -- **Pill**(400,13px):状态药丸、成员栏里的草稿块与错误块。 -- **Label**(500,12px,`muted-foreground`):节标签「房间」「成员 · 5」「检查连接」「可加入」。中文,不大写、不拉字距。 +- **Pill**(400,13px):状态药丸与错误块。 +- **Label**(500,12px,`muted-foreground`):节标签「房间」「成员 · 5」「可加入」。中文,不大写、不拉字距。 - **Meta**(400,12px):时间戳、计时器、状态词、文字动作、页脚、房间列表元信息、输入框下的提示、角色词、序号、Badge。 - **Mark / Mark-sm**(600,11px / 10px,0.02em):`AvatarFallback` 里的两个字母。 - **Chip / Chip-mark**(600,15px / 8px):提及胶囊的名字,和胶囊前面那颗 14px 圆点里的两个字母。胶囊永远是黑体,即使它落在宋体正文里——它是一个界面对象,不是一句话的一部分。 -- **Mono**(等宽栈,12px 或继承,`tabular-nums`):计时 `0:47`、用时 `1:04`、报数序号、`PATH` 命令与版本。 +- **Mono**(等宽栈,12px 或继承,`tabular-nums`):计时 `0:47`、`PATH` 命令与版本。 ### Named Rules **The Tabular Clock Rule.** 会随时间跳动或会在一列里对齐的数字一律 `tabular-nums`(Tailwind 内置,不再自造 `.tnum`);正在走的计时器同时切 `font-mono`,让宽度不抖。 -**The Serif Is For Sentences Rule.** 宋体只给成段的句子:消息正文、正在写的那条、草稿预览、空状态的那句解释。凡是标签、按钮、状态词、时间、数字——只要它是界面在说话而不是人在说话——都是黑体。判断标准和文案纪律的第一条是同一条:这句话是读的,还是点的。 +**The Serif Is For Sentences Rule.** 宋体只给成段的句子:消息正文、正在写的那条、空状态的那句解释。凡是标签、按钮、状态词、时间、数字——只要它是界面在说话而不是人在说话——都是黑体。判断标准和文案纪律的第一条是同一条:这句话是读的,还是点的。 **The m:ss Rule.** 时长只用 `分:秒` 一种写法(`formatElapsed`:47 → `0:47`,125 → `2:05`)。已完成的回复写「用时 1:04」,不写「耗时」。 @@ -405,7 +401,7 @@ components: **三栏网格**(`RoomWorkspace`):`240px / minmax(0,1fr) / 300px`,高 `100dvh`,最小高 420px,`html` 最小宽 320px。左栏 `nav` 与右栏 `aside` 是 `sidebar` 底,各自贴一根 `sidebar-border` 边朝向中间;中栏 `main` 是 `background`。中栏内部分为页头、时间线(唯一伸缩区)、发言顺序条、输入卡片四段,后三段始终贴底。右栏的滚动交给 shadcn 的 `ScrollArea`。 -**圆角**由 shadcn 的 `--radius: 0.5rem` 派生,三档正好是宣纸要的三档:`rounded-sm` 4px(按钮、输入、药丸、Badge)、`rounded-md` 6px(导航项、房间项、成员行、菜单项)、`rounded-lg` 8px(输入卡片、菜单、草稿块、报数记录块、抽屉里的卡片)。 +**圆角**由 shadcn 的 `--radius: 0.5rem` 派生,三档正好是宣纸要的三档:`rounded-sm` 4px(按钮、输入、药丸、Badge)、`rounded-md` 6px(导航项、房间项、成员行、菜单项)、`rounded-lg` 8px(输入卡片、菜单、抽屉里的卡片)。 **节奏**:4 / 8 / 12 / 14 / 22 / 28。 @@ -423,11 +419,11 @@ components: **响应式**: -| 断点 | 变化 | -| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| ≤ 1180px | 右栏不再是网格里的一列,改由 shadcn 的 `Sheet`(`side="right"`,`min(320px,100%)`,`sidebar` 底)承担。两者只挂载一个:`RoomContext` 用 `matchMedia('(max-width: 1180px)')` 选择,所以文档里不会出现第二份面板 id 或第二个「读取更新并重答」。服务端渲染的是并排那一列,切换发生在 hydration 之后。页头出现「成员」按钮把抽屉拉出来。遮罩是 `foreground/20`,不是 shadcn 默认的 `black/50`——这套配色里不放纯黑。 | -| ≤ 820px | 网格变单列两行,左栏变成横向顶栏:项目横排、可横向滚动、右边框改成底边框;节标签「房间」、房间的元信息、页脚隐藏;新建房间表单固定 260px 宽。 | -| ≤ 720px(仅智能体页) | 左列表 / 右表单的两栏变单栏。 | +| 断点 | 变化 | +| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ≤ 1180px | 右栏不再是网格里的一列,改由 shadcn 的 `Sheet`(`side="right"`,`min(320px,100%)`,`sidebar` 底)承担。两者只挂载一个:`RoomContext` 用 `matchMedia('(max-width: 1180px)')` 选择,避免文档中出现重复的面板 id。服务端渲染的是并排那一列,切换发生在 hydration 之后。页头出现「成员」按钮把抽屉拉出来。遮罩是 `foreground/20`,不是 shadcn 默认的 `black/50`——这套配色里不放纯黑。 | +| ≤ 640px | 网格变单列两行,左栏变成横向顶栏:项目横排、可横向滚动、右边框改成底边框;节标签「房间」、房间的元信息、页脚隐藏;新建房间表单固定 260px 宽。 | +| ≤ 720px(仅智能体页) | 左列表 / 右表单的两栏变单栏。 | ### Named Rules @@ -463,16 +459,16 @@ components: 标准 variant(`default` / `outline` / `ghost` / `secondary` / `destructive` / `link`)与 size(`default` 30px / `sm` 26px / `xs` 24px / `icon` 30px / `icon-sm` 28px / `icon-xs` 24px)。 - **default**:`primary` 底 `primary-foreground` 字,hover `primary/90`,无内高光。用于「发送」(卡片里 28px)「保存」「创建房间」「新消息」。 -- **outline**:透明底 `input` 边 `foreground/75` 字,hover `accent`。用于「管理成员」「成员」「返回房间」「重新扫描」「读取更新并重答」(配 `warning-foreground` 的边与字)和 `CrewComposer` 的三个图标按钮。 -- **ghost**:无边,hover `accent`。用于「新建」「取消」「编辑」「完成」「开始报数」「主题:…」「@ 提及」和三点菜单的触发器。 +- **outline**:透明底 `input` 边 `foreground/75` 字,hover `accent`。用于「管理成员」「成员」「返回房间」「重新扫描」和 `CrewComposer` 的三个图标按钮。 +- **ghost**:无边,hover `accent`。用于「新建」「取消」「编辑」「完成」「主题:…」「@ 提及」和三点菜单的触发器。 - **destructive**:`destructive` 底 `destructive-foreground` 字。只用在「确认清空」。 - `destructive` 取 `destructive-foreground` 而不是 registry 写死的 `text-white`:暗色下 `destructive` 是一抹亮红,白字在上面读不了。 ### Badge -4px 圆角,`px-2 py-0.5`,12px / 500。变体:`muted`(`accent` 底 + `muted-foreground`,标 CLI 未安装)、`info`(可运行)、`warning`、`success`、`destructive-soft`,加上 registry 自带的 `default` / `secondary` / `destructive` / `outline` / `ghost` / `link`。 +4px 圆角,`px-2 py-0.5`,12px / 500。变体:`muted`(`accent` 底 + `muted-foreground`,标「缺失」)、`warning`(待登录)、`info`(可入座)、`success`(已入座)、`destructive-soft`,加上 registry 自带的 `default` / `secondary` / `destructive` / `outline` / `ghost` / `link`。 -**状态药丸**也是 `Badge`:时间线里 held 的那一行是 `variant="warning"`,error 的那一块是 `variant="destructive-soft"`,外加一个 `statePill` 类把它拉到宣纸的药丸尺寸(13px、`px-2.5 py-[5px]`)、允许换行、并在网格列里铺满宽度(stock Badge 是 `w-fit`)。 +**状态药丸**也是 `Badge`:错误横幅与提示使用 `variant="destructive-soft"`,外加 `statePill` 类把它拉到宣纸的药丸尺寸(13px、`px-2.5 py-[5px]`)、允许换行、并在网格列里铺满宽度(stock Badge 是 `w-fit`)。 ### DropdownMenu(房间菜单) @@ -539,47 +535,43 @@ components: `copy.test.ts` 守两件事:用几条正则守每组的语法,所以口语状态词(「说完了」)或者写成句子的标签回不来;再扫一遍房间面的全部源码,只要还有中文字面量就失败并报出文件和行号。 -| 组 | 读法 | 语法 | 例 | -| -------------- | -------------------------------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------- | -| `status` | 扫:在列表里和圆点、数字并排 | 名词短语,只有四种构词:**已X · X中 · 待X · X失败**(加裸状态「在场」「等待」) | 已回复 · 生成中 · 排队中 · 草稿待更新 · 运行失败 · 已读未答 | -| `action` | 做:按钮、菜单项 | 动词短语,不带句号 | 发送 · 创建房间 · 读取更新并重答 · 开始报数 | -| `availability` | 认:按领域状态取键的标签,映射保持穷尽 | 名词 | 可运行 · 未安装 | -| `label` | 认:节标题、导航、表单标签、占位 | 名词,不带句号 | 成员 · 5 · 检查连接 · 房间名 | -| `say` | 懂:说明、空状态、错误、页头那一句 | 完整陈述句:事实 + 下一步 | 发送失败,内容已保留在输入框 | +| 组 | 读法 | 语法 | 例 | +| -------------- | -------------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------ | +| `status` | 扫:在列表里和圆点、数字并排 | 名词短语,构词遵循 `copy.test.ts` 规则(如已X · X中 · 待X · 裸状态) | 在场 · 阅读中 · 工作中 · 已发言 · 未发言 · 超时 · 失败 | +| `action` | 做:按钮、菜单项 | 动词短语,不带句号 | 发送 · 创建房间 · 管理成员 · 重新扫描 | +| `availability` | 认:按领域状态取键的标签,映射保持穷尽 | 名词 | 缺失 · 待登录 · 可入座 · 已入座 | +| `label` | 认:节标题、导航、表单标签、占位 | 名词,不带句号 | 成员 · 5 · 房间名 · 唤醒 · 逐个运行 | +| `say` | 懂:说明、空状态、错误、页头那一句 | 完整陈述句:事实 + 下一步 | 发送失败,内容已保留在输入框 | 判断一个字串属于哪组很机械:会和别的字串并排出现的,是 `status` 或 `label`;点了会发生事的,是 `action`;其余是 `say`。 read model 的状态词永远不上屏,经 `agentStatusLabels` 翻译成 `copy.status`: -| 状态 | 上屏文案 | tone | 点 / 字色 | -| ------------------ | ---------------------------------------- | ----- | ------------------------------------------- | -| idle | 在场 | quiet | `success-foreground` / `muted-foreground` | -| running | 生成中 | run | `info-foreground` / `info-foreground` | -| completed / posted | 已回复 | quiet | `success-foreground` / `muted-foreground` | -| held | 草稿待更新 | held | `warning-foreground` / `warning-foreground` | -| silent | 已读未答 | quiet | `success-foreground` / `muted-foreground` | -| error | 运行失败 | err | `destructive` / `destructive` | -| (派生)queued | 排队中 | — | 空心环 / `muted-foreground` | -| 报数每行 | 已回复 · #seq / 回复中 / 回复失败 / 等待 | | | - -页头那一句也是名词形式,好和成员栏并排读:「当前 codex · 待回复 2 位」「当前 dsh · 最后一位」「dsh 即将开始」。 +| 状态 | 上屏文案 | tone | 点 / 字色 | +| --------- | -------- | ----- | ----------------------------------------- | +| `present` | 在场 | quiet | `success-foreground` / `muted-foreground` | +| `reading` | 阅读中 | run | `info-foreground` / `info-foreground` | +| `working` | 工作中 | run | `info-foreground` / `info-foreground` | +| `posted` | 已发言 | quiet | `success-foreground` / `muted-foreground` | +| `passed` | 未发言 | quiet | `success-foreground` / `muted-foreground` | +| `timeout` | 超时 | err | `destructive` / `destructive` | +| `failed` | 失败 | err | `destructive` / `destructive` | 确认过的文案纪律: 1. **一个判断标准**:这个词,使用者在界面之外还会不会碰到?会,就必须用同一个词(agent 的 id 原样英文);不会,就是实现细节漏上来了。这条只管**用哪个词**,不管语气。 2. **语气中性**:操作型界面没有人格,读的人在看一台机器的状态。个性只允许出现在空状态那一句里。 3. **人叫「你」**,产品叫 Rivus,房间叫「房间」。 -4. **等待要有数字**:生成中 = 脉冲点 + 真在走的计时器;已回复 = 「用时 1:04」。 -5. **HELD 草稿不是已发出的事实**:草稿正文只能出现在成员栏的「查看草稿」里。 +4. **等待要有数字**:阅读中 / 工作中 = 脉冲点 + 真在走的计时器。 +5. **HELD 留在协议层**:`HELD` 在回合内重读解决,不暴露在房间对话或成员状态界面。 6. **没有假控件**:后端没有 stop,界面就没有「停下这一轮」。 7. **空状态要教会界面**,不写「暂无」。 -8. **模板不写死数据**:人数、顺序、用时全部来自 read model。 -9. **不隐瞒代价和不确定**:「在场不代表连接可用」。 +8. **模板不写死数据**:人数、顺序、计时全部来自 read model。 ## Motion - **颜色过渡**:可交互元素 `transition-colors` / `transition-[color,box-shadow]`,150ms。没有位移、缩放或阴影的过渡;shadcn 组件里的 `slide-in` / `zoom-in` 已删除。 -- **唯一的动画**:`animate-pulse-soft`(`@theme` 里的 `--animate-pulse-soft`,`rivus-pulse 1.4s ease-in-out infinite`,透明度 1 → 0.25 → 1)。只用在「生成中」的状态点上。它旁边必须有真在走的计时器。 +- **唯一的动画**:`animate-pulse-soft`(`@theme` 里的 `--animate-pulse-soft`,`rivus-pulse 1.4s ease-in-out infinite`,透明度 1 → 0.25 → 1)。只用在「阅读中 / 工作中」的状态点上。它旁边必须有真在走的计时器。 - **减少动效**:`prefers-reduced-motion: reduce` 时所有动画取消、所有 `transition-duration` 归零。 ## `/board` 与 `/task` @@ -625,7 +617,7 @@ read model 的状态词永远不上屏,经 `agentStatusLabels` 翻译成 `copy - **Don't** 用方形头像、SVG 符号头像、位图头像。 - **Don't** 在阶梯(12 / 13 / 14 / 16 / 24)之外造字号;18px 只留给空状态标题,10 / 11px 只留给头像字母。 - **Don't** 放后端没有的动作:没有「停下这一轮」,没有对失败成员的「重试这一位」,没有看板导航。 -- **Don't** 让 read model 的词(idle / running / held / posted / seat)出现在界面上。 +- **Don't** 让 read model 的词(present / reading / working / posted / passed / timeout / failed / seat)出现在界面上。 - **Don't** 给输入框加标题、列表、加粗或附件按钮:schema 里没有的东西,工具栏上也不该有。 - **Don't** 用文档里的字符数当字数上限——服务端量的是序列化之后那一串。 - **Don't** 在编辑区之外的地方用宋体,也不要让胶囊跟着正文变成宋体。 diff --git a/apps/room-web/PRODUCT.md b/apps/room-web/PRODUCT.md index 0deedda9..da5e9c32 100644 --- a/apps/room-web/PRODUCT.md +++ b/apps/room-web/PRODUCT.md @@ -9,59 +9,56 @@ web ## Users 一个人,在自己的电脑上,同时使唤好几个本地编码 agent。装了哪几位由使用者的机器决定,不由产品决定。 -典型场景是深夜独自工作:开一间房,把问题说一遍,让在场的 agent 依次接话,看谁说得对、谁被挡住了、谁没跑起来,然后接着说。 +典型场景是深夜独自工作:开一间房,把问题说一遍,让在场的 agent 在同一条对话流里各自阅读、工作、发言或保持沉默,然后接着说。 使用者是开发者,懂 CLI 和 git,但不想在界面里读到系统内部的词。 ## Product Purpose -Rivus room-web 是本地多 agent 的聊天室。一句话发给房间,在场成员按既定顺序逐个回复,所有人读写同一条对话流。 +Rivus room-web 是本地多 agent 的聊天室。一句话发给房间,所有成员读写同一条对话流,通过 Room MCP 工具(`room_speak`、`room_read`、`room_dm`)发言或私聊。 它存在的理由是把「多个 CLI 各自开一个终端来回粘贴」变成一条时间线。 -成功的样子:使用者随时知道现在轮到谁、后面还有谁、这一位已经等了多久、谁的回复被挡住了或失败了,并且永远能继续往下说。 +成功的样子:使用者随时知道谁正在阅读或工作、已经跑了多久、谁发言了或沉默了、谁超时或失败了,并且永远能继续往下说。 ## Positioning -顺序发言是产品机制,不是限制:每个 agent 回复前必须读到它上次没读过的所有消息,读到一半有人插话就先「挡住」(HELD),重读后再答。 +Room 协议保证共享事实的一致性:每个 agent 发言前必须读到自己未读的最新消息,并发写入若落后于最新序号会在回合内被 `HELD`,重读后再决定发言或放弃(`HELD` 不暴露在对话界面上)。 邻近产品把多个模型并排放,各答各的;这里所有人在同一条流里接话,后说的人看得见先说的人。 ## Operating Context -- 全部本地:服务只绑 127.0.0.1,房间存在本机 sqlite,agent 通过本机已登录的 CLI 调用。没有账号、没有云端。 -- 一轮回复常常要 30 到 120 秒,五位成员依次说完可能几分钟。使用者在等待里最需要的是「谁在说、说了多久、后面还有谁」。 -- 消息可以 @ 单独一位;不 @ 则所有在场成员按成员顺序依次回复。发言中途再发消息会排到这一轮后面,不会被拒绝。 -- 成员顺序可以调整,也是「检查连接」时的报数顺序。 -- 智能体页面维护每位 agent 的常驻系统提示,所有房间共用,存在本机。 -- 每位 agent 是 rooms.sqlite 里 agents 表的一行:id、显示名、角色词、一条 shell 命令、建行时随机分到并存下的身份色、以及这一位的系统提示。产品不区分「内建」和「自定义」,代码里也没有任何一位 agent 的名字。 -- 行为指令属于 agent 自己:房间的提示词只给房间事实(你是谁、这间房有几位、说过什么),「要具体简洁」「先读完再答」这类要求写在各自的系统提示里,可以逐位改。改完下一轮生效,不用重启。 +- 全部本地:服务只绑 `127.0.0.1`,房间存在本机 `~/.rivus/room-web/v1/rooms.sqlite`(成员 lease 存在同目录 `member-leases.sqlite`),agent 通过本机已登录的 ACP 适配器调用。没有账号、没有云端。 +- 单回合默认超时 10 分钟,可按智能体行配置更短的 `timeoutMs`。使用者在等待里最需要的是「谁在读/工作、跑了多久」。 +- 房间默认广播唤醒(`wake = broadcast`),也可切换为仅唤醒被提及成员(`addressed`)或开启逐个运行(`serial`)。消息可以 `@` 单独一位或 `@all`;发言中途再发消息不会被拒绝。 +- 成员顺序可以调整;开启「逐个运行」时按此顺序依次运行。 +- 智能体页面维护每位 agent 的配置与常驻系统提示,所有房间共用,存在本机。 +- 每位 agent 是 `rooms.sqlite` 里 `agents` 表的一行:id、显示名、角色词、ACP 命令、建行时随机分到并存下的身份色、可选 `timeout_ms` 以及系统提示。产品不区分「内建」和「自定义」,首次打开时预置 `claude-agent-acp`、`codex-acp` 和 `opencode acp`。 +- 行为指令属于 agent 自己:房间的提示词只给房间事实(你是谁、这间房有几位、说过什么),具体风格要求写在各自的系统提示里,改完下一轮生效,不用重启。 ## Capabilities and Constraints -- 已有动作:发消息、@ 提及(含自动补全)、管理成员(增删排序)、检查连接(按顺序报数验证每个 CLI 能读写对话)、读取更新并重答(HELD 草稿重试,最多 3 次追平)、清空对话(保留房间)、新建房间、切换房间。 -- 添加一位 agent 现阶段靠手写 INSERT(见 README),界面上还没有;智能体页的「重新扫描」会重读 agents 表并重新探测每条命令。 +- 已有动作:发消息、`@` 提及(含自动补全)、管理成员(增删排序)、房间设置(唤醒模式、逐个运行、工作目录)、查看并参与成员间私聊子房间(`room_dm`)、清空对话(保留房间)、新建房间、切换房间、在智能体页新增/编辑 agent 与重新扫描探测。 - 没有的动作:停止正在进行的一轮;对失败的回复单独重试(只能再发一条消息)。界面不得放这些假控件。 -- 成员状态词表(read model):idle、running、completed、posted、held、silent、error。界面文案按 `.tmp-bin/rivus-copy.txt` 的判定标准翻译,不直接露出这些词。 -- HELD 草稿不是已发出的事实,不得出现在「房间对话」区域正文里;它属于成员状态,重试动作是重读新消息后重答,不是原样发出。 -- 「用时」在回复完成后才有(latencyMs);进行中的耗时服务端不记录,界面只能从客户端观察到 running 起计时,误差约 1 秒。 -- 本轮不引入 task:房间里不出现「升级为任务」、任务模式输入、Task 约束提示、任务看板导航。`/board`、`/task/:id` 路由代码保留但不在导航里出现。 +- 成员状态词表(`app/room-lab/read-model.ts`):`present`、`reading`、`working`、`posted`、`passed`、`timeout`、`failed`。界面文案统一由 `app/room-lab/copy.ts` 与 `app/room-lab/presentation/agent-status.ts` 映射,不直接露出内部词。 +- `HELD` 属于协议层回合内冲突解决,不进入「房间对话」正文,也不向人展示。 +- 界面保留只读任务看板路由 `/board` 与 `/task/:id`(通过 `@rivus/agent-task-loop/task-management` 读取),暂不放入房间导航。 - 人的一方在界面里叫「你」。 -- 面向中文使用者;agent 的 id(codex、claude、dsh、opencode 等)以英文原样出现,agents 表里写的是什么就显示什么。 +- 面向中文使用者;agent 的 id(如 `codex`、`claude`、`opencode` 等)以英文原样出现,`agents` 表里写的是什么就显示什么。 ## Brand Commitments - 产品名 Rivus。 -- 头像由代码生成,不用插画素材:首字母取自 agent id,底色取自它在 `agents` 表里的那一列。早先的手绘同事像已从 `public/` 删除。 -- 文案纪律(使用者已确认):一个词若使用者在界面之外碰不到,就不能出现在界面上;模板不得写死数据;按钮文字来自动作本身。 +- 头像由代码生成,不用插画素材:首字母取自 agent id,底色取自它在 `agents` 表里的那一列。 +- 文案纪律(由 `app/room-lab/copy.test.ts` 守卫):一个词若使用者在界面之外碰不到,就不能出现在界面上;模板不得写死数据;按钮文字来自动作本身。 ## Evidence on Hand - 真实 read model:`app/room-lab/read-model.ts`;真实服务行为:`app/room-lab/application/room-service.server.ts`。 -- 使用者审过的文案与判定标准:仓库根下 `.tmp-bin/rivus-copy.txt`(gitignore,未入库)。 -- 使用者迭代到第 7 版并认可的界面原型:scratchpad `rivus-prototype.html`(房间视图部分)。 -- 没有真实用户访谈、没有截图对比数据、没有品牌手册。不要编造。 +- 唯一文案词典与语法测试:`app/room-lab/copy.ts`、`app/room-lab/copy.test.ts`。 +- 视觉与组件规范:`apps/room-web/DESIGN.md`。 ## Product Principles -- 等待要可见:谁在说、多久了、后面还有谁,比任何装饰都重要。 -- 输入框永远可用:一轮没说完也能继续说,界面只提示会排在谁后面。 +- 等待要可见:谁在读/工作、跑了多久,比任何装饰都重要。 +- 输入框永远可用:成员运行中也能继续发言。 - 只展示真实存在的动作;后端没有的事,界面不放按钮。 -- 状态只有一个真相:对话流和成员区显示同一组人的同一组状态。 +- 状态只有一个真相:对话流、页头与成员区显示同一组人的同一组状态。 - 词跟着架构走,不跟着语感走。 diff --git a/apps/room-web/README.md b/apps/room-web/README.md index 2a03b9b6..c8daeb62 100644 --- a/apps/room-web/README.md +++ b/apps/room-web/README.md @@ -36,27 +36,19 @@ pnpm --filter @rivus/room-web dev Open . - **Manage members / 管理成员** adds, removes, and reorders registered agents. The selected - order is a domain invariant, not presentation-only state. -- **Room chat** broadcasts unmentioned messages to the active composition. - `@agent` targets an active seat, while `@all` explicitly addresses the current - Room. A mention to a known but inactive agent is rejected instead of silently - broadcasting. - Concurrent drafts still pass through the same `seenSeq` and `HELD` write - point before they become public facts. -- **Check connection / 检查连接** calls only the active agents, in the configured - order. Every number is a real agent reply committed to the same monotonic - Room stream, so the UI can show the exact sequence that each seat observed - and extended. -- **Task gate** invokes the Task Delivery application: Codex occupies `impl`, - Claude occupies `review`, and rejected work returns through one rework round. - The gate remains unavailable unless both required seats are active. - Task state is persisted before it is projected into Room, so a Room failure - cannot change the Task verdict. - A model PASS is shown as awaiting human acceptance, never as human approval. -- Rooms, their seating, the transcript and each member's cursor live in - `~/.rivus/room-web/v1/rooms.sqlite` and survive a restart. Set - `RIVUS_ROOM_HOME` to put that library somewhere else, and - `ROOM_AGENT_TIMEOUT_MS` to change the default 120-second CLI timeout. + order is a domain invariant, not presentation-only state, and sets turn order when `serial` is enabled. +- **Room chat** wakes members according to room settings (`wake`: `broadcast` by default or `addressed`; + `serial`: off by default; `cwd`: defaults to `~/.rivus/room-web/v1/work/`). `@agent` targets + an active seat and `@all` addresses all seated members; a mention to a known but inactive agent is + rejected instead of silently broadcasting. Members post through Room MCP tools (`room_speak`, + `room_read`, `room_dm`), and concurrent turns go through the same `seenSeq` and `HELD` write point + before becoming public facts. +- **Private rooms (`room_dm`)** open a child room between two members under the parent room; the person + can read and speak in any child room from the sidebar. +- Rooms, their seating, the transcript, and each member's cursor live in + `~/.rivus/room-web/v1/rooms.sqlite` and survive a restart (member leases live beside it in + `member-leases.sqlite`). Set `RIVUS_ROOM_HOME` to store the library elsewhere. Turn timeout defaults + to 10 minutes and can be shortened per agent via the `agents` table's `timeout_ms` column. Both development and production scripts bind to `127.0.0.1`; the production route is disabled unless it was started by the package's local-only script. @@ -69,10 +61,11 @@ deployment. ## Interface The Room is chat first, in three columns: a rail of rooms, the conversation, and -the members with their connection check. Each member wears a round mark built -from its id and the colour on its row, so a new member needs no artwork. Below -1180px the members column becomes a drawer; below 820px the rail becomes a -header strip. `/board` and `/task/:id` exist but are not linked from the room. +the members panel. Each member wears a round mark built from its id and the colour +on its row, so a new member needs no artwork. Below 1180px the members column +becomes a drawer; below 640px the rail becomes a top strip. `/board` and +`/task/:id` provide a read-only task board over `@rivus/agent-task-loop/task-management` +and are not linked from the room. Enter sends, Shift+Enter inserts a line break, and Enter or Tab selects an open mention suggestion. IME composition does not submit. Escape closes dialogs and diff --git a/docs/AGENTS.md b/docs/AGENTS.md new file mode 100644 index 00000000..3d32d87b --- /dev/null +++ b/docs/AGENTS.md @@ -0,0 +1,56 @@ +# Documentation Authoring Guide + +## 1. Where Knowledge Belongs + +Write only **non-code knowledge**: facts a reader cannot recover from the relevant source, types, tests, and config. When a rule is already enforced by types, tests, scripts, or CI, link to the check instead of restating it. + +Route each piece to one owning surface: + +- Readers who use the released artifact → `guides/` (reach one outcome) or `reference/` (public interface contracts: anything whose change needs a SemVer major or a migration note). +- Readers who change this repository → `architecture/` or `development/`. +- A constraint tied to one file or function → a source comment prefixed with `Why:` (so `rg 'Why:'` finds it). + +Keep each category in its own directory under `docs/` (`guides/`, `reference/`, `architecture/`, `development/`), even for a single document. `docs/README.md` lists this repository's documents and any repository-specific surfaces (such as a decision log or translations); for those surfaces, its rules take precedence. + +| Surface | Audience | Put here | Route elsewhere | +| --- | --- | --- | --- | +| `docs/guides/` | Users & external integrators | Getting-started tutorials and task-oriented how-to guides (including external plugin/extension guides) | Exhaustive option/API tables → `reference/`; internals → `architecture/` | +| `docs/reference/` | Users & external integrators | Public interface contracts for fast lookup: CLI commands, exit codes, config contracts, public APIs, schemas, wire mappings, error codes, compatibility matrices, SemVer guarantees; prefer linking or generating from `--help` / schemas over hand-copying | Walkthrough steps → `guides/`; rationale → `architecture/`; internal code signatures → source code | +| `docs/architecture/` | Maintainers | Current system shape: domain/module boundaries, end-to-end data flow, ownership and trust boundaries, cross-module invariants, failure/recovery semantics, major tradeoffs and rejected alternatives | Single-file quirks → `Why:` comment in source; setup & runbooks → `development/` | +| `docs/development/` | Maintainers | Local setup, test strategy, honest validation boundaries (automated vs manual/unverified), maintainer extension walkthroughs (e.g. `adding-a-provider.md`), debugging, release and deployment/rollback runbooks | User-facing guides → `guides/`; collaboration policy → `CONTRIBUTING.md` | +| `docs/plans/` | Implementers & reviewers | Active implementation plans only when upfront human alignment is needed (`0000-template.md`); skip for adjustments requested during implementation; delete in the final delivery PR/MR | Post-delivery non-code knowledge → the surfaces above; deferred work → issues | +| Code `Why:` comments | Maintainers | Single-site non-obvious constraints, external API quirks, or deliberate workarounds prefixed with `Why:` so they move and delete with the code | Cross-module invariants or system tradeoffs → `docs/architecture/` | + +Other surfaces keep their own scope: `README.md` (orientation and quick start), `CONTRIBUTING.md` (workflow, Change Design Gate, CI/release policy), root `AGENTS.md` (agent rules and commands), scripts/CI (automated enforcement), and release tools (changelogs). + +## 2. File Naming And Splitting + +- Use kebab-case filenames (`overview.md`, `public-interface.md`, `adding-a-provider.md`). +- Start `architecture/` with `overview.md`. Split out `architecture/conventions.md` only when a repository has strict layering, modeling, or extension rules that outgrow `overview.md` and root `AGENTS.md`. +- Split a document when it mixes user lookup with maintainer internals or combines distinct audiences. + +## 3. Writing Rules + +- **Link to the repository as source of truth.** Point to source files, schemas, config files, scripts, and tests instead of mirroring directory trees, symbol lists, or internal type signatures. +- **Write in current-state language.** Describe how the system works now ("X validates Y"), rather than narrating history ("PR #12 changed X from A to B"). Link to the delivery PR/MR when decision history matters. +- **Keep reference docs scannable and exact.** Use tables for contracts, defaults, bounds, exit codes, and compatibility matrices. +- **Be honest about validation.** Separate verified automated gates from manual or unverified checks. Keep examples runnable when practical; label schematic examples as illustrative and state the validation gap. +- **Keep translations in sync.** If `docs/README.md` declares translated copies, update them in the same PR/MR or open an issue marking them stale. +- **Use neutral placeholders.** Use `OWNER/REPO`, `/work/...`, or `/fake-home/...` in examples and fixtures. + +## 4. Retiring A Plan + +Do this in the final delivery PR/MR of an active plan (the one whose merge completes its code scope). Git history and that PR/MR keep the full plan. + +1. Add a `Plan retirement` table under `## Summary` in the PR/MR description: one row per section the plan kept, each with a concrete destination — `docs/#`, a `Why:` comment at `:`, an issue link, `enforced by `, or `dropped: `. +2. Write the docs and `Why:` comments the table names; open issues for remaining manual checks and deferred follow-ups. +3. Delete the plan file and remove or redirect every link pointing to it. + +Done when every row's destination exists. + +## 5. Before Finishing A Doc Change + +- Every path, command, flag, default, schema field, and version was checked against the current tree or `--help`. +- Every new or renamed document appears under `## Index` in `docs/README.md` (and root `README.md` if user-facing); every relative link resolves. +- No rule or table restates another authoritative document. +- The repository checks in root `AGENTS.md` pass on the staged change. diff --git a/docs/README.md b/docs/README.md index 01e00af1..89a7000e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,44 +1,33 @@ -# Documentation Standards +# Documentation -Use `docs/` for durable project knowledge that a maintainer or user cannot easily infer from reading the code alone. This includes current architecture and tradeoffs, user guides, factual references, development workflows, and validation boundaries. +Placement, writing rules, and plan retirement: [`docs/AGENTS.md`](AGENTS.md). +Contribution workflow and Change Design Gate: [`CONTRIBUTING.md`](../CONTRIBUTING.md). -Keep collaboration policy in `CONTRIBUTING.md`, AI-agent instructions in `AGENTS.md`, issue and review evidence requirements in templates, and automated enforcement in scripts or CI workflows. Package-specific usage stays in each package's `README.md` (for example [`packages/agent-task-loop/docs/rivus-plugin.md`](../packages/agent-task-loop/docs/rivus-plugin.md) and [`apps/room-web/README.md`](../apps/room-web/README.md)). +## Index -## What Is Here +Guides ([`guides/`](guides/)): -Guides: +- [`getting-started.md`](guides/getting-started.md) — install, first run, common commands. +- [`workflow.md`](guides/workflow.md) — task status lifecycle and agent rounds. -- [`getting-started.md`](getting-started.md): install, first run, common commands. -- [`configuration.md`](configuration.md): config resolution, `init`, `source`, task sources, projects, repositories, agents. -- [`workflow.md`](workflow.md): task status lifecycle and agent rounds. +Reference ([`reference/`](reference/)): -Architecture ([`architecture/`](architecture/)), the current system shape: +- [`configuration.md`](reference/configuration.md) — config resolution, `init`, `source`, task sources, projects, repositories, agents. -- [`overview.md`](architecture/overview.md): packages, bounded contexts, dependency rules, review gate. -- [`task-sources.md`](architecture/task-sources.md): provider composition, run-time state store, task run lease. -- [`agent-finder.md`](architecture/agent-finder.md): agent discovery through `@rivus/agent-kit`. -- [`agent-sessions.md`](architecture/agent-sessions.md): session discovery, transcripts, the session browser. -- [`agent-collaboration.md`](architecture/agent-collaboration.md): Room protocol, control plane, room-web, task board. +Architecture ([`architecture/`](architecture/)): -Development & release: +- [`overview.md`](architecture/overview.md) — packages, domain language, bounded contexts, dependency rules, review gate. +- [`task-sources.md`](architecture/task-sources.md) — provider composition, run-time state store, task run lease. +- [`agent-finder.md`](architecture/agent-finder.md) — agent discovery through `@rivus/agent-kit`. +- [`agent-sessions.md`](architecture/agent-sessions.md) — session discovery, transcripts, the session browser. +- [`agent-collaboration.md`](architecture/agent-collaboration.md) — Room protocol, control plane, room-web, task board. -- [`npm-publish.md`](npm-publish.md): npm release runbook. +Development & plans: -Add `guides/`, `reference/`, `architecture/`, or `development/` sections when the project has real documentation for that reader need. Do not create empty directories to match a list. +- [`development/npm-publish.md`](development/npm-publish.md) — npm release runbook. +- [`plans/`](plans/) — active implementation plans; each is retired in its final delivery PR. -## Active Plans Boundary +## Repository-Specific Surfaces -- [`plans/`](plans/) contains active implementation plans only while non-trivial work is in flight. - -The Change Design Gate in [`CONTRIBUTING.md`](../CONTRIBUTING.md#change-design-gate) decides when a change needs a plan. After the code lands on the default branch, move lasting non-code knowledge into `docs/` (and local `Why:` comments in code), move remaining follow-up items to issues, and delete the completed plan. Git history and the delivery PR keep the full plan, including the RFCs this repository used earlier. - -## Writing Standards - -- Give every durable document one clear audience, purpose, and owner area. -- Record what source code cannot express: _why_ a design or workaround was chosen, alternatives rejected, ownership and trust boundaries, external system quirks, and known validation limits. -- Do not duplicate directory trees, symbol lists, or type signatures that source code and type checks already express. -- Prefer current-state language over historical narration in `docs/`; link to the delivery PR for decision history. -- Keep examples runnable when practical; otherwise label them as illustrative and explain the validation gap. -- Link to source files, commands, schemas, or dashboards when they are the real source of truth. -- Update docs in the same change as behavior, configuration, command, API, deployment, architecture, or operational changes. -- Keep private tokens, internal hostnames, personal filesystem paths, generated logs, and environment-specific secrets out of documentation. +- Package-specific usage, plugin integration, skill, and app design docs stay inside their owning packages (for example [`packages/agent-task-loop/docs/rivus-plugin.md`](../packages/agent-task-loop/docs/rivus-plugin.md), [`packages/agent-task-loop/skills/agent-task-loop-cli/SKILL.md`](../packages/agent-task-loop/skills/agent-task-loop-cli/SKILL.md), [`apps/room-web/README.md`](../apps/room-web/README.md), and [`apps/room-web/DESIGN.md`](../apps/room-web/DESIGN.md)). +- Historical RFCs remain in Git history. diff --git a/docs/architecture/agent-finder.md b/docs/architecture/agent-finder.md index 399887a4..37eabbfd 100644 --- a/docs/architecture/agent-finder.md +++ b/docs/architecture/agent-finder.md @@ -4,15 +4,15 @@ Agent discovery is the read-only inventory of the coding agents installed on the current host. It is not a scheduler, runner, terminal multiplexer, API proxy, or credential reader. The CLI surface is [`packages/agent-finder-cli/README.md`](../../packages/agent-finder-cli/README.md); -publishing is in [`../npm-publish.md`](../npm-publish.md). +publishing is in [`../development/npm-publish.md`](../development/npm-publish.md). ## Layers -| Layer | Where | Owns | -| --------------------------------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Kit detection `@rivus/agent-kit` | npm | `builtinProviders` discovery services and `detectAgents` for its 7 agents (claude-code, codex, cursor, gemini-cli, grok, opencode, pi): PATH lookup, path checks, version probes, file-based login state, evidence and status classification | -| Legacy recipes `agent-finder-cli` | `src/discovery/` | One probe recipe per MoonBit-catalog agent the kit does not cover (20 agents): the ported command, app, config and MCP paths, `--version` probes, and the original warnings | -| CLI `@rivus/agent-finder-cli` | `packages/agent-finder-cli` | Argument parsing and human output: `scan`, `scan --json`, `provider -h`, `provider list`, `provider inspect `, `doctor`, and the session browser | +| Layer | Where | Owns | +| --------------------------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Kit detection `@rivus/agent-kit` | npm | `builtinProviders` discovery services and `detectAgents` for its 9 built-in agents (`claude-code`, `codex`, `dsh`, `cursor`, `gemini-cli`, `grok`, `opencode`, `pi`, `zcode`): PATH lookup, path checks, version probes, file-based login state, evidence and status classification | +| Legacy recipes `agent-finder-cli` | `src/discovery/` | One probe recipe per MoonBit-catalog agent the kit does not cover (20 agents): the ported command, app, config and MCP paths, `--version` probes, and the original warnings | +| CLI `@rivus/agent-finder-cli` | `packages/agent-finder-cli` | Argument parsing and human output: `scan`, `scan --json`, `provider -h`, `provider list`, `provider inspect `, `doctor`, and the session browser | `detectAgents` checks paths through a platform port, so fixtures run against an in-memory platform (`@rivus/agent-kit/testing`'s `createMemoryPlatform`) and diff --git a/docs/architecture/agent-sessions.md b/docs/architecture/agent-sessions.md index 64e3595e..2e326eaa 100644 --- a/docs/architecture/agent-sessions.md +++ b/docs/architecture/agent-sessions.md @@ -9,7 +9,8 @@ deleted when the kit replaced it. ## Model - `listSessions(platform)` yields one `SessionHead` per session file across - every built-in session adapter (claude-code, codex, grok), plus a + every built-in session adapter in `@rivus/agent-kit` (`claude-code`, `codex`, + `dsh`, `gemini-cli`, `grok`, `opencode`, `pi`, `zcode`), plus a `SessionListFailure` for each root or file that could not be listed. A head carries `ref` (agent id, path, session id), `title`, `cwd`, `startedAt`, `lastActiveAt` (epoch ms), `sizeBytes` and `firstPrompt`; @@ -31,12 +32,10 @@ deleted when the kit replaced it. ## Discovery -Kit home rules, with environment variables winning over defaults: Codex -`CODEX_HOME` (else `~/.codex`) lists both `sessions/` and `archived_sessions/`; -Claude Code `CLAUDE_CONFIG_DIR` (else `~/.claude`) lists `projects/`, skipping -each session's `subagents/` directory; grok `GROK_HOME` (else `~/.grok`) lists -`sessions/`. Node hosts pass `createNodePlatform()`; every read goes through -the platform. +Session roots follow `@rivus/agent-kit`'s per-agent home rules (environment +variables winning over defaults, for example `CODEX_HOME`, `CLAUDE_CONFIG_DIR`, +`GEMINI_CLI_HOME`, `GROK_HOME`, `PI_CODING_AGENT_DIR`, `XDG_DATA_HOME`). Node +hosts pass `createNodePlatform()`; every read goes through the platform. ## Consumers @@ -56,7 +55,6 @@ the platform. ## Limits -- OpenCode sessions are not listed: the kit has no OpenCode session adapter. - Resume prints a command; it does not start the agent. `sessions list --json` carries no resumability field; `sessions inspect --json` carries `resumeCommand` (`null` without a verified resume form), and the browser @@ -72,6 +70,5 @@ the platform. and the model's `response_item` copy); the kit attributes the message to the `response_item` only, so each turn renders once — the `fs-session-provider` regression test pins this. - -OpenCode sessions, fuller traces and a resumable flag are tracked in -[#158](https://github.com/PerfectPan/agent-task-loop/issues/158). +- Further session adapter and trace enhancements live upstream in + `@rivus/agent-kit`. diff --git a/docs/architecture/overview.md b/docs/architecture/overview.md index 0d904390..341fdca2 100644 --- a/docs/architecture/overview.md +++ b/docs/architecture/overview.md @@ -23,6 +23,16 @@ Detailed pages: - [Agent collaboration: rooms, control plane, room-web](agent-collaboration.md) - The Rivus Task Manager Plugin: [`packages/agent-task-loop/docs/rivus-plugin.md`](../../packages/agent-task-loop/docs/rivus-plugin.md) +## Domain language + +Shared task orchestration vocabulary across the CLI and external Agent integrations: + +- **Task**: A unit of requested work whose authoritative business fields and lifecycle are owned by one Task Backend. _Avoid_: Job, ticket. +- **Task Backend**: The system of record that stores Tasks and authorizes reads and mutations for them. _Avoid_: Task cache, Rivus Memory. +- **Task Run**: One execution and review workflow for a Task, including recovery, rework, acceptance, and publication state. _Avoid_: Rivus run, chat session. +- **Task Manager**: An Agent-facing application boundary that lists, reads, creates, and starts Tasks without exposing backend credentials or Task Run internals. _Avoid_: Task Backend, worker. +- **External Worker**: The configured coding-agent process that performs a Task Run under agent-task-loop orchestration. _Avoid_: Rivus subagent, Task Manager. + ## Dependency rules 1. Domain code imports no application or infrastructure module. diff --git a/docs/architecture/task-sources.md b/docs/architecture/task-sources.md index 3e060084..92e50109 100644 --- a/docs/architecture/task-sources.md +++ b/docs/architecture/task-sources.md @@ -5,7 +5,7 @@ Task is owned by one Task Backend (Feishu Base or GitHub Issues); the loop reads it from there and routes writes back to the owner. The loop's own execution state lives in a local store the backends never see. -Configuration and commands are in [`../configuration.md`](../configuration.md). +Configuration and commands are in [`../reference/configuration.md`](../reference/configuration.md). ## Provider composition diff --git a/docs/npm-publish.md b/docs/development/npm-publish.md similarity index 87% rename from docs/npm-publish.md rename to docs/development/npm-publish.md index 144473a2..0262fab3 100644 --- a/docs/npm-publish.md +++ b/docs/development/npm-publish.md @@ -1,6 +1,6 @@ # npm Publish Runbook -This runbook describes how to publish `@rivus/agent-task-loop`. +This runbook describes how to publish the public npm packages in this repository (`@rivus/agent-task-loop` and `@rivus/agent-finder-cli`). ## Preconditions @@ -10,13 +10,9 @@ This runbook describes how to publish `@rivus/agent-task-loop`. - public npm registry: `https://registry.npmjs.org` - release manager: Changesets, through the shared workflow `PerfectPan/gh-repo-checks/.github/workflows/npm-release.yml@v1`; its [runbook](https://github.com/PerfectPan/gh-repo-checks/blob/v1/docs/npm-release.md) describes the jobs and their recovery -## Scope Check +## Pre-Release Verification -Confirm and reserve the npm package scope before the first publish. - -The current implementation uses `@rivus/agent-task-loop`. `@rivus` is the selected personal npm namespace, while the GitHub repository remains `PerfectPan/agent-task-loop`. - -Create or reserve the `rivus` npm owner before publishing `v0.1.0`. After the first publish, changing package scope means publishing a new package name and maintaining a migration path. +Both published packages live under the `@rivus` npm scope, while the GitHub repository remains `PerfectPan/agent-task-loop`. Run local validation before preparing a release: @@ -33,12 +29,13 @@ cd packages/agent-task-loop npm pack --dry-run --registry=https://registry.npmjs.org ``` -The tarball should contain only: +The `@rivus/agent-task-loop` tarball should contain only: - `LICENSE` - `README.md` - `bin/` - `dist/` +- `docs/rivus-plugin.md` - `skills/agent-task-loop-cli/` - `package.json` @@ -81,7 +78,7 @@ Changesets returns the release PR to Draft whenever it updates the version commi Confirm that the full `test` job actually ran and passed for the current head and merge result, alongside the lightweight Review checks, before merging. A skipped Draft job is not test evidence. The CI workflow has no -manual dispatch trigger. See [CI Execution Policy](../CONTRIBUTING.md#ci-execution-policy) for the shared +manual dispatch trigger. See [CI Execution Policy](../../CONTRIBUTING.md#ci-execution-policy) for the shared Ready/Draft behavior; the existing publishing process is unchanged. Merging the release pull request runs the shared workflow in `publish` mode. A read-only job runs the gates this repository passes as `check-command` (`pnpm test && pnpm build && pnpm typecheck`) and `pnpm --filter '!./apps/**' audit --prod --audit-level=high` (the private apps never reach npm), then packs each unpublished version. The publish job, the only one with the OIDC permission, installs without lifecycle scripts and publishes the packed tarballs through Changesets: npm trusted publishing (OIDC) authenticates and attaches provenance because the repository and the packages are public. diff --git a/docs/getting-started.md b/docs/guides/getting-started.md similarity index 88% rename from docs/getting-started.md rename to docs/guides/getting-started.md index e4e5f380..890723a0 100644 --- a/docs/getting-started.md +++ b/docs/guides/getting-started.md @@ -4,7 +4,7 @@ Agent Task Loop runs local coding agents through a task lifecycle: pick a task, ## Prerequisites -- Node.js 22 or newer +- Node.js `^26.13.1` to install and build from this repository (the published `@rivus/agent-task-loop` CLI requires Node.js `>=22.13`) - pnpm 12, the version pinned in `packageManager` (Corepack or `pnpm self-update` installs it) - GitHub CLI authenticated with access to the target repository - `lark-cli` configured for Feishu Base access, when using a Feishu source @@ -39,7 +39,7 @@ npx @rivus/agent-task-loop --help npx --no-install @rivus/agent-task-loop init ``` -2. Edit `~/.agent-task-loop/config.json` with your projects, repositories, and local agent commands. See [configuration.md](./configuration.md). +2. Edit `~/.agent-task-loop/config.json` with your projects, repositories, and local agent commands. See [configuration.md](../reference/configuration.md). 3. Check that the config can be loaded. @@ -95,4 +95,4 @@ npx --no-install @rivus/agent-task-loop create --task TASK-101 --title "Fix logi Open a GitHub issue for bugs and ideas. -For design proposals, see the [Change Design Gate](../CONTRIBUTING.md#change-design-gate). +For design proposals, see the [Change Design Gate](../../CONTRIBUTING.md#change-design-gate). diff --git a/docs/workflow.md b/docs/guides/workflow.md similarity index 100% rename from docs/workflow.md rename to docs/guides/workflow.md diff --git a/docs/plans/0000-template.md b/docs/plans/0000-template.md index 4b220867..84f3eb18 100644 --- a/docs/plans/0000-template.md +++ b/docs/plans/0000-template.md @@ -136,10 +136,6 @@ State the smallest reversible batch, how to revert it, and any persisted-data or | --- | --- | --- | --- | --- | | | risk / open question / follow-up | | | | -## 8. Retirement checklist +## 8. Retirement -Complete before deleting this file in the final delivery PR/MR: - -- [ ] Remaining manual checks or follow-up items moved to issues -- [ ] Lasting non-code knowledge (invariants, tradeoffs, external quirks, validation limits) migrated to `docs/` or local `Why:` comments -- [ ] This plan file deleted in the final delivery PR/MR +Retire this plan in its final delivery PR/MR following [`docs/AGENTS.md` §4](../AGENTS.md#4-retiring-a-plan) (add the `Plan retirement` table under `## Summary` in the PR/MR description, migrate lasting non-code knowledge, open follow-up issues, and delete this file). diff --git a/docs/plans/README.md b/docs/plans/README.md index 8fbcb649..71e8d3ca 100644 --- a/docs/plans/README.md +++ b/docs/plans/README.md @@ -1,9 +1,9 @@ # Implementation Plans -A plan records the design and execution steps for one non-trivial deliverable. Bugfixes and routine changes do not need a plan—explain what changed, why, and how it was verified directly in the PR/MR description. See the [Change Design Gate](../../CONTRIBUTING.md#change-design-gate). +Write a plan only when upfront alignment with a human is needed before implementing. Bugfixes, routine changes, and adjustments requested during implementation or review do not need a plan—explain what changed, why, and how it was verified directly in the PR/MR description. See the [Change Design Gate](../../CONTRIBUTING.md#change-design-gate). Start from [`0000-template.md`](0000-template.md). Keep only the sections the change needs—typically background and goals, outline, detailed design, rollout, verification, and (for multi-PR or agent-executed work) the execution plan—and delete the rest. Keep a plan `blocked` while a material decision is unresolved. Unknown owners and dates stay "unconfirmed". The design sections match the `technical-design-docs` skill when installed; this repository does not copy those rules. -Once the code lands on the default branch, retire the plan in the final delivery PR/MR following the [plan lifecycle](../../CONTRIBUTING.md#plan-lifecycle-and-retirement): move unfinished manual checks or follow-ups to issues, migrate lasting non-code constraints into current-state `docs/` (or local `Why:` comments in code), and delete the plan file. +Retire the plan in its final delivery PR/MR following [`docs/AGENTS.md` §4](../AGENTS.md#4-retiring-a-plan) (see the [plan lifecycle](../../CONTRIBUTING.md#plan-lifecycle-and-retirement)). diff --git a/docs/configuration.md b/docs/reference/configuration.md similarity index 95% rename from docs/configuration.md rename to docs/reference/configuration.md index 3954c5df..12244615 100644 --- a/docs/configuration.md +++ b/docs/reference/configuration.md @@ -12,7 +12,7 @@ JavaScript config. With none of the three present, commands fail with a message pointing at `agent-task-loop init`. The full shape is in -[`packages/agent-task-loop/config.example.json`](../packages/agent-task-loop/config.example.json). +[`packages/agent-task-loop/config.example.json`](../../packages/agent-task-loop/config.example.json). ## Create the config @@ -70,7 +70,7 @@ At least one of `feishu` and `githubIssues` is required. chosen. How sources are combined and where run-time state is kept is described in -[`architecture/task-sources.md`](architecture/task-sources.md). +[`architecture/task-sources.md`](../architecture/task-sources.md). ## Projects diff --git a/packages/agent-finder-cli/README.md b/packages/agent-finder-cli/README.md index f63209d3..d5ea3f95 100644 --- a/packages/agent-finder-cli/README.md +++ b/packages/agent-finder-cli/README.md @@ -1,6 +1,6 @@ # agent-finder-cli -Command-line interface for local code agent discovery. +Command-line interface for local coding-agent discovery and session browsing. ```bash agent-finder scan @@ -9,9 +9,13 @@ agent-finder provider -h agent-finder provider list agent-finder provider inspect codex agent-finder doctor +agent-finder sessions +agent-finder sessions list --json +agent-finder sessions inspect +agent-finder sessions resume ``` -Detection and provider metadata come from `@rivus/agent-kit`'s `/catalog` and `/discovery` entries: seven built-in probe recipes, plus 20 probe recipes the CLI ships for the other catalog agents. +Detection, session listing, and provider metadata come from `@rivus/agent-kit` (`@rivus/agent-kit/catalog`, `/discovery`, `/sessions`, `/transcript`): nine built-in discovery recipes, plus 20 probe recipes the CLI ships for the other catalog agents. ## License diff --git a/packages/agent-room/README.md b/packages/agent-room/README.md index 1872ef44..a40ca13e 100644 --- a/packages/agent-room/README.md +++ b/packages/agent-room/README.md @@ -3,7 +3,7 @@ Shared **posted stream**, per-agent session, and write-point HELD. This package does not know tasks, occupancy seats, Feishu, or ReviewLoop. -Callers inject the capability port for the slice they use. `rivus-agent` is the first live adapter. +Callers inject the capability port for the slice they use. `apps/room-web` is the live collaboration endpoint in this repository. See [`docs/architecture/agent-collaboration.md`](../../docs/architecture/agent-collaboration.md). diff --git a/packages/agent-task-loop/docs/rivus-plugin.md b/packages/agent-task-loop/docs/rivus-plugin.md index c0a74f3c..940bb83a 100644 --- a/packages/agent-task-loop/docs/rivus-plugin.md +++ b/packages/agent-task-loop/docs/rivus-plugin.md @@ -18,13 +18,13 @@ import plugin from '@rivus/agent-task-loop/rivus-plugin'; ## Requirements - Node.js 24 or a later version supported by the installed Rivus Core -- `@rivus/agent` in the supported peer range `>=0.17.0 <0.18.0` +- `@rivus/agent` in the supported peer range `>=0.17.0` - Agent Task Loop configured as described in the package README Install and lock both Core and Plugin in the Deployment project: ```bash -npm install @rivus/agent@0.17.0 @rivus/agent-task-loop --registry=https://registry.npmjs.org +npm install @rivus/agent @rivus/agent-task-loop --registry=https://registry.npmjs.org ``` `@rivus/agent` is an optional package peer so a CLI-only installation keeps the @@ -173,13 +173,13 @@ pnpm --registry https://registry.npmjs.org/ --filter @rivus/agent-task-loop pack ``` The check packs the package into temporary clean consumers. It first installs -and runs the CLI without Rivus Core, then installs Core 0.17.0 by default, -imports and validates the Plugin, and compiles a downstream TypeScript -consumer. +and runs the CLI without Rivus Core, then installs the `@rivus/agent` +devDependency version by default, imports and validates the Plugin, and +compiles a downstream TypeScript consumer. -To test another supported Core patch, set `RIVUS_CORE_PACKAGE` to its exact -`@rivus/agent` package version. Versions outside the supported minor fail the -check. +To test another supported Core release, set `RIVUS_CORE_PACKAGE` to an exact +`@rivus/agent@` matching `>=0.17.0`. Versions below `0.17.0` or +prereleases fail the check. Before a Core release is available, pass all four actual package archives from the versioned release tree: @@ -196,7 +196,7 @@ integrity, module resolution, and tarball SHA-256. Its receipt reports the package names, versions, and hashes. Archive verification is evidence for those exact artifacts. Normal repository -validation and registry smoke still require published Core 0.17.0 packages. +validation and registry smoke still require published Core packages (`>=0.17.0`). The repository exempts `@rivus/*` from pnpm's one-day release delay so owned packages can be validated immediately; other dependencies retain the delay described in the contribution guide. Keep the consumer change pending until diff --git a/packages/agent-task-loop/package.json b/packages/agent-task-loop/package.json index 047cf273..017f7a44 100644 --- a/packages/agent-task-loop/package.json +++ b/packages/agent-task-loop/package.json @@ -82,7 +82,7 @@ "vitest": "catalog:" }, "peerDependencies": { - "@rivus/agent": ">=0.17.0 <0.23.0" + "@rivus/agent": ">=0.17.0" }, "peerDependenciesMeta": { "@rivus/agent": { diff --git a/packages/agent-task-loop/scripts/check-package.mjs b/packages/agent-task-loop/scripts/check-package.mjs index 9f61ded1..41425f73 100644 --- a/packages/agent-task-loop/scripts/check-package.mjs +++ b/packages/agent-task-loop/scripts/check-package.mjs @@ -10,13 +10,15 @@ import { } from './rivus-core-archives.mjs'; const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); +const packageManifest = JSON.parse(readFileSync(path.join(packageRoot, 'package.json'), 'utf8')); +const defaultRivusCoreVersion = packageManifest.devDependencies?.['@rivus/agent'] || '0.17.0'; const registry = 'https://registry.npmjs.org/'; const archiveInput = process.env.RIVUS_CORE_ARCHIVES_JSON; if (archiveInput !== undefined && process.env.RIVUS_CORE_PACKAGE?.trim()) { throw new Error('Use either RIVUS_CORE_ARCHIVES_JSON or RIVUS_CORE_PACKAGE, not both'); } const rivusCoreArchives = archiveInput !== undefined ? readRivusCoreArchives(archiveInput) : undefined; -const rivusCoreSource = process.env.RIVUS_CORE_PACKAGE?.trim() || '@rivus/agent@0.17.0'; +const rivusCoreSource = process.env.RIVUS_CORE_PACKAGE?.trim() || `@rivus/agent@${defaultRivusCoreVersion}`; if (!rivusCoreArchives) { if (!rivusCoreSource.startsWith('@rivus/agent@')) { throw new Error('RIVUS_CORE_PACKAGE must name an exact supported @rivus/agent version'); @@ -184,7 +186,7 @@ void [defaultPlugin, configuredPlugin]; ); const installedPackageJson = JSON.parse(readFileSync(path.join(installedPackageDirectory, 'package.json'), 'utf8')); - if (installedPackageJson.peerDependencies?.['@rivus/agent'] !== '>=0.17.0 <0.18.0') { + if (installedPackageJson.peerDependencies?.['@rivus/agent'] !== '>=0.17.0') { throw new Error('Unexpected @rivus/agent peer range'); } if (!installedPackageJson.peerDependenciesMeta?.['@rivus/agent']?.optional) { diff --git a/packages/agent-task-loop/scripts/rivus-core-archives.mjs b/packages/agent-task-loop/scripts/rivus-core-archives.mjs index d415bacb..164184c2 100644 --- a/packages/agent-task-loop/scripts/rivus-core-archives.mjs +++ b/packages/agent-task-loop/scripts/rivus-core-archives.mjs @@ -9,8 +9,17 @@ import { isDeepStrictEqual } from 'node:util'; const corePackageNames = ['@rivus/platform', '@rivus/runtime', '@rivus/gateway', '@rivus/agent']; export function assertSupportedRivusCoreVersion(version) { - if (typeof version !== 'string' || !/^0\.17\.(?:0|[1-9]\d*)$/.test(version)) { - throw new Error(`Unsupported Rivus Core version ${version}; expected >=0.17.0 <0.18.0`); + if (typeof version !== 'string') { + throw new Error(`Unsupported Rivus Core version ${version}; expected >=0.17.0`); + } + const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(version); + if (!match) { + throw new Error(`Unsupported Rivus Core version ${version}; expected >=0.17.0`); + } + const major = Number(match[1]); + const minor = Number(match[2]); + if (major === 0 && minor < 17) { + throw new Error(`Unsupported Rivus Core version ${version}; expected >=0.17.0`); } } diff --git a/packages/agent-task-loop/skills/agent-task-loop-cli/SKILL.md b/packages/agent-task-loop/skills/agent-task-loop-cli/SKILL.md index fbc40010..28ae55fd 100644 --- a/packages/agent-task-loop/skills/agent-task-loop-cli/SKILL.md +++ b/packages/agent-task-loop/skills/agent-task-loop-cli/SKILL.md @@ -1,6 +1,6 @@ --- name: agent-task-loop-cli -description: Use when operating the repo-local Agent Task Loop CLI from this workspace, especially to start, watch, resume, or complete Feishu Base backed agent tasks through the local npx entry. +description: Use when operating the repo-local Agent Task Loop CLI from this workspace, especially to sync, start, watch, resume, complete, or clean up Feishu Base or GitHub Issues backed agent tasks through the local npx entry. --- # Agent Task Loop CLI @@ -12,10 +12,11 @@ description: Use when operating the repo-local Agent Task Loop CLI from this wor ## When to Use -- 需要启动一条 Feishu Base 任务 -- 需要查看某条任务进度 +- 需要初始化或管理任务源(Feishu Base / GitHub Issues) +- 需要启动一条任务 +- 需要查看某条任务进度或打开交互式看板 - 需要恢复执行 / review 会话 -- 需要在验收后自动提交、push、创建 Pull Request +- 需要在验收后自动提交、push、创建 Pull Request,或清理任务工作区 不要在这些场景里直接拼 `pnpm dev ...`。优先使用仓库根本地入口: @@ -26,12 +27,16 @@ npx --no-install @rivus/agent-task-loop ... ## Commands ```bash +npx --no-install @rivus/agent-task-loop init +npx --no-install @rivus/agent-task-loop source list npx --no-install @rivus/agent-task-loop sync npx --no-install @rivus/agent-task-loop schema +npx --no-install @rivus/agent-task-loop tui npx --no-install @rivus/agent-task-loop start --task npx --no-install @rivus/agent-task-loop watch --task npx --no-install @rivus/agent-task-loop resume --task npx --no-install @rivus/agent-task-loop complete --task +npx --no-install @rivus/agent-task-loop cleanup --task ``` ## Command Mapping @@ -43,6 +48,9 @@ npx --no-install @rivus/agent-task-loop complete --task ## Notes -- CLI 会自动发现 `task.config.ts`,不需要默认再写 `--config` +- 配置为纯 JSON,按以下顺序取首个命中的路径(不做目录向上查找,不再支持 `task.config.*`): + 1. `--config ` + 2. `AGENT_TASK_LOOP_CONFIG` 环境变量 + 3. `~/.agent-task-loop/config.json`(默认全局配置,可通过 `init` 创建) - 如果用户明确指定了别的配置文件,再补 `--config ` - 这个 skill 假设当前工作目录在仓库根或其子目录内 diff --git a/tests/scripts/rivus-core-archives.test.mjs b/tests/scripts/rivus-core-archives.test.mjs index 916569c8..1a85c132 100644 --- a/tests/scripts/rivus-core-archives.test.mjs +++ b/tests/scripts/rivus-core-archives.test.mjs @@ -140,8 +140,10 @@ test('rejects malformed, incomplete, duplicate, old, and mixed-version archives' /Duplicate Rivus Core archive/, ); assert.throws(() => assertSupportedRivusCoreVersion('0.16.6'), /Unsupported Rivus Core version/); - assert.throws(() => assertSupportedRivusCoreVersion('0.18.0'), /Unsupported Rivus Core version/); assert.throws(() => assertSupportedRivusCoreVersion('0.17.0-rc.1'), /Unsupported Rivus Core version/); + assert.doesNotThrow(() => assertSupportedRivusCoreVersion('0.18.0')); + assert.doesNotThrow(() => assertSupportedRivusCoreVersion('0.22.3')); + assert.doesNotThrow(() => assertSupportedRivusCoreVersion('1.0.0')); const mixedVersionFixture = createFixture(t, ['0.17.0', '0.17.0', '0.17.0', '0.17.1']); assert.throws(() => readRivusCoreArchives(JSON.stringify(mixedVersionFixture.archivePaths)), /same version/); }); diff --git a/vite.config.ts b/vite.config.ts index c6d254f3..5a8dba5d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -13,6 +13,7 @@ export default defineConfig({ // Copied verbatim from the project template; keep them byte-identical so syncs stay a plain diff. '.github/ISSUE_TEMPLATE/**', '.github/workflows/review.yml', + 'docs/AGENTS.md', 'docs/plans/0000-template.md', 'docs/plans/README.md', ],