forgexa-cli 1.109.6__tar.gz → 1.110.0__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.109.6 → forgexa_cli-1.110.0}/PKG-INFO +1 -1
  2. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/__init__.py +1 -1
  3. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/agent_core.py +100 -20
  4. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/daemon.py +1 -1
  5. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli.egg-info/PKG-INFO +1 -1
  6. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/pyproject.toml +1 -1
  7. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/README.md +0 -0
  8. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/_build_config.py +0 -0
  9. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/_local_bind.py +0 -0
  10. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/autoupgrade.py +0 -0
  11. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/aws_evidence.py +0 -0
  12. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/aws_logs_evidence.py +0 -0
  13. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/code_review_rules.py +0 -0
  14. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/component_runtime.py +0 -0
  15. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/main.py +0 -0
  16. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/observability_contract.py +0 -0
  17. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/observability_evidence.py +0 -0
  18. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/ocr_adapter.py +0 -0
  19. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/py.typed +0 -0
  20. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/runtime_evidence.py +0 -0
  21. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/workspace_storage.py +0 -0
  22. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli/zcode_protocol.py +0 -0
  23. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli.egg-info/SOURCES.txt +0 -0
  24. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli.egg-info/dependency_links.txt +0 -0
  25. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli.egg-info/entry_points.txt +0 -0
  26. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli.egg-info/requires.txt +0 -0
  27. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/forgexa_cli.egg-info/top_level.txt +0 -0
  28. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/setup.cfg +0 -0
  29. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/tests/test_auth_and_runtime_commands.py +0 -0
  30. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/tests/test_autoupgrade.py +0 -0
  31. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/tests/test_check_command.py +0 -0
  32. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/tests/test_delivery_review_packaged.py +0 -0
  33. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/tests/test_expiry_warnings_and_revoke.py +0 -0
  34. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/tests/test_local_bind_commands.py +0 -0
  35. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/tests/test_publish_script.py +0 -0
  36. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/tests/test_runtime_credentials.py +0 -0
  37. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/tests/test_session_credentials.py +0 -0
  38. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/tests/test_silent_install.py +0 -0
  39. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/tests/test_upgrade_observability.py +0 -0
  40. {forgexa_cli-1.109.6 → forgexa_cli-1.110.0}/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.109.6
3
+ Version: 1.110.0
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.109.6"
2
+ __version__ = "1.110.0"
@@ -1328,6 +1328,45 @@ def _wsl_npm_agent_node(path: str) -> str | None:
1328
1328
  return None
1329
1329
 
1330
1330
 
1331
+ _WINDOWS_AGENT_DEFAULT_SUFFIXES = (".COM", ".EXE", ".BAT", ".CMD")
1332
+ _WINDOWS_AGENT_LAUNCHER_SUFFIXES = (*_WINDOWS_AGENT_DEFAULT_SUFFIXES, ".PS1")
1333
+
1334
+
1335
+ def _which_agent_command(command: str, *, path_override: str | None = None) -> str | None:
1336
+ """Find a launchable agent rather than npm's extensionless POSIX shim."""
1337
+ if sys.platform != "win32":
1338
+ return shutil.which(path_override or command)
1339
+
1340
+ target = os.path.abspath(path_override) if path_override else command
1341
+ directory, name = os.path.split(target)
1342
+ suffix = os.path.splitext(name)[1].upper()
1343
+ if suffix:
1344
+ if suffix not in _WINDOWS_AGENT_LAUNCHER_SUFFIXES:
1345
+ return None
1346
+ names = (name,)
1347
+ else:
1348
+ # shutil.which varies across Python versions and can select `copilot`
1349
+ # ahead of `copilot.cmd`. Keep PATH order, but consider only launchers
1350
+ # we know how to run, even if e.g. .CMD is missing from PATHEXT.
1351
+ configured = os.environ.get("PATHEXT", "").upper().split(os.pathsep)
1352
+ suffixes = dict.fromkeys(
1353
+ suffix for suffix in (*configured, *_WINDOWS_AGENT_DEFAULT_SUFFIXES)
1354
+ if suffix in _WINDOWS_AGENT_LAUNCHER_SUFFIXES
1355
+ )
1356
+ names = tuple(name + suffix for suffix in suffixes)
1357
+
1358
+ directories = (directory,) if directory else os.get_exec_path()
1359
+ for entry in directories:
1360
+ entry = entry.strip('"')
1361
+ if not entry:
1362
+ continue
1363
+ for name in names:
1364
+ candidate = os.path.join(entry, name)
1365
+ if os.path.isfile(candidate):
1366
+ return os.path.abspath(candidate)
1367
+ return None
1368
+
1369
+
1331
1370
  def _prepare_agent_command(
1332
1371
  command: list[str], *, preserve_argv: bool = True,
1333
1372
  ) -> list[str]:
