forgexa-cli 1.106.2__tar.gz → 1.106.3__tar.gz

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.
Files changed (40) hide show
  1. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/PKG-INFO +1 -1
  2. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/__init__.py +1 -1
  3. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/agent_core.py +60 -3
  4. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/daemon.py +1 -1
  5. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli.egg-info/PKG-INFO +1 -1
  6. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/pyproject.toml +1 -1
  7. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/README.md +0 -0
  8. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/_build_config.py +0 -0
  9. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/_local_bind.py +0 -0
  10. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/autoupgrade.py +0 -0
  11. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/aws_evidence.py +0 -0
  12. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/aws_logs_evidence.py +0 -0
  13. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/code_review_rules.py +0 -0
  14. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/component_runtime.py +0 -0
  15. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/main.py +0 -0
  16. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/observability_contract.py +0 -0
  17. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/observability_evidence.py +0 -0
  18. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/ocr_adapter.py +0 -0
  19. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/py.typed +0 -0
  20. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/runtime_evidence.py +0 -0
  21. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/workspace_storage.py +0 -0
  22. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli/zcode_protocol.py +0 -0
  23. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli.egg-info/SOURCES.txt +0 -0
  24. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli.egg-info/dependency_links.txt +0 -0
  25. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli.egg-info/entry_points.txt +0 -0
  26. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli.egg-info/requires.txt +0 -0
  27. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/forgexa_cli.egg-info/top_level.txt +0 -0
  28. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/setup.cfg +0 -0
  29. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/tests/test_auth_and_runtime_commands.py +0 -0
  30. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/tests/test_autoupgrade.py +0 -0
  31. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/tests/test_check_command.py +0 -0
  32. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/tests/test_delivery_review_packaged.py +0 -0
  33. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/tests/test_expiry_warnings_and_revoke.py +0 -0
  34. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/tests/test_local_bind_commands.py +0 -0
  35. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/tests/test_publish_script.py +0 -0
  36. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/tests/test_runtime_credentials.py +0 -0
  37. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/tests/test_session_credentials.py +0 -0
  38. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/tests/test_silent_install.py +0 -0
  39. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/tests/test_upgrade_observability.py +0 -0
  40. {forgexa_cli-1.106.2 → forgexa_cli-1.106.3}/tests/test_workspace_storage.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: forgexa-cli
3
- Version: 1.106.2
3
+ Version: 1.106.3
4
4
  Summary: Forgexa CLI — command-line client and AI agent runtime for the Forgexa platform
5
5
  Author-email: Jason Sun <dev.winds@gmail.com>
6
6
  License-Expression: MIT
@@ -1,2 +1,2 @@
1
1
  """forgexa-cli — Forgexa command-line client."""
2
- __version__ = "1.106.2"
2
+ __version__ = "1.106.3"
@@ -51,6 +51,7 @@ import platform
51
51
  import re
52
52
  import shlex
53
53
  import shutil
54
+ import stat
54
55
  import subprocess
55
56
  import tempfile
56
57
  import time
@@ -1299,10 +1300,43 @@ class DiscoveredAgent:
1299
1300
  selection_revision: int | None = None
1300
1301
 
1301
1302
 
1303
+ def _wsl_copilot_node(path: str) -> str | None:
1304
+ """Pair a WSL npm Copilot entry with its installation's executable Node."""
1305
+ if sys.platform != "linux" or not os.environ.get("WSL_DISTRO_NAME"):
1306
+ return None
1307
+ try:
1308
+ resolved = Path(path).resolve(strict=True)
1309
+ with resolved.open("rb") as stream:
1310
+ header = stream.read(512)
1311
+ if not header.startswith(b"#!"):
1312
+ return None
1313
+ parts = shlex.split(header.split(b"\n", 1)[0][2:].decode("utf-8", errors="strict"))
1314
+ if not parts or Path(parts[0]).name != "env" or parts[1:] not in (["node"], ["-S", "node"]):
1315
+ return None
1316
+ for parent in resolved.parents:
1317
+ if parent.name == "node_modules" and parent.parent.name == "lib":
1318
+ if resolved.relative_to(parent).parts[:2] != ("@github", "copilot"):
1319
+ return None
1320
+ node = parent.parent.parent / "bin" / "node"
1321
+ if node.is_file() and os.access(node, os.X_OK):
1322
+ return str(node)
1323
+ return None
1324
+ except (OSError, RuntimeError, UnicodeError, ValueError):
1325
+ pass
1326
+ return None
1327
+
1328
+
1302
1329
  def _prepare_agent_command(
1303
1330
  command: list[str], *, preserve_argv: bool = True,
1304
1331
  ) -> list[str]:
