agent-orchestration-process 0.3.0__tar.gz → 0.3.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.
Files changed (28) hide show
  1. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/PKG-INFO +1 -1
  2. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/pyproject.toml +1 -1
  3. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/pyproject.toml.orig +1 -1
  4. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/prompt_transport.py +6 -2
  5. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/runner.py +139 -84
  6. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/LICENSE +0 -0
  7. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/README.md +0 -0
  8. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/__init__.py +0 -0
  9. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/__main__.py +0 -0
  10. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/batch.py +0 -0
  11. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/cli.py +0 -0
  12. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/codex_auth.py +0 -0
  13. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/codex_routes.py +0 -0
  14. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/dsh_runner.mjs +0 -0
  15. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/egress.py +0 -0
  16. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/egress_bridge.py +0 -0
  17. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/integration.py +0 -0
  18. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/isolation.py +0 -0
  19. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/locks.py +0 -0
  20. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/migration.py +0 -0
  21. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/model_catalog.py +0 -0
  22. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/model_listing.py +0 -0
  23. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/models.py +0 -0
  24. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/pricing.py +0 -0
  25. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/provider_versions.py +0 -0
  26. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/worktrees.py +0 -0
  27. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/zcode.py +0 -0
  28. {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.3.1}/src/agent_orchestration_process/zcode_protocol.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-orchestration-process
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Run bounded, non-interactive jobs across agent harnesses with isolation, exact resume, and provenance
5
5
  Keywords: agent-orchestration,ai-agents,autoresearch,coding-agents,git-worktrees
6
6
  Author: AOP contributors
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "agent-orchestration-process"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "Run bounded, non-interactive jobs across agent harnesses with isolation, exact resume, and provenance"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "agent-orchestration-process"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "Run bounded, non-interactive jobs across agent harnesses with isolation, exact resume, and provenance"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -91,6 +91,10 @@ sys.argv = sys.argv[1:]
91
91
  flag = '--prompt' if '--prompt' in sys.argv else '-q'
92
92
  i = sys.argv.index(flag) + 1
93
93
  sys.argv[i] = pathlib.Path(sys.argv[i]).read_bytes().decode('utf-8')