@@ -1344,11 +1383,11 @@ def _prepare_agent_command(
1344
1383
 
1345
1384
  suffix = Path(command[0]).suffix.lower()
1346
1385
  if suffix in {".cmd", ".bat"}:
1347
- if not preserve_argv:
1386
+ if not preserve_argv and all(re.fullmatch(r"[\w.\\:/-]+", arg) for arg in command):
1348
1387
  # Agent discovery invokes only fixed registry commands such as
1349
1388
  # `opencode --version`, so cmd.exe never parses task text here.
1350
1389
  # Keep this proven path for version probes: Windows PowerShell can
1351
- # change how a CLI writes its version to redirected stdout.
1390
+ # change redirected output. Quoted paths need the argv-safe branch.
1352
1391
  comspec = os.environ.get("COMSPEC", "")
1353
1392
  if comspec and Path(comspec).is_file():
1354
1393
  command_processor = comspec
@@ -2306,13 +2345,18 @@ class AgentDiscovery:
2306
2345
  await asyncio.to_thread(component_runtime.selected_external_agent_selection, agent_id)
2307
2346
  if managed is None else (None, None)
2308
2347
  )
2309
- custom_path = selected_path or os.environ.get(spec.get("env_path_override", ""))
2310
- cmd = managed.argv_prefix[-1] if managed is not None else custom_path or spec["commands"][0]
2311
- resolved = shutil.which(cmd)
2348
+ path_override = os.environ.get(spec.get("env_path_override", ""))
2349
+ cmd = spec["commands"][0]
2350
+ if managed is not None:
2351
+ resolved = shutil.which(managed.argv_prefix[-1])
2352
+ elif selected_path:
2353
+ resolved = shutil.which(selected_path)
2354
+ else:
2355
+ resolved = _which_agent_command(cmd, path_override=path_override)
2312
2356
  if resolved:
2313
2357
  resolved, issue = await asyncio.to_thread(
2314
2358
  self._resolve_wsl_candidate, resolved,
2315
- cmd if managed is None and not custom_path else None,
2359
+ cmd if managed is None and not (selected_path or path_override) else None,
2316
2360
  )
2317
2361
  if issue:
2318
2362
  logger.warning(
@@ -2322,6 +2366,11 @@ class AgentDiscovery:
2322
2366
  return None
2323
2367
  if managed is None:
2324
2368
  await asyncio.to_thread(component_runtime.validate_external_executable, resolved)
2369
+ if agent_id == "zcode" and sys.platform == "linux" and not (selected_path or path_override):
2370
+ bundle = Path(resolved).resolve().parent
2371
+ if (bundle / "chrome-sandbox").is_file() and (bundle / "resources" / "app.asar").is_file():
2372
+ logger.debug("Ignoring the ZCode desktop application on PATH at %s", resolved)
2373
+ return None
2325
2374
  version = (
2326
2375
  await self._get_version(spec["detect"], resolved)
2327
2376
  if managed is None
@@ -2413,9 +2462,11 @@ class AgentDiscovery:
2413
2462
  if executable:
2414
2463
  parts[0] = executable
2415
2464
  else:
2416
- resolved = shutil.which(parts[0])
2465
+ resolved = _which_agent_command(parts[0])
2417
2466
  if resolved:
2418
2467
  parts[0] = resolved
2468
+ elif sys.platform == "win32":
2469
+ return None
2419
2470
  if managed is not None:
2420
2471
  parts = managed.wrap_command(parts)
2421
2472
  parts = _prepare_agent_command(parts, preserve_argv=False)
@@ -2431,6 +2482,14 @@ class AgentDiscovery:
2431
2482
  )
2432
2483
  env = os.environ.copy()
2433
2484
  env.update(TMPDIR=probe_dir.name, BUN_TMPDIR=probe_dir.name)
2485
+ if managed is None and detect_cmd == "opencode --version":
2486
+ probe_root = Path(probe_dir.name)
2487
+ env.update(
2488
+ XDG_CONFIG_HOME=str(probe_root / "config"),
2489
+ XDG_CACHE_HOME=str(probe_root / "cache"),
2490
+ XDG_DATA_HOME=str(probe_root / "data"),
2491
+ XDG_STATE_HOME=str(probe_root / "state"),
2492
+ )
2434
2493
  if managed is not None:
2435
2494
  if probe_dir is None:
2436
2495
  probe_dir = tempfile.TemporaryDirectory(prefix="forgexa-managed-discovery-")
@@ -3859,24 +3918,36 @@ def delivery_review_candidate(input_data: dict | None, workspace_resolution: str
3859
3918
  return candidate
3860
3919
 
3861
3920
 
3862
- def delivery_review_sandbox_exec() -> str | None:
3921
+ def delivery_review_sandbox_probe() -> tuple[str | None, str | None]:
3863
3922
  if sys.platform not in {"darwin", "linux"}:
3864
- return None
3923
+ return None, "platform_unsupported"
3865
3924
  executable = "/usr/bin/sandbox-exec" if sys.platform == "darwin" else "/usr/bin/bwrap"
3866
- if not os.path.isfile(executable) or not os.access(executable, os.X_OK):
3867
- return None
3925
+ if not os.path.isfile(executable):
3926
+ return None, "missing"
3927
+ if not os.access(executable, os.X_OK):
3928
+ return None, "probe_failed"
3868
3929
  if sys.platform == "linux":
3869
3930
  try:
3870
3931
  probe = subprocess.run(
3871
3932
  [executable, "--unshare-all", "--share-net", "--die-with-parent", "--new-session",
3872
3933
  "--ro-bind", "/", "/", "--proc", "/proc", "--dev", "/dev", "--", "/bin/true"],
3873
- stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=3, check=False,
3934
+ stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, timeout=3, check=False,
3874
3935
  )
3875
3936
  except (OSError, subprocess.SubprocessError):
3876
- return None
3937
+ return None, "probe_failed"
3877
3938
  if probe.returncode != 0:
3878
- return None
3879
- return executable
3939
+ detail = probe.stderr.lower()
3940
+ if any(marker in detail for marker in (
3941
+ b"creating new namespace failed", b"no permissions to create",
3942
+ b"operation not permitted", b"permission denied",
3943
+ )):
3944
+ return None, "system_denied"
3945
+ return None, "probe_failed"
3946
+ return executable, None
3947
+
3948
+
3949
+ def delivery_review_sandbox_exec() -> str | None:
3950
+ return delivery_review_sandbox_probe()[0]
3880
3951
 
3881
3952
 
3882
3953
  def project_review_node_read_paths(node: str) -> set[Path]:
@@ -3903,6 +3974,7 @@ def delivery_review_linux_command(
3903
3974
  command: list[str], *, cwd: Path, home: Path, writable: bool = False, network: bool = True,
3904
3975
  read_paths: list[Path] | None = None, write_paths: list[Path] | None = None,
3905
3976
  read_only_paths: list[Path] | None = None, deny_paths: list[Path] | None = None,
3977
+ excluded_source: Path | None = None,
3906
3978
  ) -> list[str]:
3907
3979
  sandbox = delivery_review_sandbox_exec()
3908
3980
  if sys.platform != "linux" or not sandbox:
@@ -3918,13 +3990,20 @@ def delivery_review_linux_command(
3918
3990
  wrapped = [sandbox, "--unshare-all", "--die-with-parent", "--new-session", "--cap-drop", "ALL"]
3919
3991
  if network:
3920
3992
  wrapped.append("--share-net")
3921
- for path in (
3993
+ system_paths = (
3922
3994
  "/usr", "/bin", "/sbin", "/lib", "/lib64", "/etc/ssl/certs", "/etc/ca-certificates", "/etc/pki",
3923
3995
  "/etc/resolv.conf", "/etc/hosts", "/etc/nsswitch.conf", "/etc/gai.conf", "/etc/localtime",
3924
3996
  "/etc/passwd", "/etc/group", "/etc/ld.so.cache", "/etc/alternatives",
3925
- ):
3926
- if Path(path).exists():
3927
- wrapped += ["--ro-bind", path, path]
3997
+ )
3998
+ system_paths = tuple(path for path in system_paths if Path(path).exists())
3999
+ if excluded_source is not None:
4000
+ source = excluded_source.resolve()
4001
+ mounted = {workspace, isolated_home, *roots, *writable_roots, *readonly_roots,
4002
+ *(Path(path).resolve() for path in system_paths)}
4003
+ if any(path == source or path in source.parents or source in path.parents for path in mounted):
4004
+ raise RuntimeError("The Linux review sandbox would expose the original repository")
4005
+ for path in system_paths:
4006
+ wrapped += ["--ro-bind", path, path]
3928
4007
  wrapped += ["--proc", "/proc", "--dev", "/dev", "--tmpfs", "/tmp", "--tmpfs", "/var/tmp"]
3929
4008
  for path in sorted(roots):
3930
4009
  if path.exists():
@@ -3963,7 +4042,7 @@ def delivery_review_sandbox_command(
3963
4042
  command: list[str], workspace: Path, home: Path, *, writable: bool,
3964
4043
  network: bool = True, read_paths: list[Path] | None = None,
3965
4044
  allow_claude_tmp: bool = False, deny_paths: list[Path] | None = None,
3966
- restrict_global_reads: bool = False,
4045
+ restrict_global_reads: bool = False, excluded_source: Path | None = None,
3967
4046
  ) -> list[str]:
3968
4047
  sandbox = delivery_review_sandbox_exec()
3969
4048
  if not sandbox:
@@ -4011,6 +4090,7 @@ def delivery_review_sandbox_command(
4011
4090
  return delivery_review_linux_command(
4012
4091
  command, cwd=workspace_path, home=home_path, writable=writable, network=network,
4013
4092
  read_paths=[Path(root) for root in read_roots], deny_paths=deny_paths,
4093
+ excluded_source=excluded_source,
4014
4094
  )
4015
4095
  executable_rules = " ".join(f"(subpath {json.dumps(root)})" for root in sorted(read_roots))
4016
4096
  metadata_paths = {
@@ -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.109.6"
1431
+ DAEMON_VERSION = "1.110.0"
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.109.6
3
+ Version: 1.110.0
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.109.6"
3
+ version = "1.110.0"
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