1305
- """Make Windows script launchers executable without losing argv boundaries."""
1332
+ """Preserve argv with target-local Copilot Node or Windows script shims."""
1333
+ if command:
1334
+ node = _wsl_copilot_node(command[0])
1335
+ if node is not None:
1336
+ issue = AgentDiscovery._wsl_execution_issue(command[0])
1337
+ if issue:
1338
+ raise ValueError(issue)
1339
+ return [node, *command]
1306
1340
  if sys.platform != "win32" or not command:
1307
1341
  return command
1308
1342
 
@@ -2220,7 +2254,7 @@ class AgentDiscovery:
2220
2254
  # not this host's cwd. Refuse rather than check another tool.
2221
2255
  if not search_path or any(not Path(entry).is_absolute() for entry in search_path.split(os.pathsep)):
2222
2256
  return issue
2223
- interpreter = shutil.which(arguments[0], path=search_path)
2257
+ interpreter = _wsl_copilot_node(candidate) or shutil.which(arguments[0], path=search_path)
2224
2258
  if not interpreter:
2225
2259
  return issue
2226
2260
  candidate = interpreter
@@ -2556,6 +2590,7 @@ def acquire_file_lock(
2556
2590
  *,
2557
2591
  blocking: bool = False,
2558
2592
  timeout_seconds: float = 10.0,
2593
+ owner_uid: int | None = None,
2559
2594
  ):
2560
2595
  """Open ``path`` and take an exclusive OS-level lock on it.
2561
2596
 
@@ -2563,11 +2598,25 @@ def acquire_file_lock(
2563
2598
  bounded serialized state updates. Returns the open file handle to hold for
2564
2599
  the lock's duration, or ``None`` when the lock cannot be acquired in time.
2565
2600
  Callers must release via :func:`release_file_lock` in a ``finally`` block.
2601
+ New files are private at creation. Managed callers supply ``owner_uid``
2602
+ to reject unsafe descriptors before any initialization or locking.
2566
2603
  """
2567
2604
  lock_path = Path(path)
2568
2605
  lock_path.parent.mkdir(parents=True, exist_ok=True)
2569
- lock_file = open(lock_path, "a+b")
2606
+
2607
+ def opener(file, flags):
2608
+ if owner_uid is not None:
2609
+ flags |= getattr(os, "O_NOFOLLOW", 0) | getattr(os, "O_NONBLOCK", 0)
2610
+ return os.open(file, flags, 0o600)
2611
+
2612
+ lock_file = open(lock_path, "a+b", opener=opener)
2570
2613
  try:
2614
+ if owner_uid is not None:
2615
+ info, current = os.fstat(lock_file.fileno()), lock_path.lstat()
2616
+ if (not stat.S_ISREG(info.st_mode) or info.st_nlink != 1
2617
+ or (info.st_dev, info.st_ino) != (current.st_dev, current.st_ino)
2618
+ or sys.platform == "linux" and (info.st_uid != owner_uid or info.st_mode & 0o022)):
2619
+ raise ValueError("Lock ownership or permissions are unsafe")
2571
2620
  lock_file.seek(0, os.SEEK_END)
2572
2621
  if lock_file.tell() == 0:
2573
2622
  lock_file.write(b"\0")
@@ -2593,11 +2642,19 @@ def acquire_file_lock(
2593
2642
  or deadline is None
2594
2643
  or time.monotonic() >= deadline
2595
2644
  ):
2645
+ if owner_uid is not None and exc.errno in {errno.EACCES, errno.EAGAIN}:
2646
+ lock_file.close()
2647
+ return None
2596
2648
  raise
2597
2649
  time.sleep(0.05)
2598
2650
  except OSError:
2599
2651
  lock_file.close()
2652
+ if owner_uid is not None:
2653
+ raise
2600
2654
  return None
2655
+ except BaseException:
2656
+ lock_file.close()
2657
+ raise
2601
2658
  return lock_file
2602
2659
 
2603
2660
 
@@ -1428,7 +1428,7 @@ except (ImportError, ModuleNotFoundError):
1428
1428
  # DAEMON_VERSION is the protocol/logic version of the daemon code.
1429
1429
  # Kept in sync with pyproject.toml version via bump-version.sh.
1430
1430
  # CLIENT_TYPE identifies which packaging/distribution this daemon runs in.
1431
- DAEMON_VERSION = "1.106.2"
1431
+ DAEMON_VERSION = "1.106.3"
1432
1432
 
1433
1433
 
1434
1434
  def _detect_client_type() -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: forgexa-cli
3
- Version: 1.106.2
3
+ Version: 1.106.3
4
4
  Summary: Forgexa CLI — command-line client and AI agent runtime for the Forgexa platform
5
5
  Author-email: Jason Sun <dev.winds@gmail.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "forgexa-cli"
3
- version = "1.106.2"
3
+ version = "1.106.3"
4
4
  description = "Forgexa CLI — command-line client and AI agent runtime for the Forgexa platform"
5
5
  requires-python = ">=3.9"
6
6
  license = "MIT"
File without changes
File without changes