openclacky 1.3.2 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +54 -0
  3. data/Dockerfile +3 -0
  4. data/README.md +1 -1
  5. data/README_JA.md +237 -0
  6. data/docs/rich_ui_guide.md +277 -0
  7. data/docs/rich_ui_refactor_plan.md +396 -0
  8. data/lib/clacky/agent/llm_caller.rb +10 -4
  9. data/lib/clacky/agent/session_serializer.rb +52 -7
  10. data/lib/clacky/agent/time_machine.rb +247 -26
  11. data/lib/clacky/agent.rb +15 -3
  12. data/lib/clacky/api_extension.rb +262 -0
  13. data/lib/clacky/api_extension_loader.rb +156 -0
  14. data/lib/clacky/cli.rb +93 -3
  15. data/lib/clacky/client.rb +38 -13
  16. data/lib/clacky/default_agents/_panels/git/panel.js +201 -0
  17. data/lib/clacky/default_agents/_panels/time_machine/panel.js +640 -0
  18. data/lib/clacky/default_agents/coding/profile.yml +3 -0
  19. data/lib/clacky/default_agents/coding/webui/.gitkeep +0 -0
  20. data/lib/clacky/default_skills/cron-task-creator/SKILL.md +1 -1
  21. data/lib/clacky/default_skills/extend-openclacky/SKILL.md +6 -4
  22. data/lib/clacky/default_skills/media-gen/SKILL.md +37 -10
  23. data/lib/clacky/idle_compression_timer.rb +3 -1
  24. data/lib/clacky/locales/en.rb +26 -0
  25. data/lib/clacky/locales/i18n.rb +26 -0
  26. data/lib/clacky/locales/zh.rb +26 -0
  27. data/lib/clacky/media/openai_compat.rb +64 -1
  28. data/lib/clacky/message_history.rb +9 -0
  29. data/lib/clacky/rich_ui/components/base_component.rb +50 -0
  30. data/lib/clacky/rich_ui/components/dialogs/approval_dialog.rb +142 -0
  31. data/lib/clacky/rich_ui/components/dialogs/config_menu_dialog.rb +106 -0
  32. data/lib/clacky/rich_ui/components/dialogs/form_dialog.rb +128 -0
  33. data/lib/clacky/rich_ui/components/sidebar.rb +119 -0
  34. data/lib/clacky/rich_ui/components/sidebar_panels.rb +134 -0
  35. data/lib/clacky/rich_ui/components/status_view.rb +58 -0
  36. data/lib/clacky/rich_ui/components/thinking_live_view.rb +79 -0
  37. data/lib/clacky/rich_ui/entry_tracker.rb +56 -0
  38. data/lib/clacky/rich_ui/layout_adapter.rb +16 -0
  39. data/lib/clacky/rich_ui/progress_handle_adapter.rb +24 -0
  40. data/lib/clacky/rich_ui/rich_ui_controller.rb +868 -0
  41. data/lib/clacky/rich_ui/shell/rich_agent_shell.rb +184 -0
  42. data/lib/clacky/rich_ui/view_renderer.rb +291 -0
  43. data/lib/clacky/rich_ui.rb +57 -0
  44. data/lib/clacky/rich_ui_controller.rb +3 -1549
  45. data/lib/clacky/server/api_extension_dispatcher.rb +120 -0
  46. data/lib/clacky/server/channel/channel_manager.rb +26 -0
  47. data/lib/clacky/server/git_panel.rb +115 -0
  48. data/lib/clacky/server/http_server.rb +547 -15
  49. data/lib/clacky/server/server_master.rb +6 -4
  50. data/lib/clacky/server/session_registry.rb +1 -1
  51. data/lib/clacky/shell_hook_loader.rb +1 -1
  52. data/lib/clacky/tools/edit.rb +14 -2
  53. data/lib/clacky/ui2/ui_controller.rb +7 -0
  54. data/lib/clacky/version.rb +1 -1
  55. data/lib/clacky/web/app.css +511 -101
  56. data/lib/clacky/web/app.js +95 -14
  57. data/lib/clacky/web/components/code-editor.js +197 -0
  58. data/lib/clacky/web/{notify.js → components/notify.js} +1 -1
  59. data/lib/clacky/web/{onboard.js → components/onboard.js} +18 -2
  60. data/lib/clacky/web/core/aside.js +117 -0
  61. data/lib/clacky/web/core/ext.js +387 -0
  62. data/lib/clacky/web/features/backup/store.js +92 -0
  63. data/lib/clacky/web/features/backup/view.js +94 -0
  64. data/lib/clacky/web/features/billing/store.js +163 -0
  65. data/lib/clacky/web/{billing.js → features/billing/view.js} +132 -240
  66. data/lib/clacky/web/features/brand/store.js +110 -0
  67. data/lib/clacky/web/{brand.js → features/brand/view.js} +49 -199
  68. data/lib/clacky/web/features/channels/store.js +103 -0
  69. data/lib/clacky/web/{channels.js → features/channels/view.js} +50 -127
  70. data/lib/clacky/web/features/creator/store.js +81 -0
  71. data/lib/clacky/web/{creator.js → features/creator/view.js} +53 -102
  72. data/lib/clacky/web/features/mcp/store.js +158 -0
  73. data/lib/clacky/web/{mcp.js → features/mcp/view.js} +57 -134
  74. data/lib/clacky/web/features/model-tester/store.js +77 -0
  75. data/lib/clacky/web/features/model-tester/view.js +7 -0
  76. data/lib/clacky/web/features/profile/store.js +170 -0
  77. data/lib/clacky/web/{profile.js → features/profile/view.js} +94 -144
  78. data/lib/clacky/web/features/share/store.js +145 -0
  79. data/lib/clacky/web/{share.js → features/share/view.js} +66 -202
  80. data/lib/clacky/web/features/skills/store.js +331 -0
  81. data/lib/clacky/web/features/skills/view.js +581 -0
  82. data/lib/clacky/web/features/tasks/store.js +135 -0
  83. data/lib/clacky/web/features/tasks/view.js +241 -0
  84. data/lib/clacky/web/features/trash/store.js +242 -0
  85. data/lib/clacky/web/{trash.js → features/trash/view.js} +102 -293
  86. data/lib/clacky/web/features/version/store.js +165 -0
  87. data/lib/clacky/web/features/version/view.js +323 -0
  88. data/lib/clacky/web/features/workspace/store.js +99 -0
  89. data/lib/clacky/web/features/workspace/view.js +305 -0
  90. data/lib/clacky/web/i18n.js +68 -6
  91. data/lib/clacky/web/index.html +113 -62
  92. data/lib/clacky/web/sessions.js +493 -39
  93. data/lib/clacky/web/settings.js +143 -49
  94. data/lib/clacky/web/skills.js +3 -863
  95. data/lib/clacky/web/vendor/codemirror/codemirror.min.js +29 -0
  96. data/lib/clacky/web/ws-dispatcher.js +7 -3
  97. data/lib/clacky.rb +17 -1
  98. metadata +81 -20
  99. data/lib/clacky/web/backup.js +0 -119
  100. data/lib/clacky/web/model-tester.js +0 -66
  101. data/lib/clacky/web/tasks.js +0 -373
  102. data/lib/clacky/web/version.js +0 -449
  103. data/lib/clacky/web/workspace.js +0 -316
  104. /data/lib/clacky/web/{notify.mp3 → assets/notify.mp3} +0 -0
  105. /data/lib/clacky/web/{datepicker.js → components/datepicker.js} +0 -0
  106. /data/lib/clacky/web/{sidebar.js → components/sidebar.js} +0 -0
  107. /data/lib/clacky/web/{marked.min.js → vendor/marked/marked.min.js} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed703cddac3ffa9887b5c500c5dfbe57c895eb5aab0e9dc3338592c9317555ec
