caproom 0.7.4 → 0.7.6
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 +9 -2
- package/package.json +2 -2
package/bin/caproom
CHANGED
|
@@ -847,6 +847,7 @@ run_watchdog() {
|
|
|
847
847
|
# the cap on the pty tree (same kill logic as normal).
|
|
848
848
|
if [[ "$USE_PTY" -eq 1 ]]; then
|
|
849
849
|
echo "caproom: pty mode — allocating pty via forkpty for '${1##*/}' (limit ${LIMIT_MB}m, verbatim forwarding)" >&2
|
|
850
|
+
stty -tostop 2>/dev/null || true
|
|
850
851
|
printf '\033[?1049l\033[?1000l\033[?1002l\033[?1003l\033[?1006l\033[?2004l\033[?25h' >/dev/tty 2>/dev/null || true
|
|
851
852
|
local saved_stty=""
|
|
852
853
|
if [[ -t 0 ]]; then
|
|
@@ -915,6 +916,7 @@ run_watchdog() {
|
|
|
915
916
|
fi
|
|
916
917
|
# Clean stale tty modes before handing off, same snapshot hygiene as
|
|
917
918
|
# the normal watchdog path but without taking foreground away.
|
|
919
|
+
stty -tostop 2>/dev/null || true
|
|
918
920
|
printf '\033[?1049l\033[?1000l\033[?1002l\033[?1003l\033[?1006l\033[?2004l\033[?25h' >/dev/tty 2>/dev/null || true
|
|
919
921
|
# Detached watchdog monitors the TUI's pid tree without owning stdio.
|
|
920
922
|
# Resolve our own path (works via shim and direct invocation).
|
|
@@ -923,6 +925,7 @@ run_watchdog() {
|
|
|
923
925
|
if [[ ! -f "$_cap_bin" ]]; then
|
|
924
926
|
_cap_bin="$(command -v caproom 2>/dev/null || echo "$_cap_bin")"
|
|
925
927
|
fi
|
|
928
|
+
set +m 2>/dev/null || true
|
|
926
929
|
"$@" &
|
|
927
930
|
local _tui_pid=$!
|
|
928
931
|
# Fire-and-forget watch; it exits when _tui_pid exits. Suppressed so it
|
|
@@ -930,6 +933,7 @@ run_watchdog() {
|
|
|
930
933
|
bash "$_cap_bin" watch --threshold-mb "$LIMIT_MB" --interval "$INTERVAL" --auto-park --json "$_tui_pid" >/dev/null 2>&1 &
|
|
931
934
|
local _watch_pid=$!
|
|
932
935
|
wait "$_tui_pid"
|
|
936
|
+
set -m 2>/dev/null || true
|
|
933
937
|
local _rc=$?
|
|
934
938
|
# Best-effort cleanup of the detached watcher (it should already exit
|
|
935
939
|
# via all-exited, but kill is cheap if TUI exited fast).
|
|
@@ -942,8 +946,9 @@ run_watchdog() {
|
|
|
942
946
|
# Terminal hygiene: a TUI child (opencode, claude, ...) puts the tty in
|
|
943
947
|
# raw + mouse-tracking mode. If WE kill it, it never restores, and the
|
|
944
948
|
# user's shell then prints mouse reports like [[<35;25;15M as garbage.
|
|
945
|
-
# Clear
|
|
946
|
-
#
|
|
949
|
+
# Clear stale state before snapshot — disable tostop to avoid SIGTTOU suspend
|
|
950
|
+
# when caproom backgrounds the TUI (ghostty reports [[<... as suspended tty output).
|
|
951
|
+
stty -tostop 2>/dev/null || true
|
|
947
952
|
printf '\033[?1049l\033[?1000l\033[?1002l\033[?1003l\033[?1006l\033[?2004l\033[?25h' >/dev/tty 2>/dev/null || true
|
|
948
953
|
local saved_stty=""
|
|
949
954
|
if [[ -t 0 ]]; then
|
|
@@ -956,6 +961,7 @@ run_watchdog() {
|
|
|
956
961
|
|| { [[ -t 0 ]] && stty sane </dev/tty 2>/dev/null || true; }
|
|
957
962
|
printf '\033[?1049l\033[?1000l\033[?1002l\033[?1003l\033[?1006l\033[?2004l\033[?25h' >/dev/tty 2>/dev/null || true
|
|
958
963
|
}
|
|
964
|
+
set +m 2>/dev/null || true
|
|
959
965
|
"$@" &
|
|
960
966
|
local pid=$!
|
|
961
967
|
local exit_code=0
|
|
@@ -1000,6 +1006,7 @@ run_watchdog() {
|
|
|
1000
1006
|
sleep "$INTERVAL"
|
|
1001
1007
|
done
|
|
1002
1008
|
wait "$pid" || exit_code=$?
|
|
1009
|
+
set -m 2>/dev/null || true
|
|
1003
1010
|
exit "$exit_code"
|
|
1004
1011
|
}
|
|
1005
1012
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "caproom",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "Memory-cap any command (AI coding agents, builds, background jobs) on macOS, Linux, and Windows
|
|
3
|
+
"version": "0.7.6",
|
|
4
|
+
"description": "Memory-cap any command (AI coding agents, builds, background jobs) on macOS, Linux, and Windows \u2014 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",
|
|
7
7
|
"caproom-mcp": "bin/caproom-mcp.js"
|