94
- sys.path.insert(0, str(pathlib.Path(sys.argv[0]).resolve().parent))
95
- runpy.run_path(sys.argv[0], run_name='__main__')
94
+ if sys.argv[0] == '-c':
95
+ code = sys.argv.pop(1)
96
+ exec(compile(code, '<string>', 'exec'), {'__name__': '__main__'})
97
+ else:
98
+ sys.path.insert(0, str(pathlib.Path(sys.argv[0]).resolve().parent))
99
+ runpy.run_path(sys.argv[0], run_name='__main__')
96
100
  """
@@ -2,7 +2,6 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- import ast
6
5
  import contextlib
7
6
  import fnmatch
8
7
  import hashlib
@@ -2150,6 +2149,10 @@ class GrokAdapter:
2150
2149
  "--no-subagents",
2151
2150
  "--tools",
2152
2151
  "read_file,search_replace,grep,list_dir,todo_write",
2152
+ # Grok 1.0.60 adds search_tool and use_tool, which find and
2153
+ # call MCP servers' tools, outside the --tools allowlist.
2154
+ "--disallowed-tools",
2155
+ "search_tool,use_tool",
2153
2156
  "--deny",
2154
2157
  "Bash",
2155
2158
  "--deny",
@@ -4036,9 +4039,22 @@ def _provider_command(
4036
4039
  environment["XDG_CACHE_HOME"] = os.fspath(cursor_cache)
4037
4040
  if request.provider == "hermes":
4038
4041
  isolated_home = Path(environment["HERMES_HOME"])
4039
- if isolated_home != provider_state / "hermes" / "home":
4042
+ if isolated_home != provider_state / _HERMES_TASK_HOME:
4040
4043
  raise AOPError("Hermes runtime home is outside its task-private state")
4041
4044
  environment["HERMES_REAL_HOME"] = os.fspath(isolated_home)
4045
+ tools = (provider_state / "hermes" / "tools").resolve()
4046
+ if tools.is_dir():
4047
+ # Hermes's managed Python, Node.js, ripgrep and ffmpeg.
4048
+ _add_guest_parent_directories(wrapped, tools)
4049
+ wrapped.extend(["--ro-bind", os.fspath(tools), os.fspath(tools)])
4050
+ store = (provider_state / "hermes" / "installs").resolve()
4051
+ if store.is_dir():
4052
+ # Hermes takes a lock and leases its dependency generation at every
4053
+ # start. A temporary overlay lets it, without writing the store.
4054
+ _add_guest_parent_directories(wrapped, store)
4055
+ wrapped.extend(
4056
+ ["--overlay-src", os.fspath(store), "--tmp-overlay", os.fspath(store)]
4057
+ )
4042
4058
  if request.provider == "opencode":
4043
4059
  source_config = _opencode_source_config(environment)
4044
4060
  source_data = _opencode_source_data(environment)
@@ -4143,12 +4159,21 @@ def _prompt_runtime_command(
4143
4159
  with resolved.open("rb") as handle:
4144
4160
  header = handle.readline(4096).decode(errors="replace").strip()
4145
4161
  if request.provider == "hermes" and request.profile == "host":
4146
- runtime = _hermes_wrapper_runtime(resolved, command[1:])
4162
+ runtime = _hermes_runtime(resolved, command[1:])
4147
4163
  if runtime is not None:
4148
4164
  command = runtime[0]
4149
4165
  environment.pop("PYTHONPATH", None)
4150
4166
  environment.pop("PYTHONHOME", None)
4151
4167
  if "python" in Path(command[0]).name:
4168
+ if "-c" in command:
4169
+ # python [options] -c CODE ARGS runs the loader, which runs CODE.
4170
+ split = command.index("-c")
4171
+ return [
4172
+ *command[:split],
4173
+ "-c",
4174
+ prompt_transport.PYTHON_ARGV_LOADER,
4175
+ *command[split:],
4176
+ ]
4152
4177
  return [command[0], "-c", prompt_transport.PYTHON_ARGV_LOADER, *command[1:]]
4153
4178
  if header.startswith("#!") and "python" in header:
4154
4179
  parts = header[2:].split()
@@ -4230,7 +4255,7 @@ def _provider_runtime(
4230
4255
  command[0] = os.fspath(resolved)
4231
4256
  return command, [(os.fspath(brew), os.fspath(brew))]
4232
4257
  if provider == "hermes":
4233
- hermes_runtime = _hermes_wrapper_runtime(resolved, command[1:])
4258
+ hermes_runtime = _hermes_runtime(resolved, command[1:])
4234
4259
  if hermes_runtime is not None:
4235
4260
  return hermes_runtime
4236
4261
  if provider == "dsh":
@@ -4274,68 +4299,54 @@ def _provider_runtime(
4274
4299
  return command, mounts
4275
4300
 
4276
4301
 
4277
- def _hermes_wrapper_runtime(
4278
- wrapper: Path, arguments: list[str]
4302
+ def _hermes_launcher(path: Path) -> Path | None:
4303
+ """The Hermes launcher behind `path`, through one-line `exec` wrappers."""
4304
+ for _ in range(4):
4305
+ try:
4306
+ text = path.read_text()
4307
+ except (OSError, UnicodeDecodeError):
4308
+ return None
4309
+ if "--print-runtime-command" in text:
4310
+ return path
4311
+ match = re.fullmatch(r'#!/bin/(?:ba)?sh\n\s*exec\s+"?(/[^"\s]+)"?\s+"\$@"\s*', text)
4312
+ if match is None:
4313
+ return None
4314
+ path = Path(match.group(1)).resolve()
4315
+ return None
4316
+
4317
+
4318
+ def _hermes_runtime(
4319
+ executable: Path, arguments: list[str]
4279
4320
  ) -> tuple[list[str], list[tuple[str, str]]] | None:
4280
- try:
4281
- contents = wrapper.read_text()
4282
- except (OSError, UnicodeDecodeError):
4321
+ """Hermes's own launch command and the read-only trees it runs from."""
4322
+ launcher = _hermes_launcher(executable)
4323
+ if launcher is None:
4283
4324
  return None