4
- data.tar.gz: 67d21c3c857e72bb729cfcecbdb3749eaaac1c76b21e1d0600081d1e4d79e880
3
+ metadata.gz: 8d5879a7f2c6eb0a1846dd3049fa79abd3ca53119750bd0a43b337339f146dad
4
+ data.tar.gz: 12a39e3d860e9e9e691424289543b73813bcb4652e11fe0719e72aa9e6c72760
5
5
  SHA512:
6
- metadata.gz: 4fe46c92c67e5937bf24e325be47046a9ebf555afb722aaaaf108a17b2c13403c7e42c08d4b1a7abafad5c5ffb5d79d2749264c051572d157d0094dcb067ac78
7
- data.tar.gz: 5fa8e909159560aa13944c0435716e7a98265504c6f61e8cfc298bc09553aa218ac404423d4e9b45f5a8d17563f0ae8a7a50547460fb497e06a98bc46b55aa53
6
+ metadata.gz: cdb47cb9da7cccae4329aa0d4b98f03d9e5cadf763c12b9cd255060e2f230154eed3e7404e494f9a0b7e7b54cdb569f2dc25a1ea69c0b8af386a4a1122942d65
7
+ data.tar.gz: 196c48e418e2119201664b920871aa489ff3531128a8aa8b981f73d6ddc95a7d3ef23ecb79da0611810b8af02735f83340ce0712ddb18ad30de0f94421dbd0a4
data/CHANGELOG.md CHANGED
@@ -5,6 +5,60 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.3.4] - 2026-06-25
9
+
10
+ ### Added
11
+ - Skill edit UI with brand skill theme colors
12
+ - WebUI language preference propagated to backend for localized error messages
13
+ - Edit message resend with confirmation modal and localStorage key normalization
14
+ - Duplicate model card action
15
+ - i18n support for aside tab labels (files/git/time-machine)
16
+ - File picker defaults to workspace with mkdir/rename support and hardened validation
17
+ - API extensions and EPIPE rebuild client handling
18
+ - Ruby Rich enhancement and refactoring (runtime dependency added)
19
+
20
+ ### Improved
21
+ - Default aside panel to collapsed; sidebar widths aligned to 16rem
22
+ - Onboarding manual config UX and spacing improvements
23
+ - Fixed positioning for modal model/baseurl dropdowns to avoid overflow clipping
24
+ - Disable transition during aside resize drag
25
+ - Rename resetAfterUnbind to resetBrandState to avoid view/store collision
26
+
27
+ ### Fixed
28
+ - Edit tool performs literal replacement (C-5682)
29
+ - Shield code spans before math extraction to prevent LaTeX rendering (C-5635)
30
+ - Preserve updated_at on idle compression and session eviction; fix Today/Yesterday display bug
31
+ - Remove media output dir UI setting — always use session workspace
32
+ - Test: stub req.path and req.request_method in check_access_key loopback bypass spec
33
+
34
+ ## [1.3.3] - 2026-06-23
35
+
36
+ ### Added
37
+ - Profile editor with CodeMirror for editing agent SOUL/USER files
38
+ - Inline editing for memory cards
39
+ - Workspace file preview, plus "copy path" in the context menu and a close button in the code editor
40
+ - Time Machine: browse and restore previous workspace states via git
41
+ - Image editing support in media generation
42
+ - Copy and edit actions on user/assistant message bubbles
43
+ - Media output directory configuration in settings
44
+ - Web UI extension support
45
+ - Health check endpoint and signal logging
46
+
47
+ ### Improved
48
+ - Differentiated icons and reordered buttons in the context menu and memory card
49
+ - Removed the standalone preview panel for a cleaner workspace layout
50
+ - Throttle duplicate inbound channel messages
51
+ - Session bar labels no longer wrap
52
+ - Added Japanese README (README_JA.md)
53
+
54
+ ### Fixed
55
+ - Lock the default-model checkbox when only one model exists (C-5677)
56
+ - Jump to a session that is not yet loaded in the sidebar (C-5679)
57
+ - Workspace panel now uses overlay mode on mobile
58
+ - Clarified that `include_sessions` applies to auto-backup only (UI)
59
+ - Removed extra padding from model cards in the grid
60
+ - Moved profile fetch into the store and fixed the architecture spec
61
+
8
62
  ## [1.3.2] - 2026-06-18
