diff --git a/.github/workflows/ark-turn.yml b/.github/workflows/ark-turn.yml index 5a6cfc6295..bef2e62448 100644 --- a/.github/workflows/ark-turn.yml +++ b/.github/workflows/ark-turn.yml @@ -29,7 +29,7 @@ concurrency: jobs: adapter-contract: runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: python: ["3.11", "3.13"] diff --git a/.github/workflows/frontstage-pages.yml b/.github/workflows/frontstage-pages.yml index 80e1783366..0ef56a9f1d 100644 --- a/.github/workflows/frontstage-pages.yml +++ b/.github/workflows/frontstage-pages.yml @@ -12,6 +12,7 @@ on: - ".github/workflows/frontstage-pages.yml" - "README.md" - "README.zh-CN.md" + - "README.ja.md" - "apps/presentation/dashboard/**" - "scripts/chat_bundle.py" - "scripts/chat_bundle_launcher.mjs" @@ -56,6 +57,7 @@ on: - ".github/workflows/frontstage-pages.yml" - "README.md" - "README.zh-CN.md" + - "README.ja.md" - "apps/presentation/dashboard/**" - "scripts/chat_bundle.py" - "scripts/chat_bundle_launcher.mjs" diff --git a/.github/workflows/runtime-snapshots.yml b/.github/workflows/runtime-snapshots.yml index 88c7948c24..bcfecbf17b 100644 --- a/.github/workflows/runtime-snapshots.yml +++ b/.github/workflows/runtime-snapshots.yml @@ -89,7 +89,39 @@ jobs: shell: bash run: | set -euo pipefail - revision="$(python -c 'import json; print(json.load(open("runtime/loopx-runtime.json"))["source_revision"])')" + # Validate the downloaded qualification before any remote mutation. + # Successful installation alone does not qualify outcome/cost claims. + revision="$(python - <<'PY' + import hashlib + import json + from pathlib import Path + import re + root = Path("runtime") + manifest_bytes = (root / "loopx-runtime.json").read_bytes() + manifest = json.loads(manifest_bytes) + revision = manifest["source_revision"] + if not isinstance(revision, str) or not re.fullmatch(r"[0-9a-f]{40}", revision): + raise SystemExit("Invalid runtime source revision") + qualification = json.loads((root / f"qualification-{revision}.json").read_bytes()) + checks = ("ok", "clean_install", "upgrade", "doctor", "skills", "frontend_bundle_contract", + "frontend_http", "no_frontend_build_tools", "license_notices", "activation_failure_restored") + if any(qualification.get(check) is not True for check in checks): + raise SystemExit("Runtime installation qualification is missing or failed") + if manifest["channel"] != "main" or any(qualification.get(key) != manifest[key] + for key in ("source_revision", "channel", "sha256")): + raise SystemExit("Runtime qualification does not match the candidate") + archive = root / f"loopx-runtime-{revision}.tar.gz" + with archive.open("rb") as stream: + digest = hashlib.file_digest(stream, "sha256").hexdigest() + if type(manifest["size"]) is not int or type(qualification.get("bytes")) is not int or ( + archive.stat().st_size != manifest["size"] or qualification["bytes"] != manifest["size"] + or digest != manifest["sha256"]): + raise SystemExit("Qualified runtime bytes differ from the candidate") + if (root / f"loopx-runtime-{revision}.json").read_bytes() != manifest_bytes: + raise SystemExit("Immutable runtime metadata differs from the channel candidate") + print(revision) + PY + )" # Keep each immutable snapshot below GitHub's per-release asset cap. # The existing channel release retains its historical assets and URL. tag="runtime-main-${revision}" diff --git a/README.ja.md b/README.ja.md new file mode 100644 index 0000000000..16fd08cfba --- /dev/null +++ b/README.ja.md @@ -0,0 +1,978 @@ +
+ +

LoopX 2.0

