forgexa-cli 1.98.3__tar.gz → 1.98.4__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.98.3 → forgexa_cli-1.98.4}/PKG-INFO +1 -1
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/__init__.py +1 -1
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/agent_core.py +11 -6
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/component_runtime.py +62 -3
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/daemon.py +1 -1
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/ocr_adapter.py +2 -1
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli.egg-info/PKG-INFO +1 -1
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/pyproject.toml +1 -1
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/README.md +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/_build_config.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/_local_bind.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/autoupgrade.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/aws_evidence.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/aws_logs_evidence.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/main.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/observability_contract.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/observability_evidence.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/py.typed +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/runtime_evidence.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/workspace_storage.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli/zcode_protocol.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli.egg-info/SOURCES.txt +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli.egg-info/dependency_links.txt +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli.egg-info/entry_points.txt +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli.egg-info/requires.txt +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/forgexa_cli.egg-info/top_level.txt +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/setup.cfg +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/tests/test_auth_and_runtime_commands.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/tests/test_autoupgrade.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/tests/test_check_command.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/tests/test_expiry_warnings_and_revoke.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/tests/test_local_bind_commands.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/tests/test_publish_script.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/tests/test_runtime_credentials.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/tests/test_session_credentials.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/tests/test_silent_install.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/tests/test_upgrade_observability.py +0 -0
- {forgexa_cli-1.98.3 → forgexa_cli-1.98.4}/tests/test_workspace_storage.py +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""forgexa-cli — Forgexa command-line client."""
|
|
2
|
-
__version__ = "1.98.
|
|
2
|
+
__version__ = "1.98.4"
|
|
@@ -2098,11 +2098,12 @@ class AgentDiscovery:
|
|
|
2098
2098
|
if additions:
|
|
2099
2099
|
os.environ["PATH"] = os.pathsep.join(additions) + os.pathsep + current
|
|
2100
2100
|
logger.debug("Expanded PATH with: %s", ", ".join(additions))
|
|
2101
|
-
|
|
2102
|
-
|
|
2101
|
+
for component in (*AgentDiscovery.AGENT_REGISTRY, "forgexa.ocr"):
|
|
2102
|
+
official_base = home / ".forgexa" / "official" / component
|
|
2103
|
+
official_bin = official_base if is_win else official_base / "bin"
|
|
2103
2104
|
current = os.environ.get("PATH", "")
|
|
2104
|
-
if
|
|
2105
|
-
os.environ["PATH"] = os.pathsep.join(filter(None, (current, str(
|
|
2105
|
+
if official_bin.is_dir() and str(official_bin) not in current.split(os.pathsep):
|
|
2106
|
+
os.environ["PATH"] = os.pathsep.join(filter(None, (current, str(official_bin))))
|
|
2106
2107
|
|
|
2107
2108
|
@staticmethod
|
|
2108
2109
|
def _wsl_windows_executable(path: str) -> bool:
|
|
@@ -2224,7 +2225,11 @@ class AgentDiscovery:
|
|
|
2224
2225
|
async def _discover_instance(
|
|
2225
2226
|
self, agent_id: str, spec: dict, managed: Any = None
|
|
2226
2227
|
) -> DiscoveredAgent | None:
|
|
2227
|
-
|
|
2228
|
+
selected_path, selected_revision = (
|
|
2229
|
+
await asyncio.to_thread(component_runtime.selected_external_agent_selection, agent_id)
|
|
2230
|
+
if managed is None else (None, None)
|
|
2231
|
+
)
|
|
2232
|
+
custom_path = selected_path or os.environ.get(spec.get("env_path_override", ""))
|
|
2228
2233
|
cmd = managed.argv_prefix[-1] if managed is not None else custom_path or spec["commands"][0]
|
|
2229
2234
|
resolved = shutil.which(cmd)
|
|
2230
2235
|
if resolved:
|
|
@@ -2288,7 +2293,7 @@ class AgentDiscovery:
|
|
|
2288
2293
|
min_version_ok=min_version_ok,
|
|
2289
2294
|
version_warning=version_warning,
|
|
2290
2295
|
installation_id=managed.receipt["installation_id"] if managed is not None else None,
|
|
2291
|
-
selection_revision=managed.selection_revision if managed is not None else
|
|
2296
|
+
selection_revision=managed.selection_revision if managed is not None else selected_revision,
|
|
2292
2297
|
)
|
|
2293
2298
|
logger.info("Discovered agent: %s v%s (%s)", agent_id, version, resolved)
|
|
2294
2299
|
if managed is not None:
|
|
@@ -917,6 +917,20 @@ def _require_absent_unverified_selection(root: Path, component_id: str) -> None:
|
|
|
917
917
|
raise ComponentRuntimeError("component_platform_unverified")
|
|
918
918
|
|
|
919
919
|
|
|
920
|
+
def _valid_external_selection_path(path: Any) -> bool:
|
|
921
|
+
if not isinstance(path, str) or not path.startswith("/"):
|
|
922
|
+
return False
|
|
923
|
+
try:
|
|
924
|
+
if len(path.encode("utf-8")) > 4096:
|
|
925
|
+
return False
|
|
926
|
+
except UnicodeEncodeError:
|
|
927
|
+
return False
|
|
928
|
+
return (
|
|
929
|
+
not any(ord(character) < 32 or ord(character) == 127 or character == ":" for character in path)
|
|
930
|
+
and all(part not in {"", ".", ".."} for part in path.split("/")[1:])
|
|
931
|
+
)
|
|
932
|
+
|
|
933
|
+
|
|
920
934
|
def _acquire_component(
|
|
921
935
|
component_id: str, root: Path | None = None, override: str | None = None,
|
|
922
936
|
kind: str = "agent",
|
|
@@ -945,7 +959,7 @@ def _acquire_component(
|
|
|
945
959
|
"installation_id",
|
|
946
960
|
"enabled",
|
|
947
961
|
},
|
|
948
|
-
optional_fields={"external"},
|
|
962
|
+
optional_fields={"external", "external_path"},
|
|
949
963
|
)
|
|
950
964
|
if selection is None:
|
|
951
965
|
return None
|
|
@@ -964,7 +978,9 @@ def _acquire_component(
|
|
|
964
978
|
external = selection.get("external")
|
|
965
979
|
if (external is not None and external is not True) or (
|
|
966
980
|
external is True and (selection["installation_id"] is not None or kind != "agent")
|
|
967
|
-
)
|
|
981
|
+
) or ("external_path" in selection and (
|
|
982
|
+
external is not True or not _valid_external_selection_path(selection["external_path"])
|
|
983
|
+
)):
|
|
968
984
|
raise ComponentRuntimeError("component_selection_invalid")
|
|
969
985
|
if not selection["enabled"]:
|
|
970
986
|
raise ComponentRuntimeError("component_disabled")
|
|
@@ -1096,6 +1112,44 @@ def acquire_component(
|
|
|
1096
1112
|
raise ComponentRuntimeError("component_storage_unavailable") from error
|
|
1097
1113
|
|
|
1098
1114
|
|
|
1115
|
+
def selected_external_agent_selection(component_id: str, root: Path | None = None) -> tuple[str | None, int | None]:
|
|
1116
|
+
_identifier(component_id)
|
|
1117
|
+
root = default_store_root() if root is None else root
|
|
1118
|
+
if root.is_symlink():
|
|
1119
|
+
raise ComponentRuntimeError("component_storage_invalid")
|
|
1120
|
+
if not root.exists():
|
|
1121
|
+
return None, None
|
|
1122
|
+
try:
|
|
1123
|
+
if os.name != "posix" or os.environ.get("WSL_DISTRO_NAME"):
|
|
1124
|
+
_require_absent_unverified_selection(root, component_id)
|
|
1125
|
+
return None, None
|
|
1126
|
+
with _ComponentManagerLock(root):
|
|
1127
|
+
selection = _record(
|
|
1128
|
+
root / "selections" / f"{component_id}.json",
|
|
1129
|
+
{"schema_version", "target_id", "component_id", "revision", "installation_id", "enabled"},
|
|
1130
|
+
optional_fields={"external", "external_path"},
|
|
1131
|
+
)
|
|
1132
|
+
if selection is None:
|
|
1133
|
+
return None, None
|
|
1134
|
+
target = _component_target(root)
|
|
1135
|
+
if (
|
|
1136
|
+
selection["target_id"] != target["target_id"] or selection["component_id"] != component_id
|
|
1137
|
+
or type(selection["revision"]) is not int or not 0 <= selection["revision"] <= 9_007_199_254_740_991
|
|
1138
|
+
or type(selection["enabled"]) is not bool
|
|
1139
|
+
):
|
|
1140
|
+
raise ComponentRuntimeError("component_selection_invalid")
|
|
1141
|
+
if not selection["enabled"]:
|
|
1142
|
+
raise ComponentRuntimeError("component_disabled")
|
|
1143
|
+
if selection.get("external") is not True or selection["installation_id"] is not None:
|
|
1144
|
+
raise ComponentRuntimeError("component_selection_changed")
|
|
1145
|
+
path = selection.get("external_path")
|
|
1146
|
+
if path is not None and not _valid_external_selection_path(path):
|
|
1147
|
+
raise ComponentRuntimeError("component_selection_invalid")
|
|
1148
|
+
return path, selection["revision"]
|
|
1149
|
+
except OSError as error:
|
|
1150
|
+
raise ComponentRuntimeError("component_storage_unavailable") from error
|
|
1151
|
+
|
|
1152
|
+
|
|
1099
1153
|
def require_unselected_component(component_id: str, root: Path | None = None) -> None:
|
|
1100
1154
|
_identifier(component_id)
|
|
1101
1155
|
root = default_store_root() if root is None else root
|
|
@@ -1203,8 +1257,13 @@ def admit_execution(
|
|
|
1203
1257
|
) -> ManagedComponentLease | None:
|
|
1204
1258
|
lease = acquire_component(component_id, root=root, override=override)
|
|
1205
1259
|
if lease is None:
|
|
1206
|
-
if installation_id is not None
|
|
1260
|
+
if installation_id is not None:
|
|
1207
1261
|
raise ComponentRuntimeError("component_instance_missing")
|
|
1262
|
+
selected_path, selected_revision = selected_external_agent_selection(component_id, root)
|
|
1263
|
+
if selected_revision != selection_revision:
|
|
1264
|
+
raise ComponentRuntimeError("component_selection_changed")
|
|
1265
|
+
if selected_path is not None and os.path.realpath(binary_path) != os.path.realpath(selected_path):
|
|
1266
|
+
raise ComponentRuntimeError("component_instance_changed")
|
|
1208
1267
|
validate_external_executable(binary_path, root)
|
|
1209
1268
|
return None
|
|
1210
1269
|
try:
|
|
@@ -1412,7 +1412,7 @@ except (ImportError, ModuleNotFoundError):
|
|
|
1412
1412
|
# DAEMON_VERSION is the protocol/logic version of the daemon code.
|
|
1413
1413
|
# Kept in sync with pyproject.toml version via bump-version.sh.
|
|
1414
1414
|
# CLIENT_TYPE identifies which packaging/distribution this daemon runs in.
|
|
1415
|
-
DAEMON_VERSION = "1.98.
|
|
1415
|
+
DAEMON_VERSION = "1.98.4"
|
|
1416
1416
|
|
|
1417
1417
|
|
|
1418
1418
|
def _detect_client_type() -> str:
|
|
@@ -262,8 +262,9 @@ async def run_ocr_delegation(
|
|
|
262
262
|
*,
|
|
263
263
|
external_executable: Path | None = None,
|
|
264
264
|
expected_external_instance: str | None = None,
|
|
265
|
+
_wsl_guarded: bool = False,
|
|
265
266
|
) -> dict[str, Any]:
|
|
266
|
-
if os.name != "posix" or os.environ.get("WSL_DISTRO_NAME"):
|
|
267
|
+
if os.name != "posix" or (os.environ.get("WSL_DISTRO_NAME") and not _wsl_guarded):
|
|
267
268
|
raise OcrAdapterError("ocr_platform_unverified")
|
|
268
269
|
if (lease is None) == (external_executable is None):
|
|
269
270
|
raise OcrAdapterError("ocr_instance_unavailable")
|
|
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
|