9
63
 
10
64
  ### Added
data/Dockerfile CHANGED
@@ -24,5 +24,8 @@ VOLUME ["/root/.clacky"]
24
24
 
25
25
  EXPOSE 7070
26
26
 
27
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
28
+ CMD curl -f http://localhost:7070/health || exit 1
29
+
27
30
  ENTRYPOINT ["openclacky"]
28
31
  CMD ["server", "--host", "0.0.0.0"]
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![License](https://img.shields.io/badge/license-MIT-lightgrey?style=flat-square)](LICENSE.txt)
8
8
 
9
9
  <p align="center">
10
- <a href="README.md">English</a> · <a href="README_CN.md">简体中文</a>
10
+ <a href="README.md">English</a> · <a href="README_CN.md">简体中文</a> · <a href="README_JA.md">日本語</a>
11
11
  </p>
12
12
 
13
13
  > Contributing? Read **[CONTRIBUTING.md](./CONTRIBUTING.md)** before opening a PR.
data/README_JA.md ADDED
@@ -0,0 +1,237 @@
1
+ # OpenClacky
2
+
3
+ [![Build](https://img.shields.io/github/actions/workflow/status/clacky-ai/openclacky/main.yml?label=build&style=flat-square)](https://github.com/clacky-ai/openclacky/actions)
4
+ [![Release](https://img.shields.io/gem/v/openclacky?label=release&style=flat-square&color=blue)](https://rubygems.org/gems/openclacky)
5
+ [![Ruby](https://img.shields.io/badge/ruby-%3E%3D%203.1.0-red?style=flat-square)](https://www.ruby-lang.org)
6
+ [![Downloads](https://img.shields.io/gem/dt/openclacky?label=downloads&style=flat-square&color=brightgreen)](https://rubygems.org/gems/openclacky)
7
+ [![License](https://img.shields.io/badge/license-MIT-lightgrey?style=flat-square)](LICENSE.txt)
8
+
9
+ <p align="center">
10
+ <a href="README.md">English</a> · <a href="README_CN.md">简体中文</a> · <a href="README_JA.md">日本語</a>
11
+ </p>
12
+
13
+ > コントリビュートする場合は、PR を作成する前に **[CONTRIBUTING.md](./CONTRIBUTING.md)** をお読みください。
14
+
15
+ **最もトークン効率の高いオープンソース AI エージェント。**
16
+
17
+ OpenClacky は Claude Code と同等の性能を同等のコストで実現しつつ、他のオープンソースエージェントと比べて大幅にコストを削減します(OpenClaw 比で約 50%、Hermes 比で約 3 倍安価)。100% オープンソース(MIT)、任意の OpenAI 互換モデルで BYOK が可能で、2 年にわたるエージェント開発(Agentic R&D)とハーネスエンジニアリングの上に構築されています。
18
+
19
+ > Web サイト: https://www.openclacky.com/ · 出資元 **MiraclePlus · ZhenFund · Sequoia China · Hillhouse Capital**
20
+
21
+ ## なぜ OpenClacky なのか?
22
+
23
+ 同じタスクで、どれだけ支払いますか? 同等のエージェントワークロードにおいて、OpenClacky は主流の代替手段と比べて大量のトークン消費を節約します。
24
+
25
+ | エージェント | 相対コスト | 備考 |
26
+ |---|---|---|
27
+ | **OpenClacky** | **約 0.8** | 16 ツール · キャッシュヒット率約 100% · サブエージェントルーティング |
28
+ | Claude Code | 1.0×(基準) | 世界クラスのハーネス、クローズドソースのサブスクリプション |
29
+ | OpenClaw | 約 1.5× | 同等のハーネスエージェント |
30
+ | Hermes | 約 3× | 52 個の組み込みツール — スキーマの肥大化が約 3〜4 倍 |
31
+
32
+ *数値は社内の一般的なエージェントタスクで計測した平均値であり、Claude Code を基準としています。詳細なベンチマークレポートは GitHub で公開予定です。*
33
+
34
+ ## 機能比較
35
+
36
+ エージェントのコア性能はこの分野でおおむね横並びであり、本当の差別化要因は **コスト、オープン性、Skill の進化、そして統合機能** です。
37
+
38
+ | 機能 | Claude Code | OpenClaw | Hermes | **OpenClacky** |
39
+ |---|:---:|:---:|:---:|:---:|
40
+ | トークンコスト | 1.0× | 約 1.5× | 約 3× | **約 0.8** |
41
+ | オープンソース | ❌ クローズド | ✅ オープン | ✅ オープン | ✅ MIT |
42
+ | BYOK / モデルの自由度 | ❌ Anthropic のみ | ✅ | ✅ | ✅ |
43
+ | Skill の自己進化 | ❌ | ❌ | ✅ | ✅ |
44
+ | IM 統合(Feishu/WeCom/WeChat/Discord/Telegram) | ❌ | ✅ | ✅ | ✅ |
45
+
46
+ ## どうやってコストを下げているのか
47
+
48
+ 機能を削るのではなく、すべてのレイヤーで正しい選択を積み重ねることで実現しています。
49
+
50
+ ### 1. 超高水準のキャッシュヒット率
51
+ セッションを再起動しない、ダブルキャッシュマーカー、**Insert-then-Compress(挿入してから圧縮)** — システムプロンプトは決して書き換えられないため、圧縮後もキャッシュを再利用できます。**計測されたキャッシュヒット率: ほぼ 100%。**
52
+
53
+ ### 2. 最小限のツールセット
54
+ **コアツールはわずか 16 個** です。機能は単一の `invoke_skill` メタツールを介して Skill エコシステムにオフロードされます。指標はツールの数ではなく、タスクの完了率です。
55
+
56
+ | OpenClacky | Claude Code | OpenClaw | Hermes |
57
+ |:--:|:--:|:--:|:--:|
58
+ | **16** | 40+ | 23 | 52 |
59
+
60
+ ### 3. アイドル時の自動圧縮
61
+ 会議に行く、コーヒーを淹れる — その間にエージェントは長いコンテキストをバックグラウンドで圧縮し、キャッシュを事前にウォームアップします。戻ってきて最初に送るメッセージは直接キャッシュにヒットします。**コールドスタート時の初回トークンコストを 50% 以上削減。**
62
+
63
+ ### 4. BYOK — モデルを自分で選び、コストを自分で決める
64
+ 任意の OpenAI 互換 API をプラグアンドプレイで利用できます。公式の直接接続、集約ルーティング、互換リレー — 選択は 100% あなた次第です。コードには Claude を使い、サブタスクは自動的に DeepSeek にルーティングして、さらにトークンを節約しましょう。
65
+
66
+ **2 年 · 3 世代のエージェントアーキテクチャ · 6 つのコアハーネスエンジニアリングの意思決定** の上に構築されています。
67
+
68
+ ## Skill — エージェントの魂
69
+
70
+ - **`/` で呼び出す** — 瞬時の閲覧、あいまい検索、ダイレクトコール。何百もの Skill を指先で操作できます。
71
+ - **自然言語で Skill を作成** — やりたいことを説明するだけで、エージェントが `SKILL.md` を起草し、手順を分解し、検証を実行します。コードは不要です。
72
+ - **自己進化** — 各実行のあと、エージェントは実行コンテキストと結果に基づいて Skill を更新します。次回の呼び出しはより安定し、より正確になります。
73
+ - **オープンで互換性が高い** — Claude Skills / Markdown Pack / カスタム形式をサポートします。
74
+ - **収益化が可能** — 洗練された Skill はパッケージ化して販売でき、暗号化配布、License 管理、作者が設定する価格設定に対応します。
75
+
76
+ ## インストール
77
+
78
+ ### デスクトップインストーラー(推奨)
79
+
80
+ ダブルクリックでインストール — 環境、依存関係、Skill のすべてが自動的にセットアップされます。
81
+
82
+ - **macOS** — [`.dmg` をダウンロード](https://oss.1024code.com/openclacky-installer/official/openclacky-installer.dmg)(Apple Silicon / Intel)
83
+ - **Windows** — [`.exe` をダウンロード](https://oss.1024code.com/openclacky-installer/official/openclacky-installer.exe)(Windows 10 2004+ / Windows 11)
84
+
85
+ その他のオプション: https://www.openclacky.com/
86
+
87
+ ### コマンドライン
88
+
89
+ ワンラインインストール(Mac/Ubuntu):
90
+
91
+ ```bash
92
+ /bin/bash -c "$(curl -sSL https://raw.githubusercontent.com/clacky-ai/openclacky/main/scripts/install.sh)"
93
+ ```
94
+
95
+ Windows:
96
+
97
+ ```bash
98
+ powershell -c "& ([scriptblock]::Create((irm 'https://raw.githubusercontent.com/clacky-ai/openclacky/main/scripts/install.ps1')))"
99
+ ```
100
+
101
+ または Ruby(3.x/4.x)を使う場合:
102
+
103
+ **要件:** Ruby >= 3.1.0
104
+
105
+ ```bash
106
+ gem install openclacky
107
+ ```
108
+
109
+ 詳細はこちら: https://www.openclacky.com/docs/installation
110
+
111
+ ### Docker
112
+
113
+ ビルド:
114
+
115
+ ```bash
116
+ git clone https://github.com/clacky-ai/openclacky.git
117
+ cd openclacky
118
+ docker build -t openclacky .
119
+ ```
120
+
121
+ **Linux:**
122
+
123
+ ```bash
124
+ docker run -d --network=host -e CLACKY_ACCESS_KEY="" openclacky
125
+ ```
126
+
127
+ `--network=host` は、コンテナ内のエージェントがホスト上で動作する Chrome のリモートデバッグポートに到達するために必要です。
128
+
129
+ **macOS / Windows:**
130
+
131
+ ```bash
132
+ docker run -d -p 7070:7070 -e CLACKY_ACCESS_KEY="" openclacky
133
+ ```
134
+
135
+ > **注意:** macOS/Windows では `--network=host` がサポートされていないため、ブラウザの自動化が制限される場合があります。
136
+
137
+ 起動後、**http://localhost:7070** を開いてください。
138
+
139
+ 環境変数:
140
+
141
+ | 変数 | 説明 |
142
+ |---|---|
143
+ | `CLACKY_ACCESS_KEY` | アクセスキーで Web UI を保護します(空の場合はパブリックモード) |
144
+
145
+
146
+ ## クイックスタート
147
+
148
+ ### ターミナル(CLI)
149
+
150
+ ```bash
151
+ openclacky # カレントディレクトリで対話型エージェントを起動
152
+ ```
153
+
154
+ ### Web UI
155
+
156
+ ```bash
157
+ openclacky server # デフォルト: http://localhost:7070
158
+ ```
159
+
160
+ **http://localhost:7070** を開くと、マルチセッション対応の本格的なチャットインターフェースが利用できます — コーディング、コピーライティング、リサーチのセッションを並行して実行できます。
161
+
162
+ オプション:
163
+
164
+ ```bash
165
+ openclacky server --port 8080 # カスタムポート
166
+ openclacky server --host 0.0.0.0 # すべてのインターフェースでリッスン(リモートアクセス)
167
+ ```
168
+
169
+ ## 設定
170
+
171
+ ```bash
172
+ $ openclacky
173
+ > /config
174
+ ```
175
+
176
+ **API Key**、**Model**、**Base URL**(任意の OpenAI 互換プロバイダー)を設定します。
177
+
178
+ 標準でサポート: **Claude (Anthropic) · GPT (OpenAI) · DeepSeek · Kimi (Moonshot) · MiniMax · OpenRouter** — または任意のカスタムエンドポイント。
179
+
180
+ ## コーディングのユースケース
181
+
182
+ OpenClacky は汎用 AI コーディングアシスタントとして機能します — フルスタックアプリの雛形作成、機能追加、あるいは未知のコードベースの探索が可能です:
183
+
184
+ ```bash
185
+ $ openclacky
186
+ > /new my-app # 新しいプロジェクトの雛形を作成
187
+ > メールとパスワードによるユーザー認証を追加して
188
+ > 決済モジュールはどのように動作しますか?
189
+ ```
190
+
191
+ ## Star History
192
+
193
+ <a href="https://www.star-history.com/?repos=clacky-ai%2Fopenclacky&type=date&legend=top-left">
194
+ <picture>
195
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=clacky-ai/openclacky&type=date&theme=dark&legend=top-left" />
196
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=clacky-ai/openclacky&type=date&legend=top-left" />
197
+ <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=clacky-ai/openclacky&type=date&legend=top-left" />
198
+ </picture>
199
+ </a>
200
+
201
+ ## 上級者向け — クリエイタープログラム
202
+
203
+ すでにパワーユーザーたちは、自身のワークフローを OpenClacky 上の垂直特化型 AI エキスパートへと変えています — 暗号化配布、License 管理、自分で設定する価格。法務、医療、ファイナンシャルプランニングなど、さまざまな分野で展開されています。
204
+
205
+ 詳細はこちら: https://www.openclacky.com/ → Creators
206
+
207
+ ## ソースからのインストール
208
+
209
+ ```bash
210
+ git clone https://github.com/clacky-ai/openclacky.git
211
+ cd openclacky
212
+ bundle install
213
+ bin/clacky
214
+ ```
215
+
216
+ ## 信頼性と信用
217
+
218
+ - **100% オープンソース** — MIT ライセンス、すべてのコードが公開され、すべての意思決定が追跡可能
219
+ - **2 年にわたるエージェント開発(Agentic R&D)** — 3 世代のアーキテクチャ
220
+ - **16 個のコアツール** — 設計思想としての最小主義
221
+ - **出資元** MiraclePlus · ZhenFund · Sequoia China · Hillhouse Capital
222
+
223
+ ## コントリビューター
224
+
225
+ すべてのコード、バグ報告、そして丁寧なレビューが大切です。OpenClacky をより良くしてくださり、ありがとうございます。
226
+
227
+ <a href="https://github.com/clacky-ai/openclacky/graphs/contributors">
228
+ <img src="https://contrib.rocks/image?repo=clacky-ai/openclacky" />
229
+ </a>
230
+
231
+ ## コントリビュート
232
+
233
+ バグ報告とプルリクエストは GitHub( https://github.com/clacky-ai/openclacky )で歓迎しています。コントリビューターは[行動規範](https://github.com/clacky-ai/openclacky/blob/main/CODE_OF_CONDUCT.md)を遵守することが求められます。
234
+
235
+ ## ライセンス
236
+
237
+ [MIT ライセンス](https://opensource.org/licenses/MIT)のもとでオープンソースとして利用可能です。
@@ -0,0 +1,277 @@
1
+ # OpenClacky Rich UI Mode — Operations and Interface Display
2
+
3
+ > Source directory: `lib/clacky/rich_ui/`
4
+ > Terminal TUI interface built on the RubyRich library
5
+
6
+ ---
7
+
8
+ ## I. Overall Architecture
9
+
10
+ `lib/clacky/rich_ui` is OpenClacky's terminal TUI interface module, built on the `RubyRich` library, implementing a complete terminal user interaction interface. The core entry point is `RichUIController` (`rich_ui_controller.rb`), which manages layout, components, events, and lifecycle through `RichAgentShell`.
11
+
12
+ ---
13
+
14
+ ## II. Interface Layout (7-layer Zoning)
15
+
16
+ The interface is defined by the zoning layout in `RichAgentShell#build_layout`:
17
+
18
+ | Zone | Name | Description |
19
+ |------|------|-------------|
20
+ | Row 1 | **Header** | Top title bar, displays `OpenClacky` title/subtitle |
21
+ | Main body left | **Transcript** | Conversation viewport, displays user messages, assistant replies, tool calls, etc. |
22
+ | Main body right | **Sidebar** | Sidebar (36 columns wide), contains Work / Tasks / Context three panels |
23
+ | Main body bottom | **ThinkingLive** | Real-time thinking display area (dynamically appears/disappears, height 0 or 6 rows) |
24
+ | From row 6 | **Composer** | Input editor, with Framed border titled "Composer" |
25
+ | Last row | **Status** | Bottom status bar, displays current mode, model, task count, cost, etc. |
26
+
27
+ ---
28
+
29
+ ## III. Sidebar — Three Information Panels
30
+
31
+ The sidebar (`RichSidebar`, `components/sidebar.rb`) supports multiple display modes, switched via F1-F4 shortcuts:
32
+
33
+ - **F1 → Work panel**: Displays plan description, up to 8 recent tool activities (with status markers), task count and cost statistics
34
+ - **F2 → Tasks panel**: Displays the current task list (from `update_todos`), with completion progress (e.g. `3/5 done`), status markers:
35
+ - `✓` (green) = Completed
36
+ - `●` (blue) = In progress
37
+ - `!` (red) = Failed
38
+ - `○` (gray) = Pending
39
+ - **F3 → Auto mode**: Automatically displays all panels that have content
40
+ - **F4 → Context panel**: Displays Token usage details (prompt / output / total / cost)
41
+
42
+ Sidebar panels are implemented by `components/sidebar_panels.rb`:
43
+ - `RichWorkPanel`: Work progress panel
44
+ - `RichTasksPanel`: Task list panel
45
+ - `RichContextPanel`: Context / Token info panel
46
+
47
+ ---
48
+
49
+ ## IV. Bottom Status Bar
50
+
51
+ `RichStatusView` (`components/status_view.rb`) renders a single row of status information at the very bottom of the terminal:
52
+
53
+ - **Idle state**: Shows mode name + "idle" + model name + task count + cost + "Ctrl+C quit"
54
+ - **Working**: Shows rotating spinner animation + current tool name (e.g. "web_search…") + model/latency + task count + cost
55
+ - **Ctrl+C warning**: Red prompt "Press Ctrl+C again to exit"
56
+ - Latency info is appended after the model name (format: `model_name (1.2s)`)
57
+
58
+ ---
59
+
60
+ ## V. Transcript — Operations and Display
61
+
62
+ ### 5.1 Message Display
63
+
64
+ - **User messages**: Displayed directly in the conversation area
65
+ - **Assistant replies**: Rendered in Markdown format (supports code blocks, tables, lists, etc.)
66
+ - Long text (≥240 characters) triggers **streaming rendering**: 6 characters per chunk, 0.03s interval, appearing progressively
67
+ - File summaries are automatically appended at the end of replies (e.g. `Files - path/to/file.rb`)
68
+ - **System messages**: Regular info / warning / error displayed in different colors
69
+ - **Welcome banner**: On first launch, displays `WelcomeBanner` containing working directory, mode, etc.; if there is session history, shows a "recent session" separator and the last user message
70
+
71
+ ### 5.2 Thinking Process Display (Two Phases)
72
+
73
+ 1. **Live phase**: `ThinkingLiveView` (`components/thinking_live_view.rb`) dynamically appears (occupying 6 rows), renders thinking content character by character in real time, with a rotating spinner and elapsed time counter, stays for about 0.6s after completion
74
+ 2. **Collapsed phase**: Thinking content is retained in the conversation area as a collapsed block (marked "Xs"), press Ctrl+O to expand and view
75
+
76
+ ### 5.3 Tool Call Display
77
+
78
+ Each tool call process is visualized in three steps:
79
+
80
+ - **Start**: Insert a `running` status entry in the conversation area, displaying tool name and parameters (truncated as needed, e.g. `web_search("query...")`, `web_fetch(hostname)`)
81
+ - **Complete**: Update entry status to `done` (green `[OK]`), with output content appended
82
+ - **Error**: Update entry status to `error` (red `[Error]`), with error message appended
83
+
84
+ Tool activities are simultaneously synced to the sidebar Work panel (up to 12 entries recorded).
85
+
86
+ ### 5.4 Diff Display
87
+
88
+ Through the `show_diff` method, using the `Diffy` library to generate unified format diffs, truncated to 50 visible lines (excess lines indicate hidden count), with stats appended (e.g. `+5, -3, 2 hunks`).
89
+
90
+ ### 5.5 Token Usage Display
91
+
92
+ `show_token_usage` displays prompt/output/total token counts and cost estimates in the conversation area, while syncing to the sidebar Context panel.
93
+
94
+ ### 5.6 Text Selection and Copy
95
+
96
+ `ViewportSelection` (`extensions/viewport_selection.rb`) extends `RubyRich::Viewport`, supporting:
97
+
98
+ - **Mouse selection**: Left-click drag to select text, highlighted with reverse color
99
+ - **Right-click copy**: Copy selected text to system clipboard
100
+ - **Multi-platform clipboard support**: Linux (wl-copy / xclip / xsel), macOS (pbcopy), Windows, with OSC 52 terminal protocol fallback
101
+
102
+ ### 5.7 Table Rendering Optimization
103
+
104
+ `MarkdownTableAdapter` (`extensions/markdown_table_adapter.rb`) extends RubyRich's Markdown converter, enabling tables to adapt to terminal width: calculating natural column widths, proportionally compressing columns when exceeding terminal width, and auto-wrapping long text.
105
+
106
+ ---
107
+
108
+ ## VI. Composer (Input Area) — Operations
109
+
110
+ ### 6.1 Basic Operations
111
+
112
+ - **Text input**: Single-line editor, `Shift+Enter` for newline
113
+ - **History navigation**: Up/down arrows to browse message history
114
+ - **Vim scrolling**: Type `/vim` to toggle, enabling `j`/`k` to scroll the conversation area in single-line mode
115
+ - **Clear**: `Ctrl+C` first press interrupts current task, second press exits; `Esc` multi-layer cancel (see below)
116
+
117
+ ### 6.2 Slash Commands
118
+
119
+ Built-in commands trigger a dropdown menu via `/`:
120
+
121
+ | Command | Description |
122
+ |---------|-------------|
123
+ | `/clear` | Clear output and restart session |
124
+ | `/config` | Open model configuration dialog |
125
+ | `/undo` | Restore previous task state |
126
+ | `/help` | Show help information |
127
+ | `/exit` | Exit application |
128
+ | `/model` | Switch LLM model |
129
+
130
+ Skill slash commands are also dynamically registered in the Composer menu, with descriptions truncated to 50 characters.
131
+
132
+ ### 6.3 Esc Multi-Layer Cancel Stack
133
+
134
+ Pressing `Esc` processes in priority order:
135
+
136
+ 1. Close any open dialog (if present)
137
+ 2. Close slash menu (if open)
138
+ 3. Interrupt running task
139
+ 4. Clear input field text (Composer native behavior)
140
+
141
+ ---
142
+
143
+ ## VII. Dialog System
144
+
145
+ RichUI provides three dialog types, all running in blocking mode (calling `show_blocking_dialog`):
146
+
147
+ ### 7.1 Approval Dialog (ApprovalDialog)
148
+
149
+ File: `components/dialogs/approval_dialog.rb`
150
+
151
+ Security confirmation before tool execution, displaying:
152
+ - **Tool name** + category badge (File/Shell/Network/Paid, different colors)
153
+ - **Risk level**: Low (green), Medium (yellow), High (yellow), Critical (red), with `●○○○` style progress bar
154
+ - **Tool info** and parameter details
155
+ - Three action buttons: `Approve`, `Deny`, `Always allow` (fingerprint whitelist)
156
+
157
+ Navigation: `←`/`→` or `h`/`l` to switch options, `Enter` to confirm, `Esc` to deny.
158
+
159
+ ### 7.2 Configuration Menu Dialog (ConfigMenuDialog)
160
+
161
+ File: `components/dialogs/config_menu_dialog.rb`
162
+
163
+ Opened by `/config` command, for model management:
164
+ - Lists all configured models (showing API Key mask, type labels)
165
+ - Actions: Switch model / Add new model / Edit current model / Delete model / Close
166
+ - When adding a model, first select Provider (pre-configured vs custom), then fill in API Key, Model name, Base URL form
167
+ - Connection test verification available after adding/editing
168
+
169
+ Navigation: `↑`/`↓` or `j`/`k` to move, `Enter` to select, `q`/`Esc` to cancel.
170
+
171
+ ### 7.3 Form Dialog (FormDialog)
172
+
173
+ File: `components/dialogs/form_dialog.rb`
174
+
175
+ General-purpose form input, used for model editing and similar scenarios:
176
+ - Supports multiple fields (with labels, default values, placeholders, password masking)
177
+ - Focused field shows `➜` marker
178
+ - Navigation: `↑`/`↓`/`Tab`/`Shift+Tab` to switch fields, `Enter` to submit, `Esc` to cancel
179
+
180
+ ### 7.4 Model Switch Dialog
181
+
182
+ Triggered by `/model` command, two-step operation:
183
+ 1. Select target model from the available model list
184
+ 2. Choose scope: current session only / save permanently
185
+
186
+ ---
187
+
188
+ ## VIII. Keyboard Shortcut Overview
189
+
190
+ | Shortcut | Scope | Function |
191
+ |----------|-------|----------|
192
+ | `Ctrl+C` | Global (within 1s) | Interrupt current task |
193
+ | `Ctrl+C` | Global (after 1s) | Exit program |
194
+ | `Ctrl+M` | Global (within 2s) | Toggle permission mode (confirm_safes ↔ confirm_all) |
195
+ | `Tab` | Global | Toggle permission mode + refocus Composer |
196
+ | `F1` | Global | Sidebar → Work panel |
197
+ | `F2` | Global | Sidebar → Tasks panel |
198
+ | `F3` | Global | Sidebar → Auto mode |
199
+ | `F4` | Global | Sidebar → Context panel |
200
+ | `Esc` | Global | Multi-layer cancel (dialog→menu→interrupt→clear input) |
201
+ | `Shift+Enter` | Composer | Newline |
202
+ | `↑`/`↓` | Composer | History message navigation |
203
+ | `j`/`k` | Composer (single-line mode) | Scroll conversation area |
204
+ | `Ctrl+O` | Transcript | Expand/collapse thinking block |
205
+ | Left-click drag | Transcript | Select text |
206
+ | Right-click | Transcript | Copy selected text |
207
+
208
+ ---
209
+
210
+ ## IX. Auxiliary Modules
211
+
212
+ | Module | File | Function |
213
+ |--------|------|----------|
214
+ | **ViewRenderer** | `view_renderer.rb` | Tool output formatting (`[OK]`/`[Error]`), parameter truncation, tool activity label generation, Diff stat parsing, thinking text extraction, API Key masking, config menu option building, model form validation |
215
+ | **EntryTracker** | `entry_tracker.rb` | Lightweight ID tracker, maintains tool call stack (push/pop), ensures correct pairing of tool calls and results |
216
+ | **LayoutAdapter** | `layout_adapter.rb` | Layout adapter, provides `clear_output` to clear conversation area |
217
+ | **ProgressHandleAdapter** | `progress_handle_adapter.rb` | Wraps RubyRich progress handler, provides `update` / `finish` / `cancel` interface |
218
+ | **BaseComponent** | `components/base_component.rb` | Component base class, provides shared rendering methods: `muted`/`colored`/`status_marker`/`truncate`/`theme` |
219
+ | **TranscriptPlain** | `extensions/transcript_plain.rb` | Extends Transcript, supports `plain: true` marked plain text entries (for welcome banner, etc.) |
220
+ | **MarkdownTableAdapter** | `extensions/markdown_table_adapter.rb` | Monkey patch extending Kramdown-to-RubyRich table conversion, implementing terminal-width-adaptive table wrapping |
221
+ | **ViewportSelection** | `extensions/viewport_selection.rb` | Extends viewport, supports text selection and multi-platform clipboard copy |
222
+
223
+ ---
224
+
225
+ ## X. Key Rendering Constants
226
+
227
+ | Constant | Value | Description |
228
+ |----------|-------|-------------|
229
+ | `STREAMING_MARKDOWN_THRESHOLD` | 240 chars | Triggers streaming rendering when exceeded |
230
+ | `STREAMING_MARKDOWN_CHUNK_SIZE` | 6 chars/chunk | Streaming rendering chunk size |
231
+ | `STREAMING_MARKDOWN_DELAY` | 0.03s | Streaming rendering interval |
232
+ | Thinking streaming chunk size | 3 chars/chunk | Thinking content streaming display chunk size |
233
+ | Thinking streaming delay | 0.008s | Thinking content streaming display interval |
234
+ | `SKILL_DESC_MAX` | 50 chars | Skill description truncation length in menu |
235
+ | Tool activity record limit | 12 entries | Max entries in sidebar Work panel |
236
+ | Diff visible lines | 50 lines | Default max display lines for `show_diff` |
237
+ | Tool label truncation | 40 chars | Truncation length for tool call parameter labels |
238
+
239
+ ---
240
+
241
+ ## XI. Source File Listing
242
+
243
+ ```
244
+ lib/clacky/rich_ui/
245
+ ├── rich_ui_controller.rb # Core controller (824 lines)
246
+ ├── view_renderer.rb # View rendering helper module (291 lines)
247
+ ├── entry_tracker.rb # Entry ID tracker
248
+ ├── layout_adapter.rb # Layout adapter
249
+ ├── progress_handle_adapter.rb # Progress handler adapter
250
+ ├── shell/
251
+ │ └── rich_agent_shell.rb # AgentShell in Rich mode
252
+ ├── components/
253
+ │ ├── base_component.rb # Base component module
254
+ │ ├── sidebar.rb # Sidebar
255
+ │ ├── sidebar_panels.rb # Sidebar panels (Work/Tasks/Context)
256
+ │ ├── status_view.rb # Status view (bottom status bar)
257
+ │ ├── thinking_live_view.rb # Real-time thinking view
258
+ │ └── dialogs/
259
+ │ ├── approval_dialog.rb # Approval dialog
260
+ │ ├── form_dialog.rb # Form dialog
261
+ │ └── config_menu_dialog.rb # Configuration menu dialog
262
+ └── extensions/
263
+ ├── markdown_table_adapter.rb # Markdown table adapter
264
+ ├── transcript_plain.rb # Plain text transcript extension
265
+ └── viewport_selection.rb # Viewport text selection extension
266
+ ```
267
+
268
+ ## XII. Lifecycle
269
+
270
+ 1. `RichUIController#initialize` — Initializes configuration, creates `RichAgentShell`, `LayoutAdapter`, `EntryTracker`, binds callbacks
271
+ 2. `initialize_and_show_banner` — Sets `running=true`, displays welcome banner or session history
272
+ 3. `start` → `start_input_loop` → `@shell.start` — Enters terminal event loop
273
+ 4. User submits input → `on_submit` callback → `@input_callback` → CLI → Agent
274
+ 5. Agent response → `show_assistant_message` (thinking streaming + Markdown rendering)
275
+ 6. Tool calls → `show_tool_call` / `show_tool_result` / `show_tool_error`
276
+ 7. Task complete → `show_complete`, updates status bar and sidebar
277
+ 8. `stop` — Exits event loop, optional screen clear