+ +LoopX — Trendshift が記録した GitHub Trending #1 + +**1 つのゴールから始めましょう。長時間にわたるエージェントの作業を検証可能に保ちます。** + +すでに使っている Agent に、やってほしいことを伝えるだけです。LoopX はゴール、 +進捗、意思決定、検証可能な結果を保持するため、セッションをまたいで作業を続けられます。
+Codex、Claude Code、DeepSeek Harness などのランタイムにまたがる 24 時間 365 日常駐エージェントのための、オープンでハーネス非依存のコントロールプレーンです。ローカルの SQLite ワークフローからマルチエージェントチームまでスケールします。 + +[![Release](https://img.shields.io/github/v/release/loopx-project/loopx?color=brightgreen)](https://github.com/loopx-project/loopx/releases/latest) [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE) [![TypeScript core](https://img.shields.io/badge/core-TypeScript-3178C6?logo=typescript&logoColor=white)](docs/architecture/rfcs/typescript-control-plane-migration-v0.md) [![Python](https://img.shields.io/badge/python-3.11%2B-blue.svg)](pyproject.toml) + +[![Local-first state](https://img.shields.io/badge/local--first-state-brightgreen.svg)](docs/public-private-boundary.md) [![Loop Agents](https://img.shields.io/badge/status-loop%20agents%20supported-brightgreen.svg)](docs/product/release-readiness.md) [![GitHub contributors](https://img.shields.io/github/contributors-anon/loopx-project/loopx?color=blue)](https://github.com/loopx-project/loopx/graphs/contributors) [![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/XmGgQyCFZd) [![Listed on dsh-plugin.org](https://dsh-plugin.org/badges/listed.svg)](https://dsh-plugin.org/plugins/loopx-project/loopx) + +[はじめる](#quick-start) · [なぜ LoopX なのか](#なぜ-loopx-なのか) · [24/7 常駐](#always-on-agents) · [動作を見る](#loopx-の動作を見る) · [エビデンス](#エビデンス) · [コントリビュート](#contributing) · [ドキュメント](https://loopx-project.github.io/loopx/docs/) · [English](README.md) · [简体中文](README.zh-CN.md) + +
+ +--- + + + +## 1 つのゴールから始める + +**1. LoopX を一度インストールします。** Python 3.11 以降と +Node.js 22.22.3 以降(24 LTS を推奨)が必要です。 + +```bash +python3 -m pip install --upgrade loopx && loopx workflow-skills --install +``` + +[インストールオプションとアップグレード](docs/guides/installing-loopx.md) + +**2. Agent に望む成果を伝えます。** Agent ホストを再起動してプロジェクトを開き、 +自然言語のゴールを 1 つ送ります: + +```text +$loopx speed up this project's slowest workflow; compare approaches and verify the gains +``` + +LoopX はそれを、目に見える計画、あなたの判断が必要な意思決定、そして必要に応じた検証へと変換します。 +Claude Code では `/loopx ` を使います。その他のランタイムについては +[ホストのセットアップ](#使っている-agent-から始める)をご覧ください。ガイド付きで最初の +実行を試したい場合は、[下のタスクから選んでください](#loopx-を試す)。 + +## 📰 ニュース + + + +- **2026-11-01 · 📘 [24/7 エージェントのための段階的コンテキスト配信](https://loopx-project.github.io/loopx/blog/context-delivery/)** — コンパクションサイクル単位の構造化差分と段階的ビューにより、モデル向けの 213 回の起床にわたってコントロールプレーンのバイト数を削減しました(単層の段階的ビューで `32.5%`、サイクル内の 112 回の継続にわたる積み重ね型の初回読み取りエントリで本文 `3.0%` / CLI `5.0%`)。同時に、ロスレスなベースライン復元も維持しています。 +- **2026-10-25 · 🤝 [長期タスク向けエージェント研究:共同研究者を募集中](https://loopx-project.github.io/loopx/blog/edgebench-feedback-and-memory/)** — EdgeBench と実世界のタスクにおけるフィードバック、再計画、再現可能な評価を通じて、**同一予算下での長期的な成果のブレークスルー**を探求しています。学術研究室や企業のチームとの共同研究を歓迎し、成果と総コストを比較していきます。[共同研究について話し合う](https://github.com/loopx-project/loopx/discussions)。 +- **2026-10-20 · 🚀 [LoopX 2.0](https://github.com/loopx-project/loopx/releases/tag/v2.0.0)** — 共有の TypeScript 状態レイヤーと、長期研究用ワークベンチ。[移行ガイド](docs/product/releases/v2.0.0.md) · [エンジニアリングの舞台裏](https://loopx-project.github.io/loopx/blog/typescript-control-plane-refactor/)。 +- **2026-10-14 · 🤖 [エージェント型ソフトウェア](https://loopx-project.github.io/loopx/blog/semantic-software-development/)** — ゴール、エビデンス、人間のフィードバックをエンジニアリングの成果物につなげます。 +- **2026-10-02 · 🧠 [長期ブートストラップと RSI](https://loopx-project.github.io/loopx/blog/long-horizon-rsi/)** — LoopX を使って LoopX を開発した 4 か月間:公開されているプロジェクトの歴史と、システムレベルの自己改善に関する設計上の視点。 +- **2026-09-18 · 🧪 [LoopX × LHTB](https://loopx-project.github.io/loopx/benchmarks/lhtb/)** — 同一モデルによる 46 タスクの研究が、**より多くの計算資源をより良い成果に変える**ことを実証的に裏付けました。LoopX 1.0.3 Heartbeat による継続実行の平均報酬は、Plain Codex より 17.3%、ネイティブ Goal より 10.6% 高くなりました。 +- **2026-09-06 · 🎉 [LoopX 1.0](https://github.com/loopx-project/loopx/releases/tag/v1.0.0)** — セッションをまたいでエージェントの作業を追跡し、意思決定に対応し、納品された結果を確認できる Personal Agent Workspace。[Workspace ガイド](https://github.com/loopx-project/loopx/blob/v1.0.0/docs/guides/personal-workspace-user-guide.md)。 +- **2026-08-02 · ⏱️ [200 時間超のトラジェクトリを X で公開](https://x.com/huangruiteng/status/2083904257494024425)** — 経過時間 200 時間超にわたるオーナー実行の初期事例が X で大きな注目を集め、実行、待機、人間の判断、復旧にまたがる作業を示しました。[トラジェクトリとその限界](#オープンソースの-issue-修正)。 + +[すべてのリリース](https://github.com/loopx-project/loopx/releases) + + + +## なぜ LoopX なのか + +最初の有用なアクションの前に、LoopX の内部を学ぶ必要はありません。 +デフォルトの進め方はゴールファーストです。望む成果を記述し、Agent に計画を +準備させ、意思決定やデバッグが必要になったときにだけ内部の仕組みを確認します。 + +エージェントは 1 つのセッションでタスクを完了できます。しかし長時間にわたる作業はもっと難しくなります。 +目的は変わり、オーナーの判断が必要になり、エビデンスは古くなり、エージェントは +作業を仲間に引き継ぎます。タイマーはループを動かし続けられますが、それだけでは有用になりません。 + +- **最初からやり直さずに続けられます。** ゴール、受け入れ済みの要件、 + 意思決定、エビデンスを、セッションや再起動をまたいで保持します。 +- **[コンテキストを失わずに連携できます。](https://loopx-project.github.io/loopx/blog/agent-facing-kanban/#walkthrough)** 委任された作業、依存する + 成果物、レビュー、返された結果を、責任の所在を明確にしたまま結び付けます。 +- **何が変わったかで進捗を判断できます。** 単なる活動量ではなく、成果物、裏付けとなる + エビデンスと反証となるエビデンス、コスト、次の意思決定を確認します。 + +モデルとツールは Agent ランタイムが提供します。LoopX の永続的な状態レイヤーは、 +エンジニアリング、研究、運用のために、ゴール、受け入れ基準、意思決定、オーナーシップ、エビデンスを +セッションやランタイムをまたいで保持します。エージェントと人間はそれらの事実を使って、 +次に何をすべきかを見直します。保護されたアクションは、引き続き人間の承認によって統制されます。 + + + +| やりたいこと | ここから始める | +| --- | --- | +| コーディングや研究のエージェントをセッションをまたいで働かせ続ける | [インストールして始める](#quick-start) | +| 個人のプロジェクト、スケジュール、意思決定を 1 か所で管理する | [Personal Agent Workspace](#personal-agent-workspace-の紹介) | +| インフラを自作せずに 24/7 常駐エージェントを構築する | [24/7 常駐エージェントのコントロールプレーン](#always-on-agents) | +| エージェント同士を連携させ、検証可能な結果を納品させる | [エージェント連携ガイド](docs/product/use-cases/cross-runtime/README.md) | + +LoopX は、永続的な作業状態を 1 つのコンパクトなレイヤーに保持します: + + + + ハーネスがターンを実行し、LoopX が作業を引き継ぎます。 + + +作業を実行するのは Agent ランタイムです。LoopX は、エンジニアリング、研究、探索、 +運用のループが実行をまたいで継続できるようにするための状態を保持します。これは +新たなエージェントフレームワークでも、特定プロバイダー向けのオーケストレーションランタイムでもありません。 + +
+詳細:コントロールレイヤーの仕組みと位置付け + + + + 単なるタイマーではなく、統制された状態遷移の詳細ビュー。 + + +わかりやすいメンタルモデルは、 +**[長時間作業のためのエージェントネイティブなカンバン](docs/development/control-plane-course/00-concept-primer.md)** です。 +カードはアイデンティティ、権限、エビデンス、継続情報を持ちます。カードの移動は、claim、gate、monitor、 +writeback などの検証済みオペレーターです。ボードは投影(プロジェクション)であり、 +信頼できる唯一の情報源は LoopX の状態です。 + +登録されたエージェントは対等な仲間です。claim、リース、タスク境界、ケイパビリティ、 +型付きの継続によって次に誰が動くかが決まり、永続的なリーダーのアイデンティティは +必要ありません。 + +LoopX は、次のようなものを実行するときに役立ちます: + +- 複数日にわたるエンジニアリング、研究、ベンチマーク、実験の目標 +- スコープ、エビデンス、レビュー状態を保持しなければならない Issue や PR のループ +- 定期的な heartbeat や監視の作業 +- オーナー、安全性、公開、プライベートデータのゲートがあるプロジェクト +- オーナーシップ、リース、引き継ぎが重要になる対等なエージェントのチーム +- 進捗がエンジニアではないオペレーターにも理解できる状態でなければならない、 + クリエイター、研究、運用のワークフロー + +LoopX は自律的な本番コントローラーではありません。危険な権限、 +公開、本番環境への書き込み、最終的なオーナーシップは人間に残ります。 + +
+ + + +### 5 つのサブシステムを自作せずに 24/7 常駐エージェントを構築する + +[Anthropic の *Building always-on agents*](https://claude.com/resources/articles/building-always-on-agents) +では、効果的な常駐エージェントは実時間のほとんどをトークン消費ゼロで +スリープして過ごし、周囲の 5 つのサブシステム(**Event Inbox**、**Timers**、**Memory**、**Permissions**、 +**Outbox**)にまたがる限定的な実行のために起床すると指摘しています。実際には、チームはエージェントホストごとに、 +cron スクリプト、JSON キュー、プロンプトのコンパクション、場当たり的な承認チェックといった壊れやすい +つなぎのコードを作り直しがちで、2 週目には気付かないうちの陳腐化、重複書き込み、ノイズの多いステータス通知に +悩まされることになります。 + +LoopX はそのオープンでハーネス非依存のコントロールレイヤーをパッケージ化しているため、 +すでに使っているランタイム(Codex CLI、Claude Code、DeepSeek Harness、カスタムランナー)を、 +明示的な永続性と人間によるゲートを備えた状態で 24 時間 365 日運用できます: + +| 常駐のためのプリミティブ | LoopX コントロールプレーンのサブシステム | 数週間にわたる実行で防げること | +| --- | --- | --- | +| **Event Inbox** | シングルフライトの **Goal / Todo / Hard Lease** キュー、非同期のアプリ受信箱、接続済みの Lark / GitHub リスナー | 同じリポジトリの状態を重複したワーカーが変更すること、実行中に人間の入力が失われること | +| **Timers & Wakeups** | **Guarded Heartbeat** と安全な定期プリセット(`daily-triage`、`changelog-draft`、`pr-watch`。`loopx preset list` で確認) | 何も変わっていない、またはゲートがまだ人間を待っているのに、やみくもな cron ループがトークンを浪費すること | +| **Memory & Compaction** | [`Decision Context`](loopx/capabilities/decision_context/README.md) によるソース追跡、コンパクションサイクル単位の **Progressive + Delta** [`context_delivery`](https://loopx-project.github.io/loopx/blog/context-delivery/)(213 回の起床にわたるビューで `32.5%`、サイクル内の 112 回の起床にわたる初回読み取りエントリで `3.0% / 5.0%`)、およびオプションの [`Reward Memory`](loopx/capabilities/reward_memory/README.md) | 気付かないうちのソースの陳腐化、コンパクションをまたいだプロンプトの再送の累積や差分の破損 | +| **Permissions & Deferred Calls** | 明示的な**オーナー、安全性、公開、プライベートデータのゲート**、分離されたワークツリー、レビュー可能な引き継ぎ | 自律的な cron 実行による外部への公開、強制マージ、プライベートなコンテキストの漏洩 | +| **Outbox** | 本当の完了、ブロッカー、未解決のゲートを示す、共有 Workspace と Lark の Goal/Decision/Evidence ビュー | 断片化したターミナルログや、人間に実行の子守りを強いるノイズの多い通知 | + +**個人のローカル利用からチーム・組織規模まで、1 つの契約セットで:** + +| 規模 | LoopX の動かし方 | 権限、連携、ガバナンスの姿勢 | +| --- | --- | --- | +| **個人開発者とローカルエージェント** | 外部インフラなしで `python3 -m pip install --upgrade loopx`。既存の CLI/デスクトップのランタイムを接続します | ハードリースを備えた正規のローカル **SQLite** ストア(既存の File セットアップも利用可)。アイドル時のトークン消費ゼロで、再起動やコンパクションを乗り越えます | +| **エンジニアリングチームとエンタープライズへの道筋** | 対等なワーカーが todo を claim し、Desktop Workspace、GitHub、Lark を通じて共有ゴール上でレビュー済みの成果物を返します([3 エージェントのデモ](examples/collaboration-delivery/README.md)) | ワーカーのオーナーシップと人間の承認ゲートを維持します。段階的な **PostgreSQL** リモート権限([プロバイダー](loopx/control_plane/coordination/postgresql_authority_store.ts))や、計画中の組織ガバナンス(RBAC、SSO、クォータ、署名付き監査)へと拡張できます。詳しくは[導入と SaaS のロードマップ](docs/product/roadmaps/saas-opportunity-assessment.md)をご覧ください | + +## LoopX の動作を見る + +企業のチーム、研究組織、個人開発者のための長期研究ワークベンチである LoopX 2.0。記録された研究履歴と、縮尺どおりに描き直したカウントリボンを、ラベル付きのアプリフレーム内に表示
+研究ワークベンチの動画を見る · 86 秒 · 文字起こし、字幕、出典。録画したアプリの抜粋、合成例、イラストにはラベルを付けています。 + + + +### 継続できる研究 + +ゴールを開くと、その作業、担当の Agent、記録された Explore の履歴を確認できます。 +**Deep analysis** を使うと、登録されたトラジェクトリ、その引用、ネイティブな +結果の読み戻し、個別に計測されたコストを確認できます。研究画面では、出典に紐付いた +[人間の注意](docs/reference/trajectory-assessment.md#human-attention-in-research-optional)も、 +記録された入力、タイミングのカバレッジ、確認可能な最適化ポイントとともに表示されます。ソースは Agent が準備します。 +ページを開いたり結果を読んだりしても、モデル呼び出しは始まりません。明示的な分析では、 +設定されたホストとアカウントが使われます。 + +裏付けられた発見、反証された発見、不明な発見を見える状態に保ちます。アプローチが +変更された理由や継続された理由を確認し、そのエビデンスを次の試行に持ち込みます。 + +### Personal Agent Workspace の紹介 + +長期的なゴールを 1 つのローカルファーストなワークスペースに保持します。ゴール、注意、 +会話、タスク、ファイル、スケジュール、復旧は、日をまたいでも、再起動しても、 +ハーネスが変わっても失われません。プロジェクトを再び開き、前のターンの状態と +エビデンスを確認して、次に許可されたアクションを続けます。 + +新しいデフォルトの Codex ゴールでは、タスクとワークスペースの権限を確認してから +**Create Goal and start first run** を確定します。元のタスクは、独立したチェックと実行枠の準備が整うと +元の会話の中で続行されます。通常のメッセージは読み取り専用のままです。待機、結果の読み戻し、 +復旧については[ワークスペースガイド](docs/guides/personal-workspace-user-guide.md#在原对话执行已检查的任务--run-the-checked-original-task)に +従ってください。 + +LoopX は、こうした長期的なコントロール状態を Personal Workspace にまとめます。1 か所で次のことができます: + +- 何があなたを必要としているか、何が実行中か、何が監視中か、何が + スケジュール済みまたは停止中かを確認する +- ゴールのケイパビリティを設定し、マシンのデフォルトとゴールごとの上書きを区別し、 + 適用前に変更をプレビューする +- 実行中のターンを誘導したり、メッセージをキューに入れたり、接続済みの Lark 会話から + 明示的な Goal/Agent/セッションのルーティングで非同期受信箱を使ったりする +- 納品されたファイル、定期レポート、それらを裏付けるエビデンスを確認する +- Codex、Claude Code、モデル直接利用、その他の登録済み Agent セッションをまたいで、 + ゴールの状態やエビデンスを失わずに作業を続ける +- 型付きのプレビュー、明示的な確認、受領記録を通じて保護された変更をレビューする。 + その間も、権威を持つのはブラウザーではなく LoopX の状態です + +Manager のグループ会話では、LoopX はメッセージの可視性とターンの権限を分けて +扱います。バイリンガルの [Lark Manager のコンテキストと権限の +契約](docs/reference/protocols/lark-manager-context-authority-v0.md)をご覧ください。 + +```bash +loopx dashboard +``` + +`loopx dashboard` がサポートされているブラウザー/PWA の起動方法です。ネイティブのデスクトップ版 +プレビューを[現在のリリース](https://github.com/loopx-project/loopx/releases/latest)からダウンロードすることもできます。 +これらは同じループバックサービスとゴールの状態を再利用します。Apple Silicon の macOS では、 +シェルと同梱のランタイムを組み合わせる署名付きのアプリ更新に加え、修復と +復旧にも対応しています。Python 3.11 以降が必要です。アプリは ad-hoc 署名のみで、公証はされていません。 +Windows の NSIS プレビューインストーラーは main チャネルで同じ署名付きの更新フローに対応しており、 +CLI は別途インストールします。stable チャネルと MSI でのインストールは +手動のままで、アプリのロールバックと修復は利用できず、インストーラーには +Authenticode 証明書がありません(Windows で SmartScreen の確認が表示される場合があります)。 +[デスクトップ版のインストール、更新、ソースからの開発](apps/desktop/loopx-control-plane/README.md)。 + +実際の Workspace の録画:子タスクの容量と、許可された責任範囲を設定する + +
+ケイパビリティ設定と再現可能なワークスペースのシナリオ + +ソースをチェックアウトした状態で `python -m demo.workspace serve` を実行すると、コミュニティ +イベント、家庭のエネルギー比較、地域の Web サイト公開の 3 つを試せます。それぞれに 4 つの +作業ロール、18 個のタスク、2 つの意思決定、2 つの監視があります。上のスクリーンショットは +この再現可能なワークスペースのものです。[シナリオとリプレイの手順](demo/workspace/README.md)。 + +
+ +[32 秒のウォークスルー全編を見る](docs/assets/personal-workspace/loopx-dashboard-launch.mp4) +· [ワークスペースガイドを読む](docs/guides/personal-workspace-user-guide.md) +· [5 分間のツアーを試す](docs/guides/personal-workspace-trial-guide.md) + +## LoopX を試す + +確認できる結果が得られるウォークスルーを選んでください: + +| 始めるもの | やること | +| --- | --- | +| [初めてのバグ修正ループ](docs/guides/first-bugfix-loop.md) | 小さな Python プロジェクトで 2 つのバグを再現し、Agent に修正させてから、テストとパッチを確認します。 | +| [長時間のコーディング作業](docs/guides/long-running-coding-agents.md) | Issue を修正したり、自分のリポジトリを改善し続けたりします。レビュー、エビデンス、復旧はセッションをまたいで引き継がれます。 | +| [Personal Agent Workspace(中国語)](docs/guides/personal-workspace-user-guide.md) | 図解ガイドに沿って、アプリでプロジェクト、会話、タスク、納品された結果を管理します。 | + +### 使っている Agent から始める + +[2 ステップのセットアップ](#quick-start)の後、プロジェクトで開いたセッションで +お使いのホスト用のエントリを使います: + +| ホスト | 開始と継続の確認 | +| --- | --- | +| Codex App | `$loopx `。[heartbeat オートメーションが保存されていること](docs/guides/first-bugfix-loop.md#confirm-that-it-actually-started)を確認します。 | +| Codex CLI | `$loopx `。生成された[ネイティブの `/goal`](docs/product/runtimes/codex-cli/codex-cli-packaged-install.md#current-user-path) を同じセッションで有効化します。 | +| Claude Code | `/loopx `。定期的な作業には[ループドライバーのセットアップ](docs/guides/newcomer-command-path.md#choose-the-loop-driver)に従います。 | +| DeepSeek Harness | [ネイティブの DSH プラグイン](packages/dsh-loopx-plugin/README.md)をインストールし、`loopx` スキルを選択してから、タスクを記述します | + +LoopX は既存のプロジェクト状態を再利用するか、プロジェクトを接続し、作業を +Todo として計画して、ホストの有効化をガイドします。アクティブなゴール、 +次の Todo、継続の仕組みを Agent に確認してもらってください。セットアップパケットだけではアクティブなループになりません。 +作業を続けるあいだは、ホストを利用可能な状態にしておいてください。`loopx status` はゴール、 +あなたを待っている意思決定、次の Todo を表示します。`loopx doctor` はインストールを診断します。 + +[LoopX のインストール](docs/guides/installing-loopx.md)では、ネイティブの Windows、`pipx`、 +アップグレード、ロールバック、アンインストールについて説明しています。 + +**1.x からアップグレードする場合は?** 既存のゴールを続ける前に、[2.0 の移行と復旧のガイド](docs/product/releases/v2.0.0.md)をお読みください。 + +
+その他のホスト、ループドライバー、カスタムランナー + +| ホスト | 推奨される開始方法 | ループドライバー | +| --- | --- | --- | +| Codex App | プロジェクトで開いたスレッドで `$loopx ` を実行するか、`/skills` から `loopx` を選びます。 | Codex App の heartbeat オートメーション。`quota should-run.scheduler_hint` から更新されます | +| Codex App over SSH | `loopx agent-onboard --agent-type codex-app-ssh --project .` | 返される可視の `/goal ` | +| Codex CLI | プロジェクトで `codex` を起動し、`$loopx ` または `/skills` を使います。 | 可視の `/goal `。デフォルトでは隠れたヘッドレス実行はありません | +| Claude Code | オプトインのアダプターをインストールし、`/loopx ` に続けて `/loop` を実行します。 | LoopX によってゲートされた、Claude Code ネイティブの `/loop` | +| KunlunCode | `loopx-kunluncode connect --project . --goal-id --agent-id ` を実行し、範囲を限定した todo を追加してから、`loopx-kunluncode run --project .` を実行します。 | app-server を介したネイティブの Goal Pro。LoopX は厳密な検証の後にのみ、完了とクォータを書き込みます | +| OpenCode | 静的なコマンドファサードをインストールし、定期的なゴールには `--with-goal-bridge` でオプトインします。 | OpenCode のコマンドファサードと明示的なゴールブリッジ | +| Pi | `loopx slash-commands --install --surface pi` でオプトインのゴール拡張をインストールし、信頼できる Pi セッションから `/loopx ` を使います。 | LoopX のクォータによってゲートされた可視の Pi ゴール拡張(`loopx_goal_activate` + `agent_settled` による継続) | +| ZCode | `loopx slash-commands --install --surface zcode` でスキルファサードをインストールし、プロジェクトの ZCode セッションから `$loopx` スキル(または `/loopx `)を呼び出します。 | ZCode セッション自身のターンループ。すべての継続は `quota should-run` を経由します | +| Antigravity CLI (agy) | `loopx slash-commands --install --surface agy` でスキルファサードをインストールし、プロジェクトの `agy` セッションから `loopx` スキル(または `/loopx `)を呼び出します。 | セッションのネイティブな `/goal` ループ(`` まで監査されます)と、セッションが生きている間の `schedule` による自己起床。ファサードは各ターン/起床で `quota should-run` を経由して再入するよう指示します。これは助言的なペース配分であり、ホストが強制するゲートではありません | +| Kiro CLI | `loopx slash-commands --install --surface kiro-cli` でスキルファサードをインストールし、プロジェクトの `kiro-cli` セッションから `/loopx ` を実行します。 | セッションのネイティブな `/goal --max Done when: ` ループ。ホストがゴール文から受け入れ基準を導出するため、基準はゴール文の中に記述します。ホスト自身の反復予算(デフォルトは 5)で制限され、組み込みの `goal` 完了契約によって確定されます。ファサードは各ターンと反復で `quota should-run` を経由して再入するよう指示します。これは助言的なペース配分であり、ホストが強制するゲートではありません | +| DeepSeek Harness (dsh) | [ネイティブの DSH プラグイン](packages/dsh-loopx-plugin/README.md)をインストールし、`loopx` スキルを選択して、タスクを記述します。ヘッドレスなターンには、引き続き [dsh goal-mode アダプター](loopx/dsh_goal_mode/README.md)を利用できます。 | ネイティブな同一セッション内での継続と GoalBar、またはヘッドレスな dsh セグメント。どちらも LoopX の権限によってゲートされます | +| Cursor、シェル、カスタムランナー | `loopx start-goal --guided --project . --goal-text ""` を実行するか、ランナーから LoopX を呼び出します。 | お使いのシェル、スケジューラー、ランナー | + +そのままコピーできるセットアップメッセージとホストの復旧手順は、 +[Getting Started](docs/guides/getting-started.md) にあります。ホスト連携では、 +[Codex App のホストコマンドレジストリ契約](docs/reference/protocols/codex-app-host-command-registry-v0.md)、 +[Codex CLI のパッケージインストール手順](docs/product/runtimes/codex-cli/codex-cli-packaged-install.md)、 +[Claude Code アダプター](loopx/claude_goal_mode/README.md)、 +[KunlunCode のネイティブ Goal アダプター](loopx/kunluncode_goal_mode/README.md)、 +[Kiro CLI の goal-mode アダプター](loopx/kiro_cli_goal_mode/README.md)、または +[DeepSeek Harness のターンアダプター](loopx/dsh_goal_mode/README.md)を確認できます。 + +ネイティブな手順については、[60 秒の DSH × LoopX Replan の録画と再現可能な +フィクスチャ](docs/showcases/cases/dsh-loopx-replan-demo.md)をご覧ください: +プラグインをインストールし、スキルを 1 つ選択し、重要な制約を変更して、 +保持された意思決定の記録を確認します。 + +カスタムランナーの場合は、まず +[最小限のカスタムランタイムの例](docs/guides/minimal-custom-runtime-example.md) +(`python3 examples/custom-runtime-minimal-cli-turn-smoke.py`)から始め、次に完全な +[Embed LoopX in Your Agent Runner](docs/guides/custom-agent-runner-integration.md) +ガイドと[ワーカーブリッジのインストール契約](docs/integrations/worker-bridge-install-contract.md)をご覧ください。 +コアとなる 1 回の tick は、意図的に小さくしています: + +```text +loopx quota should-run # should this registered agent act now? +loopx todo claim # who owns this slice? +loopx todo update # what changed? +loopx refresh-state # what should the next turn see? +loopx quota spend-slot # account for a completed, validated slice +``` + +クローンによるインストールは、ライブの canary ラッパーを使いたいコントリビューター向けです: + +```bash +git clone https://github.com/loopx-project/loopx ~/loopx +~/loopx/scripts/install-local.sh +loopx doctor +``` + +
+ +### 初回実行のフィードバック + +LoopX がうまく動いたら、1 分で書ける公開 Issue が、実際の初回実行がどのようなものかを +知る助けになります。これは任意で、テレメトリは含まれません。ログ、パス、認証情報、 +社内のプロジェクト名、ゴールの内容は含めないでください: + +- [初回実行のフィードバック](https://github.com/loopx-project/loopx/issues/new?template=first_run.yml) +- [長時間の実行についての利用事例](https://github.com/loopx-project/loopx/issues/new?template=usage_story.yml) + +`loopx first-run-report` は、何も送信せずに、同じ入力済みのリンクをローカルで +表示します。 + +基本的な利用統計は、初回利用時の告知の後、デフォルトで有効になります。プラットフォームのサポート状況と継続利用を把握するための、 +ランダム ID による 1 日 1 回の heartbeat と、それとは別の ID なしの CLI 利用回数です。 +コンテンツは収集しません。どちらも Settings → Capability Center、 +または `loopx usage-ping disable` / `LOOPX_USAGE_PING=0` で無効化できます。送信内容は +`loopx usage-ping status` で確認できます。[基本的な利用統計](docs/reference/usage-ping.md)をご覧ください。 + + + +## エビデンス + + + +### LHTB:同じモデルでより高い平均報酬 + +**LoopX 1.0.3 Heartbeat は、対応する 46 タスクで平均報酬 0.4948 を達成しました:** +**Plain Codex を 17.3% 上回り**、**ネイティブの Codex Goal を 10.6% 上回っています**。 +3 つとも GPT-5.6 Sol、最大の推論努力、Web Search 無効の条件で実行しています。 +[Long-Horizon Terminal-Bench](https://zli12321.github.io/LHTB/index.html) はコーディングにとどまりません。これらのタスクは、研究の +再現、科学シミュレーション、マルチモーダル分析、専門的な +ワークフロー、ゲーム、システム関連の作業にまたがります。 + +| 実行モード | 平均報酬 ↑ | 厳格な合格率(≥0.95) | 合格率(≥0.80) | +| --- | ---: | ---: | ---: | +| Plain Codex | 0.4218 | 7/46 (15.2%) | 12/46 (26.1%) | +| ネイティブの Codex Goal | 0.4475 | 4/46 (8.7%) | 14/46 (30.4%) | +| **LoopX 1.0.3 Heartbeat** | **0.4948** | **7/46 (15.2%)** | **15/46 (32.6%)** | + +≥0.80 のしきい値は補足的な事後の見方です。ベンチマークの厳格な解決しきい値は +引き続き ≥0.95 です。この研究にはちょうど 0.80 のスコアがないため、 +これらの件数は研究概要の >0.80 の見方とも一致します。 + +ネイティブの Goal と比べると、タスク単位の報酬は **23** タスクで改善、**13** タスクで同等、 +**10** タスクで悪化しました。厳格な解決数は Plain Codex と同じであるため、平均の向上は、 +すべてのタスクが改善したことや、Plain より多くのタスクが完全に解決されたことを +主張するものではありません。平均報酬は部分的な進捗も評価に含めます。 + +タスクとモードごとに有効な試行は 1 回です。指定された代替試行があり、 +ランタイムや予算は均等ではありません(一部の Heartbeat の代替試行にはより長い予算を含みます)。 +これらは観測されたシステムとしての結果であり、同一予算での効率の結果でも、 +LoopX の効果を単独で推定した因果的な推定値でもありません。 + +[インタラクティブな結果、タスクの比較、方法論](https://loopx-project.github.io/loopx/benchmarks/lhtb/) +· [5 アームの研究とその限界](benchmark/LHTB/studies/five-arm-gpt56sol-max/README.md) +· [公開されているタスク単位のスコア](benchmark/LHTB/studies/five-arm-gpt56sol-max/data.json) + +ベンチマーク以外にも、LoopX には確認可能な長期プロジェクトのエビデンスがあります。 +公開されている OpenViking へのコントリビューションの流れは、 +**ループの経過時間で 200 時間超**にわたり、 +範囲を限定したターン、意思決定、エビデンスの更新を保持しています。これはプロジェクトの実時間を +計測したものであり、連続したモデルの実行時間や無人での本番自律運用を示すものではありません。 +図を開くと、公開しても安全なタスクグラフ、エビデンスの分岐、 +ターンをまたいだ意思決定を確認できます。この事例には、出典と再現性の範囲が記載されています。 + +### オープンソースの Issue 修正 + +**200 時間超の公開コントリビューションの軌跡:PR の納品と再利用可能な修正知識が +ともに進化します。** + + + 焦点を絞った PR の納品と、再利用可能な LoopX のケイパビリティを結び付けた、オープンソースの Issue 修正のトラジェクトリ + + +
+コントリビューションの出典とエビデンスの範囲 + +LoopX の作者は、この手順を +[OpenViking のコントリビューター](https://github.com/volcengine/OpenViking/pulls?q=is%3Apr+author%3Ahuangruiteng)として使っています。 +示されている公開コントリビューションの流れは、最初の PR の作成から、示されている最新の +レビューまたは更新まで、経過時間で 200 時間を超えています。 +[Issue-Fix ケイパビリティ](loopx/capabilities/issue_fix/README.md)は、継続的に更新される +リポジトリのコンテキスト、リビジョンが刻まれた修正知識、レビュアー向けの +好みを分けて保持します。権威を持つのは、リンクされた PR と、現在のチェックアウトのソースおよびテストです。 + +
+ +### 実際のプロジェクトでの利用 + +- **独立したユーザー · `>13h` の C++ 精度改善の実行。** ユーザーの報告によると、 + 複数段階のタスクが一貫性を保ち、公開情報の調査を行い、 + [公開されているコードメモリツール](https://github.com/DeusData/codebase-memory-mcp)を採用し、 + 最終的な精度が向上しました。[エビデンスの範囲を読む](docs/showcases/cases/independent-cpp-accuracy-long-run.md)。 +- **独立したユーザー · `4d` の無人実行。** ユーザーの報告によると、4 日間 + 人間の介入なしに有用な作業が続き、定期レポートの画面も + 機能しました。[マスキング済みの事例を読む](docs/showcases/cases/independent-four-day-unattended-agent.md)。 +- **独立したユーザー · `7` 件のマージ済み PR。** LoopX によるものとされる Engine のリファクタリングが、 + [公開 Issue](https://github.com/zilliztech/mfs/issues/166) と + 7 件のマージ済み PR で確認できます。LoopX によるものという帰属と、報告された `1B+` トークンという規模は、ユーザーの + 報告に基づくものです。[事例を確認する](docs/showcases/cases/independent-public-engine-refactor.md)。 +- **独立したユーザー · vLLM の最適化がアップストリームにマージ。** + [Zheng Cai](https://x.com/zigzagcai/status/2109952174822408443) は、プロファイリング、調査、実験、 + 正確性チェックのワークフローエンジンとして LoopX を使ったと報告しています。[vLLM PR #54951](https://github.com/vllm-project/vllm/pull/54951) + では sparse-indexer の最適化がマージされました。報告されている総トークンスループットの **32.59%** の向上は、 + GLM-5.3-Flash、入力 1M トークン、4×H200、TP4、C1 の条件でのものです。 + [ワークフロー、すべての条件、エビデンスの範囲を確認する](docs/showcases/cases/independent-vllm-long-context-optimization.md)。 + +これらは注目の独立ユーザー事例 4 件であり、すべてではありません。コントリビューターの事例、 +作者自身によるドッグフーディング、再現可能なデモ、明示的なエビデンスの強度ラベルについては、 +[Showcase の完全なカタログ](docs/showcases/README.md)をご覧ください。 + +### 探索的なベンチマーク研究 + +- **[SWE-Marathon](https://loopx-project.github.io/loopx/benchmarks/swe-marathon/):** + 対応する 15 タスクで 5 つの実行モードを比較し、自己検証、スコア、 + コストを比べています。自己検証を増やしても、一貫して高いスコアにはなりませんでした。 +- **[LHTB × LoopX](https://loopx-project.github.io/loopx/benchmarks/lhtb/):** + [上記の結果](#lhtb-results)から、5 つの実行メカニズム、 + タスク単位の比較、悪化した事例、探索的なタスクタイプ分析へと続きます。 +- **[DeepSWE の行動分析](https://loopx-project.github.io/loopx/benchmarks/deepswe/behavior-discovery/)**(中国語): + 選ばれた事例をもとに、ドメインのヒントが要件の保持や + 検証の選択とどう関係するかを調べ、さらなる検証のためのメカニズムの仮説を示しています。 + +SWE-Marathon と LHTB は、タスクとモードごとに有効な試行が 1 回です。DeepSWE は +選ばれた事例と事後分析を用いています。 + +その他の確認できる情報: + +- 製品のストーリー、クイックスタート、長期実行のエビデンスについては + [公開ホームページ](https://loopx-project.github.io/loopx/) +- [Showcase の完全なカタログ](docs/showcases/README.md)と、その + [バイリンガルのホスト版インデックス](docs/showcases/index.html) +- 依存する成果物、独立したレビュー、返された結果については[エージェント連携ガイド](docs/product/use-cases/cross-runtime/README.md) +- 公開されている[ユーザーマニュアル](https://my.feishu.cn/wiki/CaL5wMk9ui17ngkWzeUcMlAYnZg) + + + +## ケイパビリティ + +必要な成果から始めましょう。オプションのケイパビリティは、同じゴール、 +作業のオーナーシップ、エビデンスを再利用します。それぞれのサポート状況と権限の範囲を確認してください。 + +### 製品ケイパビリティの進め方 + +ケイパビリティは、汎用的なプリミティブを、成果に責任を持つ作業レーンに変えます。 +成果から始め、現在登録されている実装とその書き込み範囲を +確認してください: + +| やりたいこと | ケイパビリティ | 始め方 | +| --- | --- | --- | +| 公開 Issue を、レビュー可能でエビデンスに裏付けられた変更にする | [Issue Fix](loopx/capabilities/issue_fix/README.md) | `loopx capability show issue-fix --format json` | +| 納品前に、最終的な差分そのものを適格性確認する | [Change Quality](loopx/capabilities/change_quality/README.md) | `loopx capability show change-quality-qualification --format json` | +| 定期レビューの前に、忙しいのにゴールから外れている作業ラウンドに気付く | [Progress-Review Sentinel](loopx/capabilities/progress_review/README.md) | `loopx capability show progress-review-sentinel --format json` | +| すでにレビュー済みのブランチの、変化し続けるスタックを保持する | [Integration Branch](loopx/capabilities/integration_branch/README.md) | `loopx capability show integration-branch-reconcile --format json` | +| 仮説や発見を失わずに、不確実な研究を探索する | [Explore](loopx/capabilities/explore/README.md) | `loopx capability show explore --format json` | +| 現在のエビデンスと検証済みの結果に基づいて意思決定を見直す | [Decision Context](loopx/capabilities/decision_context/README.md) | `loopx capability show decision-context --format json` | +| 受領記録付きで、定期的または進捗をきっかけにしたレポートを作成する | [Periodic Report](loopx/capabilities/periodic_report/README.md) | `loopx capability show periodic-report --format json` | + +インストール済みのリリースにおける正式なカタログは、`loopx capability list --format json` を実行すると確認できます。 +ケイパビリティの詳細には、ユーザーにとっての価値、成熟度、 +プロバイダーの準備状況、エントリコマンド、書き込み範囲、プロトコル、永続的な +検証が含まれます。成果から選ぶには[人が読めるケイパビリティのインデックス](loopx/capabilities/README.md)を参照し、 +プロバイダーをインストールまたは構築するときは [Extensions and Capabilities](docs/reference/extensions.md) を +使ってください。 + +### コントロールプレーンの中核となる約束 + +Kernel は、その仕組みを 5 つの問いにまとめています。それぞれの問いが、あらゆるエージェントハーネスの上で +1 つの製品上の約束を果たします:目的 → 長期的な状態、 +次 → 意味的な意思決定、人間の判断 → 人間とエージェントの協働、 +エビデンス → 復旧、継続 → ガバナンス。 + +| 問い | LoopX が見える状態に保つもの | +| --- | --- | +| 目的は何か? | アクティブなゴール、明示的なスコープ、現在の権限。 | +| 次に何が起こるか? | 順序付けられたユーザーとエージェントの todo、オーナーシップ、claim、リース。 | +| 人間の判断が必要なものは何か? | 曖昧な「オーナー待ち」ではなく、具体的なユーザーゲート。 | +| どのエビデンスが変わったか? | コンパクトな実行履歴、検証、ブロッカー、受け入れられた writeback。 | +| ループを続けてよいか? | クォータ、ケイパビリティ、安全なフォールバック、スケジューラーのヒント、停止条件。 | + +Goal の停止は `loopx goal-lifecycle --goal-id --operation stop` でプレビューできます。 +資格を元に戻すには `--operation resume` を使います。遷移を適用するには +`--actor-kind owner --execute` を使い、Goal のアクションビューから提供された場合は最新の `--expected-state-fingerprint` を付けたままにします。 +通常の CLI とスタンドアロンの +[`loopx-core`](packages/loopx-core/README.md) CLI は、同じライフサイクルオーナーを使います。 + +
+アーキテクチャ、コントロールプレーンの画面、ランタイムの責任 + +LoopX はアーキテクチャを明示的に保つことで、エージェントハーネスや外部プロバイダーが +変わっても、同じ統制された成果が生き残れるようにしています。以下の用語は、交換可能な +プラグインの種類ではなく、異なる境界を表しています: + +| 境界 | 意味 | 詳しく見る | +| --- | --- | --- | +| **Kernel** | 永続的なゴール、todo、ゲート、エビデンス、クォータ、復旧、スケジューリングの真実を管理します。 | [アーキテクチャ](docs/architecture.md) | +| **Capability** | LoopX の状態から、範囲が限定され検証可能な呼び出し元の成果を 1 つ生み出すための、安定したプロバイダー非依存の契約を定義します。 | [ケイパビリティのカタログ](loopx/capabilities/README.md) | +| **Provider** | 外部システムやローカルの実装を呼び出し、範囲が限定された観測、効果の結果、読み戻しを返します。 | [プロバイダーの責任](docs/reference/extensions.md#runtime-responsibilities) | +| **Extension** | 明示的なインストール、準備状況、有効化、アップグレード、無効化、ロールバックのライフサイクルを通じて、オプションのプロバイダーをパッケージ化して運用します。 | [Extension のライフサイクル](docs/reference/extensions.md#runtime-lifecycle) | + +`--available-capability shell` のようなホストの宣言は、観測された +実行サポートを表します。この製品マップでは、これらはランタイムの能力であり、製品の +ケイパビリティでも権限の付与でもありません。有効なケイパビリティは、遷移を提案する前に、 +引き続き独自のポリシーと権限のチェックを適用します。 + +### コントロールプレーンの画面 + +| 画面 | 役割 | 始め方 | +| --- | --- | --- | +| ゴールの状態とステータス | アクティブな状態、todo、claim、ゲート、エビデンス、実行履歴、最初の画面で注意すべき点を追跡します。 | `loopx status`、`loopx diagnose`、`loopx review-packet` | +| クォータとインタラクションの契約 | ターンで納品するか、尋ねるか、待つか、自己修復するか、静かにしているかを決定します。 | `loopx quota should-run`、[クォータの割り当て](docs/quota-allocation.md) | +| Agent ランタイムのブリッジ | Codex App、Codex CLI、Claude Code、汎用ワーカーを同じガードにそろえます。 | `loopx heartbeat-prompt`、`loopx codex-cli-bootstrap-message`、`loopx worker-bridge` | +| オペレーター向け画面 | ブラウザーを状態の権威にすることなく、コンパクトなステータスを表示します。 | `loopx serve-status`、[ダッシュボード](apps/presentation/dashboard/README.md) | +| セッションダッシュ | セッション、そのゴール、各ゴールのステータス/todo の進捗といったフリート全体の進捗を、結果の統計とともに追跡するライブの単一ページパネルを起動します。その場で自動更新されます。 | `loopx dash`、[セッションダッシュの設計](docs/product/surfaces/session-dash-panel-design.md) | +| 外部への投影 | LoopX を権威として保ったまま、todo とゲートをコラボレーション画面に投影します。 | `loopx lark-kanban`、[Lark Kanban アダプター](docs/integrations/lark-kanban-control-plane-adapter.md) | +| ドメインケイパビリティ | Issue 修正、コンテンツ運用、価値コネクターの計画、ML 実験のアドバイス、ベンチマークのエビデンス、Explore など、繰り返し可能な作業レーンをパッケージ化します。 | `loopx issue-fix`、`loopx content-ops`、`loopx value-connectors`、`loopx ml-experiment`、`loopx benchmark`、[Explore](loopx/capabilities/explore/README.md) | +| 実験的なコンテキスト学習 | 名前付きの登録済みエージェントが、無視される・デフォルトでオフのプロジェクト設定を通じて、プロバイダー非依存の Reward Memory を試せるようにします。OpenViking はプロバイダーの選択肢の 1 つであり、グローバルな依存関係ではありません。 | `loopx reward-memory experiment-status`、[Reward Memory のアーキテクチャ](loopx/capabilities/reward_memory/README.md) | +| ガバナンスのパターン | 再利用可能なルーティング、ゲート、エビデンス、投影、計画の形を記録します。 | [インタラクションパターン](docs/concepts/interaction-pattern-catalog.md)、[状態モデル](docs/state-interaction-model.md) | + +提供済みのプリミティブには、ライフタイムゴール、具体的なユーザーゲート、監査済みの安全な +フォールバック、対等な todo のオーナーシップ、クォータとステアリング、コンパクトな実行履歴、 +エビデンスに裏付けられた引き継ぎ、読み取り優先の管理画面、プロジェクトレベルの価値 +シグナル、公開/非公開の境界チェックが含まれます。 + +### ランタイムの責任 + +| 役割 | 責任 | +| --- | --- | +| **Agent** | ホスト/ランタイムを通じて、計画、分析、ツールの使用を行い、範囲を限定したアクションを 1 つ実行します。 | +| **Provider** | 外部システムを呼び出し、観測、効果の結果、読み戻しを返します。 | +| **Capability** | 呼び出し元の成果を定義し、プロバイダーの出力を正規化して検証し、型付きの遷移を提案します。 | +| **Kernel** | 永続的な todo、ゲート、監視、受け入れられた writeback、クォータ、復旧、スケジューリングを管理します。 | + +実行の経路は `Agent -> Capability -> Provider` で、制御の経路は +`Provider readback -> Capability transition -> Kernel` と戻ってきます。Extension は、 +オプションのプロバイダーをパッケージ化して管理する方法であり、コントロールプレーンの別の +オーナーではありません。[アーキテクチャ](docs/architecture.md)と +[Extensions and Capabilities](docs/reference/extensions.md) をご覧ください。 + +
+ +
+パーソナルエージェント、チーム、自己改善するワークフロー + +### パーソナルエージェント、チーム、自己改善するワークフロー + +[Meta Muse](https://about.fb.com/news/2026/09/introducing-muse-personal-ai-agent/)、 +[Grok Bot](https://x.ai/news/introducing-grok-bot)、そして +[Anthropic の *Building always-on agents*](https://claude.com/resources/articles/building-always-on-agents) +によって、常駐するパーソナルエージェントや、スリープ/起床によるイベント駆動の実行は、おなじみの製品 +およびアーキテクチャのモデルになっています。LoopX はこの領域に、すでに実行しているエージェントのための、オープンでプロバイダー非依存の +[24/7 コントロールプレーン](#always-on-agents)としてアプローチします。いずれかの製品を +置き換えるホスト型サービスではありません。 + +- **パーソナルエージェント:** 提供済みの Workspace と接続済みの Lark の画面を使って、 + ゴールを確認し、作業を誘導し、意思決定を解決します。 + [常駐スチュワードと意味的な引き継ぎの RFC](docs/architecture/rfcs/capable-manager-semantic-handoff-v0.md) + は、これをチームのための有能な 1 つの窓口へと拡張するものです。完全な体験は + まだ適格性確認中です。 +- **エージェントチーム:** ワーカーのオーナーシップを消すことなくゴールを共有します。claim、エビデンス、 + 明示的な返却によって、実装とレビューがつながった状態に保たれます。修正と 2 回のレビューラウンドを含む + 範囲を限定した例については、[3 エージェントの連携デモ](examples/collaboration-delivery/README.md)を + ご覧ください。 +- **自己改善するワークフロー:** [Reward Memory](loopx/capabilities/reward_memory/README.md) を通じて + フィードバックを次の試行につなげ、[Explore](loopx/capabilities/explore/README.md) を通じて + 変更候補を評価します。どちらもオプションです。**再帰的自己改善(RSI)** とのつながりは + 提案、テスト、レビュー、保持というエンジニアリングのループであり、LoopX が + 自律的なモデルの改善や複利的な能力向上を実証したと主張するものではありません。 + +パーソナルスチュワードはインタラクション上の役割であり、2 つ目の権威の源ではありません。 +バックグラウンドでの実行には、引き続き利用可能なホストと設定済みのランタイムが必要です。 +[全体のロードマップ](docs/architecture/rfcs/loopx-overall-roadmap-v0.md)では、 +提供済みの基盤と、次のエンドツーエンドの受け入れマイルストーンを分けて示しています。 + +
+ + + + +
+2.0 の背景と移行 + +| 共有のコントロールプレーン | 長期研究用ワークベンチ | +| --- | --- | +| 移行済みのトランザクション、権限、復旧のルールは TypeScript が担います。Python は実際のホスト/プロバイダーの IO と特殊な計算を引き続き担当します。 | 委任された作業、Explore の履歴、成果物、トラジェクトリ分析、次の意思決定を通じて、研究上の問いを追跡します。 | +| [2 か月間のエンジニアリング、ソースの履歴、主要な統計](https://loopx-project.github.io/loopx/blog/typescript-control-plane-refactor/) | [86 秒の動画を見る](https://github.com/user-attachments/assets/543af0b1-c3d4-4cfb-aedd-a68563a20601) · [分析の契約を読む](docs/reference/trajectory-assessment.md) | + +**1.x からアップグレードする場合は?** 2.0 では、昇格されていない Markdown のゴールへの通常の書き込みを廃止しています。 +それらのゴールを続ける前に、[移行と復旧のガイド](docs/product/releases/v2.0.0.md)を +確認してください。インストールによって既存の状態が黙って変換されることはありません。 + +
+ +## 高度な使い方 + +最初の有用なループには、すべてのオプション機能が必要なわけではありません。これらは作業で +必要になったときにだけ追加してください。 + +高度な機能を有効にする前に、現在のゴールの読み取り専用のケイパビリティカタログを +確認してください: + +```bash +loopx configure-goal --goal-id +``` + +`--execute` を付けなければ、このコマンドはプロジェクトの状態を変更せずに、現在/デフォルトの状態、適合性、範囲、 +コピーできるコマンドを報告します。 + +### 定期作業のプリセット + +安全なプリセットは、日次のトリアージ、changelog の下書き、PR の監視をカバーしています。まずは +[初心者向けプリセットガイド](docs/product/foundations/beginner-loop-presets.md)から始めてください。 + +```bash +loopx preset list +loopx preset show daily-triage +``` + +プリセットの確認は読み取り専用です。接続済みの定期的なゴールについては、 +`loopx ready-score --goal-id --agent-id ` が、 +ループを繰り返し実行する準備ができているかどうかを報告します。 + +### 統制されたターン + +LoopX は、検証済みの受領記録、最新のクォータ状態、プロバイダー非依存の予算から、 +純粋で範囲が限定されたターンの決定を 1 つ生成できます。現在の Codex CLI の +クイックスタートと有効化の契約は、 +[LoopX Turn for Codex CLI](docs/product/runtimes/codex-cli/loopx-turn-codex-cli-quickstart.md) に記載されています。 + +### Explore のグラフとハーネス + +Explore はサポートされているオプション機能で、デフォルトではオフです。タスクに +測定可能なオフライン評価、ベースライン、施策、ガードレールがある場合に最も効果を発揮します。 +本番環境の承認の代わりにはなりません。まずは +[Explore ケイパビリティ](loopx/capabilities/explore/README.md)と、その +[Lark での表示のマッピング](loopx/capabilities/explore/README.md#presentation-sink-lark-mapping)から始めてください。 + +### エージェントの作業をレビューする + +意思決定、エビデンス、検証、未解決のゲートを、オーナー向けにコンパクトに確認するには +`loopx review-packet` を使います。 +[インテリジェントな管理画面](docs/product/surfaces/intelligent-management-surface.md) +ではオペレーターのモデルを説明しており、 +[プロジェクトレベルの報酬モデル](docs/product/foundations/project-level-reward-model.md) +では、出力の量、品質、トークン +コスト、ユーザーの注意のコストにまたがる、控えめな価値シグナルを説明しています。 + +具体的な対等ワークフローについては、まず +[エージェント連携ガイド](docs/product/use-cases/cross-runtime/README.md)をご覧ください: +ビルダーがアナリストの成果物を使い、独立したレビューを受け、 +オーナーからの修正に対応して、確認済みの結果を返します。このガイドでは、 +実行可能な同一ホストの例と、以前のクロスランタイムの設計スケッチを区別しています。 + +### アプリと投影の使い方 + +- ローカルの読み取り優先 UI:[ダッシュボードガイド](apps/presentation/dashboard/README.md) +- 公開されている製品概要:[公開ホームページ](https://loopx-project.github.io/loopx/) +- ドキュメントポータル:[ホスト版ドキュメント](https://loopx-project.github.io/loopx/docs/) +- Feishu/Lark への投影:[Lark Kanban アダプター](docs/integrations/lark-kanban-control-plane-adapter.md) +- 汎用的なホスト連携:[連携ガイド](docs/integration.md) +- カスタムのマルチエージェントランナー: + [最小限のカスタムランタイムの例](docs/guides/minimal-custom-runtime-example.md)、 + 次に[カスタムランナーの連携](docs/guides/custom-agent-runner-integration.md) + +オプションの投影は状態を確認しやすくしますが、信頼できる情報源に +なるわけではありません。 + +### 運用と復旧 + +日々の確認は次のコマンドから始めます: + +```bash +loopx status +loopx history --goal-id your-project-goal +loopx quota should-run --goal-id your-project-goal +``` + +自動のターンは、まずクォータを確認し、検証済みの writeback の後にのみ消費を記録しなければなりません。 +静かなスキップ、事前チェックの失敗、ドライランのプレビューでは消費しません。 +ユーザーゲートが 1 つのレーンをブロックしている場合、別途監査された安全なフォールバックで +続行できることがありますが、ゲートを迂回してはいけません。 + +対等なエージェントは、納品の前に `loopx todo claim` を、検証の後に `loopx todo update` を使い、 +オーナーシップとエビデンスが見える状態を保ちます。 + +スケジューラーの周期は `quota should-run.scheduler_hint` に従います。インストール済みの Codex +App のオートメーションは、返された `ack_hint.cli_args` を通じて現在のヒントを確認応答します。 +衝突からの復旧、監視のセマンティクス、自己修復、 +正確なオペレーターコマンドは、 +[Getting Started](docs/guides/getting-started.md)、 +[Quota Allocation](docs/quota-allocation.md)、 +[Long-Task Cadence Policy](docs/operations/long-task-cadence-policy.md) で管理されています。 + +公開ドキュメントや例を公開する前に: + +```bash +loopx check \ + --scan-path README.md \ + --scan-path docs/ \ + --scan-path examples/ +``` + +## 現在の技術的方向性 + +LoopX には、3 つの進行中の戦略プログラムと、アーキテクチャおよび研究の +インキュベーターがあります。これらは方向性を示すものであり、納品の約束ではありません。提供済みの事実の情報源は、引き続き `main`、リリース済みの +成果物、安定したリファレンス契約です。 + +- **長期ベンチマークとエビデンス:** 相補的なベンチマーク環境にまたがる、 + 再現可能な能力のエビデンスと、制御されたメカニズムの研究。[方向性トラッカー](https://github.com/loopx-project/loopx/issues/3243) +- **オペレーター画面と IM 連携:** オペレーターのワークスペース、セッションの + 記録、範囲を限定したコラボレーション画面。Personal Workspace は + 提供済みで、統合されたスチュワード、実行、復旧の体験はまだ適格性確認中です。 + 実装リードは `@maxliux5` です。 + [方向性トラッカー](https://github.com/loopx-project/loopx/issues/3244) +- **共有ゴールの権限とクロスホストの連携:** 明示的に共有されたゴールのための、プロバイダー非依存の + 連携。NoKV は、新たなコントロールプレーンの権威ではなく、昇格前の + プロバイダー候補です。 + [方向性トラッカー](https://github.com/loopx-project/loopx/issues/3245) +- **アーキテクチャと研究のインキュベーター:** Effect Program の堅牢化、 + TypeScript への同等性を保った移行、階層的なストライド、研究の探索、 + 人間の注意、成果物のライフサイクル、メモリの有用性に関する作業。それぞれ成熟度は明示的に + 異なります。 + [方向性トラッカー](https://github.com/loopx-project/loopx/issues/3246) + +ステージ、昇格のゲート、コントリビューターが安全に取り組める切り口、オーナーシップの範囲については、正式な +[Technical Directions マップ](docs/project/technical-directions.md)をお読みください。コミュニティでの議論には、 +ピン留めされた [GitHub Discussion](https://github.com/loopx-project/loopx/discussions/2851) +を使ってください。コアとなるコントロールプレーンの信頼性は、これらのプログラムを支える +共通の基盤として継続されます。 + +## 高度なドキュメント + +[製品 Web サイト](https://loopx-project.github.io/loopx/) · [ブログ](https://loopx-project.github.io/loopx/blog/) · [Developer Book](https://loopx-project.github.io/loopx/docs/book/en/) + +現在のタスクに合った道筋から始めてください。公開されているドキュメントサイトには、ホスト版の +[ドキュメントポータル](https://loopx-project.github.io/loopx/docs/)を使ってください。 +[ドキュメントのインデックス](docs/README.md)は、引き続き完全なソースマップです。この一覧は +厳選したものです。より詳しいドキュメントやバージョン管理されたプロトコルは、各カテゴリのインデックスが管理しています。 + +### 使う・運用する + +- [Getting Started](docs/guides/getting-started.md):インストール、接続、 + 診断、日々のワークフロー、heartbeat、ダッシュボード、開発、コマンド。 +- [ユーザーマニュアル](https://my.feishu.cn/wiki/CaL5wMk9ui17ngkWzeUcMlAYnZg): + 公開されているオンボーディング、概念、FAQ、厳選した事例。 +- [運用](docs/operations/README.md):ゴールの継続、todo、周期、 + 注意、権限のワークフロー。 +- [Quota Allocation](docs/quota-allocation.md) と + [Heartbeat Automation Prompt](docs/heartbeat-automation-prompt.md):スケジューラーの + 実行可否、消費、スケジュールされた継続。 +- [ダッシュボード](apps/presentation/dashboard/README.md)と + [Status Data Contract](docs/status-data-contract.md):オペレーター向けの状態 + と投影の契約。 +- [Release Readiness](docs/product/release-readiness.md):インストール/更新の手順、 + 互換性のゲート、リリースノート、安心して依存できる画面。 + +### コントロールプレーンを理解する + +- [アーキテクチャ](docs/architecture.md):ライフタイムゴールの不変条件とカーネル。 +- [State Interaction Model](docs/state-interaction-model.md):アクター、ストア、 + インタラクションの契約、writeback。 +- [概念](docs/concepts/README.md):再利用可能なルーティング、ゲート、エビデンス、 + 投影、計画のパターン。 +- [Product Foundations](docs/product/foundations/README.md):Loop Engineering の + 原則、プロジェクトレベルの報酬、報酬スタイルの再計画。 +- [Product Vision](docs/product/vision.md):より広い Loop Agent の方向性。 + +### 連携する・拡張する + +- [連携ガイド](docs/integration.md) +- [最小限のカスタムランタイムの例](docs/guides/minimal-custom-runtime-example.md) +- [カスタムエージェントランナーの連携](docs/guides/custom-agent-runner-integration.md) +- [Integrations](docs/integrations/README.md):ワーカーブリッジや Lark を含む、ランタイム、ホスト、コラボレーション、 + 外部システムのアダプター。 +- [Extensions and Capabilities](docs/reference/extensions.md) + +### LoopX をビルドする・レビューする + +- [開発者ガイド](docs/development/README.md):コントリビューターのワークフロー、 + ベンチマークの開発、ドキュメントの構成、品質のゲート。 +- [リファレンスとプロトコル](docs/reference/README.md):ホストコマンドや Reward Memory の + アーキテクチャを含む、安定した契約とバージョン管理された実装プロトコル。 +- [コントロールプレーン開発者コース](docs/development/control-plane-course/README.md): + コードを中心とした中国語の講義 9 回。 +- [テストと品質](docs/development/testing-and-quality.md):検証の + レイヤーとリスクに基づくチェック。 +- [公開/非公開の境界](docs/public-private-boundary.md):安全なフィクスチャ、 + 例、エビデンス、公開。 + +### 成果を確認する + +- [Showcase カタログ](docs/showcases/README.md):公開しても安全な事例とエビデンスの + ラベル。 +- [研究とエビデンス](docs/research/README.md):ベンチマークの調査 + と出典に裏付けられた発見。 +- [Update Notes](docs/update-notes/README.md):公開しても安全な進捗メモ。 + +### プロジェクトとコミュニティ + +- [現在の技術的方向性](docs/project/technical-directions.md) +- [プロジェクトのガバナンス](.github/GOVERNANCE.md) +- [コントリビューション](CONTRIBUTING.md)と[コントリビューター向けタスク](docs/development/contributor-tasks.md) +- [作者とコントリビューター](docs/project/authors.md) +- [プロジェクトの歴史](docs/project/history.md) +- [名称と商標](docs/project/trademarks.md) +- [外部利用のためのブランドガイド](docs/project/brand-guide.md):プロジェクトや企業が LoopX、その連携、アートワークに言及する方法 +- [ADOPTERS](ADOPTERS.md):任意の自己申告による導入事例ディレクトリ +- [エコシステムでの導入](docs/community/ecosystem-adoption.md) - 私たちが観測・追跡している連携、 + サンプリング、派生プロジェクト + +## パートナープロジェクト + +LoopX は、長時間稼働するエージェントのエコシステムを築くために、他のオープンソースプロジェクトとの +協力を歓迎しています。確定しているパートナーは次のとおりです: + +- [OpenViking](https://github.com/volcengine/OpenViking) - AI エージェントのための + 自己進化するコンテキストデータベース +- [NoKV](https://github.com/NoKV-Lab/NoKV) - AI ネイティブな分散ファイルシステム + +## 現在のステータス + +LoopX は、長時間にわたるエージェントの作業のための実用的なローカルコントロールプレーンであり、 +より広い導入の段階に入りつつあります。完全なエージェントプラットフォーム、エージェントランタイム、 +自律的な本番コントローラーではありません。 + +現在の LoopX は、ゴール、型付きの todo と意思決定の +スコープ、対等な claim とリース、エビデンスと writeback、クォータを考慮したスケジューリング、 +ターンをまたいだ継続のための永続的な状態カーネルを提供しています。ガイド付きの開始、定期的な heartbeat、分離された Codex +CLI のターン、エビデンスに裏付けられた Issue-Fix の受け入れ、オプションの Explore と自動 +研究の手順、公開検証用の canary、複数プロジェクトの Personal +Workspace は、いずれもその共有のコントロール状態の上に構築されています。 + +サポートレベルは引き続き明示されています。状態と CLI の契約が安定した +中心であり、いくつかのホスト連携や高度な使い方は、オプション、デフォルトでオフ、 +または実験的なものです。LoopX は、認証情報を付与したり、破壊的な操作や +本番環境での操作を承認したり、承認なしにユーザーに代わって公開したり、 +検証されていない実行を成功のエビデンスに変えたりはしません。 + +現在の投資は、 +[Technical Directions マップ](docs/project/technical-directions.md)を通じて整理されています:長期 +ベンチマークのエビデンス、オペレーター画面と IM 連携、共有ゴールのクロスホスト +連携、そして明示的に段階分けされたアーキテクチャおよび研究のインキュベーターです。 + + + + +## コミュニティとコントリビューション + +長期的な Agent チームの働き方を一緒に形作りましょう。ワークフローを共有したり、 +バグを再現したり、連携を構築したり、Agent が成し遂げたことを紹介したりしてください。コード、 +ドキュメント、例、レビュー、慎重に範囲を限定したエビデンスの研究は、 +いずれも歓迎します。 + +- **学ぶ:** [ドキュメント](https://loopx-project.github.io/loopx/docs/) · + [ブログ](https://loopx-project.github.io/loopx/blog/) · + [技術的方向性](docs/project/technical-directions.md)。 +- **議論・共有する:** [GitHub Discussions](https://github.com/loopx-project/loopx/discussions) で、 + 質問したり、ワークフローを比較したり、プロジェクトを共有したりしてください。 +- **バグを報告する・機能を提案する:** バージョン、ホスト/ランタイム、期待される動作、公開しても安全な再現手順を添えて、 + [GitHub Issue](https://github.com/loopx-project/loopx/issues/new/choose) を + 作成してください。 +- **最初のコントリビューションをする:** [コントリビューター向けタスク](docs/development/contributor-tasks.md)から + 公開タスクを選ぶか、自己完結した修正を持ち込んでください。[コントリビューションガイド](CONTRIBUTING.md)では、セットアップ、 + 検証、PR のプロセスを説明しています。大きな変更は議論から始めてください。 +- **会話に参加する:** [Discord](https://discord.gg/XmGgQyCFZd) · + [Lark](docs/assets/loopx-lark-developer-group.png) · + [WeChat](docs/assets/loopx-wechat-contact.png)。 + +チャネルの使い分けと公式の情報源については [Support](.github/SUPPORT.md) を、コミュニティへの参加については +[行動規範](CODE_OF_CONDUCT.md)をご覧ください。 + +
+コード、ログ、例を共有する前に + +`.loopx/`、レガシーの `.codex/goals/`、ライブの `ACTIVE_GOAL_STATE.md`、生の Agent +セッションやベンチマークのトレース、認証情報、非公開のログ、社内リンク、 +機密性の高いユーザー/チームのデータ、オペレーターの成果物は、公開のコントリビューションに含めないでください。 + +
+ +### コントリビューター + +コード、ドキュメント、バグ報告、レビュー、実際の利用に基づくフィードバックで +貢献してくださっているすべての方に感謝します。皆さんのおかげで、長期的な Agent の作業は、より実行しやすく、 +確認しやすく、信頼しやすいものになっています。 + +[![LoopX GitHub contributors](https://contrib.rocks/image?repo=loopx-project/loopx&columns=12&max=120)](https://github.com/loopx-project/loopx/graphs/contributors) + +[すべての GitHub コントリビューター](https://github.com/loopx-project/loopx/graphs/contributors) · +[作者とコントリビューションの記録](docs/project/authors.md) · +[ガバナンス](.github/GOVERNANCE.md) · [プロジェクトの歴史](docs/project/history.md) · +[名称と商標](docs/project/trademarks.md)。 + +### コミュニティチャット + +

+ LoopX の Lark 開発者グループの QR コード + LoopX の WeChat 連絡先の QR コード +

+

+ Lark:スキャンして直接参加できます
WeChat:huangrt00 · 友だち申請の際に LoopX と書き添えてください
+

+ +## Star の推移 + +

+ 検証済みのスナップショットに基づく LoopX の GitHub スター数の推移
+ リポジトリで承認されたワークフローを使い、GitHub 公式の stargazer のタイムスタンプから 6 時間ごとに生成しています。スナップショットは、取得した行数が GitHub の現在のスター数と一致した場合にのみ公開されます。GitHub の画像キャッシュにより、更新が遅れることがあります。 +

+ +## ライセンス + +Copyright 2026 LoopX contributors. 作者は +[`@huangruiteng`](https://github.com/huangruiteng) です。公開されている +[作者とコントリビューターの記録](docs/project/authors.md)をご覧ください。 + +`v0.4.8` 以降は Apache License 2.0 です。[LICENSE](LICENSE) と +[NOTICE](NOTICE) をご覧ください。`v0.4.7` までのリリースは、元の MIT の +条件のままです。その歴史的なテキストと告知は +[LICENSE-MIT](LICENSE-MIT) に保存されています。[ライセンスポリシー](docs/project/licensing.md)では、 +バージョン、コントリビューション、特許許諾、オープンコアの範囲について説明しています。 + +AI による生成、コードの書き換え、言語間の翻訳、 +プロジェクト名の変更を根拠に、適用されるライセンスの下での著作権、帰属表示、 +NOTICE の保持の要件を削除したり回避したりしてはなりません。配布される +素材が LoopX の派生物である場合、それらの義務は引き続き適用されます。この +説明は、適用されるライセンスで許可されている改変や再配布を制限するものではありません。[再利用と帰属表示](docs/project/licensing.md#reuse-ports-and-attribution) +と[名称と商標のガイダンス](docs/project/trademarks.md)をご覧ください。派生物の +配布物を LoopX の公式リリースとして提示してはなりません。 + +[osai-verify: eb42dd9cf910399988f0]: # diff --git a/README.md b/README.md index abf5236aa9..7c74e0c5f7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ **Start with one goal. Keep long-running agent work verifiable.** -Tell the Agent you already use what you want done. LoopX preserves goals, +Tell your agent what you want to accomplish. LoopX preserves goals, progress, decisions and verifiable results so work can continue across sessions.
An open, harness-neutral control plane for 24/7 always-on agents across Codex, Claude Code, DeepSeek Harness and other runtimes—scaling from local SQLite workflows to multi-agent teams. @@ -14,7 +14,7 @@ progress, decisions and verifiable results so work can continue across sessions. [![Local-first state](https://img.shields.io/badge/local--first-state-brightgreen.svg)](docs/public-private-boundary.md) [![Loop Agents](https://img.shields.io/badge/status-loop%20agents%20supported-brightgreen.svg)](docs/product/release-readiness.md) [![GitHub contributors](https://img.shields.io/github/contributors-anon/loopx-project/loopx?color=blue)](https://github.com/loopx-project/loopx/graphs/contributors) [![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/XmGgQyCFZd) [![Listed on dsh-plugin.org](https://dsh-plugin.org/badges/listed.svg)](https://dsh-plugin.org/plugins/loopx-project/loopx) -[Get started](#quick-start) · [Why LoopX](#why-loopx) · [24/7 Always-On](#always-on-agents) · [See it in action](#see-loopx-in-action) · [Evidence](#evidence) · [Contribute](#contributing) · [Docs](https://loopx-project.github.io/loopx/docs/) · [简体中文](README.zh-CN.md) +[Get started](#quick-start) · [Why LoopX](#why-loopx) · [24/7 Always-On](#always-on-agents) · [See it in action](#see-loopx-in-action) · [Evidence](#evidence) · [Contribute](#contributing) · [Docs](https://loopx-project.github.io/loopx/docs/) · [简体中文](README.zh-CN.md) · [日本語](README.ja.md) @@ -53,7 +53,7 @@ run? [Choose a task below](#try-loopx). not news. Keep both languages aligned, newest first, using verified publication dates (UTC). --> -- **2026-11-01 · 📘 [Progressive context delivery for 24/7 agents](https://loopx-project.github.io/loopx/blog/context-delivery/)** — Compaction-cycle structured deltas and progressive views cut control-plane bytes across 213 model-facing wakes (`32.5%` single-layer progressive view; `3.0%` body / `5.0%` CLI stacked first-read entry across 112 in-cycle continuations) while preserving lossless baseline recovery ([47-day freshness postmortem](https://loopx-project.github.io/loopx/blog/five-freshness-incidents/)). +- **2026-11-01 · 📘 [Progressive context delivery for 24/7 agents](https://loopx-project.github.io/loopx/blog/context-delivery/)** — Compaction-cycle structured deltas and progressive views cut control-plane bytes across 213 model-facing wakes (`32.5%` single-layer progressive view; `3.0%` body / `5.0%` CLI stacked first-read entry across 112 in-cycle continuations) while preserving lossless baseline recovery. - **2026-10-25 · 🤝 [Long-horizon agent research: collaborators welcome](https://loopx-project.github.io/loopx/blog/edgebench-feedback-and-memory/)** — Exploring **breakthroughs in long-horizon outcomes under equal budgets**, through feedback, replanning and reproducible evaluation on EdgeBench and real-world tasks. Academic labs and industry teams are welcome to collaborate, comparing outcomes and total cost. [Discuss collaboration](https://github.com/loopx-project/loopx/discussions). - **2026-10-20 · 🚀 [LoopX 2.0](https://github.com/loopx-project/loopx/releases/tag/v2.0.0)** — A shared TypeScript state layer and long-horizon research workbench. [Migration guide](docs/product/releases/v2.0.0.md) · [Engineering story](https://loopx-project.github.io/loopx/blog/typescript-control-plane-refactor/). - **2026-10-14 · 🤖 [Agentic software](https://loopx-project.github.io/loopx/blog/semantic-software-development/)** — Connecting goals, evidence and human feedback to engineering delivery. @@ -163,7 +163,7 @@ operate 24/7 with explicit durability and human gates: | --- | --- | --- | | **Event Inbox** | Single-flight **Goal / Todo / Hard Lease** queue, async app inbox, and connected Lark / GitHub listeners | Duplicate workers mutating the same repo state; dropped human inputs mid-run | | **Timers & Wakeups** | **Guarded Heartbeat** and safe recurring presets (`daily-triage`, `changelog-draft`, `pr-watch`; inspect via `loopx preset list`) | Blind cron loops burning tokens when nothing changed or a gate is still waiting on a human | -| **Memory & Compaction** | [`Decision Context`](loopx/capabilities/decision_context/README.md) source tracking, compaction-cycle **Progressive + Delta** [`context_delivery`](https://loopx-project.github.io/loopx/blog/context-delivery/) (`32.5%` view across 213 wakes; `3.0% / 5.0%` first-read entry across 112 in-cycle wakes), and optional [`Reward Memory`](loopx/capabilities/reward_memory/README.md) | Silent source staleness ([5 incidents across 253 turns / 47 days](https://loopx-project.github.io/loopx/blog/five-freshness-incidents/)); compounding prompt replay or broken deltas across compaction | +| **Memory & Compaction** | [`Decision Context`](loopx/capabilities/decision_context/README.md) source tracking, compaction-cycle **Progressive + Delta** [`context_delivery`](https://loopx-project.github.io/loopx/blog/context-delivery/) (`32.5%` view across 213 wakes; `3.0% / 5.0%` first-read entry across 112 in-cycle wakes), and optional [`Reward Memory`](loopx/capabilities/reward_memory/README.md) | Silent source staleness; compounding prompt replay or broken deltas across compaction | | **Permissions & Deferred Calls** | Explicit **owner, safety, publication, and private-data gates**, isolated worktrees, and review-ready handoffs | Autonomous cron runs publishing externally, forcing merges, or leaking private context | | **Outbox** | Shared Workspace & Lark Goal/Decision/Evidence views surfacing genuine completions, blockers, and open gates | Fragmented terminal logs and high-noise pings that force humans to babysit runs | @@ -528,6 +528,12 @@ evidence → recovery; continuation → governance. | What evidence changed? | Compact run history, validation, blockers, and accepted writeback. | | May the loop continue? | Quota, capabilities, safe fallback, scheduler hints, and stop conditions. | +Preview a Goal stop with `loopx goal-lifecycle --goal-id --operation stop`; +use `--operation resume` to restore eligibility. Apply the transition with +`--actor-kind owner --execute`, retaining a fresh `--expected-state-fingerprint` +when supplied by the Goal actions view. The ordinary and standalone +[`loopx-core`](packages/loopx-core/README.md) CLI use the same lifecycle owner. +
Architecture, control-plane surfaces and runtime responsibilities diff --git a/README.zh-CN.md b/README.zh-CN.md index c1de31fe77..0bfad065b2 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -14,7 +14,7 @@ [![Local first](https://img.shields.io/badge/control--plane-local--first-brightgreen.svg)](docs/public-private-boundary.md) [![Loop Agents](https://img.shields.io/badge/status-loop%20agents%20supported-brightgreen.svg)](docs/product/release-readiness.md) [![GitHub contributors](https://img.shields.io/github/contributors-anon/loopx-project/loopx?color=blue)](https://github.com/loopx-project/loopx/graphs/contributors) [![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/XmGgQyCFZd) [![Listed on dsh-plugin.org](https://dsh-plugin.org/badges/listed.svg)](https://dsh-plugin.org/plugins/loopx-project/loopx) -[快速上手](#快速开始) · [为什么需要 LoopX](#为什么需要-loopx) · [7×24 常驻架构](#always-on-agents) · [看看实际使用](#看看-loopx-如何工作) · [证据与案例](#证据) · [参与贡献](#贡献) · [文档](https://loopx-project.github.io/loopx/docs/) · [English](README.md) +[快速上手](#快速开始) · [为什么需要 LoopX](#为什么需要-loopx) · [7×24 常驻架构](#always-on-agents) · [看看实际使用](#看看-loopx-如何工作) · [证据与案例](#证据) · [参与贡献](#贡献) · [文档](https://loopx-project.github.io/loopx/docs/) · [English](README.md) · [日本語](README.ja.md) @@ -50,7 +50,7 @@ LoopX 会按需把它变成可见的任务、决策门和证据。Claude Code not news. Keep both languages aligned, newest first, using verified publication dates (UTC). --> -- **2026-11-01 · 📘 [面向 7×24 Agent 的渐进式上下文交付](https://loopx-project.github.io/loopx/blog/zh/context-delivery/)** — 受 Compaction 周期约束的结构化差分与按需视图在 213 次模型唤醒中将单层渐进载荷降至原文 `32.5%`,112 次同周期续跑的叠加首读入口降至 `3.0%` 正文 / `5.0%` 含封装,同时保留压缩失配时原子回切完整基线的能力(延伸阅读:[47 天保鲜事故复盘](https://loopx-project.github.io/loopx/blog/zh/five-freshness-incidents/))。 +- **2026-11-01 · 📘 [面向 7×24 Agent 的渐进式上下文交付](https://loopx-project.github.io/loopx/blog/zh/context-delivery/)** — 受 Compaction 周期约束的结构化差分与按需视图在 213 次模型唤醒中将单层渐进载荷降至原文 `32.5%`,112 次同周期续跑的叠加首读入口降至 `3.0%` 正文 / `5.0%` 含封装,同时保留压缩失配时原子回切完整基线的能力。 - **2026-10-25 · 🤝 [长程 Agent 研究:欢迎学术与企业合作者](https://loopx-project.github.io/loopx/blog/zh/edgebench-feedback-and-memory/)** — 探索**等预算下的长期效果突破**:围绕 EdgeBench 和真实长程任务,研究反馈、重规划与可复现评测,同时核对效果与完整成本。欢迎学术与企业团队合作。[交流合作](https://github.com/loopx-project/loopx/discussions)。 - **2026-10-20 · 🚀 [LoopX 2.0](https://github.com/loopx-project/loopx/releases/tag/v2.0.0)** — 共享 TypeScript 控制面与长程研究工作台。[迁移指南](docs/product/releases/v2.0.0.md#中文指南) · [重构历程](https://loopx-project.github.io/loopx/blog/zh/typescript-control-plane-refactor/)。 - **2026-10-14 · 🤖 [Agentic Software](https://loopx-project.github.io/loopx/blog/zh/semantic-software-development/)** — 连接目标、证据、人的反馈与工程交付。 @@ -140,7 +140,7 @@ LoopX 把这套**开源、Harness 中立**的控制面直接做成可运行基 | --- | --- | --- | | **Event Inbox(事件收件箱)** | Single-flight **Goal / Todo / Hard Lease** 队列、异步对话收件箱,以及飞书 / GitHub 事件监听 | 多 Worker 并发踩踏同一份仓库状态;运行中途用户消息丢失 | | **Timers(定时与唤醒)** | **Guarded Heartbeat** 与安全周期预设(`daily-triage`、`changelog-draft`、`pr-watch`,可用 `loopx preset list` 只读查看) | 盲目 cron 在零增量或人门尚未批准时反复唤醒模型白烧 Token | -| **Memory(记忆与压缩恢复)** | [`Decision Context`](loopx/capabilities/decision_context/README.md) 来源追踪、受 Compaction 周期约束的 **Progressive + Delta** [`context_delivery`](https://loopx-project.github.io/loopx/blog/zh/context-delivery/)(213 次唤醒中单层渐进降至原文 `32.5%`,112 次同周期续跑首读降至原文 `3.0% / 5.0%`),以及可选 [`Reward Memory`](loopx/capabilities/reward_memory/README.md) | 数据源过期却一路亮绿灯([47 天 / 253 轮中的 5 次保鲜事故](https://loopx-project.github.io/loopx/blog/zh/five-freshness-incidents/));上下文压缩后全量重放或差分悬空 | +| **Memory(记忆与压缩恢复)** | [`Decision Context`](loopx/capabilities/decision_context/README.md) 来源追踪、受 Compaction 周期约束的 **Progressive + Delta** [`context_delivery`](https://loopx-project.github.io/loopx/blog/zh/context-delivery/)(213 次唤醒中单层渐进降至原文 `32.5%`,112 次同周期续跑首读降至原文 `3.0% / 5.0%`),以及可选 [`Reward Memory`](loopx/capabilities/reward_memory/README.md) | 数据源过期却一路亮绿灯;上下文压缩后全量重放或差分悬空 | | **Permissions(权限与延后批准)** | 显式 **Owner / 安全 / 公开发布 / 私有数据 Gate**、隔离 Worktree 与可评审交付交接 | 定时任务在无人确认时私自对外发布、强行合并或越界读写 | | **Outbox(低噪成果回传)** | 本地工作区与飞书共享同一份 Goal / 决策 / 证据视图,仅在真正完成、阻塞或待决时打扰人类 | 碎片化终端日志与各端高频无效推送,避免人肉盯盘 | @@ -463,6 +463,12 @@ Kernel 把控制面归结为五个用户可以直接行动的问题。每个问 | 证据发生了什么变化? | 紧凑 run history、验证、blocker 和已接受 writeback。 | | Loop 是否可以继续? | Quota、capability、安全侧路、scheduler hint 和停止条件。 | +用 `loopx goal-lifecycle --goal-id --operation stop` 预览 Goal 停止; +改用 `--operation resume` 可恢复资格。加入 `--actor-kind owner --execute` +执行变更;Goal actions 视图提供了新鲜指纹时,保留 +`--expected-state-fingerprint`。普通 CLI 与独立 +[`loopx-core`](packages/loopx-core/README.md) CLI 使用同一个生命周期 owner。 +
架构、控制面能力与运行责任 diff --git a/apps/desktop/loopx-control-plane/README.md b/apps/desktop/loopx-control-plane/README.md index dc3df5bb77..deac5411c4 100644 --- a/apps/desktop/loopx-control-plane/README.md +++ b/apps/desktop/loopx-control-plane/README.md @@ -449,6 +449,13 @@ directly in Research after a normal quit and a loopback-port change. Window close/reopen, an explicit return to Manager and a corrupt preference were also checked. It does not demonstrate model execution or an official App upgrade. +Within a local Goal's Research view, the preference also retains an explicit +case/history choice, selected registered analysis pack and chapter or citation +bookmark. The dashboard rechecks the pack and source when reopening. A missing +or inaccessible pack keeps its existing reader recovery path. The bookmark +must match the selected pack and the dashboard's chapter grammar. Existing +version-1 preferences without research selections continue to open as before. + ![Packaged QA reopening the same synthetic Goal in Research](docs/assets/research-reopen-qa.jpg) For native qualification, use a separately identified packaged App with the diff --git a/apps/desktop/loopx-control-plane/src-tauri/src/workspace_location.rs b/apps/desktop/loopx-control-plane/src-tauri/src/workspace_location.rs index 2a17e5ae6d..3171e602e3 100644 --- a/apps/desktop/loopx-control-plane/src-tauri/src/workspace_location.rs +++ b/apps/desktop/loopx-control-plane/src-tauri/src/workspace_location.rs @@ -15,6 +15,66 @@ struct LocalWorkspace { view: Option, work_agent: Option, todo: Option, + research: Option, +} + +/// Selection within the existing dashboard reader, scoped to this local Goal. +#[derive(Debug, PartialEq)] +struct ResearchReading { + mode: String, + pack_id: Option, + chapter: Option, +} + +fn digest_id(value: &str) -> bool { + value.len() == 64 + && value + .bytes() + .all(|c| c.is_ascii_digit() || (b'a'..=b'f').contains(&c)) +} + +impl ResearchReading { + fn selections(mode: &str, pack: &str, chapter: &str) -> Option { + if !matches!(mode, "case" | "history") { + return None; + } + let pack_id = digest_id(pack).then(|| pack.to_owned()); + // The frontend resolves this bookmark against the saved study. Carry + // only its declared chapter/citation grammar, never an arbitrary URL. + let chapter = pack_id.as_deref().and_then(|pack| { + let body = chapter.strip_prefix("case-section-")?; + let prefix = format!("{pack}-"); + let section = body.strip_prefix(&prefix).or_else(|| { + let (namespace, rest) = body.split_once('-')?; + digest_id(namespace).then_some(rest)?.strip_prefix(&prefix) + })?; + let (id, citation) = match section.split_once('~') { + Some((id, ordinal)) => (id, Some(ordinal)), + None => (section, None), + }; + let valid_id = id.len() <= 80 + && id + .bytes() + .all(|c| c.is_ascii_alphanumeric() || b"_-".contains(&c)) + && (!id.is_empty() || citation.is_some()); + let valid_citation = citation.is_none_or(|ordinal| { + ordinal.len() <= 2 + && !ordinal.starts_with('0') + && ordinal.bytes().all(|c| c.is_ascii_digit()) + && !ordinal.is_empty() + }); + (mode == "case" && valid_id && valid_citation).then(|| chapter.to_owned()) + }); + Some(Self { + mode: mode.to_owned(), + pack_id, + chapter, + }) + } + + fn value(&self) -> Value { + json!({"mode": self.mode, "pack_id": self.pack_id, "chapter": self.chapter}) + } } // Match the existing Goal instance ID and frontend Agent/Todo search boundary. @@ -44,6 +104,7 @@ impl LocalWorkspace { .then(|| view.to_owned()), work_agent: selection_id(agent), todo: selection_id(todo), + research: None, }) } @@ -71,7 +132,23 @@ impl LocalWorkspace { // authority. Reopening that unsupported context returns Manager. return Some(Self::default()); } - Self::selections(get("goalId"), get("view"), get("workAgent"), get("todo")) + let mut selection = + Self::selections(get("goalId"), get("view"), get("workAgent"), get("todo"))?; + if selection.view.as_deref() == Some("research") + && get("research_goal") == selection.goal_id + { + let pack = if get("research_analysis_goal") == selection.goal_id { + get("research_pack") + } else { + "" + }; + selection.research = ResearchReading::selections( + get("research_reading"), + pack, + current.fragment().unwrap_or(""), + ); + } + Some(selection) } fn destination(&self, origin: &Url) -> Url { @@ -90,7 +167,20 @@ impl LocalWorkspace { query.append_pair(key, value); } } + if let Some(research) = &self.research { + query.append_pair("research_goal", &self.goal_id); + query.append_pair("research_reading", &research.mode); + if let Some(pack) = &research.pack_id { + query.append_pair("research_analysis_goal", &self.goal_id); + query.append_pair("research_pack", pack); + } + } drop(query); + destination.set_fragment( + self.research + .as_ref() + .and_then(|research| research.chapter.as_deref()), + ); destination } @@ -98,17 +188,30 @@ impl LocalWorkspace { if value["version"] != 1 { return None; } - Self::selections( + let mut selection = Self::selections( value["goal_id"].as_str()?, value["view"].as_str().unwrap_or(""), value["work_agent"].as_str().unwrap_or(""), value["todo"].as_str().unwrap_or(""), - ) + )?; + if !selection.goal_id.is_empty() && selection.view.as_deref() == Some("research") { + let research = &value["research"]; + selection.research = ResearchReading::selections( + research["mode"].as_str().unwrap_or(""), + research["pack_id"].as_str().unwrap_or(""), + research["chapter"].as_str().unwrap_or(""), + ); + } + Some(selection) } fn value(&self) -> Value { - json!({"version": 1, "goal_id": self.goal_id, "view": self.view, - "work_agent": self.work_agent, "todo": self.todo}) + let mut value = json!({"version": 1, "goal_id": self.goal_id, "view": self.view, + "work_agent": self.work_agent, "todo": self.todo}); + if let Some(research) = &self.research { + value["research"] = research.value(); + } + value } } @@ -211,6 +314,124 @@ mod tests { format!("http://127.0.0.1:{port}/chat/").parse().unwrap() } + fn research_page(port: u16) -> Url { + let mut page = origin(port); + page.query_pairs_mut().extend_pairs([ + ("goalId", "example"), + ("view", "research"), + ("research_goal", "example"), + ("research_reading", "case"), + ("research_analysis_goal", "example"), + ("research_pack", &"a".repeat(64)), + ]); + page + } + + #[test] + fn research_reopen_keeps_registered_pack_and_chapter_or_citation_on_the_new_port() { + let directory = tempfile::tempdir().unwrap(); + let path = directory.path().join("workspace-location.json"); + for namespace in [String::new(), format!("{}-", "b".repeat(64))] { + for section in ["turning-point", "turning-point~2", "~1"] { + let mut page = research_page(49123); + let chapter = format!("case-section-{namespace}{}-{section}", "a".repeat(64)); + page.set_fragment(Some(&chapter)); + let saved = LocalWorkspace::capture(&page, &origin(49123)).unwrap(); + write(&path, &saved).unwrap(); + let reopened = read(&path).unwrap().destination(&origin(59234)); + assert_eq!(reopened.port(), Some(59234)); + let reopened_query = reopened + .query_pairs() + .into_owned() + .collect::>(); + for (key, value) in page.query_pairs().into_owned() { + assert_eq!(reopened_query.get(&key), Some(&value)); + } + assert_eq!(reopened.fragment(), Some(chapter.as_str())); + let bytes = fs::read_to_string(&path).unwrap(); + assert!(!bytes.contains("49123") && !bytes.contains("http")); + assert_eq!(read(&path), Some(saved)); + } + } + } + + #[test] + fn research_selections_stay_with_their_goal_view_and_pack() { + let mut page = research_page(49123); + page.set_fragment(Some(&format!( + "case-section-{}-turning-point", + "a".repeat(64) + ))); + for (key, value) in [ + ("goalId", "other"), + ("view", "tasks"), + ("research_goal", "other"), + ] { + let mut changed = page.clone(); + let pairs = changed + .query_pairs() + .into_owned() + .map(|(k, v)| { + let v = if k == key { value.to_owned() } else { v }; + (k, v) + }) + .collect::>(); + changed.query_pairs_mut().clear().extend_pairs(pairs); + assert!(LocalWorkspace::capture(&changed, &origin(49123)) + .unwrap() + .research + .is_none()); + } + for pack in ["wrong", &"c".repeat(64)] { + let mut changed = page.clone(); + changed.query_pairs_mut().clear().extend_pairs([ + ("goalId", "example"), + ("view", "research"), + ("research_goal", "example"), + ("research_reading", "case"), + ("research_analysis_goal", "other"), + ("research_pack", pack), + ]); + let saved = LocalWorkspace::capture(&changed, &origin(49123)).unwrap(); + let research = saved.research.unwrap(); + assert!(research.pack_id.is_none() && research.chapter.is_none()); + } + let history = + ResearchReading::selections("history", &"a".repeat(64), page.fragment().unwrap()) + .unwrap(); + assert_eq!(history.mode, "history"); + assert!(history.chapter.is_none()); + assert!(ResearchReading::selections("retired", "", "").is_none()); + } + + #[test] + fn invalid_bookmarks_and_unrelated_preference_fields_are_not_restored() { + let pack = "a".repeat(64); + for chapter in [ + "https://example.org/secret".to_owned(), + format!("case-section-{}-chapter", "c".repeat(64)), + format!("case-section-{pack}-../secret"), + format!("case-section-{pack}-chapter~0"), + format!("case-section-{pack}-chapter~01"), + format!("case-section-{pack}-chapter~100"), + format!("case-section-{pack}-{}", "x".repeat(81)), + ] { + assert!(ResearchReading::selections("case", &pack, &chapter) + .unwrap() + .chapter + .is_none()); + } + let legacy = json!({"version": 1, "goal_id": "example", "view": "research"}); + let saved = LocalWorkspace::from_value(&legacy).unwrap(); + assert!(saved.research.is_none()); + let mut modified = legacy; + modified["research"] = json!({"mode": "case", "pack_id": pack, "chapter": "secret", "url": "https://example.org"}); + let restored = LocalWorkspace::from_value(&modified).unwrap(); + assert!(restored.research.as_ref().unwrap().chapter.is_none()); + assert!(!restored.value().to_string().contains("secret")); + assert!(!restored.value().to_string().contains("example.org")); + } + #[test] fn ordinary_reopen_keeps_selection_across_ports_without_replaying_other_inputs() { let old = origin(49123); diff --git a/apps/presentation/dashboard/smoke/bound-conversation-http-fixture.py b/apps/presentation/dashboard/smoke/bound-conversation-http-fixture.py index 7f6c634bb4..426935f323 100644 --- a/apps/presentation/dashboard/smoke/bound-conversation-http-fixture.py +++ b/apps/presentation/dashboard/smoke/bound-conversation-http-fixture.py @@ -141,15 +141,28 @@ def start(self, server): "position": 1, "content": body}]}} frozen = conversation_reply_context(raw)["context_text"] + "\n\nCurrent user message:\n" + body record.update(reply_context_message=frozen, reply_context_source_text=body) - turn, _ = server.chat_store.create_turn(sid, client_turn_id=f"external-{request}", message=frozen, origin="lark") + queued_reply = "--queued-reply" in sys.argv + if queued_reply: + server.chat_store.create_turn(sid, client_turn_id="synthetic-held-turn", message="An active synthetic task.", origin="web") + create = server.chat_store.create_queued_turn if queued_reply else server.chat_store.create_turn + attachments = [] + if queued_reply: + image = "iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAIAAAASFvFNAAAAEElEQVR4nGP4v0gdghjgLABwBAqxX1jWkgAAAABJRU5ErkJggg==" + attachments = [{"id": "queued-image", "name": "queued-image.png", "mime_type": "image/png", + "size": len(base64.b64decode(image)), "data_url": "data:image/png;base64," + image}] + turn, _ = create(sid, client_turn_id=f"external-{request}", message=frozen, origin="lark", attachments=attachments) correlation = {"request_ref": request, "binding_id": binding["binding_id"], "source": source, "session_id": sid, "turn_id": turn["turn_id"]} for directory, value in (("external-requests", {**correlation, "status": "accepted", "command": None, "message": frozen}), ("lark-private-deliveries", {**record, **correlation, "status": "delivered"})): _atomic_write_json(server.chat_store.root / directory / f"{request}.json", value) - server.chat_store.update_turn(sid, turn["turn_id"], status="completed") - server.chat_store.release_active_turn(sid, turn["turn_id"]) - server.chat_store.append_message(sid, role="agent", text="已保留原要求,当前核验结果待进一步确认。", turn_id=turn["turn_id"]) + if queued_reply: + # Identical prose without admission journals must stay literal. + server.chat_store.create_queued_turn(sid, client_turn_id="synthetic-literal-context", message=frozen, origin="web") + else: + server.chat_store.update_turn(sid, turn["turn_id"], status="completed") + server.chat_store.release_active_turn(sid, turn["turn_id"]) + server.chat_store.append_message(sid, role="agent", text="已保留原要求,当前核验结果待进一步确认。", turn_id=turn["turn_id"]) paths = [server.chat_store.root / directory / f"{request}.json" for directory in ("external-requests", "lark-private-deliveries")] paths.extend([server.chat_store.sessions_root / sid / "messages.jsonl", diff --git a/apps/presentation/dashboard/smoke/compaction-memory-retirement-browser-smoke.mjs b/apps/presentation/dashboard/smoke/compaction-memory-retirement-browser-smoke.mjs new file mode 100644 index 0000000000..5d3c9276f8 --- /dev/null +++ b/apps/presentation/dashboard/smoke/compaction-memory-retirement-browser-smoke.mjs @@ -0,0 +1,107 @@ +// Retirement regression: a saved experimental opt-in stays inert and hidden; +// sibling settings retain real preview/apply/readback and stale-write recovery. +// Isolated machine, empty registry, unavailable native host; no model calls. +import assert from "node:assert/strict"; +import {spawn} from "node:child_process"; +import {mkdtemp, mkdir, rm, writeFile} from "node:fs/promises"; +import {tmpdir} from "node:os"; +import {join, resolve} from "node:path"; +import {resolveTestPython} from "../../../../scripts/test-python.mjs"; +import {launchBrowser, loadPlaywright, waitForHttp} from "../../../../examples/dashboard-browser-smoke-support.mjs"; + +const repoRoot = resolve(import.meta.dirname, "../../../.."); +const root = await mkdtemp(join(tmpdir(), "loopx-compaction-preference-")); +const port = Number(process.env.LOOPX_COMPACTION_MEMORY_PORT ?? 5414); +const screenshots = process.env.LOOPX_COMPACTION_MEMORY_SCREENSHOTS; +const registry = join(root, "registry.json"); +await mkdir(join(root, "runtime", "machine"), {recursive: true}); +await writeFile(join(root, "runtime", "machine", "configuration.json"), JSON.stringify({ + schema_version: "loopx_machine_configuration_v0", namespaces: { + compaction_memory: {schema_version: "compaction_memory_machine_defaults_v0", enabled: true}, + }, +})); +await writeFile(registry, '{"goals":[]}'); +await mkdir(join(root, "home")); +if (screenshots) await mkdir(screenshots, {recursive: true}); +const server = spawn(resolveTestPython({repoRoot}), ["-m", "loopx.cli", "--registry", registry, + "--runtime-root", join(root, "runtime"), "chat", "--port", String(port), "--no-open", + "--codex-bin", join(root, "unavailable-native-host"), "--assets-dir", join(repoRoot, "loopx/web/chat")], { + cwd: root, env: {...process.env, HOME: join(root, "home"), PYTHONPATH: repoRoot, LOOPX_USAGE_PING: "0"}, + stdio: ["ignore", "pipe", "pipe"], +}); +let serverError = "", browser; +for (const stream of [server.stdout, server.stderr]) stream.on("data", chunk => {serverError += String(chunk);}); +try { + const base = `http://127.0.0.1:${port}`; + await waitForHttp(`${base}/chat/`).catch(error => {throw new Error(`${error.message}\n${serverError}`);}); + browser = await launchBrowser(loadPlaywright().chromium); + const page = await browser.newPage({locale: "en-US", viewport: {width: 1440, height: 1000}}); + const workRequests = []; + page.on("request", request => { + if (request.method() === "POST") { + const path = new URL(request.url()).pathname; + if (path === "/api/chat/sessions" || /^\/api\/chat\/sessions\/[^/]+\/turns$/u.test(path)) workRequests.push(path); + } + }); + const open = async () => { + await page.goto(`${base}/chat/?settings_scope=machine&settings_tab=capabilities`, {waitUntil: "networkidle"}); + await page.getByText("Progressive context", {exact: true}).first().click(); + assert.equal(await page.getByText("Compaction working memory (experimental)", {exact: true}).count(), 0); + assert.equal(await page.getByRole("switch", {name: "Enable experimental compaction working memory"}).count(), 0); + }; + const progressive = page.getByRole("switch", {name: "Read context progressively"}); + const delta = page.getByRole("switch", {name: "Use cross-turn delta automatically on supported hosts"}); + const configuration = async () => (await (await page.request.get(`${base}/api/chat/machine-configuration`)).json()).machine_configuration; + const capture = async name => { + if (screenshots) await page.screenshot({path: join(screenshots, name)}); + }; + await open(); + assert.equal(await progressive.isChecked(), true); + assert.equal(await delta.isChecked(), true); + assert.equal((await configuration()).namespaces.compaction_memory, undefined); + await capture("desktop-settings.png"); + await page.setViewportSize({width: 430, height: 932}); + assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true); + await capture("narrow-settings.png"); + await page.setViewportSize({width: 1440, height: 1000}); + + // Keep the actual backend and invalidate only the request's CAS expectation. + const apply = "**/api/chat/machine-configuration/apply"; + await page.route(apply, route => route.continue({postData: JSON.stringify({ + ...route.request().postDataJSON(), expected_plan_revision: `sha256:${"0".repeat(64)}`, + })})); + await progressive.click(); + await page.getByText(/machine-configuration plan revision changed/u).waitFor(); + assert.equal(await progressive.isChecked(), true, "A rejected save retains the confirmed value"); + assert.equal((await configuration()).namespaces.context_delivery, undefined); + await capture("desktop-rejected.png"); + await page.unroute(apply); + await progressive.click(); + await page.getByText("Progressive reads preference saved.", {exact: true}).waitFor(); + assert.equal((await configuration()).namespaces.context_delivery.mode, "off"); + assert.equal(await delta.isChecked(), true); + await delta.click(); + await page.getByText("Cross-turn delta preference saved.", {exact: true}).waitFor(); + assert.equal((await configuration()).namespaces.context_delivery.delta_delivery, "off"); + assert.equal(await progressive.isChecked(), false); + await open(); + assert.equal(await progressive.isChecked(), false); + assert.equal(await delta.isChecked(), false); + assert.equal((await configuration()).namespaces.compaction_memory, undefined); + await page.evaluate(() => localStorage.setItem("loopx-pw-locale", "zh-CN")); + await page.reload({waitUntil: "networkidle"}); + assert.equal(await page.getByText("压缩工作记忆(实验)", {exact: true}).count(), 0); + assert.equal(await page.getByRole("switch", {name: "启用实验性压缩工作记忆"}).count(), 0); + await capture("chinese-settings.png"); + // Existing Workbench entry may create Session metadata; no Turn is dispatched. + assert.equal(workRequests.some(path => path.endsWith("/turns")), false); + console.log("compaction memory retirement: legacy-on hidden; sibling save/reload/stale-write recovery passed"); +} finally { + await browser?.close(); + if (server.exitCode === null) { + const exited = new Promise(resolveExit => server.once("exit", resolveExit)); + server.kill(); + await exited; + } + await rm(root, {recursive: true, force: true}); +} diff --git a/apps/presentation/dashboard/smoke/conversation-reply-browser-smoke.mjs b/apps/presentation/dashboard/smoke/conversation-reply-browser-smoke.mjs index 784a95aa7c..54f1f41596 100644 --- a/apps/presentation/dashboard/smoke/conversation-reply-browser-smoke.mjs +++ b/apps/presentation/dashboard/smoke/conversation-reply-browser-smoke.mjs @@ -12,11 +12,12 @@ import {launchBrowser, loadPlaywright} from "../../../../examples/dashboard-brow const repo = resolve(import.meta.dirname, "../../../.."); const returnedFiles = process.argv.includes("--returned-files"); const historyImages = process.argv.includes("--history-images"); +const queuedReply = process.argv.includes("--queued-reply"); const output = resolve(process.env.LOOPX_REPLY_OUTPUT ?? resolve(repo, "output/playwright/conversation-reply")); await mkdir(output, {recursive: true}); const child = spawn(resolveTestPython({repoRoot: repo}), ["-u", "apps/presentation/dashboard/smoke/bound-conversation-http-fixture.py", returnedFiles ? "--returned-files" : "--reply-context", - ...(historyImages ? ["--history-images"] : [])], + ...(historyImages ? ["--history-images"] : []), ...(queuedReply ? ["--queued-reply"] : [])], {cwd: repo, env: {...process.env, LOOPX_USAGE_PING: "0"}, stdio: ["pipe", "pipe", "pipe"]}); const exited = once(child, "exit"), queue = [], waiting = []; let stderr = "", browser; @@ -80,11 +81,21 @@ async function checkReturnedFiles(ready, page, errors, writes) { } } await page.screenshot({path: resolve(output, `${baseline ? "before" : "after"}-files-desktop.png`), animations: "disabled"}); + const historyPath = `/api/chat/sessions/${ready.sessionId}`; + const readerRequest = page.context().waitForEvent("request", {predicate: request => + new URL(request.url()).pathname === historyPath + && new URL(request.frame().url()).searchParams.get("reportMessageId") === ready.fileMessageId}); const opened = page.context().waitForEvent("page"); await timeline.getByRole("link", {name: "单独阅读完整答复"}).click(); const report = await opened; report.on("pageerror", error => errors.push(error.message)); await report.getByRole("heading", {name: "结果已核验 / Verified result", exact: true}).waitFor(); + const readerQuery = new URL((await readerRequest).url()).searchParams; + if (!baseline) { + assert.equal(readerQuery.get("turn_id"), answer.turn_id, "The saved answer checks its original Turn"); + assert.equal(readerQuery.get("report_message_id"), answer.message_id, "The reader requests only the chosen answer"); + assert.equal(readerQuery.has("message_limit"), false); + } assert.equal(await report.locator("a[download]").count(), baseline ? 0 : ready.files.length); await report.screenshot({path: resolve(output, `${baseline ? "before" : "after"}-files-reader.png`), animations: "disabled"}); if (!baseline) { @@ -109,6 +120,91 @@ async function checkReturnedFiles(ready, page, errors, writes) { const url = ready.origin + answer.attachments[0].data_url; assert.equal((await page.request.get(url.replace(ready.sessionId, "unrelated-session"))).status(), 404); assert.equal((await page.request.get(url, {headers: {Origin: "https://unrelated.example"}})).status(), 403); + + const legacy = new URL(report.url()); + legacy.searchParams.delete("reportTurnId"); + const savedAnswerRequest = url => url.pathname === historyPath && url.searchParams.get("report_message_id") === ready.fileMessageId; + const legacyRead = report.waitForResponse(response => new URL(response.url()).pathname === historyPath); + await report.goto(legacy.toString()); + await report.getByRole("link", {name: "Download file: source.bin", exact: false}).waitFor(); + const legacyResponse = await legacyRead; + assert.ok(savedAnswerRequest(new URL(legacyResponse.url())), "An existing link selects its saved message without loading the transcript"); + const legacySnapshot = await legacyResponse.json(); + assert.deepEqual(legacySnapshot.messages.filter(row => row.role !== "user").map(row => row.message_id), [ready.fileMessageId]); + const legacyAnswer = legacySnapshot.messages.find(row => row.message_id === ready.fileMessageId); + assert.equal(legacyAnswer.text, answer.text); + assert.deepEqual(legacyAnswer.attachments, answer.attachments); + + await report.route(savedAnswerRequest, route => route.fulfill({status: 400, json: {ok: false, error: "invalid history page arguments"}})); + const fallbackRead = report.waitForRequest(request => { + const url = new URL(request.url()); + return url.pathname === historyPath && url.search === ""; + }); + await report.reload(); + await report.getByRole("link", {name: "Download file: source.bin", exact: false}).waitFor(); + await fallbackRead; + + const fallbackTurnRead = report.waitForRequest(request => { + const url = new URL(request.url()); + return url.pathname === historyPath && url.searchParams.get("turn_id") === answer.turn_id && url.searchParams.has("message_limit"); + }); + const withTurn = new URL(legacy); + withTurn.searchParams.set("reportTurnId", answer.turn_id); + await report.goto(withTurn.toString()); + await report.getByRole("link", {name: "Download file: source.bin", exact: false}).waitFor(); + await fallbackTurnRead; + await report.unroute(savedAnswerRequest); + await report.goto(legacy.toString()); + await report.getByRole("link", {name: "Download file: source.bin", exact: false}).waitFor(); + + // Earlier history readers accept unknown query arguments and return their + // complete v1 snapshot. Both existing and Turn-pinned links still open it. + await report.route(savedAnswerRequest, route => route.fulfill({json: snapshot})); + for (const address of [legacy, withTurn]) { + await report.goto(address.toString()); + await report.getByRole("link", {name: "Download file: source.bin", exact: false}).waitFor(); + assert.equal(await report.locator("a[download]").count(), ready.files.length); + } + const wrongTurn = new URL(withTurn); + wrongTurn.searchParams.set("reportTurnId", "unrelated-turn"); + await report.goto(wrongTurn.toString()); + await report.getByText("This answer was not found. It may have been removed, or the link may be incorrect.").waitFor(); + assert.equal(await report.locator("a[download]").count(), 0); + await report.unroute(savedAnswerRequest); + + for (const invalid of [ + {...snapshot, session: {...snapshot.session, session_id: "another-session"}}, + {...snapshot, report_message_id: "another-message"}, + {...snapshot, message_page: {next_cursor: "another-page"}}, + ]) { + await report.route(savedAnswerRequest, route => route.fulfill({json: invalid})); + await report.goto(legacy.toString()); + await report.getByText("Could not load this answer.").waitFor(); + assert.equal(await report.locator("a[download]").count(), 0); + await report.unroute(savedAnswerRequest); + } + + const refusedReads = []; + const observeRefusal = request => { + if (new URL(request.url()).pathname === historyPath) refusedReads.push(new URL(request.url())); + }; + report.on("request", observeRefusal); + for (const [status, error] of [[403, "Source access was revoked"], [400, "invalid Chat journal record"]]) { + refusedReads.length = 0; + await report.route(savedAnswerRequest, route => route.fulfill({status, json: {ok: false, error}})); + await report.reload(); + await report.getByText("Could not load this answer.").waitFor(); + assert.equal(await report.locator("a[download]").count(), 0); + assert.equal(refusedReads.length, 1); + assert.ok(savedAnswerRequest(refusedReads[0]), "A refused or invalid source must never trigger a wider history read"); + await report.unroute(savedAnswerRequest); + } + report.off("request", observeRefusal); + + legacy.searchParams.set("reportTurnId", "unrelated-turn"); + await report.goto(legacy.toString()); + await report.getByText(/This answer was not found|Could not load this answer/).waitFor(); + assert.equal(await report.locator("a[download]").count(), 0); } child.stdin.write("inspect\n"); const inspection = await next(); @@ -184,6 +280,71 @@ async function checkHistoryImages(ready, page, errors, writes) { console.log("history-images-browser: passed (latest, scroll, inline retry and original message link; zero model Turns)"); } +async function checkQueuedReply(ready, page, errors, writes) { + const endpoint = `${ready.origin}/api/chat/sessions/${ready.sessionId}`; + const snapshot = await (await page.request.get(endpoint)).json(); + const original = snapshot.messages.find(row => row.origin === "lark" && row.reply_context); + assert.ok(original.text.startsWith("Referenced message (")); + const body = original.reply_context.source_text; + const queued = await (await page.request.get(`${endpoint}/queue`)).json(); + assert.equal(queued.turns.length, 2); + assert.equal(queued.turns[0].preview, body.slice(0, 240)); + assert.equal(queued.turns[0].character_count, [...body].length); + assert.equal(queued.turns[1].preview, [...original.text].slice(0, 240).join(""), + "An identical unbound literal must not become a source-backed quote"); + await openWhileCheckingOriginalConversation(ready, page); + await page.getByRole("navigation", {name: "管家视图"}).getByRole("button", {name: /^(Chat|对话)$/}).click(); + const queue = page.locator(".personal-conversation-queue"); + const message = queue.locator(":scope > ol > li").first(); + const summary = message.getByLabel("待处理消息 1", {exact: true}); + await summary.waitFor(); + assert.equal(await summary.getByText(body, {exact: true}).count(), 1); + assert.equal(queued.turns[0].attachment_count, 1); + await page.screenshot({path: resolve(output, "queue-default-desktop.png"), animations: "disabled"}); + child.stdin.write("history-unavailable\n"); + assert.equal((await next()).history_available, false); + await summary.focus(); await page.keyboard.press("Enter"); + await message.getByRole("alert").waitFor(); + child.stdin.write("history-available\n"); + assert.equal((await next()).history_available, true); + await message.getByRole("button", {name: "重试", exact: true}).click(); + const context = message.locator(".conversation-reply-context"); + await context.waitFor(); + await page.waitForFunction(() => document.querySelector('.personal-conversation-queue img[alt="queued-image.png"]')?.naturalWidth === 3); + assert.equal(await context.getAttribute("open"), null); + await context.locator("summary").focus(); await page.keyboard.press("Enter"); + await context.getByText("原要求:保留已有结果和失败记录。Original requirement: retain results and failed attempts.", {exact: true}).waitFor(); + assert.equal(await context.locator("section").count(), 1); + assert.equal(await context.locator("blockquote ol").first().evaluate(node => getComputedStyle(node).listStyleType), "decimal"); + assert.deepEqual(await context.locator("blockquote ol").evaluateAll(lists => lists.map(list => list.start)), [1, 2, 3, 7, 0]); + assert.equal(await message.locator(".personal-queue-message").getByText(body, {exact: true}).count(), 1); + await page.screenshot({path: resolve(output, "queue-expanded-desktop.png"), animations: "disabled"}); + await page.setViewportSize({width: 390, height: 844}); + await context.locator("summary").scrollIntoViewIfNeeded(); + assert.ok(await page.locator("body").evaluate(node => node.scrollWidth <= innerWidth + 1)); + await page.screenshot({path: resolve(output, "queue-expanded-narrow.png"), animations: "disabled"}); + const literal = queue.locator(":scope > ol > li").nth(1); + await literal.getByLabel("待处理消息 2", {exact: true}).click(); + await literal.locator(".personal-queue-message").getByText("Referenced message (", {exact: false}).waitFor(); + assert.equal(await literal.locator(".conversation-reply-context").count(), 0); + await page.evaluate(() => localStorage.setItem("loopx-pw-locale", "en")); + await page.reload(); + await queue.getByLabel("Queued message 1", {exact: true}).click(); + await queue.getByText("Reply and thread context", {exact: true}).waitFor(); + assert.deepEqual(errors, []); + assert.ok(!writes.some(path => /\/turns(?:\/|$)|\/queue\/[^/]+\/(?:input|steer)/u.test(path))); + child.stdin.write("inspect\n"); + const inspection = await next(); + assert.equal(inspection.model_turns, 0); + assert.equal(inspection.reply_evidence_unchanged, true); + child.stdin.write("revoke\n"); + assert.equal((await next()).revoked, ready.bindingId); + const denied = await page.request.get(`${endpoint}/queue`); + assert.ok(!denied.ok(), "Queue projection must not bypass revoked source access"); + assert.equal((await denied.json()).turns, undefined); + console.log("queued-reply-browser: passed (real HTTP/source journals, readable preview, full quote/thread, literal parity, read failure/retry, keyboard, narrow/English, no model Turns or queue mutations)"); +} + try { const ready = await next(); browser = await launchBrowser(loadPlaywright().chromium); @@ -196,6 +357,8 @@ try { await checkHistoryImages(ready, page, errors, writes); } else if (returnedFiles) { await checkReturnedFiles(ready, page, errors, writes); + } else if (queuedReply) { + await checkQueuedReply(ready, page, errors, writes); } else { const snapshot = await (await page.request.get(`${ready.origin}/api/chat/sessions/${ready.sessionId}`)).json(); const source = snapshot.messages.find(row => row.role === "user" && row.turn_id); diff --git a/apps/presentation/dashboard/src/data/chat.ts b/apps/presentation/dashboard/src/data/chat.ts index 79bbd8946f..8488f528ef 100644 --- a/apps/presentation/dashboard/src/data/chat.ts +++ b/apps/presentation/dashboard/src/data/chat.ts @@ -972,6 +972,32 @@ export async function fetchChatSession(sessionId: string, signal?: AbortSignal) return requestJson(`/api/chat/sessions/${encodeURIComponent(sessionId)}`, { signal }); } +export async function fetchSavedChatAnswer(sessionId: string, messageId: string, signal: AbortSignal, turnId?: string) { + const query = new URLSearchParams({report_message_id: messageId}); + if (turnId !== undefined) query.set("turn_id", turnId); + const path = `/api/chat/sessions/${encodeURIComponent(sessionId)}?${query}`; + try { + const snapshot = await requestJson(path, {signal}); + // A legacy service can ignore the selector and return its complete v1 + // snapshot. A conflicting marker or a partial history remains invalid. + if (Object.hasOwn(snapshot, "report_message_id")) { + if (snapshot.report_message_id !== messageId) throw new Error("The saved answer selection changed during read."); + } else if ("message_page" in snapshot || "history_resume" in snapshot) { + throw new Error("The saved answer history is incomplete."); + } + return snapshot; + } catch (error) { + // Older Chat builds reject unknown history selectors before reading the + // Session. Only that response enables the earlier history read paths. + if (!(error instanceof ChatApiError) || error.payload.http_status !== 400 + || error.message !== "invalid history page arguments") throw error; + signal.throwIfAborted(); + return turnId === undefined + ? fetchChatSession(sessionId, signal) + : fetchChatSessionHistory(sessionId, signal, turnId); + } +} + export const chatQueueInputRequestSchema = z.discriminatedUnion("action", [ z.object({action: z.literal("edit"), operation_id: z.string().min(1).max(160), expected_revision: z.number().int().nonnegative(), message: z.string().min(1).max(24000)}).strict(), @@ -983,15 +1009,16 @@ const chatQueuedInputSchema = z.object({input_revision: z.number().int().nonnega attachments: z.array(z.object({id: z.string(), name: z.string(), size: z.number(), mime_type: z.string(), data_url: z.string()})), }); -export type ChatQueuedInput = z.infer; +export type ChatQueuedInput = z.infer & Pick; export async function fetchQueuedChatInput(sessionId: string, turnId: string, signal?: AbortSignal) { // Keep original-source audience projection and complete paging. The visible // input and its revision come from one canonical user row, never raw model context. const history = await fetchChatSessionHistory(sessionId, signal, turnId); const original = history.messages.find(row => row.role === "user" && row.turn_id === turnId); if (!original) throw new Error("Original queued input is unavailable"); - return chatQueuedInputSchema.parse({input_revision: original.queue_input_revision ?? 0, - message: original.reply_context?.source_text ?? original.text, attachments: original.attachments ?? []}); + return {...chatQueuedInputSchema.parse({input_revision: original.queue_input_revision ?? 0, + message: original.reply_context?.source_text ?? original.text, attachments: original.attachments ?? []}), + reply_context: original.reply_context}; } const chatQueueSchema = z.object({ ok: z.literal(true), schema_version: z.literal("loopx_chat_store_v1"), session_id: z.string().min(1), @@ -3131,12 +3158,16 @@ export async function updateGoalOwnership(body: { goal_id: string; mode: Executi const privateAgentSessionSchema = z.object({session_id: z.string(), goal_id: z.string(), agent_id: z.string(), executor_endpoint_id: z.string()}); const privateAgentTargetSchema = privateAgentSessionSchema.extend({target_ref: z.string(), host_ref: z.string(), goal_instance_id: z.string().nullable()}); -const privateConversationSchema = z.object({ +const privateConversationSettingsRowSchema = z.object({ binding_id: z.string(), app_ref: z.string(), context_kind: z.enum(["project", "steward"]), project_ref: z.string(), project_title: z.string(), context_available: z.boolean(), executor_endpoint_id: z.string(), - grant: z.enum(["workspace_read", "workspace_write", "portfolio_read"]), goal_count: z.number().int().default(0), listener_status: z.string(), + grant: z.enum(["workspace_read", "workspace_write", "portfolio_read"]), goal_count: z.number().int().default(0), goal_scope: z.enum(["all_registered", "selected"]).nullable().optional(), audience: z.enum(["owner", "group"]).default("owner"), group_count: z.number().int().default(0), + agent_targets: z.array(privateAgentTargetSchema).default([]), +}); +const privateConversationDiagnosticsRowSchema = z.object({ + binding_id: z.string(), listener_status: z.string(), pending_count: z.number().int(), recovery_count: z.number().int(), ingress: z.object({status: z.enum(["unobserved", "verified", "gap", "unavailable"]), last_checked_at: z.number().nullable(), last_complete_at: z.number().nullable(), @@ -3169,14 +3200,21 @@ const privateConversationSchema = z.object({ z.object({available: z.literal(false), error_code: z.string(), execution_available: z.boolean().optional(), execution_error_code: z.string().optional()}), ]).optional(), - agent_candidates: z.array(privateAgentSessionSchema).default([]), agent_targets: z.array(privateAgentTargetSchema).default([]), + agent_candidates: z.array(privateAgentSessionSchema).default([]), }); +const privateConversationSchema = privateConversationSettingsRowSchema.extend(privateConversationDiagnosticsRowSchema.shape); const privateConversationStopRecoverySchema = z.object({binding_id: z.string(), project_ref: z.string(), project_title: z.string(), pending_count: z.number().int().positive()}); export type PrivateConversationStopRecovery = z.infer; -const privateConversationsSchema = z.object({ok: z.literal(true), revision: z.number().int(), +const privateConversationSettingsSchema = z.object({ok: z.literal(true), revision: z.number().int(), app_steward_binding_id: z.string().regex(/^[a-f0-9]{24}$/).nullable().default(null), + connections: z.array(privateConversationSettingsRowSchema)}); +const privateConversationDiagnosticsSchema = z.object({ok: z.literal(true), revision: z.number().int(), + connections: z.array(privateConversationDiagnosticsRowSchema), stop_recoveries: z.array(privateConversationStopRecoverySchema)}); +const privateConversationsSchema = privateConversationSettingsSchema.extend({ connections: z.array(privateConversationSchema), stop_recoveries: z.array(privateConversationStopRecoverySchema).default([])}); +export type PrivateConversationSettings = z.infer; +export type PrivateConversationDiagnostics = z.infer; export type PrivateConversation = z.infer; const boundConversationSourceSchema = privateConversationSchema.pick({ binding_id: true, app_ref: true, context_kind: true, project_title: true, executor_endpoint_id: true, @@ -3199,6 +3237,23 @@ export async function resolveBoundConversation(target: BoundConversationTarget, export async function fetchPrivateConversations(signal?: AbortSignal) { return privateConversationsSchema.parse(await requestJson("/api/chat/lark/private-conversations", { signal })); } + +export async function fetchPrivateConversationSettings(signal: AbortSignal) { + return privateConversationSettingsSchema.parse( + await requestJson("/api/chat/lark/private-conversations?view=settings", {signal})); +} + +export async function fetchPrivateConversationDiagnostics(settings: PrivateConversationSettings, signal: AbortSignal) { + const diagnostics = privateConversationDiagnosticsSchema.parse(await requestJson( + `/api/chat/lark/private-conversations?view=diagnostics&revision=${settings.revision}`, {signal})); + const observedBindingIds = new Set(diagnostics.connections.map(row => row.binding_id)); + if (diagnostics.revision !== settings.revision || diagnostics.connections.length !== settings.connections.length + || observedBindingIds.size !== diagnostics.connections.length + || !settings.connections.every(row => observedBindingIds.has(row.binding_id))) { + throw new Error("Conversation bindings changed during the read"); + } + return diagnostics; +} const appStewardTargetSchema = z.union([ z.object({ok: z.literal(true), binding_id: z.null(), session_id: z.null()}), z.object({ok: z.literal(true), binding_id: z.string().regex(/^[a-f0-9]{24}$/), @@ -3216,7 +3271,7 @@ export async function selectAppSteward(bindingId: string | null, revision: numbe return result; } export async function connectPrivateConversation(appRef: string, projectRef: string, executor: string, contextKind: "project" | "steward" = "project", projectGrant: "workspace_read" | "workspace_write" = "workspace_write", groupIds?: string[]) { - return privateConversationsSchema.parse(await requestJson("/api/chat/lark/private-conversations", { + return z.object({ok: z.literal(true)}).parse(await requestJson("/api/chat/lark/private-conversations?response=minimal", { method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({app_ref: appRef, project_ref: projectRef, executor_endpoint_id: executor, context_kind: contextKind, project_grant: projectGrant, ...(contextKind === "steward" ? {goal_scope: "all_registered"} : {}), @@ -3224,7 +3279,7 @@ export async function connectPrivateConversation(appRef: string, projectRef: str })); } export async function disconnectPrivateConversation(bindingId: string, revision: number) { - return privateConversationsSchema.parse(await requestJson("/api/chat/lark/private-conversations", { + return z.object({ok: z.literal(true)}).parse(await requestJson("/api/chat/lark/private-conversations?response=minimal", { method: "DELETE", headers: {"Content-Type": "application/json"}, body: JSON.stringify({binding_id: bindingId, revision}), })); } diff --git a/apps/presentation/dashboard/src/features/personal-workspace/answer-report-page.tsx b/apps/presentation/dashboard/src/features/personal-workspace/answer-report-page.tsx index 5f38dc2034..167c0a129c 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/answer-report-page.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/answer-report-page.tsx @@ -1,6 +1,6 @@ import {useEffect, useMemo, useRef, useState} from "react"; -import {fetchChatSession, type ChatSessionSnapshot, type ChatVisibleMessage} from "../../data/chat"; +import {fetchSavedChatAnswer, type ChatSessionSnapshot, type ChatVisibleMessage} from "../../data/chat"; import {visibleAgentMessage} from "./answer-text"; import {readWorkspaceLocale} from "./i18n"; import {resolveConversationScope} from "../../../../../../loopx/control_plane/collaboration/conversation_scope"; @@ -24,7 +24,8 @@ export function AnswerReportPage({sessionId, messageId, statusUrl}: { messageId: string; statusUrl: string; }) { - const scope = JSON.stringify([statusUrl || "/status.json", sessionId, messageId]); + const turnId = new URLSearchParams(window.location.search).get("reportTurnId"); + const scope = JSON.stringify([statusUrl || "/status.json", sessionId, messageId, turnId]); const [loaded, setLoaded] = useState<{scope: string; value: ReportState} | null>(null); // A late read from the preceding source never appears in the new reader. const state: ReportState = loaded?.scope === scope ? loaded.value : {kind: "loading"}; @@ -44,16 +45,18 @@ export function AnswerReportPage({sessionId, messageId, statusUrl}: { setLoaded({scope, value: {kind: "loading"}}); setCopied(false); setCopyFailed(false); - void fetchChatSession(sessionId, controller.signal).then((snapshot) => { + const read = fetchSavedChatAnswer(sessionId, messageId, controller.signal, turnId ?? undefined); + void read.then((snapshot) => { if (!live) return; if (snapshot.ok !== true || snapshot.schema_version !== "loopx_chat_store_v1" || snapshot.session.session_id !== sessionId) throw new Error("The saved Session changed during read."); const message = snapshot.messages.find((item) => item.message_id === messageId - && ["agent", "assistant"].includes(item.role)); + && ["agent", "assistant"].includes(item.role) + && (turnId === null || item.turn_id === turnId)); setLoaded({scope, value: message ? {kind: "ready", snapshot, message} : {kind: "missing", snapshot}}); }).catch(() => { if (live) setLoaded({scope, value: {kind: "error"}}); }); return () => {live = false; controller.abort(); copyAttempt.current += 1; document.title = previousTitle;}; - }, [scope, sessionId, messageId, zh, readRevision]); + }, [scope, sessionId, messageId, turnId, zh, readRevision]); const navigation = answerReportNavigation( (state.kind === "ready" || state.kind === "missing") ? state.snapshot.session : null, window.location.href, statusUrl, zh, @@ -180,6 +183,7 @@ export function answerReportNavigation( const managed = scope.kind === "owner_goal" && session?.managed_agent_id; url.searchParams.delete("reportSessionId"); url.searchParams.delete("reportMessageId"); + url.searchParams.delete("reportTurnId"); url.searchParams.delete("todo"); url.searchParams.delete("messageSession"); url.searchParams.delete("message"); diff --git a/apps/presentation/dashboard/src/features/personal-workspace/channel-timeline.tsx b/apps/presentation/dashboard/src/features/personal-workspace/channel-timeline.tsx index a895b0b681..2645c89c58 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/channel-timeline.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/channel-timeline.tsx @@ -23,10 +23,12 @@ import { conversationOrder } from "./conversation-order"; import { ConversationFind, conversationMessageKey } from "./conversation-find"; import type { WorkspaceActionPreview, WorkspaceDrawerSelection, WorkspaceGoal, WorkspaceTimelineItem } from "./personal-workspace-model"; -function answerLink(sessionId: string, messageId: string) { +function answerLink(sessionId: string, messageId: string, turnId?: string) { const url = new URL(window.location.href); url.searchParams.set("reportSessionId", sessionId); url.searchParams.set("reportMessageId", messageId); + if (turnId) url.searchParams.set("reportTurnId", turnId); + else url.searchParams.delete("reportTurnId"); url.searchParams.set("view", "conversation"); url.hash = ""; return url.toString(); @@ -116,12 +118,10 @@ export const ChannelTimeline = memo(function ChannelTimeline({ useLayoutEffect(() => { if (!findMessageId) return; readMessage(); - const frame = requestAnimationFrame(() => { - const row = Array.from(timeline.current?.querySelectorAll("[data-timeline-id]") ?? []) - .find(node => node.dataset.timelineId === findMessageId); - row?.scrollIntoView({block: "start"}); - }); - return () => cancelAnimationFrame(frame); + // Keep the scroll with the selection so a later user scroll stays put. + const row = Array.from(timeline.current?.querySelectorAll("[data-timeline-id]") ?? []) + .find(node => node.dataset.timelineId === findMessageId); + row?.scrollIntoView({block: "start"}); }, [findMessageId, findNavigation]); const presentedItems = items.filter(item => { // The visible draft already owns this confirmation and recovery entry. @@ -290,7 +290,7 @@ export const ChannelTimeline = memo(function ChannelTimeline({ {item.message.role === "assistant" && !item.message.pending && item.message.text.length >= MIN_SEPARATE_ANSWER_LENGTH && item.message.sourceSessionId && item.message.sourceMessageId - ? {locale === "zh-CN" ? "单独阅读完整答复" : "Read full answer separately"} : null} {item.message.role !== "user" && (item.message.pending || item.message.sourceTurnId || item.message.activity?.length || item.message.steps?.length) ? : null} diff --git a/apps/presentation/dashboard/src/features/personal-workspace/conversation-queue.css b/apps/presentation/dashboard/src/features/personal-workspace/conversation-queue.css index 273217988a..3ba5f38670 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/conversation-queue.css +++ b/apps/presentation/dashboard/src/features/personal-workspace/conversation-queue.css @@ -1,7 +1,7 @@ .personal-conversation-queue { min-width: 0; margin: 0 0 8px; font-size: var(--text-caption); color: var(--pw-text); } .personal-conversation-queue header { display: flex; align-items: center; gap: 8px; margin: 0 8px 4px; color: var(--pw-muted); } -.personal-conversation-queue ol { max-height: min(28dvh, 220px); overflow: auto; overscroll-behavior: contain; list-style: none; padding: 0; margin: 0; border: 1px solid var(--pw-line-strong); border-radius: 12px; background: #fff; } -.personal-conversation-queue li + li { border-top: 1px solid var(--pw-line-strong); } +.personal-conversation-queue > ol { max-height: min(28dvh, 220px); overflow: auto; overscroll-behavior: contain; list-style: none; padding: 0; margin: 0; border: 1px solid var(--pw-line-strong); border-radius: 12px; background: #fff; } +.personal-conversation-queue > ol > li + li { border-top: 1px solid var(--pw-line-strong); } .personal-queue-row { display: flex; align-items: start; gap: 8px; padding: 8px 10px; } .personal-queue-row details { min-width: 0; flex: 1; } .personal-queue-row summary { cursor: pointer; } @@ -13,7 +13,8 @@ .personal-conversation-queue button:focus-visible, .personal-queue-row summary:focus-visible { outline: 2px solid var(--pw-blue); outline-offset: 2px; } .personal-queue-steer { flex-shrink: 0; } .personal-queue-message { margin: 8px 0 0; font-size: var(--text-body); line-height: var(--leading-body); } -.personal-queue-message p { white-space: pre-wrap; overflow-wrap: anywhere; } +.personal-queue-message > .personal-md, .personal-workspace-shell[data-pw-theme="loopx"] .personal-queue-message > .personal-md { margin-top: 0; font-size: var(--text-body); line-height: var(--leading-body); } +.personal-queue-message p, .personal-queue-message > .personal-md > p { white-space: pre-wrap; overflow-wrap: anywhere; } .personal-queue-message img { display: block; max-width: 100%; max-height: 120px; object-fit: contain; } .personal-queue-feedback { margin: 0; padding: 0 10px 8px; color: var(--pw-muted); overflow-wrap: anywhere; } .personal-queue-actions { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; } diff --git a/apps/presentation/dashboard/src/features/personal-workspace/conversation-queue.tsx b/apps/presentation/dashboard/src/features/personal-workspace/conversation-queue.tsx index 333ebf0d19..7b3b361878 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/conversation-queue.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/conversation-queue.tsx @@ -5,6 +5,8 @@ import { ChatApiError, chatQueueInputRequestSchema, fetchQueuedChatInput, mutate import { composerKeyAction } from "./composer-keyboard"; import { DocumentAttachment, isTextDocument } from "./document-attachment"; import { ContextHelp } from "./context-help"; +import { ConversationReplyContext } from "./conversation-requests"; +import { MarkdownText } from "./markdown"; import { queueInputKeys, readQueueInputRecovery, retireQueueInputRequest } from "./queue-input-recovery"; import { RetainedQueueInputs } from "./retained-queue-inputs"; import { useWorkspaceI18n } from "./i18n"; @@ -135,7 +137,7 @@ function QueuedMessage({sessionId, turn, index, targetTurnId, onChange, onInputC {open ?
{failed ?

{zh ? "完整消息读取失败" : "Full message unavailable"}

: !message ?

{zh ? "正在读取完整消息…" : "Reading the full message…"}

- : <>

{message.message}

+ : <> {message.attachments?.map(attachment => isTextDocument(attachment.mime_type) ? : {attachment.name}/)}} diff --git a/apps/presentation/dashboard/src/features/personal-workspace/goal-report-reviews.tsx b/apps/presentation/dashboard/src/features/personal-workspace/goal-report-reviews.tsx index d98d0b0fad..73801ec851 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/goal-report-reviews.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/goal-report-reviews.tsx @@ -72,10 +72,12 @@ export function GoalReportReviews({goalId, sourceId, zh, focusTodoId, refreshKey const [error, setError] = useState(""); const [textOnly, setTextOnly] = useState(false); const generation = useRef(0); + const completedRead = useRef(0); const navigation = useRef(""); const selectedId = useRef(focusTodoId ?? null); const focus = useResultCatalogFocus(); const storageKey = JSON.stringify(["loopx-report-reading", sourceId ?? location.origin, goalId]); + const pendingFocus = useRef<{scope: string; row?: string} | null>(null); function rememberSelection(todoId?: string) { selectedId.current = todoId ?? null; try { @@ -92,10 +94,23 @@ export function GoalReportReviews({goalId, sourceId, zh, focusTodoId, refreshKey try {saved = sessionStorage.getItem(storageKey);} catch { /* Reading works without storage. */ } selectedId.current = focusTodoId ?? saved; setReading(selectedId.current); setRows([]); setLoaded(false); setTextOnly(false); + if (selectedId.current) pendingFocus.current = {scope: storageKey}; } void load(); - return () => {generation.current++; focus.cancel();}; + return () => {generation.current++;}; }, [goalId, sourceId, focusTodoId, refreshKey]); + useEffect(() => {focus.cancel();}, [storageKey]); + useEffect(() => { + const target = pendingFocus.current; + // Navigation can start a newer read before this render receives its busy state. + // Consume focus only after that read has committed its readable or error view. + if (!target || busy || (!loaded && !error) || completedRead.current !== generation.current) return; + if (target.scope !== storageKey) {pendingFocus.current = null; return;} + if (target.row ? reading !== null : reading === null) return; + pendingFocus.current = null; + if (target.row) focus.row(target.row); + else focus.reader(); + }, [busy, loaded, error, reading, rows, storageKey]); async function read(todoId: string, current: number) { const value = await readReportReview(goalId, todoId); @@ -121,16 +136,17 @@ export function GoalReportReviews({goalId, sourceId, zh, focusTodoId, refreshKey if (selectedId.current) await read(selectedId.current, current); } catch { if (current === generation.current) setError(zh ? "材料或审阅状态暂不可读,请重试。" : "Material or review state is unavailable. Retry the read."); - } finally {if (current === generation.current) setBusy(false);} + } finally {if (current === generation.current) {completedRead.current = current; setBusy(false);}} } async function select(row: ReportReviewRow) { const current = ++generation.current; setReading(row.todo_id); setSelected(null); setTextOnly(false); rememberSelection(row.todo_id); - setBusy(true); setError(""); focus.reader(); + pendingFocus.current = {scope: storageKey}; + setBusy(true); setError(""); try {await read(row.todo_id, current);} catch {if (current === generation.current) setError(zh ? "原版本已不可读取,请重试。" : "The original edition cannot be read. Retry.");} - finally {if (current === generation.current) setBusy(false);} + finally {if (current === generation.current) {completedRead.current = current; setBusy(false);}} } const label = (row: ReportReviewRow) => row.superseded_by ? (zh ? "已有修订" : "Superseded") : row.status === "done" ? (zh ? "审阅已处理" : "Review handled") @@ -140,9 +156,10 @@ export function GoalReportReviews({goalId, sourceId, zh, focusTodoId, refreshKey const html = selected?.artifacts.find(item => item.renderer_id === "html_artifact_v0"); const htmlView = useMemo(() => html ? inertReportHtml(html.content, zh) : "", [html?.content, zh]); function returnToCatalog() { + pendingFocus.current = {scope: storageKey, row: reading ?? undefined}; generation.current++; setReading(null); setSelected(null); setBusy(false); setError(""); + completedRead.current = generation.current; rememberSelection(); - if (reading) focus.row(reading); } const attention: WorkspaceAttention | null = selected ? {goalId, sourceId, todoId: selected.review.todo_id, text: selected.review.title, blocking: false, decisionSource: "todo", details: {...attentionDetails(selected.todo), @@ -152,7 +169,10 @@ export function GoalReportReviews({goalId, sourceId, zh, focusTodoId, refreshKey
{reading ? :

{zh ? "审阅材料" : "Review materials"}

}

{zh ? "阅读不会完成验收。每份材料的审阅分别记录;处理材料不等于整个 Goal 验收通过。反馈回到负责 Agent 的原工作对话。页面版保留静态目录;外部来源可从文字版打开。" : "Reading does not accept a result. Each edition has its own review; handling it does not accept the entire Goal. Feedback returns to its responsible Agent's work conversation. Page view keeps the static index; open external sources from text view."}

-
+
{busy ?

{zh ? "正在读取材料…" : "Reading material…"}

: null} {error ?

{error}

: null}