4284
- match = re.search(
4285
- r'^exec\s+"([^"\n]+/venv/bin/python)"\s+"([^"\n]+/hermes)"\s+"\$@"\s*$',
4286
- contents,
4287
- flags=re.MULTILINE,
4288
- )
4289
- if match is None:
4290
- return None
4291
- python = Path(match.group(1))
4292
- entrypoint = Path(match.group(2))
4293
- agent_root = entrypoint.parent.resolve()
4294
- venv = python.parent.parent
4295
- if not python.exists() or not entrypoint.is_file() or not venv.is_dir():
4296
- raise AOPError("Hermes launcher references an incomplete private runtime")
4297
- resolved_python = python.resolve()
4298
- python_runtime = resolved_python.parent.parent
4299
- if not python_runtime.is_dir():
4300
- raise AOPError("Hermes launcher Python runtime is unavailable")
4301
-
4302
- finders = sorted(venv.glob("lib/python*/site-packages/__editable__*_finder.py"))
4303
- if len(finders) != 1:
4304
- raise AOPError("Hermes private runtime has no unique editable package map")
4305
4325
  try:
4306
- tree = ast.parse(finders[0].read_text())
4307
- except (OSError, SyntaxError) as error:
4308
- raise AOPError(f"could not inspect Hermes private runtime: {error}") from error
4309
- mapping: dict[str, str] | None = None
4310
- for node in tree.body:
4311
- if not isinstance(node, ast.AnnAssign):
4312
- continue
4313
- if not isinstance(node.target, ast.Name) or node.target.id != "MAPPING":
4314
- continue
4315
- try:
4316
- value = ast.literal_eval(node.value)
4317
- except (ValueError, TypeError, SyntaxError) as error:
4318
- raise AOPError("Hermes editable package map is not literal") from error
4319
- if isinstance(value, dict) and all(
4320
- isinstance(key, str) and isinstance(path, str)
4321
- for key, path in value.items()
4322
- ):
4323
- mapping = value
4324
- break
4325
- if mapping is None:
4326
- raise AOPError("Hermes private runtime has no valid editable package map")
4327
-
4328
- sources = {entrypoint, venv, python_runtime}
4329
- for raw_path in mapping.values():
4330
- candidate = Path(raw_path)
4331
- if not candidate.exists():
4332
- candidate = candidate.with_suffix(".py")
4333
- source = candidate.resolve()
4334
- if not source.is_relative_to(agent_root) or not source.exists():
4335
- raise AOPError("Hermes editable package map escapes its installation")
4336
- sources.add(source)
4337
- mounts = [(os.fspath(source), os.fspath(source)) for source in sorted(sources)]
4338
- return [os.fspath(python), os.fspath(entrypoint), *arguments], mounts
4326
+ reported = subprocess.run(
4327
+ [os.fspath(launcher), "--print-runtime-command", "--", *arguments],
4328
+ capture_output=True,
4329
+ text=True,
4330
+ timeout=60,
4331
+ check=True,
4332
+ ).stdout
4333
+ command = json.loads(reported)
4334
+ except (OSError, subprocess.SubprocessError, ValueError) as error:
4335
+ raise AOPError(f"could not resolve the Hermes launch command: {error}") from error
4336
+ if not (
4337
+ isinstance(command, list)
4338
+ and len(command) >= 4
4339
+ and all(isinstance(part, str) for part in command)
4340
+ and "-c" in command
4341
+ ):
4342
+ raise AOPError("Hermes reported an unrecognized launch command")
4343
+ code = command[command.index("-c") + 1]
4344
+ root = re.search(r"sys\.path\.insert\(0, '([^']+)'\)", code)
4345
+ python = Path(command[0])
4346
+ if root is None or not python.is_absolute() or not Path(root.group(1)).is_dir():
4347
+ raise AOPError("Hermes reported a launch command without its installation")
4348
+ sources = {python.resolve().parent.parent, Path(root.group(1)).resolve()}
4349
+ return command, [(os.fspath(path), os.fspath(path)) for path in sorted(sources)]
4339
4350
 
4340
4351
 
4341
4352
  def _guest_path(value: str, mappings: tuple[tuple[Path, Path], ...]) -> str:
