openclacky 1.2.4 → 1.2.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80e1b5549b0e55760ec4e0e905eea3ab50bc9a66bd8c256e628a1afdb8531ba0
4
- data.tar.gz: 54142ef66c3b74d3998214202fa73618dd9b22ebdb06586c8d6896aafcb56d9d
3
+ metadata.gz: 234f676c7efe1f2803eeb4f262b20014e2a4b967442a03af70dc3e04e81b4f6b
4
+ data.tar.gz: 6e9161983ebec82c44467a28e92ff25636718942bec953ebdc7ef6593b515c7e
5
5
  SHA512:
6
- metadata.gz: d69d02391cc1929d26f2cfc2a260d27cb6b1f6840c254ae67f7ad358f621ba16eb2476fd5cee28308f7eaf2e0eb21d5983b49de4f84c6905863292625644641a
7
- data.tar.gz: 54dbeb6d31f187edc30ea4e6030776e988cf50ee7ed44a2177a77473d00c47ae358df25dfd9bd526ea93126b94733feaca5a63048cde8657201c4c1e7cd05edd
6
+ metadata.gz: afd3471fa15b77e3921aa640fbfd7cf937030478d834c06d0ad2d52faa6ada82561929ce7aa4ac2b075a71b1cf97bd5295ec80af4d2903dbf55c983bb4263e1f
7
+ data.tar.gz: 7713e3b3a0aa9775a4a993b651a536552963320787f072ea6f79dbde0bf345a1d680b3cc0a07eec1d5667da69899f770344ba376b52d44d12360ac3ec60402a4
data/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ 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.2.5] - 2026-05-28
9
+
10
+ ### Fixed
11
+ - Bash tool stream output not rendering in real-time
12
+ - Multi-line shell output being incorrectly stripped
13
+
14
+ ### More
15
+ - Remove WSL2 network doctor script for better compatibility
16
+
8
17
  ## [1.2.4] - 2026-05-27
9
18
 
10
19
  ### Added
@@ -111,96 +111,6 @@ chrome-devtools-mcp --version 2>/dev/null
111
111
 
112
112
  If still missing after user confirms, stop with error message.
113
113
 
