machinaos 0.0.84 → 0.0.85
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/cli/ports.py +36 -4
- package/client/package.json +1 -1
- package/package.json +1 -1
- package/server/uv.lock +35 -35
package/cli/ports.py
CHANGED
|
@@ -30,6 +30,38 @@ class KillResult:
|
|
|
30
30
|
port_free: bool
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
def _ancestor_pids() -> set[int]:
|
|
34
|
+
"""Return PIDs of the current process + every ancestor up the tree.
|
|
35
|
+
|
|
36
|
+
Used by the pattern-matching kill functions below so we never
|
|
37
|
+
terminate our own parent / grandparent. When invoked through the
|
|
38
|
+
npm bin shim the chain is ``powershell -> node.exe (bin/cli.js)
|
|
39
|
+
-> python.exe (-m cli ...)`` -- if ``kill_orphaned_machina_processes``
|
|
40
|
+
matches ``node.exe`` (its cmdline carries the npm install path),
|
|
41
|
+
killing it tears down stdio mid-execution and the Python child
|
|
42
|
+
exits with whatever garbage code Windows assigns to an
|
|
43
|
+
abruptly-orphaned process (observed: 58). Walk up the tree once
|
|
44
|
+
and exclude every ancestor PID.
|
|
45
|
+
|
|
46
|
+
Bounded loop (20 hops) defends against process-tree cycles
|
|
47
|
+
(theoretically impossible but cheap insurance).
|
|
48
|
+
"""
|
|
49
|
+
pids: set[int] = set()
|
|
50
|
+
try:
|
|
51
|
+
cur: psutil.Process | None = psutil.Process(os.getpid())
|
|
52
|
+
for _ in range(20):
|
|
53
|
+
if cur is None:
|
|
54
|
+
break
|
|
55
|
+
pids.add(cur.pid)
|
|
56
|
+
try:
|
|
57
|
+
cur = cur.parent()
|
|
58
|
+
except (psutil.NoSuchProcess, psutil.AccessDenied):
|
|
59
|
+
break
|
|
60
|
+
except (psutil.NoSuchProcess, psutil.AccessDenied):
|
|
61
|
+
pids.add(os.getpid())
|
|
62
|
+
return pids
|
|
63
|
+
|
|
64
|
+
|
|
33
65
|
def find_pids_by_port(port: int) -> set[int]:
|
|
34
66
|
"""Find PIDs listening on ``port`` via psutil's native APIs."""
|
|
35
67
|
pids: set[int] = set()
|
|
@@ -137,7 +169,7 @@ def kill_by_pattern(pattern: str, *, root_dir: str | None = None) -> list[int]:
|
|
|
137
169
|
"""
|
|
138
170
|
pattern_lower = pattern.lower()
|
|
139
171
|
root_norm = root_dir.lower().replace("\\", "/") if root_dir else None
|
|
140
|
-
|
|
172
|
+
safe_pids = _ancestor_pids()
|
|
141
173
|
killed: list[int] = []
|
|
142
174
|
|
|
143
175
|
for proc in psutil.process_iter(["pid", "name", "cmdline"]):
|
|
@@ -148,7 +180,7 @@ def kill_by_pattern(pattern: str, *, root_dir: str | None = None) -> list[int]:
|
|
|
148
180
|
continue
|
|
149
181
|
if root_norm and root_norm not in cmd:
|
|
150
182
|
continue
|
|
151
|
-
if proc.pid
|
|
183
|
+
if proc.pid in safe_pids:
|
|
152
184
|
continue
|
|
153
185
|
proc.kill()
|
|
154
186
|
killed.append(proc.pid)
|
|
@@ -163,7 +195,7 @@ def kill_orphaned_machina_processes(
|
|
|
163
195
|
"""Kill stray python/node processes whose cmdline references the project root."""
|
|
164
196
|
root_norm = root_dir.lower().replace("\\", "/")
|
|
165
197
|
target_names = {"python", "python3", "python.exe", "node", "node.exe"}
|
|
166
|
-
|
|
198
|
+
safe_pids = _ancestor_pids()
|
|
167
199
|
killed: list[int] = []
|
|
168
200
|
|
|
169
201
|
for proc in psutil.process_iter(["pid", "name", "cmdline"]):
|
|
@@ -176,7 +208,7 @@ def kill_orphaned_machina_processes(
|
|
|
176
208
|
continue
|
|
177
209
|
if exclude_substring and exclude_substring.lower() in cmd:
|
|
178
210
|
continue
|
|
179
|
-
if proc.pid
|
|
211
|
+
if proc.pid in safe_pids:
|
|
180
212
|
continue
|
|
181
213
|
if kill_pid(proc.pid, graceful_timeout=2.0):
|
|
182
214
|
killed.append(proc.pid)
|
package/client/package.json
CHANGED
package/package.json
CHANGED
package/server/uv.lock
CHANGED
|
@@ -460,41 +460,41 @@ wheels = [
|
|
|
460
460
|
|
|
461
461
|
[[package]]
|
|
462
462
|
name = "coverage"
|
|
463
|
-
version = "7.14.
|
|
464
|
-
source = { registry = "https://pypi.org/simple" }
|
|
465
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
466
|
-
wheels = [
|
|
467
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
468
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
469
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
470
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
471
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
472
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
473
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
474
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
475
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
476
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
477
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
478
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
479
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
480
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
481
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
482
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
483
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
484
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
485
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
486
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
487
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
488
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
489
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
490
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
491
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
492
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
493
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
494
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
495
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
496
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
497
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
463
|
+
version = "7.14.1"
|
|
464
|
+
source = { registry = "https://pypi.org/simple" }
|
|
465
|
+
sdist = { url = "https://files.pythonhosted.org/packages/54/fd/0ab2772530e946e1be1abd0bc09e647ec9b02e88f0867857601fefca8953/coverage-7.14.1.tar.gz", hash = "sha256:30c08f7d90415aa98b3c990385dea2939b0da55f38515e5b369b83655f8523be", size = 920132, upload-time = "2026-05-26T20:41:36.783Z" }
|
|
466
|
+
wheels = [
|
|
467
|
+
{ url = "https://files.pythonhosted.org/packages/7d/d7/477ad149490e6cb849f28abea1dabb9c823cea72e7500c81b4240ce619c0/coverage-7.14.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:478b5bcd63c2e1357c5c7e16c070690df7b07f676b1c114d7b93e533c664309f", size = 219848, upload-time = "2026-05-26T20:38:38.715Z" },
|
|
468
|
+
{ url = "https://files.pythonhosted.org/packages/91/82/a5eb47257c50601bb7b9a9d2857c67b7a3a85ad74180eb2c98bb1fbe0ce5/coverage-7.14.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a24a81f9715ee42ef59a316cc11611c98fe23920f7c81861315c9f3ff4a230f4", size = 220354, upload-time = "2026-05-26T20:38:40.232Z" },
|
|
469
|
+
{ url = "https://files.pythonhosted.org/packages/43/8b/78419b5391a5cb706b6544390507e469d83ffc9a8248b02c4011aceb9365/coverage-7.14.1-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:196a13319ad88d6d8ef5ab489ec4f44ddde2143c0c7d5b27786f6c3ffd56a7e1", size = 250771, upload-time = "2026-05-26T20:38:41.782Z" },
|
|
470
|
+
{ url = "https://files.pythonhosted.org/packages/77/63/e77aaacd491182210d639636b7a8bba23ffffa9b82aa3762da9431855fa9/coverage-7.14.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:3d452fd08b5c72c5167c93e6867b5c08500bd40f2a21e1e854a500550b6cc36f", size = 252683, upload-time = "2026-05-26T20:38:43.305Z" },
|
|
471
|
+
{ url = "https://files.pythonhosted.org/packages/65/1c/a022e3cfbec2ac241640003cb3a817e161d9c7f5aa9b49173756cdc03204/coverage-7.14.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:23bf7fa51ac02e07fc7c96849b82946da47ae862dc8f86d183b2a4864fc38129", size = 254791, upload-time = "2026-05-26T20:38:45.361Z" },
|
|
472
|
+
{ url = "https://files.pythonhosted.org/packages/61/d6/967e408aca4c1ceb88cb0cc677169110ae7f5995fb5eaf5fb1f5a1bb8f5d/coverage-7.14.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:bcaa50684dcaadfa599ac48f81103c756d791cfd85c97203d2217c593d48b860", size = 256748, upload-time = "2026-05-26T20:38:46.91Z" },
|
|
473
|
+
{ url = "https://files.pythonhosted.org/packages/b8/be/869188f7fe28638078ec479331ace6dc5f7b40b7153eb616f47ab79404d8/coverage-7.14.1-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:4ea1c034f95c9b056e856b794630b17f9fa3d57e4800ff1e503d3be0f9c9078c", size = 250907, upload-time = "2026-05-26T20:38:48.493Z" },
|
|
474
|
+
{ url = "https://files.pythonhosted.org/packages/07/aa/adb7d3b4278d690e68703abcd76ab1b948242e3668d921711551b78f9ddb/coverage-7.14.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c7e057326434e441306226fbeb5d1aaf14a2637efe97ba668306635835f32ad7", size = 252483, upload-time = "2026-05-26T20:38:50.074Z" },
|
|
475
|
+
{ url = "https://files.pythonhosted.org/packages/43/61/331c74103c62dcb0c4b9b3a0de9a61aca016208b0a90f109592a9f9ecc28/coverage-7.14.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:59baf88468dbc8d63b1887afd92bda52e40bb1561696e5819670601403810cec", size = 250545, upload-time = "2026-05-26T20:38:51.613Z" },
|
|
476
|
+
{ url = "https://files.pythonhosted.org/packages/f6/b6/c5dae3c104d89be04828f61810e6b3473825482e4c288cc4ed04553e08ae/coverage-7.14.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:d34d75f892b3ab73ba11cab5442cce7b3e168fd64162b16f0e1e0d09c508edef", size = 254310, upload-time = "2026-05-26T20:38:53.503Z" },
|
|
477
|
+
{ url = "https://files.pythonhosted.org/packages/ad/a1/2b9d5863e3b83c01ad8199e3c597802fbb3a9dc90b058885804c20296d31/coverage-7.14.1-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:3a56abc20a472baf0304c455721bc601477440d28ecfde8a03dde79ede07e0df", size = 250266, upload-time = "2026-05-26T20:38:55.414Z" },
|
|
478
|
+
{ url = "https://files.pythonhosted.org/packages/7f/5e/0e511fbdb269359be26fe678a1c3fa1f2aa2a01573cc3f54268c8d6d4797/coverage-7.14.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:6a3cb83d1552c0cd1b4906655b6a33fd4a8473229633a901c6b73bf86914dee9", size = 251174, upload-time = "2026-05-26T20:38:57.141Z" },
|
|
479
|
+
{ url = "https://files.pythonhosted.org/packages/85/10/e55307b622b3dd9671cb321824502dc10f93e72f2802b9946159a8edadeb/coverage-7.14.1-cp311-cp311-win32.whl", hash = "sha256:10274a1fbeb8ec5d72966e17bb198a3104257aca4ac09d98667c5f8aca8c8548", size = 222354, upload-time = "2026-05-26T20:38:58.727Z" },
|
|
480
|
+
{ url = "https://files.pythonhosted.org/packages/71/cf/107421693cfb71e4f1ca5bf70443f64d4161878068d07a3e51c7ad21d17b/coverage-7.14.1-cp311-cp311-win_amd64.whl", hash = "sha256:87ebdf787d4888e3f3f2d523eadc6e18c6d18c6d0eb173801a189641627fb37e", size = 223290, upload-time = "2026-05-26T20:39:00.413Z" },
|
|
481
|
+
{ url = "https://files.pythonhosted.org/packages/b8/1d/3e3644585eb29e9dafefb19555078529a4d7cce12bd21929664eea989277/coverage-7.14.1-cp311-cp311-win_arm64.whl", hash = "sha256:dd34767fa19848d35659ffc0a75314f58c7af3f1cd87ec521e8292a1238398a3", size = 221953, upload-time = "2026-05-26T20:39:02.159Z" },
|
|
482
|
+
{ url = "https://files.pythonhosted.org/packages/3d/b7/bdbb725ba02c5b42825b200c940f38b7a54fcad24627b7192f78f8110d76/coverage-7.14.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:a06c76364a9360e33d6d23769aefdf7f66f38e2ffb60ceb1baaa4989d83b695c", size = 220022, upload-time = "2026-05-26T20:39:03.702Z" },
|
|
483
|
+
{ url = "https://files.pythonhosted.org/packages/72/81/fdc0898a55c6219223291ec1a1fe89966ef212ce82276aa0899df84b5de0/coverage-7.14.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:fad54e871165f6ec2f536063ac74c3104508a12963e64072ba44bd822de52b0c", size = 220379, upload-time = "2026-05-26T20:39:05.381Z" },
|
|
484
|
+
{ url = "https://files.pythonhosted.org/packages/de/72/de048c4a25e13bce59ac6a339351c10bdf2515e07459afcdaf04dc3143a2/coverage-7.14.1-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:84b535f00655ecafe1d929d1fb00ed5d6fa3051ea643ab2c161a3887b86f294b", size = 251888, upload-time = "2026-05-26T20:39:07.367Z" },
|
|
485
|
+
{ url = "https://files.pythonhosted.org/packages/28/30/300c343f68beb9d4cbb64ec81e58c5b6b80b56927f72d2b38654ac26e013/coverage-7.14.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:6b6b0853b895fe0e98cbfc580d1ec3393d9302b4b1e96a77b3f5c91fdab899e6", size = 254624, upload-time = "2026-05-26T20:39:09.037Z" },
|
|
486
|
+
{ url = "https://files.pythonhosted.org/packages/b1/ed/7b25642496e8170b6bac14adce00537c6e5fa2d586159401a4de3e8b49e6/coverage-7.14.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:442cc9c952b2df400cda54bb04ab87330cf2cd08a8692cbbea36773531eb6f37", size = 255739, upload-time = "2026-05-26T20:39:10.889Z" },
|
|
487
|
+
{ url = "https://files.pythonhosted.org/packages/7f/a2/abd210b8c4e29c24e4624916db97bb519097a91034aaeb767f937e7da794/coverage-7.14.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8270544c361ed405a27a060dbc9ed2c124b084d96dfdc2d9a2510482aef981ad", size = 257998, upload-time = "2026-05-26T20:39:12.722Z" },
|
|
488
|
+
{ url = "https://files.pythonhosted.org/packages/7f/24/7c50beed3792fe62f6ce0545c6686ce83379719e2c0276179333d97eae92/coverage-7.14.1-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:48b283b1dd6372e8de2a7a9a4c4d5dc06f4d4fd209b876f3c88a7a205a0c8f84", size = 252296, upload-time = "2026-05-26T20:39:14.259Z" },
|
|
489
|
+
{ url = "https://files.pythonhosted.org/packages/15/05/0f874628ebcbfc77ead559ff210281ef06a97db08481832e7dd39274a135/coverage-7.14.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:5b0c99ba93a07d56f6df340bb79be53202a082b2fdb81bfe6190b741a3470d54", size = 253658, upload-time = "2026-05-26T20:39:15.923Z" },
|
|
490
|
+
{ url = "https://files.pythonhosted.org/packages/99/6f/ca6ad067364b337ef997802115e7ecad2abd2248b05471464b0dea02b4d4/coverage-7.14.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:e471bc5769ff073b058cfadb0d736b56ce067c8560eabeb0da88462df98c23e7", size = 251803, upload-time = "2026-05-26T20:39:17.537Z" },
|
|
491
|
+
{ url = "https://files.pythonhosted.org/packages/c0/30/b9b4d377cd9f40baf228068f5a81faf8450c6228503011bd499708483a50/coverage-7.14.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:f497a1ea81d4cd7c10ddcaa685135b9aabd291af3d55775a9ddf3cb7a364cdd9", size = 255873, upload-time = "2026-05-26T20:39:19.414Z" },
|
|
492
|
+
{ url = "https://files.pythonhosted.org/packages/3c/21/7c721a9e5e6bb88547d30a787aefb97512d3f54c1324c7488d9b3743f7f9/coverage-7.14.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:2222be86d0b54f5dd5a38f45f17f315f737245e857bf0bdedc70734f84a13c02", size = 251372, upload-time = "2026-05-26T20:39:21.169Z" },
|
|
493
|
+
{ url = "https://files.pythonhosted.org/packages/9d/8c/f8ae5a2200130e1503cd7661a6cd3b2b7bacef98277fbf3571fb13f8b766/coverage-7.14.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:85e85586565842f6932abebd4c18bcb1074223dc0b3576e7d173ca710622813a", size = 253245, upload-time = "2026-05-26T20:39:23.097Z" },
|
|
494
|
+
{ url = "https://files.pythonhosted.org/packages/34/62/70a9024672a5f6910517d9628c52c9afbdd3cf8f46426af52bb148a56fff/coverage-7.14.1-cp312-cp312-win32.whl", hash = "sha256:4a28fd227808366b196a75476dced2eb35b351d6766ba9c858dc93319e87f4f1", size = 222567, upload-time = "2026-05-26T20:39:24.868Z" },
|
|
495
|
+
{ url = "https://files.pythonhosted.org/packages/f6/81/8b7cd386839b039ebe1855733b9f9449a8dec5d79564018234f185a7fa70/coverage-7.14.1-cp312-cp312-win_amd64.whl", hash = "sha256:54acdb6674a4661768d7bf7db32dfb9f46ab1d764f8aba6df75ce1a6a088724e", size = 223372, upload-time = "2026-05-26T20:39:26.603Z" },
|
|
496
|
+
{ url = "https://files.pythonhosted.org/packages/ae/ba/b44d472022f620d289d95fa830143235c0c36461c6f2437ea8d51e5481ed/coverage-7.14.1-cp312-cp312-win_arm64.whl", hash = "sha256:99cd41ff91afd94896fea3bc002706b6ae4ce95727d06e4a0f39c0a8d8bd8b1a", size = 221989, upload-time = "2026-05-26T20:39:28.242Z" },
|
|
497
|
+
{ url = "https://files.pythonhosted.org/packages/8a/3c/1a983b9a745d7f83d53f057bcc5bf79ba6a2bbc08266b3f0c7d6fe630c9b/coverage-7.14.1-py3-none-any.whl", hash = "sha256:a252f21c27e38347e60111a3266b03827422a7d5525951aceee313aa68bab1d2", size = 211815, upload-time = "2026-05-26T20:41:34.078Z" },
|
|
498
498
|
]
|
|
499
499
|
|
|
500
500
|
[package.optional-dependencies]
|