@@ -4492,6 +4503,7 @@ def _filtered_environment(environment: dict[str, str]) -> dict[str, str]:
4492
4503
  "GOOGLE_API_KEY",
4493
4504
  "GOOGLE_GEMINI_BASE_URL",
4494
4505
  "GROK_STORAGE_MODE",
4506
+ "HERMES_DISABLE_LAZY_INSTALLS",
4495
4507
  "LANG",
4496
4508
  "LC_ALL",
4497
4509
  "LC_CTYPE",
@@ -4723,12 +4735,15 @@ def _prepare_dsh_environment(request: RunRequest, environment: dict[str, str]) -
4723
4735
  )
4724
4736
 
4725
4737
  if credential_ref is not None:
4726
- credentials = _read_yaml_mapping(
4727
- source_home / ".credentials.yaml", "dsh managed credentials"
4728
- )
4729
- _project_dsh_credential(
4730
- credentials, credential_ref, dsh_home / ".credentials.yaml"
4731
- )
4738
+ # dsh's headless profile reads credentials from its launch environment
4739
+ # and leaves its managed store off, so a key the user keeps in that
4740
+ # store goes into the run's environment. An exported key wins.
4741
+ if not environment.get(credential_ref):
4742
+ managed = _dsh_managed_credential(
4743
+ source_home / ".credentials.yaml", credential_ref
4744
+ )
4745
+ if managed is not None:
4746
+ environment[credential_ref] = managed
4732
4747
  environment["AOP_DSH_CREDENTIAL_REF"] = credential_ref
4733
4748
  environment["AOP_DSH_ALLOWED_AUTH_ENV"] = credential_ref
4734
4749
  else:
@@ -4773,6 +4788,11 @@ def _prepare_dsh_environment(request: RunRequest, environment: dict[str, str]) -
4773
4788
  "- id: plugin-package-inventory-deepseek",
4774
4789
  " config:",
4775
4790
  " enabled: false",
4791
+ # dsh 0.2 uploads each session's log with every DeepSeek request
4792
+ # by default. AOP sends only the request itself.
4793
+ "- id: session-log-deepseek",
4794
+ " config:",
4795
+ " enabled: false",
4776
4796
  "- id: session-title-llm",
4777
4797
  " disabled: true",
4778
4798
  "- id: headless-runner",
@@ -4787,6 +4807,9 @@ def _prepare_dsh_environment(request: RunRequest, environment: dict[str, str]) -
4787
4807
  "tool-web",
4788
4808
  "web-fetch-http",
4789
4809
  "web-search-deepseek",
4810
+ # dsh 0.2's search and fetch providers wait for the web
4811
+ # service and warn on every run when it is disabled.
4812
+ "web-deepseek-api",
4790
4813
  "web",
4791
4814
  "tool-bash",
4792
4815
  "tool-pwsh",
