forgexa-cli 1.107.3__tar.gz → 1.108.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.107.3 → forgexa_cli-1.108.0}/PKG-INFO +1 -1
  2. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/__init__.py +1 -1
  3. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/agent_core.py +95 -0
  4. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/daemon.py +33 -76
  5. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli.egg-info/PKG-INFO +1 -1
  6. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/pyproject.toml +1 -1
  7. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/README.md +0 -0
  8. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/_build_config.py +0 -0
  9. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/_local_bind.py +0 -0
  10. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/autoupgrade.py +0 -0
  11. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/aws_evidence.py +0 -0
  12. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/aws_logs_evidence.py +0 -0
  13. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/code_review_rules.py +0 -0
  14. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/component_runtime.py +0 -0
  15. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/main.py +0 -0
  16. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/observability_contract.py +0 -0
  17. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/observability_evidence.py +0 -0
  18. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/ocr_adapter.py +0 -0
  19. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/py.typed +0 -0
  20. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/runtime_evidence.py +0 -0
  21. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/workspace_storage.py +0 -0
  22. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli/zcode_protocol.py +0 -0
  23. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli.egg-info/SOURCES.txt +0 -0
  24. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli.egg-info/dependency_links.txt +0 -0
  25. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli.egg-info/entry_points.txt +0 -0
  26. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli.egg-info/requires.txt +0 -0
  27. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/forgexa_cli.egg-info/top_level.txt +0 -0
  28. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/setup.cfg +0 -0
  29. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/tests/test_auth_and_runtime_commands.py +0 -0
  30. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/tests/test_autoupgrade.py +0 -0
  31. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/tests/test_check_command.py +0 -0
  32. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/tests/test_delivery_review_packaged.py +0 -0
  33. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/tests/test_expiry_warnings_and_revoke.py +0 -0
  34. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/tests/test_local_bind_commands.py +0 -0
  35. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/tests/test_publish_script.py +0 -0
  36. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/tests/test_runtime_credentials.py +0 -0
  37. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/tests/test_session_credentials.py +0 -0
  38. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/tests/test_silent_install.py +0 -0
  39. {forgexa_cli-1.107.3 → forgexa_cli-1.108.0}/tests/test_upgrade_observability.py +0 -0
  40. {forgexa_cli-1.107.3 → forgexa_cli-1.108.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.107.3
3
+ Version: 1.108.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.107.3"
2
+ __version__ = "1.108.0"
@@ -3263,6 +3263,8 @@ def _parse_claude_output(stdout: str) -> dict:
3263
3263
  for data in reversed(parsed):
3264
3264
  if data.get("type") == "result":
3265
3265
  _extract_from(data)
3266
+ if data.get("subtype") == "error_max_turns":
3267
+ metrics["claude_result_subtype"] = "error_max_turns"
3266
3268
  break
3267
3269
 
3268
3270
  # ── 4. Fallback: scan all lines for any usage/cost data ──
@@ -3937,6 +3939,99 @@ def delivery_review_linux_command(
3937
3939
  return [*wrapped, "--chdir", str(workspace), "--", *command]
3938
3940
 
3939
3941
 
3942
+ def delivery_review_sandbox_command(
3943
+ command: list[str], workspace: Path, home: Path, *, writable: bool,
3944
+ network: bool = True, read_paths: list[Path] | None = None,
3945
+ allow_claude_tmp: bool = False, deny_paths: list[Path] | None = None,
3946
+ restrict_global_reads: bool = False,
3947
+ ) -> list[str]:
3948
+ sandbox = delivery_review_sandbox_exec()
3949
+ if not sandbox:
3950
+ raise RuntimeError("delivery_review_sandbox_unavailable")
3951
+ user_home_path = Path.home().resolve()
3952
+ workspace_path = workspace.resolve()
3953
+ home_path = home.resolve()
3954
+ if (workspace_path == user_home_path or workspace_path in user_home_path.parents
3955
+ or home_path == user_home_path or home_path in user_home_path.parents
3956
+ or workspace_path == home_path or workspace_path in home_path.parents or home_path in workspace_path.parents):
3957
+ raise RuntimeError("delivery_review_sandbox_scope_invalid")
3958
+ claude_tmp = Path("/tmp").resolve() / f"claude-{os.getuid()}"
3959
+ allowed = [
3960
+ f"(subpath {json.dumps(str(home_path))})",
3961
+ '(literal "/dev/null")',
3962
+ ]
3963
+ if allow_claude_tmp:
3964
+ if workspace_path == claude_tmp or claude_tmp in workspace_path.parents:
3965
+ raise RuntimeError("delivery_review_sandbox_scope_invalid")
3966
+ allowed.append(f"(subpath {json.dumps(str(claude_tmp))})")
3967
+ if writable:
3968
+ allowed.append(f"(subpath {json.dumps(str(workspace_path))})")
3969
+ profile = "(version 1)(allow default)(deny file-write*)(allow file-write* " + " ".join(allowed) + ")"
3970
+ user_home = str(user_home_path)
3971
+ executable = shutil.which(command[0]) or command[0]
3972
+ executable_path = Path(executable).absolute()
3973
+ read_roots = {str(executable_path.parent), str(executable_path.resolve().parent)}
3974
+ read_roots.update(str(path.resolve()) for path in (read_paths or []))
3975
+ virtualenv = executable_path.parent.parent
3976
+ if (virtualenv / "pyvenv.cfg").is_file():
3977
+ read_roots.add(str(virtualenv))
3978
+ if sys.platform == "linux":
3979
+ node_executable = shutil.which("node")
3980
+ if node_executable:
3981
+ read_roots.add(str(Path(node_executable).resolve().parent))
3982
+ for parent in executable_path.resolve().parents:
3983
+ if parent == user_home_path or parent in user_home_path.parents:
3984
+ break
3985
+ if (parent / "package.json").is_file():
3986
+ read_roots.add(str(parent))
3987
+ break
3988
+ if any(Path(root) == user_home_path or Path(root) in user_home_path.parents for root in read_roots):
3989
+ raise RuntimeError("delivery_review_sandbox_scope_invalid")
3990
+ if sys.platform == "linux":
3991
+ return delivery_review_linux_command(
3992
+ command, cwd=workspace_path, home=home_path, writable=writable, network=network,
3993
+ read_paths=[Path(root) for root in read_roots], deny_paths=deny_paths,
3994
+ )
3995
+ executable_rules = " ".join(f"(subpath {json.dumps(root)})" for root in sorted(read_roots))
3996
+ metadata_paths = {
3997
+ str(parent) for root in [*read_roots, str(workspace.resolve()), str(home.resolve())]
3998
+ for parent in Path(root).parents
3999
+ }
4000
+ metadata_rules = " ".join(f"(literal {json.dumps(path)})" for path in sorted(metadata_paths))
4001
+ if restrict_global_reads:
4002
+ system_read_roots = (
4003
+ "/System/Library", "/usr/lib", "/usr/libexec", "/usr/share/icu", "/usr/share/zoneinfo",
4004
+ "/Library/Apple", "/private/etc/ssl", "/dev",
4005
+ )
4006
+ readable = [
4007
+ *(f"(subpath {json.dumps(root)})" for root in system_read_roots),
4008
+ *(f"(subpath {json.dumps(root)})" for root in sorted(read_roots)),
4009
+ f"(subpath {json.dumps(str(workspace_path))})",
4010
+ f"(subpath {json.dumps(str(home_path))})",
4011
+ *(f"(literal {json.dumps(path)})" for path in sorted(metadata_paths)),
4012
+ ]
4013
+ profile += "(deny file-read-data (require-all " + " ".join(
4014
+ f"(require-not {rule})" for rule in readable
4015
+ ) + "))"
4016
+ profile += (
4017
+ f"(deny file-read* (subpath {json.dumps(user_home)}))"
4018
+ f"(allow file-read-metadata {metadata_rules})"
4019
+ f"(allow file-read-data {metadata_rules})"
4020
+ f"(allow file-read* (subpath {json.dumps(str(workspace.resolve()))}) "
4021
+ f"(subpath {json.dumps(str(home.resolve()))}) {executable_rules})"
4022
+ )
4023
+ profile += "(deny file-read-data " + " ".join(
4024
+ f"(regex #{json.dumps(pattern)})" for pattern in DELIVERY_REVIEW_SENSITIVE_PATTERNS
4025
+ ) + ")"
4026
+ if deny_paths:
4027
+ profile += "(deny file-read* " + " ".join(
4028
+ f"(literal {json.dumps(str(path.resolve()))})" for path in deny_paths
4029
+ ) + ")"
4030
+ if not network:
4031
+ profile += "(deny network*)"
4032
+ return [sandbox, "-p", profile, *command]
4033
+
4034
+
3940
4035
  _OPENCODE_WORKER_DENIED_TOOLS = (
3941
4036
  "task", "subagent", "delegate_task", "call_omo_agent",
3942
4037
  "background_output", "background_cancel",
@@ -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.107.3"
1431
+ DAEMON_VERSION = "1.108.0"
1432
1432
 
1433
1433
 
1434
1434
  def _detect_client_type() -> str:
@@ -6745,76 +6745,10 @@ def _delivery_review_agent_env(agent_id: str, env: dict[str, str], home: Path) -
6745
6745
  def _delivery_review_sandbox_command(command: list[str], workspace: Path, home: Path, *, writable: bool,
6746
6746
  network: bool = True, read_paths: list[Path] | None = None,
6747
6747
  allow_claude_tmp: bool = False, deny_paths: list[Path] | None = None) -> list[str]:
6748
- sandbox = agent_core.delivery_review_sandbox_exec()
6749
- if not sandbox:
6750
- raise RuntimeError("delivery_review_sandbox_unavailable")
6751
- user_home_path = Path.home().resolve()
6752
- workspace_path = workspace.resolve()
6753
- home_path = home.resolve()
6754
- if (workspace_path == user_home_path or workspace_path in user_home_path.parents
6755
- or home_path == user_home_path or home_path in user_home_path.parents
6756
- or workspace_path == home_path or workspace_path in home_path.parents or home_path in workspace_path.parents):
6757
- raise RuntimeError("delivery_review_sandbox_scope_invalid")
6758
- claude_tmp = Path("/tmp").resolve() / f"claude-{os.getuid()}"
6759
- allowed = [
6760
- f"(subpath {json.dumps(str(home_path))})",
6761
- '(literal "/dev/null")',
6762
- ]
6763
- if allow_claude_tmp:
6764
- if workspace_path == claude_tmp or claude_tmp in workspace_path.parents:
6765
- raise RuntimeError("delivery_review_sandbox_scope_invalid")
6766
- allowed.append(f"(subpath {json.dumps(str(claude_tmp))})")
6767
- if writable:
6768
- allowed.append(f"(subpath {json.dumps(str(workspace_path))})")
6769
- profile = "(version 1)(allow default)(deny file-write*)(allow file-write* " + " ".join(allowed) + ")"
6770
- user_home = str(user_home_path)
6771
- executable = shutil.which(command[0]) or command[0]
6772
- executable_path = Path(executable).absolute()
6773
- read_roots = {str(executable_path.parent), str(executable_path.resolve().parent)}
6774
- read_roots.update(str(path.resolve()) for path in (read_paths or []))
6775
- virtualenv = executable_path.parent.parent
6776
- if (virtualenv / "pyvenv.cfg").is_file():
6777
- read_roots.add(str(virtualenv))
6778
- if sys.platform == "linux":
6779
- node_executable = shutil.which("node")
6780
- if node_executable:
6781
- read_roots.add(str(Path(node_executable).resolve().parent))
6782
- for parent in executable_path.resolve().parents:
6783
- if parent == user_home_path or parent in user_home_path.parents:
6784
- break
6785
- if (parent / "package.json").is_file():
6786
- read_roots.add(str(parent))
6787
- break
6788
- if any(Path(root) == user_home_path or Path(root) in user_home_path.parents for root in read_roots):
6789
- raise RuntimeError("delivery_review_sandbox_scope_invalid")
6790
- if sys.platform == "linux":
6791
- return agent_core.delivery_review_linux_command(
6792
- command, cwd=workspace_path, home=home_path, writable=writable, network=network,
6793
- read_paths=[Path(root) for root in read_roots], deny_paths=deny_paths,
6794
- )
6795
- executable_rules = " ".join(f"(subpath {json.dumps(root)})" for root in sorted(read_roots))
6796
- metadata_paths = {
6797
- str(parent) for root in [*read_roots, str(workspace.resolve()), str(home.resolve())]
6798
- for parent in Path(root).parents
6799
- }
6800
- metadata_rules = " ".join(f"(literal {json.dumps(path)})" for path in sorted(metadata_paths))
6801
- profile += (
6802
- f"(deny file-read* (subpath {json.dumps(user_home)}))"
6803
- f"(allow file-read-metadata {metadata_rules})"
6804
- f"(allow file-read-data {metadata_rules})"
6805
- f"(allow file-read* (subpath {json.dumps(str(workspace.resolve()))}) "
6806
- f"(subpath {json.dumps(str(home.resolve()))}) {executable_rules})"
6748
+ return agent_core.delivery_review_sandbox_command(
6749
+ command, workspace, home, writable=writable, network=network, read_paths=read_paths,
6750
+ allow_claude_tmp=allow_claude_tmp, deny_paths=deny_paths,
6807
6751
  )
6808
- profile += "(deny file-read-data " + " ".join(
6809
- f"(regex #{json.dumps(pattern)})" for pattern in agent_core.DELIVERY_REVIEW_SENSITIVE_PATTERNS
6810
- ) + ")"
6811
- if deny_paths:
6812
- profile += "(deny file-read* " + " ".join(
6813
- f"(literal {json.dumps(str(path.resolve()))})" for path in deny_paths
6814
- ) + ")"
6815
- if not network:
6816
- profile += "(deny network*)"
6817
- return [sandbox, "-p", profile, *command]
6818
6752
 
6819
6753
 
6820
6754
  class ProcessManager:
@@ -7941,6 +7875,19 @@ class ProcessManager:
7941
7875
 
7942
7876
  # Parse Claude JSON output for metrics
7943
7877
  metrics = self._parse_claude_output(stdout)
7878
+ if metrics.get("claude_result_subtype") == "error_max_turns":
7879
+ return TaskResult(
7880
+ status="failed",
7881
+ exit_code=returncode or 1,
7882
+ stdout=stdout[-settings.AGENT_MAX_OUTPUT_SIZE:],
7883
+ stderr=stderr[-10000:],
7884
+ error=(
7885
+ f"Claude reached its maximum number of turns ({max_turns}). "
7886
+ "Review the retained output and narrow the task before retrying."
7887
+ ),
7888
+ failure_code="agent_turn_limit",
7889
+ metrics=metrics,
7890
+ )
7944
7891
  structured_errors = self._extract_output_signals("\n".join(part for part in (stdout, stderr) if part))["error_messages"]
7945
7892
  structured_error_text = "; ".join(str(msg).strip() for msg in structured_errors if str(msg).strip())
7946
7893
 
@@ -15583,8 +15530,13 @@ class RuntimeDaemon:
15583
15530
  review_context_json = json.dumps(review_context, ensure_ascii=False)
15584
15531
  except (TypeError, ValueError):
15585
15532
  return failed("delivery_review_scope_incomplete", "Review context is invalid")
15586
- if len(review_context_json.encode("utf-8")) > _RUNTIME_CRITIC_OUTPUT_MAX_CHARS:
15587
- return failed("delivery_review_scope_incomplete", "Review context exceeds the safe input budget")
15533
+ context_bytes = len(review_context_json.encode("utf-8"))
15534
+ if context_bytes > _DELIVERY_REVIEW_PROMPT_MAX_BYTES:
15535
+ return failed(
15536
+ "delivery_review_scope_incomplete",
15537
+ f"Review context alone exceeds the input budget ({context_bytes} bytes; "
15538
+ f"limit {_DELIVERY_REVIEW_PROMPT_MAX_BYTES} bytes)",
15539
+ )
15588
15540
  prompt_prefix = (
15589
15541
  "Review this requirement's cumulative changes against the supplied requirement. "
15590
15542
  "Read relevant callers when needed. Do not edit files, run commands, commit or push. "
@@ -15641,13 +15593,18 @@ class RuntimeDaemon:
15641
15593
  while True:
15642
15594
  batch_prompts = [assemble_prompt(index, batch_paths, batch_diff, recheck_by_batch[index])
15643
15595
  for index, (batch_paths, batch_diff) in enumerate(batches)]
15644
- oversized = next((index for index, (prompt, _) in enumerate(batch_prompts)
15645
- if snapshot is not None and len(prompt.encode("utf-8")) > _DELIVERY_REVIEW_PROMPT_MAX_BYTES), None)
15596
+ prompt_bytes = [len(prompt.encode("utf-8")) for prompt, _ in batch_prompts]
15597
+ oversized = next((index for index, size in enumerate(prompt_bytes)
15598
+ if size > _DELIVERY_REVIEW_PROMPT_MAX_BYTES), None)
15646
15599
  if oversized is None:
15647
15600
  break
15648
15601
  oversized_paths = batches[oversized][0]
15649
15602
  if len(oversized_paths) < 2 or len(batches) >= 8:
15650
- return failed("delivery_review_scope_incomplete", "A complete review prompt exceeds the input budget")
15603
+ return failed(
15604
+ "delivery_review_scope_incomplete",
15605
+ f"A complete review prompt exceeds the input budget ({prompt_bytes[oversized]} bytes; "
15606
+ f"limit {_DELIVERY_REVIEW_PROMPT_MAX_BYTES} bytes)",
15607
+ )
15651
15608
  file_diffs = []
15652
15609
  try:
15653
15610
  for path in oversized_paths:
@@ -15674,7 +15631,7 @@ class RuntimeDaemon:
15674
15631
  "recheck_issue_ids": [issue["id"] for issue in recheck_by_batch[index]]}
15675
15632
  for index, (batch_paths, _) in enumerate(batches)
15676
15633
  ]
15677
- metadata["prompt_bytes"] = [len(prompt.encode("utf-8")) for prompt, _ in batch_prompts]
15634
+ metadata["prompt_bytes"] = prompt_bytes
15678
15635
 
15679
15636
  summaries, issues, combined_metrics, rechecked = [], [], {}, []
15680
15637
  deadline = time.monotonic() + (task.timeout_seconds or settings.AGENT_TIMEOUT)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: forgexa-cli
3
- Version: 1.107.3
3
+ Version: 1.108.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.107.3"
3
+ version = "1.108.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