caproom 0.7.0 → 0.7.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.
package/bin/caproom.ps1 CHANGED
@@ -411,7 +411,7 @@ if ($args.Count -eq 0) { Show-Usage }
411
411
 
412
412
  $script:CaproomNtLoaded = $false
413
413
  function Ensure-NtSuspend {
414
- # Whole-tree park needs NtSuspendProcess/NtResumeProcess (ntdll)
414
+ # Whole-tree park needs NtSuspendProcess/NtResumeProcess (ntdll) --
415
415
  # the Windows analogue of kill -STOP/-CONT. Loaded lazily, once.
416
416
  if ($script:CaproomNtLoaded) { return }
417
417
  try {
@@ -423,7 +423,7 @@ function Ensure-NtSuspend {
423
423
  '@
424
424
  $script:CaproomNtLoaded = $true
425
425
  } catch {
426
- [Console]::Error.WriteLine('caproom watch: cannot load ntdll suspend/resume --auto-park unavailable')
426
+ [Console]::Error.WriteLine('caproom watch: cannot load ntdll suspend/resume -- --auto-park unavailable')
427
427
  throw
428
428
  }
429
429
  }
@@ -469,7 +469,7 @@ function Get-TreeStats {
469
469
  function Invoke-Top {
470
470
  # schema:1 rows identical in shape to the POSIX build. One honest
471
471
  # divergence: Windows exposes no cheap sleep-state, so state is always
472
- # 'running' and park_candidate keys off tree size alone the reason
472
+ # 'running' and park_candidate keys off tree size alone -- the reason
473
473
  # string says so instead of pretending a sleep check happened.
474
474
  param([int]$FilterPid = 0, [int]$ParkMinMb = 512)
475
475
  $snap = Get-CaproomSnapshot
@@ -562,7 +562,7 @@ function Invoke-Watch {
562
562
  if ($h -ne [IntPtr]::Zero) {
563
563
  [void][Caproom.Nt]::NtResumeProcess($h); [void][Caproom.Nt]::CloseHandle($h)
564
564
  if ($json) { Emit ([pscustomobject]@{ schema = 1; event = 'woke'; ts = [DateTimeOffset]::UtcNow.ToUnixTimeSeconds(); pid = $wpid; free_pct = $pct }) }
565
- else { [Console]::Error.WriteLine("caproom: watch: free mem ${pct}% >= ${wake}% resuming pid $wpid") }
565
+ else { [Console]::Error.WriteLine("caproom: watch: free mem ${pct}% >= ${wake}% -- resuming pid $wpid") }
566
566
  }
567
567
  }
568
568
  $parkedByUs.Clear()
@@ -589,10 +589,10 @@ function Invoke-Watch {
589
589
  }
590
590
  }
591
591
  if ($json) { Emit ([pscustomobject]@{ schema = 1; event = 'parked'; ts = $now; pid = $tpid; tree_rss_kb = $st.RssKb; tree_pids = @($st.Pids.ToArray()); stopped = $stopped }) }
592
- else { [Console]::Error.WriteLine("caproom: watch: tree of pid $tpid hit $($st.RssKb)KB (>= $([int]$threshKb)KB) PARKED tree ($stopped pids)") }
592
+ else { [Console]::Error.WriteLine("caproom: watch: tree of pid $tpid hit $($st.RssKb)KB (>= $([int]$threshKb)KB) -- PARKED tree ($stopped pids)") }
593
593
  } else {
594
594
  if ($json) { Emit ([pscustomobject]@{ schema = 1; event = 'breach'; ts = $now; pid = $tpid; tree_rss_kb = $st.RssKb }) }
595
- else { [Console]::Error.WriteLine("caproom: watch: tree of pid $tpid hit $($st.RssKb)KB (>= $([int]$threshKb)KB) no --auto-park, reporting only") }
595
+ else { [Console]::Error.WriteLine("caproom: watch: tree of pid $tpid hit $($st.RssKb)KB (>= $([int]$threshKb)KB) -- no --auto-park, reporting only") }
596
596
  }
597
597
  } else {
598
598
  if ($breaching.ContainsKey($tpid)) {
@@ -616,7 +616,7 @@ function Invoke-Setup {
616
616
  New-Item -ItemType Directory -Force -Path $dir | Out-Null
617
617
 
618
618
  @'
619
- # caproom PowerShell integration regenerated by `caproom setup`.
619
+ # caproom PowerShell integration -- regenerated by `caproom setup`.
620
620
  function global:caproom_freemem_pct {
621
621
  $os = Get-CimInstance Win32_OperatingSystem
622
622
  [int]($os.FreePhysicalMemory * 100 / $os.TotalVisibleMemorySize)
@@ -651,7 +651,7 @@ function global:prompt {
651
651
  } else {
652
652
  [Console]::Error.WriteLine('caproom setup: profile already bound')
653
653
  }
654
- [Console]::Error.WriteLine('caproom setup: shell.ps1 written to ' + $dir + ' new terminals pick it up automatically')
654
+ [Console]::Error.WriteLine('caproom setup: shell.ps1 written to ' + $dir + ' -- new terminals pick it up automatically')
655
655
  }
656
656
 
657
657
  switch ($args[0]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "caproom",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Memory-cap any command (AI coding agents, builds, background jobs) on macOS, Linux, and Windows — real enforcement via Docker cgroups, Windows Job Objects, or a polling watchdog, plus park/wake to reclaim idle process memory without killing.",
5
5
  "bin": {
6
6
  "caproom": "bin/caproom.js",
@@ -10,7 +10,8 @@
10
10
  "bin/caproom",
11
11
  "bin/caproom.js",
12
12
  "bin/caproom.ps1",
13
- "bin/caproom-mcp.js"
13
+ "bin/caproom-mcp.js",
14
+ "scripts/postinstall.js"
14
15
  ],
15
16
  "keywords": [
16
17
  "memory",
@@ -29,7 +30,7 @@
29
30
  "win32"
30
31
  ],
31
32
  "scripts": {
32
- "postinstall": "node -e \"process.stdout.write('caproom: optional next step — run `caproom setup` to bind headroom management to your shells (never modifies rc files on install)\\n')\""
33
+ "postinstall": "node scripts/postinstall.js"
33
34
  },
34
35
  "license": "MIT",
35
36
  "repository": {
@@ -0,0 +1,7 @@
1
+ // Hint only — never touches rc files on install. Binding is explicit:
2
+ // caproom setup
3
+ try {
4
+ process.stdout.write(
5
+ 'caproom: optional next step — run "caproom setup" to bind headroom warnings to your shells (never modifies rc files on install)\n'
6
+ );
7
+ } catch (_) { /* never block installs */ }