114
- ### Step 2.5 — WSL networking setup (only when session context shows `OS: WSL/Windows`)
115
-
116
- **Skip this entire step on macOS / Linux.** Look at the session context line that begins with `[Session context: ...]` — only run this step if it includes `OS: WSL/Windows`.
117
-
118
- #### Background (read this so you know what to do)
119
-
120
- The browser tool runs inside WSL but Chrome/Edge runs on Windows. By default WSL2 uses NAT networking, which means `127.0.0.1` inside WSL **cannot** reach Windows' Chrome debug port. The fix is to enable WSL2 **mirrored networking** (`networkingMode=mirrored` in `%USERPROFILE%\.wslconfig`), which makes WSL share Windows' network stack so `127.0.0.1` works directly.
121
-
122
- We have a helper script that handles all the Windows-side details:
123
-
124
- ```
125
- ~/.clacky/scripts/wsl_network_doctor.ps1
126
- ```
127
-
128
- It exposes three subcommands:
129
-
130
- | Subcommand | What it does | Exit code |
131
- |---|---|---|
132
- | `status` | Check whether mirrored is configured (auto-passes on WSL1) | `0` OK / `10` NEED_ENABLE |
133
- | `enable` | Write `networkingMode=mirrored` to `.wslconfig` (does NOT shut down WSL) | `0` success / `1` fail |
134
- | `repair` | Restart Windows Host Network Service (HNS) via UAC prompt | `0` launched / `1` fail |
135
-
136
- Invoke it from WSL like this:
137
-
138
- ```bash
139
- powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$(wslpath -w ~/.clacky/scripts/wsl_network_doctor.ps1)" <subcommand>
140
- ```
141
-
142
- #### Step 2.5.1 — Check status
143
-
144
- ```bash
145
- powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$(wslpath -w ~/.clacky/scripts/wsl_network_doctor.ps1)" status
146
- ```
147
-
148
- - Exit `0` (output starts with `OK:`) → either mirrored is configured (WSL2) or
149
- Ubuntu is running on WSL1 (which shares the Windows network stack and needs no
150
- config). Either way, proceed to Step 3.
151
- - Exit `10` (output starts with `NEED_ENABLE:`) → continue to Step 2.5.2.
152
- - Any other failure → show the output to the user and ask them to retry. Stop here.
153
-
154
- #### Step 2.5.2 — Enable mirrored (only when NEED_ENABLE)
155
-
156
- Tell the user what's about to happen (in their language):
157
-
158
- > WSL doesn't have mirrored networking enabled yet — the browser tool needs it to reach Chrome on Windows.
159
- > I'll add one line to `%USERPROFILE%\.wslconfig`. Your current WSL session will NOT be restarted.
160
-
161
- Run:
162
-
163
- ```bash
164
- powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$(wslpath -w ~/.clacky/scripts/wsl_network_doctor.ps1)" enable
165
- ```
166
-
167
- If the script exits `0`:
168
-
169
- > ✅ `.wslconfig` updated. Tell the user (in their language):
170
- >
171
- > The config takes effect only after WSL restarts, but we can't restart WSL from inside WSL.
172
- > Please:
173
- >
174
- > 1. Open **PowerShell** on Windows
175
- > 2. Run: `wsl --shutdown`
176
- > 3. Reopen the Clacky terminal
177
- > 4. Run `/browser-setup` again
178
- >
179
- > Stop here. Wait for the user to come back in a new session.
180
-
181
- If the script exits non-zero, show the output to the user and stop. Do NOT proceed to Step 3 — without mirrored networking the browser tool will not work.
182
-
183
- #### Step 2.5.3 — When to run repair
184
-
185
- Do NOT run `repair` proactively. Only run it later if **all** of the following are true:
186
-
187
- - `status` returned `OK` (mirrored is configured)
188
- - The user has restarted WSL since the config was written
189
- - Step 3's `browser(action="status")` still fails with a "Chrome/Edge is not running or remote debugging is not enabled" error
190
-
191
- In that situation, tell the user (in their language):
192
-
193
- > The config looks correct but the browser still can't connect. Windows Host Network Service may be stuck — I'll restart it.
194
- > **A Windows User Account Control (UAC) prompt will appear shortly. Please click "Yes".**
195
-
196
- Then run:
197
-
198
- ```bash
199
- powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$(wslpath -w ~/.clacky/scripts/wsl_network_doctor.ps1)" repair
200
- ```
201
-
202
- After it returns, tell the user to run `wsl --shutdown` in PowerShell and reopen Clacky. Stop and wait.
203
-
204
114
  ### Step 3 — Verify Chrome/Edge is running with remote debugging
205
115
 
206
116
  **CRITICAL**: Do NOT attempt `browser()` calls yet. First check if the browser is reachable using the API:
@@ -278,6 +188,12 @@ If still failing:
278
188
  >
279
189
  > Run `/browser-setup doctor` to diagnose the issue in detail.
280
190
 
191
+ Fetch the online troubleshooting guide for additional help:
192
+
193
+ ```
194
+ web_fetch(url="https://www.openclacky.com/docs/browser-troubleshooting")
195
+ ```
196
+
281
197
  Stop here and suggest running doctor.
282
198
 
283
199
  #### Case B: Other errors (MCP handshake timeout, daemon crash, etc.)
@@ -514,3 +430,13 @@ After fixing these issues, run `/browser-setup` again to verify.
514
430
 
515
431
  The browser tool is ready to use.
