fullcourtdefense-cli 1.20.0 → 1.20.1

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.
@@ -223,26 +223,35 @@ function desktopChatWatcherScript(mode = 'warn') {
223
223
  '} catch { }',
224
224
  ];
225
225
  if (mode === 'block') {
226
+ // The keyboard-hook helper is compiled at runtime by Add-Type using the C#
227
+ // compiler built into the .NET Framework (a core Windows component — no SDK
228
+ // or dev tools needed). If that ever fails on a locked-down machine, the
229
+ // catch leaves $global:FcdBlockReady false and the guard silently degrades
230
+ // to advisory warn mode: it still reads text, detects, toasts, and reports.
231
+ lines.push('$global:FcdBlockReady = $false');
232
+ lines.push(`$global:FcdArmPath = '${armPathLiteral}'`);
226
233
  lines.push('try {');
227
234
  lines.push(" Add-Type -TypeDefinition @'");
228
235
  for (const l of keyboardHookCSharp().split('\n'))
229
236
  lines.push(l);
230
237
  lines.push("'@");
231
238
  lines.push(' [FcdKbGuard]::Start()');
232
- lines.push('} catch { }');
233
- lines.push(`$global:FcdArmPath = '${armPathLiteral}'`);
239
+ lines.push(' $global:FcdBlockReady = $true');
240
+ lines.push('} catch { $global:FcdBlockReady = $false }');
234
241
  }
235
242
  lines.push('', 'function Get-FcdFocusedText {', ' param([int]$OwnerPid)', ' try {', ' $focused = [System.Windows.Automation.AutomationElement]::FocusedElement', ' if ($null -eq $focused) { return $null }', ' if ($focused.Current.ProcessId -ne $OwnerPid) { return $null }', ' $text = $null', ' $vp = $null', ' if ($focused.TryGetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern, [ref]$vp)) {', ' $text = $vp.Current.Value', ' }', ' if ([string]::IsNullOrEmpty($text)) {', ' $tp = $null', ' if ($focused.TryGetCurrentPattern([System.Windows.Automation.TextPattern]::Pattern, [ref]$tp)) {', ' $text = $tp.DocumentRange.GetText(20000)', ' }', ' }', ' if ([string]::IsNullOrEmpty($text)) { $text = $focused.Current.Name }', ' return $text', ' } catch { return $null }', '}', '', '$last = ""', 'while ($true) {', ' Start-Sleep -Milliseconds ' + POLL_MS);
236
243
  if (mode === 'block') {
237
244
  // Arm/expire the Enter block from the file Node maintains. The C# side
238
245
  // auto-expires too, so a missed cycle just releases the block early.
239
- lines.push(' try {');
240
- lines.push(' if (Test-Path $global:FcdArmPath) {');
241
- lines.push(' $armUntil = [long](Get-Content -Raw -Path $global:FcdArmPath)');
242
- lines.push(' $nowMs = [long]([DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds())');
243
- lines.push(' if ($armUntil -gt $nowMs) { [FcdKbGuard]::ArmFor($armUntil - $nowMs) } else { [FcdKbGuard]::Clear() }');
244
- lines.push(' } else { [FcdKbGuard]::Clear() }');
245
- lines.push(' } catch { }');
246
+ lines.push(' if ($global:FcdBlockReady) {');
247
+ lines.push(' try {');
248
+ lines.push(' if (Test-Path $global:FcdArmPath) {');
249
+ lines.push(' $armUntil = [long](Get-Content -Raw -Path $global:FcdArmPath)');
250
+ lines.push(' $nowMs = [long]([DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds())');
251
+ lines.push(' if ($armUntil -gt $nowMs) { [FcdKbGuard]::ArmFor($armUntil - $nowMs) } else { [FcdKbGuard]::Clear() }');
252
+ lines.push(' } else { [FcdKbGuard]::Clear() }');
253
+ lines.push(' } catch { }');
254
+ lines.push(' }');
246
255
  }
247
256
  lines.push(' try {', ' $h = [FcdWin]::GetForegroundWindow()', ' if ($h -eq [IntPtr]::Zero) { continue }', ' $procId = 0', ' [void][FcdWin]::GetWindowThreadProcessId($h, [ref]$procId)', ' if ($procId -eq 0) { continue }', ' $proc = Get-Process -Id $procId -ErrorAction SilentlyContinue', " if ($null -eq $proc -or $proc.ProcessName -ne 'Claude') { continue }", ' $text = Get-FcdFocusedText -OwnerPid $procId', ' if ([string]::IsNullOrEmpty($text)) { continue }', ' if ($text.Length -gt 8000) { continue }', ' if ($text -eq $last) { continue }', ' $last = $text', ' $bytes = [System.Text.Encoding]::UTF8.GetBytes($text)', ' $b64 = [Convert]::ToBase64String($bytes)', " [Console]::Out.WriteLine('" + STDOUT_PREFIX + "' + $b64)", ' [Console]::Out.Flush()', ' } catch { }', '}', '');
248
257
  return lines.join('\n');
package/dist/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "1.20.0"
2
+ "version": "1.20.1"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fullcourtdefense-cli",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "description": "Full Court Defense CLI — security scanning for AI agents from your terminal",
5
5
  "main": "dist/index.js",
6
6
  "bin": {