@@ -4865,23 +4888,25 @@ def _project_dsh_provider_settings(
4865
4888
  return projected, credential_ref
4866
4889
 
4867
4890
 
4868
- def _project_dsh_credential(
4869
- credentials: dict[str, object], credential_ref: str, destination: Path
4870
- ) -> None:
4871
- credential = credentials.get(credential_ref)
4891
+ def _dsh_managed_credential(path: Path, credential_ref: str) -> str | None:
4892
+ """One reference from dsh's managed store, `version: 1` with `refs`."""
4893
+ document = _read_yaml_mapping(path, "dsh managed credentials")
4894
+ if not document:
4895
+ return None
4896
+ if document.get("version") != 1:
4897
+ raise AOPError(
4898
+ f"{path} is not a version 1 dsh credentials file; run dsh once to "
4899
+ "convert it"
4900
+ )
4901
+ refs = document.get("refs") or {}
4902
+ if not isinstance(refs, dict):
4903
+ raise AOPError("dsh managed credentials refs must be a mapping")
4904
+ credential = refs.get(credential_ref)
4872
4905
  if credential is None:
4873
- return
4906
+ return None
4874
4907
  if not isinstance(credential, str) or not credential:
4875
4908
  raise AOPError(f"dsh managed {credential_ref} must be a nonempty string")
4876
- _atomic_write_private(
4877
- destination,
4878
- yaml.safe_dump(
4879
- {credential_ref: credential},
4880
- allow_unicode=True,
4881
- default_flow_style=False,
4882
- sort_keys=False,
4883
- ),
4884
- )
4909
+ return credential
4885
4910
 
4886
4911
 
4887
4912
  def _codex_source_home(environment: dict[str, str]) -> Path | None:
@@ -5419,6 +5444,25 @@ def _prepare_agy_dir(source: Path, destination: Path, *, sealed: bool = False) -
5419
5444
  raise AOPError(f"could not prepare isolated Agy profile: {error}") from error
5420
5445
 
5421
5446
 
5447
+ # A home at <root>/profiles/<name> gives Hermes <root> as its data root, where it
5448
+ # finds the dependency store it installed under <root>/installs.
5449
+ _HERMES_TASK_HOME = Path("hermes", "profiles", "aop")
5450
+
5451
+
5452
+ def _link_hermes_dependency_store(source_home: Path, root: Path) -> None:
5453
+ """Point the task root's installs and tools at what the user's Hermes installed."""
5454
+ source_root = (
5455
+ source_home.parent.parent
5456
+ if source_home.parent.name == "profiles"
5457
+ else source_home
5458
+ )
5459
+ for name in ("installs", "tools"):
5460
+ store = source_root / name
5461
+ link = root / name
5462
+ if store.is_dir() and not (link.is_symlink() or link.exists()):
5463
+ link.symlink_to(store.resolve())
5464
+
5465
+
5422
5466
  _HERMES_SEED_DIRECTORIES = {
5423
5467
  "cron",
5424
5468
  "hooks",
@@ -5656,6 +5700,7 @@ def _reconcile_hermes_credentials(
5656
5700
  candidates = [source_home / "auth.json", shared_auth]
5657
5701
  # Recover a rotation even if AOP was interrupted before committing it.
5658
5702
  candidates.extend(state_dir.glob("provider-state/*/hermes/home/auth.json"))
5703
+ candidates.extend(state_dir.glob(f"provider-state/*/{_HERMES_TASK_HOME}/auth.json"))
5659
5704
  stores = []
5660
5705
  for path in candidates:
5661
5706
  store = _load_hermes_auth(path)
@@ -5678,8 +5723,13 @@ def _hermes_runtime_environment(
5678
5723
  f"Hermes home does not exist: {source_home}; authenticate Hermes first"
5679
5724
  )
5680
5725
  provider_state = Path(environment["AOP_PROVIDER_STATE_DIR"])
5681
- task_home = provider_state / "hermes" / "home"
5726
+ task_home = provider_state / _HERMES_TASK_HOME
5727
+ previous_home = provider_state / "hermes" / "home"
5728
+ if previous_home.is_dir() and not task_home.exists():
5729
+ task_home.parent.mkdir(parents=True, exist_ok=True)
5730
+ previous_home.rename(task_home)
5682
5731
  _prepare_hermes_home(source_home, task_home, sealed=_sealed(environment))
5732
+ _link_hermes_dependency_store(source_home, task_home.parent.parent)
5683
5733
  configured_state = environment.get("AOP_HERMES_SHARED_STATE_DIR")
5684
5734
  state_dir = (
5685
5735
  Path(configured_state) if configured_state else provider_state.parent.parent
@@ -5687,6 +5737,11 @@ def _hermes_runtime_environment(
5687
5737
  lock_path = state_dir / "locks" / "hermes-credentials.lock"
5688
5738
  runtime_environment = environment.copy()
5689
5739
  runtime_environment["HERMES_HOME"] = os.fspath(task_home)
5740
+ # The task root shares the user's dependency store, so Hermes would treat
5741
+ # it as the installation's owner: finish pending updates, republish the
5742
+ # checkout's launchers through the task root, and restart. A task installs
5743
+ # and publishes nothing.
5744
+ runtime_environment["HERMES_DISABLE_LAZY_INSTALLS"] = "1"
5690
5745
 
5691
5746
  # Hermes has no separate auth path. Hold the lock for the complete turn so
5692
5747
  # two task-private homes cannot consume the same single-use refresh token.