516
432
  ```
433
+
434
+ ### Online Troubleshooting Guide
435
+
436
+ If any ❌ items are found, or the user reports a problem you cannot resolve with the above scenarios, fetch the latest troubleshooting guide:
437
+
438
+ ```
439
+ web_fetch(url="https://www.openclacky.com/docs/browser-troubleshooting")
440
+ ```
441
+
442
+ Use the content from that page to provide up-to-date diagnosis and resolution steps. This online document is maintained separately and may contain newer solutions not listed here.
@@ -1166,20 +1166,26 @@ module Clacky
1166
1166
  # the literal printf tail `"$__clacky_ec"`. Until we see that, we
1167
1167
  # accumulate; once we do, we strip the whole wrapper out and only
1168
1168
  # emit whatever real output came after it.
1169
+ #
1170
+ # However, when stty -echo is active (the normal case for our
1171
+ # persistent sessions), the wrapper is never echoed — so the tail
1172
+ # marker never appears. We detect this by checking: if we have a
1173
+ # complete line (\n present) and it does NOT contain the wrapper
1174
+ # fingerprint, echo was suppressed and we can start streaming
1175
+ # immediately.
1169
1176
  unless wrapper_swallowed
1170
1177
  tail_marker = '"$__clacky_ec"'
1171
1178
  tail_idx = stream_pending.index(tail_marker)
1172
1179
  if tail_idx
1173
- # Strip from start through end-of-line of the printf tail.
1174
1180
  eol_after = stream_pending.index("\n", tail_idx) || (stream_pending.bytesize - 1)
1175
1181
  stream_pending.replace(stream_pending.byteslice(eol_after + 1, stream_pending.bytesize - eol_after - 1).to_s)
1176
1182
  wrapper_swallowed = true
1177
1183
  elsif force_partial
1178
- # End of stream and we never saw the wrapper tail — give up
1179
- # on swallowing and emit what we have, run normal stripping.
1184
+ wrapper_swallowed = true
1185
+ elsif stream_pending.include?("\n") && !stream_pending.include?("__clacky_ec")
1186
+ # stty -echo suppressed the wrapper echo; real output is arriving.
1180
1187
  wrapper_swallowed = true
1181
1188
  else
1182
- # Still hunting; keep buffering. Emit nothing yet.
1183
1189
  return
1184
1190
  end
1185
1191
  end
@@ -1206,7 +1212,12 @@ module Clacky
1206
1212
  ln.include?("__clacky_pc") ||
1207
1213
  ln.match?(/\A\s*\}\s*>\s*\/dev\/null\s+2>&1;?\s*\z/)
1208
1214
  end.join
1209
- on_output.call(cleaned) unless cleaned.empty?
1215
+ # Collapse runs of 3+ blank lines into a single blank line so
1216
+ # PTY noise (cursor-positioning codes cleaned to empty lines)
1217
+ # doesn't produce a wall of whitespace in the streaming UI.
1218
+ cleaned = cleaned.gsub(/\n{3,}/, "\n\n")
1219
+ cleaned = cleaned.lstrip if cleaned.match?(/\A\n+\z/)
1220
+ on_output.call(cleaned) unless cleaned.empty? || cleaned.match?(/\A\s*\z/)
1210
1221
  rescue StandardError
1211
1222
  # Streaming is best-effort — never let a UI bug abort the command.
1212
1223
  end
@@ -21,7 +21,6 @@ module Clacky
21
21
  install_browser.sh
22
22
  install_system_deps.sh
23
23
  install_rails_deps.sh
24
- wsl_network_doctor.ps1
25
24
  ].freeze
26
25
 
27
26
  # Copy bundled scripts to ~/.clacky/scripts/ if missing or outdated.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Clacky
4
- VERSION = "1.2.4"
4
+ VERSION = "1.2.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openclacky
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - windy
@@ -596,7 +596,6 @@ files:
596
596
  - scripts/install_rails_deps.sh
597
597
  - scripts/install_system_deps.sh
598
598
  - scripts/uninstall.sh
599
- - scripts/wsl_network_doctor.ps1
600
599
  - sig/clacky.rbs
601
600
  homepage: https://github.com/clacky-ai/openclacky
602
601
  licenses:
@@ -1,196 +0,0 @@
1
- # wsl_network_doctor.ps1 — diagnose & repair WSL2 mirrored networking for the browser tool.
2
- #
3
- # Designed to be invoked from inside WSL via:
4
- # powershell.exe -NoProfile -ExecutionPolicy Bypass -File <win-path-to-this-script> <subcommand>
5
- #
6
- # Subcommands:
7
- # status Check whether mirrored networking is configured.
8
- # enable Write networkingMode=mirrored to %USERPROFILE%\.wslconfig.
9
- # repair Restart Windows Host Network Service (HNS) via UAC elevation.
10
- #
11
- # Exit codes (status only):
12
- # 0 OK — mirrored configured, OR running on WSL1 (no config needed)
13
- # 10 NEED_ENABLE — mirrored not configured, run `enable`
14
- # 20 NEED_REPAIR — configured but suspected broken, run `repair`
15
- # 1 unexpected error
16
- #
17
- # `enable` and `repair` exit 0 on success, 1 on failure.
18
-
19
- param(
20
- [Parameter(Position = 0)]
21
- [ValidateSet('status', 'enable', 'repair')]
22
- [string]$Command
23
- )
24
-
25
- $ErrorActionPreference = 'Stop'
26
-
27
- # ---------------------------------------------------------------------------
28
- # Helpers
29
- # ---------------------------------------------------------------------------
30
-
31
- function Get-WslConfigPath {
32
- return (Join-Path $env:USERPROFILE '.wslconfig')
33
- }
34
-
35
- function Test-MirroredConfigured {
36
- $cfg = Get-WslConfigPath
37
- if (-not (Test-Path $cfg)) { return $false }
38
- $content = Get-Content $cfg -Raw -ErrorAction SilentlyContinue
39
- if ($null -eq $content) { return $false }
40
- return ($content -match '(?im)^\s*networkingMode\s*=\s*mirrored\s*$')
41
- }
42
-
43
- # Returns 1 or 2 if Ubuntu is registered, $null otherwise.
44
- # Parses `wsl.exe -l -v` output (UTF-16, may contain a star marker on default distro).
45
- function Get-UbuntuWslVersion {
46
- try {
47
- $raw = & wsl.exe -l -v 2>$null
48
- } catch {
49
- return $null
50
- }
51
- if (-not $raw) { return $null }
52
-
53
- foreach ($line in $raw) {
54
- $clean = ($line -replace '\s+', ' ').Trim().TrimStart('*').Trim()
55
- if ($clean -match '^Ubuntu(?:-[\w\.]+)?\s+\S+\s+(\d+)\s*$') {
56
- return [int]$matches[1]
57
- }
58
- }
59
- return $null
60
- }
61
-
62
- # ---------------------------------------------------------------------------
63
- # Subcommand: status
64
- # ---------------------------------------------------------------------------
65
-
66
- function Invoke-Status {
67
- $wslVer = Get-UbuntuWslVersion
68
- if ($wslVer -eq 1) {
69
- Write-Host "OK: Ubuntu is running on WSL1 — shares the Windows network stack directly."
70
- Write-Host "No mirrored configuration needed. The browser tool can connect to 127.0.0.1 as-is."
71
- exit 0
72
- }
73
-
74
- if (Test-MirroredConfigured) {
75
- Write-Host "OK: mirrored networking is configured in .wslconfig."
76
- Write-Host "If the browser tool still cannot connect, run: wsl_network_doctor.ps1 repair"
77
- exit 0
78
- }
79
-
80
- Write-Host "NEED_ENABLE: mirrored networking is not configured."
81
- Write-Host "Run: wsl_network_doctor.ps1 enable"
82
- exit 10
83
- }
84
-
85
- # ---------------------------------------------------------------------------
86
- # Subcommand: enable
87
- # ---------------------------------------------------------------------------
88
-
89
- function Invoke-Enable {
90
- if (Test-MirroredConfigured) {
91
- Write-Host "OK: already enabled. No changes needed."
92
- Write-Host "If the browser tool still cannot connect, run: wsl_network_doctor.ps1 repair"
93
- exit 0
94
- }
95
-
96
- $cfg = Get-WslConfigPath
97
- Write-Host "Writing networkingMode=mirrored to $cfg ..."
98
-
99
- if (-not (Test-Path $cfg)) {
100
- New-Item -ItemType File -Path $cfg -Force | Out-Null
101
- }
102
-
103
- $content = Get-Content $cfg -Raw -ErrorAction SilentlyContinue
104
- if ($null -eq $content) { $content = '' }
105
-
106
- if ($content -match '(?im)^\s*networkingMode\s*=') {
107
- $new = [regex]::Replace($content, '(?im)^\s*networkingMode\s*=.*$', 'networkingMode=mirrored')
108
- Set-Content -Path $cfg -Value $new -NoNewline
109
- } else {
110
- if ($content -notmatch '(?im)^\[wsl2\]') {
111
- if ($content.Length -gt 0 -and -not $content.EndsWith([char]10)) {
112
- Add-Content -Path $cfg -Value ''
113
- }
114
- Add-Content -Path $cfg -Value '[wsl2]'
115
- }
116
- Add-Content -Path $cfg -Value 'networkingMode=mirrored'
117
- }
118
-
119
- Write-Host "WROTE: .wslconfig updated."
120
- Write-Host ""
121
- Write-Host "Next step (cannot be done from inside WSL):"
122
- Write-Host " 1. Open Windows PowerShell"
123
- Write-Host " 2. Run: wsl --shutdown"
124
- Write-Host " 3. Reopen Clacky and run /browser-setup again"
125
- exit 0
126
- }
127
-
128
- # ---------------------------------------------------------------------------
129
- # Subcommand: repair
130
- # ---------------------------------------------------------------------------
131
- # Restart Windows Host Network Service (HNS). Requires admin → triggers UAC.
132
- # Does NOT call `wsl --shutdown` here — the user must run it manually after
133
- # the elevated window finishes, otherwise our own WSL session would be killed.
134
-
135
- function Invoke-Repair {
136
- Write-Host "Repairing Windows Host Network Service (HNS) ..."
137
- Write-Host ""
138
- Write-Host "A Windows User Account Control (UAC) dialog will appear."
139
- Write-Host "Please click 'Yes' to allow the repair script to run."
140
- Write-Host ""
141
-
142
- $inner = @'
143
- try {
144
- Stop-Service hns -Force -ErrorAction SilentlyContinue
145
- Start-Service hns -ErrorAction Stop
146
- Write-Host "HNS restarted successfully."
147
- } catch {
148
- Write-Host "Repair failed: $_"
149
- Start-Sleep 5
150
- exit 1
151
- }
152
- Write-Host ""
153
- Write-Host "Repair complete. Please run 'wsl --shutdown' in PowerShell, then reopen Clacky."
154
- Start-Sleep 4
155
- '@
156
-
157
- $encoded = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($inner))
158
-
159
- try {
160
- Start-Process powershell -Verb RunAs -ArgumentList '-NoProfile', '-EncodedCommand', $encoded
161
- } catch {
162
- Write-Host "FAILED: could not trigger UAC prompt: $_"
163
- Write-Host ""
164
- Write-Host "You can run the repair manually:"
165
- Write-Host " 1. Open PowerShell as Administrator"
166
- Write-Host " 2. Run: net stop hns; net start hns"
167
- Write-Host " 3. Run: wsl --shutdown"
168
- Write-Host " 4. Reopen Clacky"
169
- exit 1
170
- }
171
-
172
- Write-Host "Repair script launched in an elevated PowerShell window."
173
- Write-Host ""
174
- Write-Host "After the elevated window finishes:"
175
- Write-Host " 1. Run in regular PowerShell: wsl --shutdown"
176
- Write-Host " 2. Reopen Clacky and run /browser-setup again"
177
- exit 0
178
- }
179
-
180
- # ---------------------------------------------------------------------------
181
- # Dispatch
182
- # ---------------------------------------------------------------------------
183
-
184
- switch ($Command) {
185
- 'status' { Invoke-Status }
186
- 'enable' { Invoke-Enable }
187
- 'repair' { Invoke-Repair }
188
- default {
189
- Write-Host "Usage: wsl_network_doctor.ps1 {status|enable|repair}"
190
- Write-Host ""
191
- Write-Host " status Check whether WSL2 mirrored networking is configured."
192
- Write-Host " enable Write networkingMode=mirrored to %USERPROFILE%\.wslconfig."
193
- Write-Host " repair Restart Windows Host Network Service (HNS) via UAC."
194
- exit 2
195
- }
196
- }