forgexa-cli 1.109.7__tar.gz → 1.110.1__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.
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/PKG-INFO +1 -1
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/__init__.py +1 -1
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/agent_core.py +90 -15
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/daemon.py +1 -1
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/ocr_adapter.py +9 -2
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli.egg-info/PKG-INFO +1 -1
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/pyproject.toml +1 -1
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/README.md +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/_build_config.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/_local_bind.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/autoupgrade.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/aws_evidence.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/aws_logs_evidence.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/code_review_rules.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/component_runtime.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/main.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/observability_contract.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/observability_evidence.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/py.typed +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/runtime_evidence.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/workspace_storage.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli/zcode_protocol.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli.egg-info/SOURCES.txt +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli.egg-info/dependency_links.txt +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli.egg-info/entry_points.txt +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli.egg-info/requires.txt +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/forgexa_cli.egg-info/top_level.txt +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/setup.cfg +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/tests/test_auth_and_runtime_commands.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/tests/test_autoupgrade.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/tests/test_check_command.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/tests/test_delivery_review_packaged.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/tests/test_expiry_warnings_and_revoke.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/tests/test_local_bind_commands.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/tests/test_publish_script.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/tests/test_runtime_credentials.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/tests/test_session_credentials.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/tests/test_silent_install.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/tests/test_upgrade_observability.py +0 -0
- {forgexa_cli-1.109.7 → forgexa_cli-1.110.1}/tests/test_workspace_storage.py +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""forgexa-cli — Forgexa command-line client."""
|
|
2
|
-
__version__ = "1.
|
|
2
|
+
__version__ = "1.110.1"
|
|
@@ -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
|
|
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
|
-
|
|
2310
|
-
cmd =
|
|
2311
|
-
|
|
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
|
|
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 =
|
|
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
|
|
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)
|
|
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.
|
|
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
|
-
|
|
3879
|
-
|
|
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]:
|
|
@@ -6811,8 +6882,12 @@ def copilot_base_env(env: dict[str, str], *, copilot_home: str | Path) -> dict[s
|
|
|
6811
6882
|
TERM=dumb suppresses TTY-detection (copilot suspends when it can't
|
|
6812
6883
|
acquire a pseudo-terminal); COPILOT_HOME points at the prepared home
|
|
6813
6884
|
(see prepare_copilot_home).
|
|
6885
|
+
A classic PAT must not shadow a supported token or the saved CLI login.
|
|
6814
6886
|
"""
|
|
6815
6887
|
env = dict(env)
|
|
6888
|
+
for key in COPILOT_TOKEN_ENV_VARS:
|
|
6889
|
+
if env.get(key, "").strip().startswith("ghp_"):
|
|
6890
|
+
env.pop(key)
|
|
6816
6891
|
env["TERM"] = "dumb" # suppress TTY-detection that suspends the process
|
|
6817
6892
|
env["COPILOT_HOME"] = str(copilot_home)
|
|
6818
6893
|
env.setdefault("TOKIO_WORKER_THREADS", "2")
|
|
@@ -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.
|
|
1431
|
+
DAEMON_VERSION = "1.110.1"
|
|
1432
1432
|
|
|
1433
1433
|
|
|
1434
1434
|
def _detect_client_type() -> str:
|
|
@@ -41,6 +41,7 @@ else:
|
|
|
41
41
|
OCR_COMPONENT_ID = "forgexa.ocr"
|
|
42
42
|
OCR_OUTPUT_LIMIT = 1024 * 1024
|
|
43
43
|
OCR_FILE_LIMIT = 5000
|
|
44
|
+
OCR_REVIEW_DEFAULT_MAX_FILES = 200
|
|
44
45
|
OCR_REVIEW_SANDBOX = "darwin-git-objects-v1"
|
|
45
46
|
|
|
46
47
|
|
|
@@ -135,6 +136,8 @@ def validate_ocr_review_evidence(
|
|
|
135
136
|
head_sha: str,
|
|
136
137
|
merge_base_sha: str,
|
|
137
138
|
changed_files: list[str],
|
|
139
|
+
*,
|
|
140
|
+
max_changed_files: int = OCR_REVIEW_DEFAULT_MAX_FILES,
|
|
138
141
|
) -> dict[str, Any]:
|
|
139
142
|
if not isinstance(evidence, dict) or set(evidence) != {
|
|
140
143
|
"identity",
|
|
@@ -156,7 +159,7 @@ def validate_ocr_review_evidence(
|
|
|
156
159
|
if (
|
|
157
160
|
not isinstance(reviewed, list)
|
|
158
161
|
or not isinstance(excluded, list)
|
|
159
|
-
or len(reviewed) + len(excluded) >
|
|
162
|
+
or len(reviewed) + len(excluded) > min(max_changed_files, OCR_FILE_LIMIT)
|
|
160
163
|
):
|
|
161
164
|
raise OcrAdapterError("ocr_evidence_invalid")
|
|
162
165
|
paths = [_path(path) for path in reviewed]
|
|
@@ -579,6 +582,7 @@ async def run_ocr_range_preview(
|
|
|
579
582
|
expected_external_instance: str | None = None,
|
|
580
583
|
expected_identity: dict | None = None,
|
|
581
584
|
selection_revision: int | None = None,
|
|
585
|
+
max_changed_files: int = OCR_REVIEW_DEFAULT_MAX_FILES,
|
|
582
586
|
timeout: float = 30,
|
|
583
587
|
on_identity=None,
|
|
584
588
|
) -> dict[str, Any]:
|
|
@@ -595,7 +599,7 @@ async def run_ocr_range_preview(
|
|
|
595
599
|
raise OcrAdapterError("ocr_request_invalid")
|
|
596
600
|
if (
|
|
597
601
|
not isinstance(changed_files, list)
|
|
598
|
-
or len(changed_files) >
|
|
602
|
+
or len(changed_files) > min(max_changed_files, OCR_FILE_LIMIT)
|
|
599
603
|
or len(set(changed_files)) != len(changed_files)
|
|
600
604
|
):
|
|
601
605
|
raise OcrAdapterError("ocr_request_invalid")
|
|
@@ -856,6 +860,7 @@ async def run_selected_ocr_range_preview(
|
|
|
856
860
|
changed_files: list[str],
|
|
857
861
|
*,
|
|
858
862
|
expected_identity: dict | None = None,
|
|
863
|
+
max_changed_files: int = OCR_REVIEW_DEFAULT_MAX_FILES,
|
|
859
864
|
timeout: float = 30,
|
|
860
865
|
on_identity=None,
|
|
861
866
|
) -> dict[str, Any]:
|
|
@@ -892,6 +897,7 @@ async def run_selected_ocr_range_preview(
|
|
|
892
897
|
external_executable=Path(executable),
|
|
893
898
|
expected_identity=expected_identity,
|
|
894
899
|
selection_revision=revision,
|
|
900
|
+
max_changed_files=max_changed_files,
|
|
895
901
|
timeout=timeout,
|
|
896
902
|
on_identity=on_identity,
|
|
897
903
|
)
|
|
@@ -911,6 +917,7 @@ async def run_selected_ocr_range_preview(
|
|
|
911
917
|
merge_base_sha,
|
|
912
918
|
changed_files,
|
|
913
919
|
expected_identity=expected_identity,
|
|
920
|
+
max_changed_files=max_changed_files,
|
|
914
921
|
timeout=timeout,
|
|
915
922
|
on_identity=on_identity,
|
|
916
923
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|