forgexa-cli 1.108.2__tar.gz → 1.109.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.108.2 → forgexa_cli-1.109.4}/PKG-INFO +1 -1
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/__init__.py +1 -1
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/agent_core.py +166 -19
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/daemon.py +1 -1
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/zcode_protocol.py +3 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli.egg-info/PKG-INFO +1 -1
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/pyproject.toml +1 -1
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/README.md +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/_build_config.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/_local_bind.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/autoupgrade.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/aws_evidence.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/aws_logs_evidence.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/code_review_rules.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/component_runtime.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/main.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/observability_contract.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/observability_evidence.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/ocr_adapter.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/py.typed +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/runtime_evidence.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli/workspace_storage.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli.egg-info/SOURCES.txt +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli.egg-info/dependency_links.txt +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli.egg-info/entry_points.txt +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli.egg-info/requires.txt +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/forgexa_cli.egg-info/top_level.txt +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/setup.cfg +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/tests/test_auth_and_runtime_commands.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/tests/test_autoupgrade.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/tests/test_check_command.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/tests/test_delivery_review_packaged.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/tests/test_expiry_warnings_and_revoke.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/tests/test_local_bind_commands.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/tests/test_publish_script.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/tests/test_runtime_credentials.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/tests/test_session_credentials.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/tests/test_silent_install.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/tests/test_upgrade_observability.py +0 -0
- {forgexa_cli-1.108.2 → forgexa_cli-1.109.4}/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.109.4"
|
|
@@ -3879,6 +3879,26 @@ def delivery_review_sandbox_exec() -> str | None:
|
|
|
3879
3879
|
return executable
|
|
3880
3880
|
|
|
3881
3881
|
|
|
3882
|
+
def project_review_node_read_paths(node: str) -> set[Path]:
|
|
3883
|
+
node_path = Path(node).resolve()
|
|
3884
|
+
node_root = node_path.parent
|
|
3885
|
+
paths = {node_root, node_root.parent / "lib"}
|
|
3886
|
+
if sys.platform == "darwin" and Path("/usr/bin/otool").is_file():
|
|
3887
|
+
try:
|
|
3888
|
+
result = subprocess.run(
|
|
3889
|
+
["/usr/bin/otool", "-L", str(node_path)],
|
|
3890
|
+
capture_output=True, text=True, timeout=5, check=False,
|
|
3891
|
+
)
|
|
3892
|
+
except (OSError, subprocess.SubprocessError):
|
|
3893
|
+
result = None
|
|
3894
|
+
if result and result.returncode == 0:
|
|
3895
|
+
for line in result.stdout.splitlines()[1:]:
|
|
3896
|
+
match = re.match(r"\s*(/.*) \(compatibility version ", line)
|
|
3897
|
+
if match and not match[1].startswith(("/usr/lib/", "/System/Library/")):
|
|
3898
|
+
paths.add(Path(match[1]).resolve().parent)
|
|
3899
|
+
return {path.resolve() for path in paths if path.exists()}
|
|
3900
|
+
|
|
3901
|
+
|
|
3882
3902
|
def delivery_review_linux_command(
|
|
3883
3903
|
command: list[str], *, cwd: Path, home: Path, writable: bool = False, network: bool = True,
|
|
3884
3904
|
read_paths: list[Path] | None = None, write_paths: list[Path] | None = None,
|
|
@@ -4391,16 +4411,21 @@ def approve_minimax_build(binary: str, evidence: dict) -> dict:
|
|
|
4391
4411
|
def build_minimax_command(
|
|
4392
4412
|
binary: str, *, cwd: str | Path, config: str | Path,
|
|
4393
4413
|
timeout: float = 300, max_steps: int = 60, model: str | None = None,
|
|
4394
|
-
session_id: str | None = None,
|
|
4414
|
+
session_id: str | None = None, project_review: bool = False,
|
|
4395
4415
|
) -> list[str]:
|
|
4396
4416
|
if type(timeout) not in (int, float) or not math.isfinite(timeout) or timeout <= 0 or type(max_steps) is not int or not 1 <= max_steps <= 1000:
|
|
4397
4417
|
raise ValueError("MiniMax requires a positive timeout and a bounded step budget")
|
|
4418
|
+
if project_review and session_id is not None:
|
|
4419
|
+
raise ValueError("MiniMax project review cannot resume a native session")
|
|
4398
4420
|
command = [binary, "exec", "--cwd", str(Path(cwd).resolve()), "--input", "-",
|
|
4399
|
-
"--input-format", "text", "--output-format", "stream-json", "--mode",
|
|
4421
|
+
"--input-format", "text", "--output-format", "stream-json", "--mode",
|
|
4422
|
+
"lightweight" if project_review else "standard",
|
|
4400
4423
|
"--prompt-mode", "coding", "--permission", "smart", "--config", str(config),
|
|
4401
|
-
"--timeout", f"{timeout
|
|
4424
|
+
"--timeout", f"{math.ceil(timeout)}s", "--max-steps", str(max_steps)]
|
|
4402
4425
|
if model is not None:
|
|
4403
|
-
if not re.fullmatch(
|
|
4426
|
+
if not re.fullmatch(
|
|
4427
|
+
r"(?:custom_provider:)?[A-Za-z0-9._-]+/[A-Za-z0-9._:/-]+(?:#[A-Za-z0-9._-]+)?", model,
|
|
4428
|
+
):
|
|
4404
4429
|
raise ValueError("Invalid MiniMax provider/model reference")
|
|
4405
4430
|
command += ["--model", model]
|
|
4406
4431
|
if session_id is not None:
|
|
@@ -4479,6 +4504,7 @@ async def run_minimax(
|
|
|
4479
4504
|
cancel_requested: Any = None,
|
|
4480
4505
|
component_lease: Any = None,
|
|
4481
4506
|
read_only: bool = False, delivery_review: bool = False,
|
|
4507
|
+
review_home: Path | None = None, review_source: Path | None = None,
|
|
4482
4508
|
) -> dict:
|
|
4483
4509
|
lease = (
|
|
4484
4510
|
component_lease if component_lease is not None else component_runtime.current_execution()
|
|
@@ -4492,10 +4518,29 @@ async def run_minimax(
|
|
|
4492
4518
|
stderr_bytes = 0
|
|
4493
4519
|
deadline = time.monotonic()
|
|
4494
4520
|
try:
|
|
4495
|
-
if
|
|
4521
|
+
if review_home is not None and (
|
|
4522
|
+
sys.platform != "darwin"
|
|
4523
|
+
or not read_only
|
|
4524
|
+
or not delivery_review
|
|
4525
|
+
or session_id is not None
|
|
4526
|
+
or review_source is None
|
|
4527
|
+
or lease is not None
|
|
4528
|
+
):
|
|
4529
|
+
raise RuntimeError(
|
|
4530
|
+
"MiniMax project review requires an isolated, non-resumable macOS session"
|
|
4531
|
+
)
|
|
4532
|
+
if (
|
|
4533
|
+
type(timeout) not in (int, float)
|
|
4534
|
+
or not math.isfinite(timeout)
|
|
4535
|
+
or timeout <= 0
|
|
4536
|
+
):
|
|
4496
4537
|
raise ValueError("MiniMax requires a finite positive host deadline")
|
|
4497
4538
|
deadline += timeout
|
|
4498
|
-
if
|
|
4539
|
+
if (
|
|
4540
|
+
not isinstance(prompt, str)
|
|
4541
|
+
or not prompt.strip()
|
|
4542
|
+
or len(prompt.encode("utf-8")) > MINIMAX_MAX_OUTPUT_BYTES
|
|
4543
|
+
):
|
|
4499
4544
|
raise ValueError("MiniMax prompt is empty or exceeds the input budget")
|
|
4500
4545
|
issue = await asyncio.wait_for(asyncio.to_thread(minimax_verification_issue, binary),
|
|
4501
4546
|
timeout=max(0.001, deadline - time.monotonic()))
|
|
@@ -4520,7 +4565,9 @@ async def run_minimax(
|
|
|
4520
4565
|
raise RuntimeError("MiniMax model override is not authorized by the accepted profile policy")
|
|
4521
4566
|
binding_identity = hashlib.sha256(json.dumps({
|
|
4522
4567
|
"admission": admission["fingerprint"], "workspace": str(cwd),
|
|
4523
|
-
"model": model, "prompt_mode": "coding",
|
|
4568
|
+
"model": model, "prompt_mode": "coding",
|
|
4569
|
+
"context_mode": "lightweight" if review_home is not None else "standard",
|
|
4570
|
+
"read_only": read_only,
|
|
4524
4571
|
}, sort_keys=True).encode()).hexdigest()
|
|
4525
4572
|
if session_id:
|
|
4526
4573
|
binding = root / "bindings" / (hashlib.sha256(session_id.encode()).hexdigest() + ".json")
|
|
@@ -4532,23 +4579,106 @@ async def run_minimax(
|
|
|
4532
4579
|
raise RuntimeError("MiniMax profile has an interrupted run; process-tree recovery is required")
|
|
4533
4580
|
temporary = tempfile.TemporaryDirectory(prefix="run-", dir=root)
|
|
4534
4581
|
temporary_root = Path(temporary.name)
|
|
4582
|
+
config = root / "config/runtime.json"
|
|
4583
|
+
environment = minimax_base_env(root, temporary_root)
|
|
4584
|
+
review_paths = []
|
|
4585
|
+
auth = None
|
|
4586
|
+
if review_home is not None:
|
|
4587
|
+
private = review_home.resolve()
|
|
4588
|
+
node = Path(admission["build"]["node"]).resolve()
|
|
4589
|
+
package = Path(admission["build"]["package_root"]).resolve()
|
|
4590
|
+
review_paths = [*project_review_node_read_paths(str(node)), package]
|
|
4591
|
+
source = review_source.resolve()
|
|
4592
|
+
if any(
|
|
4593
|
+
path == source or path in source.parents or source in path.parents
|
|
4594
|
+
for path in [root.resolve(), *review_paths]
|
|
4595
|
+
):
|
|
4596
|
+
raise RuntimeError("MiniMax review runtime overlaps the original repository")
|
|
4597
|
+
data = private / "data"
|
|
4598
|
+
data.mkdir(mode=0o700)
|
|
4599
|
+
for config_source, target in (
|
|
4600
|
+
(root / "data/config.yaml", data / "config.yaml"),
|
|
4601
|
+
(config, private / "runtime.json"),
|
|
4602
|
+
):
|
|
4603
|
+
shutil.copyfile(_minimax_private_path(config_source), target)
|
|
4604
|
+
target.chmod(0o600)
|
|
4605
|
+
config = private / "runtime.json"
|
|
4606
|
+
auth_source = root / "data/auth"
|
|
4607
|
+
if auth_source.exists() or auth_source.is_symlink():
|
|
4608
|
+
auth = _minimax_private_path(auth_source, directory=True).resolve()
|
|
4609
|
+
for state_file in auth.rglob("auth-state.json"):
|
|
4610
|
+
auth_state = json.loads(
|
|
4611
|
+
_minimax_private_path(state_file).read_text(encoding="utf-8")
|
|
4612
|
+
)
|
|
4613
|
+
if (
|
|
4614
|
+
not isinstance(auth_state, dict)
|
|
4615
|
+
or auth_state.get("storeKind") != "file"
|
|
4616
|
+
):
|
|
4617
|
+
raise RuntimeError(
|
|
4618
|
+
"MiniMax project review cannot reuse keyring-based authentication"
|
|
4619
|
+
)
|
|
4620
|
+
(data / "auth").symlink_to(auth, target_is_directory=True)
|
|
4621
|
+
if auth is not None:
|
|
4622
|
+
review_paths.append(auth)
|
|
4623
|
+
environment.update(
|
|
4624
|
+
HOME=str(private),
|
|
4625
|
+
USERPROFILE=str(private),
|
|
4626
|
+
MINIMAX_DATA_DIR=str(data),
|
|
4627
|
+
TMPDIR=str(private),
|
|
4628
|
+
TMP=str(private),
|
|
4629
|
+
TEMP=str(private),
|
|
4630
|
+
OPENSSL_CONF=os.devnull,
|
|
4631
|
+
)
|
|
4535
4632
|
remaining = deadline - time.monotonic()
|
|
4536
4633
|
if remaining <= 0:
|
|
4537
4634
|
raise asyncio.TimeoutError()
|
|
4538
|
-
command = build_minimax_command(
|
|
4539
|
-
|
|
4540
|
-
|
|
4635
|
+
command = build_minimax_command(
|
|
4636
|
+
admission["build"]["node"],
|
|
4637
|
+
cwd=cwd,
|
|
4638
|
+
config=config,
|
|
4639
|
+
timeout=remaining,
|
|
4640
|
+
max_steps=max_steps,
|
|
4641
|
+
model=model,
|
|
4642
|
+
session_id=session_id,
|
|
4643
|
+
project_review=review_home is not None,
|
|
4644
|
+
)
|
|
4541
4645
|
command.insert(1, admission["build"]["entry"])
|
|
4542
4646
|
command, environment = await asyncio.to_thread(
|
|
4543
|
-
component_runtime.harness_command,
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
command,
|
|
4647
|
+
component_runtime.harness_command,
|
|
4648
|
+
lease,
|
|
4649
|
+
"minimax",
|
|
4650
|
+
binary,
|
|
4651
|
+
command,
|
|
4652
|
+
environment,
|
|
4548
4653
|
)
|
|
4654
|
+
if review_home is not None:
|
|
4655
|
+
command = delivery_review_sandbox_command(
|
|
4656
|
+
command,
|
|
4657
|
+
cwd,
|
|
4658
|
+
private,
|
|
4659
|
+
writable=False,
|
|
4660
|
+
read_paths=review_paths,
|
|
4661
|
+
restrict_global_reads=True,
|
|
4662
|
+
)
|
|
4663
|
+
command[2] += (
|
|
4664
|
+
f"(deny process-exec (require-not (literal {json.dumps(str(node))})))"
|
|
4665
|
+
)
|
|
4666
|
+
if auth is not None:
|
|
4667
|
+
command[2] += f"(allow file-write* (subpath {json.dumps(str(auth))}))"
|
|
4668
|
+
else:
|
|
4669
|
+
command = _minimax_sandbox(
|
|
4670
|
+
command,
|
|
4671
|
+
admission,
|
|
4672
|
+
cwd,
|
|
4673
|
+
temporary_root,
|
|
4674
|
+
read_only=read_only,
|
|
4675
|
+
delivery_review=delivery_review,
|
|
4676
|
+
)
|
|
4549
4677
|
if cancel_requested is not None and cancel_requested():
|
|
4550
4678
|
return state.finish(-1, cancelled=True)
|
|
4551
|
-
_minimax_write_record(
|
|
4679
|
+
_minimax_write_record(
|
|
4680
|
+
active, {"fingerprint": binding_identity, "state": "spawning"}
|
|
4681
|
+
)
|
|
4552
4682
|
if lease is not None:
|
|
4553
4683
|
await asyncio.to_thread(lease.begin_spawn)
|
|
4554
4684
|
process = await asyncio.create_subprocess_exec(
|
|
@@ -4604,11 +4734,28 @@ async def run_minimax(
|
|
|
4604
4734
|
if state.error:
|
|
4605
4735
|
break
|
|
4606
4736
|
for event in events:
|
|
4607
|
-
if event["type"] == "
|
|
4608
|
-
|
|
4609
|
-
|
|
4737
|
+
if review_home is not None and event["type"] == "tool_call":
|
|
4738
|
+
state.fail(
|
|
4739
|
+
"MiniMax lightweight review attempted a tool",
|
|
4740
|
+
"minimax_review_tool_detected",
|
|
4741
|
+
)
|
|
4742
|
+
break
|
|
4743
|
+
if event["type"] == "session" and review_home is None:
|
|
4744
|
+
binding = (
|
|
4745
|
+
root
|
|
4746
|
+
/ "bindings"
|
|
4747
|
+
/ (
|
|
4748
|
+
hashlib.sha256(event["session_id"].encode()).hexdigest()
|
|
4749
|
+
+ ".json"
|
|
4750
|
+
)
|
|
4751
|
+
)
|
|
4752
|
+
_minimax_write_record(
|
|
4753
|
+
binding, {"fingerprint": binding_identity}
|
|
4754
|
+
)
|
|
4610
4755
|
if on_event is not None:
|
|
4611
4756
|
await on_event(event)
|
|
4757
|
+
if state.error:
|
|
4758
|
+
break
|
|
4612
4759
|
if on_chunk is not None:
|
|
4613
4760
|
await on_chunk(json.dumps({"type": "minimax.progress", "sequence": state.sequence}))
|
|
4614
4761
|
if not state.error:
|
|
@@ -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.109.4"
|
|
1432
1432
|
|
|
1433
1433
|
|
|
1434
1434
|
def _detect_client_type() -> str:
|
|
@@ -251,6 +251,7 @@ class ZCodeProtocolSession:
|
|
|
251
251
|
model: dict[str, Any] | None = None,
|
|
252
252
|
tool_allowlist: list[str] | None = None,
|
|
253
253
|
tool_denylist: list[str] | None = None,
|
|
254
|
+
title_generation_enabled: bool | None = None,
|
|
254
255
|
) -> ZCodeSession:
|
|
255
256
|
workspace_path = str(Path(workspace).resolve())
|
|
256
257
|
params: dict[str, Any] = {
|
|
@@ -266,6 +267,8 @@ class ZCodeProtocolSession:
|
|
|
266
267
|
}
|
|
267
268
|
if model:
|
|
268
269
|
params["model"] = model
|
|
270
|
+
if title_generation_enabled is not None:
|
|
271
|
+
params["titleGenerationEnabled"] = title_generation_enabled
|
|
269
272
|
result = await self._request("session/create", params)
|
|
270
273
|
return self._accept_session_snapshot(result)
|
|
271
274
|
|
|
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
|