agentproc 0.16.0__tar.gz → 0.20.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 (120) hide show
  1. {agentproc-0.16.0 → agentproc-0.20.0}/PKG-INFO +1 -1
  2. {agentproc-0.16.0 → agentproc-0.20.0}/pyproject.toml +1 -1
  3. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/__init__.py +22 -3
  4. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/cli.py +24 -1
  5. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/executors.py +206 -94
  6. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub.py +33 -10
  7. agentproc-0.20.0/src/agentproc/hub_data/PERMISSIONS.md +79 -0
  8. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/_shared/README.md +25 -0
  9. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/_shared/stream_utils.js +57 -4
  10. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/_shared/stream_utils.py +100 -7
  11. agentproc-0.20.0/src/agentproc/hub_data/_shared/stream_utils.test.js +70 -0
  12. agentproc-0.20.0/src/agentproc/hub_data/_shared/test_stderr_drain.py +96 -0
  13. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/agy/README.md +1 -1
  14. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/agy/bridge.js +3 -1
  15. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/agy/bridge.py +3 -1
  16. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/claude-code/bridge.py +12 -1
  17. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/codex/README.md +14 -2
  18. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/codex/bridge.js +81 -4
  19. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/codex/bridge.py +115 -7
  20. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/codex/permission_map.js +8 -4
  21. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/codex/profile.yaml +1 -1
  22. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/dsh/README.md +23 -0
  23. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/dsh/bridge.js +27 -12
  24. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/dsh/bridge.py +46 -17
  25. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/dsh/bridge.test.js +11 -2
  26. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/dsh/profile.yaml +22 -8
  27. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/opencode/README.md +1 -1
  28. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/opencode/bridge.js +6 -3
  29. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/opencode/bridge.py +7 -3
  30. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/opencode/profile.yaml +1 -1
  31. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/recursive/README.md +1 -1
  32. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/recursive/bridge.js +6 -2
  33. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/recursive/bridge.py +6 -2
  34. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/recursive/profile.yaml +1 -1
  35. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/recursive/tests/parity.json +16 -0
  36. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/recursive/tests/test_bridge_parity.js +16 -2
  37. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/recursive/tests/test_bridge_parity.py +16 -4
  38. agentproc-0.20.0/src/agentproc/run_lock.py +240 -0
  39. agentproc-0.20.0/src/agentproc/runner.py +2106 -0
  40. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc.egg-info/PKG-INFO +1 -1
  41. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc.egg-info/SOURCES.txt +13 -0
  42. {agentproc-0.16.0 → agentproc-0.20.0}/tests/test_agentproc.py +60 -0
  43. {agentproc-0.16.0 → agentproc-0.20.0}/tests/test_bridges.py +184 -15
  44. agentproc-0.20.0/tests/test_codex_perm_cleanup.py +287 -0
  45. agentproc-0.20.0/tests/test_conformance.py +288 -0
  46. agentproc-0.20.0/tests/test_executor_env.py +197 -0
  47. {agentproc-0.16.0 → agentproc-0.20.0}/tests/test_executors.py +263 -13
  48. {agentproc-0.16.0 → agentproc-0.20.0}/tests/test_hub.py +77 -0
  49. {agentproc-0.16.0 → agentproc-0.20.0}/tests/test_hub_bridge_conformance.py +39 -0
  50. agentproc-0.20.0/tests/test_issue121_failure_diagnostics.py +129 -0
  51. agentproc-0.20.0/tests/test_issue6_executor_parity.py +53 -0
  52. agentproc-0.20.0/tests/test_issue6_streaming.py +141 -0
  53. agentproc-0.20.0/tests/test_parse_robustness.py +161 -0
  54. agentproc-0.20.0/tests/test_process_tree_kill.py +103 -0
  55. agentproc-0.20.0/tests/test_run_lock.py +270 -0
  56. {agentproc-0.16.0 → agentproc-0.20.0}/tests/test_runner.py +375 -4
  57. agentproc-0.20.0/tests/test_runner_lifecycle_leaks.py +310 -0
  58. {agentproc-0.16.0 → agentproc-0.20.0}/tests/test_scenarios.py +4 -2
  59. agentproc-0.20.0/tests/test_utf8_decoding.py +135 -0
  60. agentproc-0.16.0/src/agentproc/hub_data/PERMISSIONS.md +0 -27
  61. agentproc-0.16.0/src/agentproc/runner.py +0 -1183
  62. agentproc-0.16.0/tests/test_conformance.py +0 -33
  63. {agentproc-0.16.0 → agentproc-0.20.0}/setup.cfg +0 -0
  64. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/README.md +0 -0
  65. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/agy/profile.yaml +0 -0
  66. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/aider/README.md +0 -0
  67. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/aider/bridge.js +0 -0
  68. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/aider/bridge.py +0 -0
  69. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/aider/profile.yaml +0 -0
  70. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/claude-code/README.md +0 -0
  71. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/claude-code/bridge.js +0 -0
  72. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/claude-code/permission_map.test.js +0 -0
  73. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/claude-code/profile.yaml +0 -0
  74. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/codebuddy/README.md +0 -0
  75. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/codebuddy/bridge.js +0 -0
  76. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/codebuddy/bridge.py +0 -0
  77. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/codebuddy/profile.yaml +0 -0
  78. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/codex/permission_hook.py +0 -0
  79. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/codex/permission_map.test.js +0 -0
  80. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/cursor/README.md +0 -0
  81. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/cursor/bridge.js +0 -0
  82. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/cursor/bridge.py +0 -0
  83. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/cursor/profile.yaml +0 -0
  84. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/deepseek/README.md +0 -0
  85. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/deepseek/bridge.js +0 -0
  86. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/deepseek/bridge.py +0 -0
  87. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/deepseek/profile.yaml +0 -0
  88. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/echo-agent/README.md +0 -0
  89. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/echo-agent/bridge.js +0 -0
  90. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/echo-agent/bridge.py +0 -0
  91. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/echo-agent/bridge.sh +0 -0
  92. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/echo-agent/profile.yaml +0 -0
  93. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/gemini-cli/README.md +0 -0
  94. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/gemini-cli/bridge.js +0 -0
  95. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/gemini-cli/bridge.py +0 -0
  96. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/gemini-cli/profile.yaml +0 -0
  97. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/grok-build/README.md +0 -0
  98. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/grok-build/bridge.js +0 -0
  99. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/grok-build/bridge.py +0 -0
  100. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/grok-build/profile.yaml +0 -0
  101. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/kimi-code/README.md +0 -0
  102. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/kimi-code/bridge.js +0 -0
  103. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/kimi-code/bridge.py +0 -0
  104. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/kimi-code/profile.yaml +0 -0
  105. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/pi/README.md +0 -0
  106. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/pi/bridge.js +0 -0
  107. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/pi/bridge.py +0 -0
  108. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/pi/profile.yaml +0 -0
  109. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/qwen-code/README.md +0 -0
  110. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/qwen-code/bridge.js +0 -0
  111. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/qwen-code/bridge.py +0 -0
  112. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/hub_data/qwen-code/profile.yaml +0 -0
  113. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc/yaml.py +0 -0
  114. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc.egg-info/dependency_links.txt +0 -0
  115. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc.egg-info/entry_points.txt +0 -0
  116. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc.egg-info/requires.txt +0 -0
  117. {agentproc-0.16.0 → agentproc-0.20.0}/src/agentproc.egg-info/top_level.txt +0 -0
  118. {agentproc-0.16.0 → agentproc-0.20.0}/tests/test_diagnostics.py +0 -0
  119. {agentproc-0.16.0 → agentproc-0.20.0}/tests/test_sdk.py +0 -0
  120. {agentproc-0.16.0 → agentproc-0.20.0}/tests/test_yaml.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentproc
3
- Version: 0.16.0
3
+ Version: 0.20.0
4
4
  Summary: AgentProc Protocol SDK + CLI — connect any Agent CLI to a messaging platform
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/jeffkit/agentproc
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "agentproc"
7
- version = "0.16.0"
7
+ version = "0.20.0"
8
8
  description = "AgentProc Protocol SDK + CLI — connect any Agent CLI to a messaging platform"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -193,8 +193,14 @@ class AgentContext:
193
193
  if not isinstance(rid, str) or not rid:
194
194
  raise ValueError("req['request_id'] is required")
195
195
  payload: Dict[str, Any] = {"type": "permission_request"}
196
- for k in ("request_id", "tool_name", "input"):
197
- payload[k] = req.get(k)
196
+ input_value = req.get("input")
197
+ if not isinstance(input_value, dict):
198
+ # The wire requires an object; emitting null would be rejected by
199
+ # every runner (the Go SDK defaults to {} the same way).
200
+ input_value = {}
201
+ payload["request_id"] = req.get("request_id")
202
+ payload["tool_name"] = req.get("tool_name")
203
+ payload["input"] = input_value
198
204
  for k in ("description", "tool_use_id"):
199
205
  if k in req:
200
206
  payload[k] = req[k]
@@ -344,11 +350,24 @@ def _read_turn() -> Dict[str, Any]:
344
350
 
345
351
  def _context_from_turn() -> AgentContext:
346
352
  t = _read_turn()
353
+ protocol_version = (
354
+ t.get("protocol_version")
355
+ if isinstance(t.get("protocol_version"), str)
356
+ else PROTOCOL_VERSION
357
+ )
358
+ # Diagnostic only (spec Versioning): one stderr line, then continue
359
+ # best-effort — it never gates or alters what the handler may send.
360
+ if protocol_version and protocol_version != PROTOCOL_VERSION:
361
+ warning = (
362
+ f'protocol_version "{protocol_version}" does not match this agent SDK\'s '
363
+ f'"{PROTOCOL_VERSION}"; continuing best-effort (fail-soft)'
364
+ )
365
+ sys.stderr.write(f"[agentproc] {warning}\n")
347
366
  return AgentContext(
348
367
  message=t.get("message") if isinstance(t.get("message"), str) else "",
349
368
  session_id=t.get("session_id") if isinstance(t.get("session_id"), str) else "",
350
369
  session_name=t.get("session_name") if isinstance(t.get("session_name"), str) else "default",
351
- protocol_version=t.get("protocol_version") if isinstance(t.get("protocol_version"), str) else PROTOCOL_VERSION,
370
+ protocol_version=protocol_version,
352
371
  attachments=t.get("attachments") if isinstance(t.get("attachments"), list) else [],
353
372
  permission=t.get("permission") is True,
354
373
  )
@@ -118,6 +118,7 @@ def build_parser() -> argparse.ArgumentParser:
118
118
  p.add_argument("--cwd")
119
119
  p.add_argument("--env", action="append", default=[])
120
120
  p.add_argument("--timeout", type=int)
121
+ p.add_argument("--journal")
121
122
  p.add_argument("--no-stream", action="store_true")
122
123
  p.add_argument("--verbose", action="store_true")
123
124
  p.add_argument("--quiet", action="store_true")
@@ -177,6 +178,7 @@ Output:
177
178
  --quiet Suppress protocol lines on stderr
178
179
  --raw Quiet mode: only print the final reply body (no live events)
179
180
  --stdin Read prompt from stdin instead of --prompt
181
+ --journal <path> Append an NDJSON event/decision journal to <path> (opt-in)
180
182
 
181
183
  Other:
182
184
  --version Print version and exit
@@ -236,7 +238,8 @@ def _run_hub_subcommand(args: List[str]) -> int:
236
238
  positional: List[str] = []
237
239
  runner_args: List[str] = []
238
240
  takes_value = {"--prompt", "-p", "--session", "--session-name", "--from",
239
- "--image-url", "--file-url", "--cwd", "--env", "--timeout"}
241
+ "--image-url", "--file-url", "--cwd", "--env", "--timeout",
242
+ "--journal"}
240
243
  boolean_flags = {"--no-stream", "--verbose", "--quiet", "--raw", "--stdin"}
241
244
  i = 0
242
245
  while i < len(rest):
@@ -346,6 +349,7 @@ Hub run options (same as the regular --profile runner):
346
349
  --image-url <url> Image attachment URL (carried in the turn's attachments)
347
350
  --file-url <url> File attachment URL (carried in the turn's attachments)
348
351
  --timeout <secs> Override profile.timeout_secs
352
+ --journal <path> Append an NDJSON event/decision journal to <path> (opt-in)
349
353
  --no-stream Disable streaming
350
354
  --verbose / --quiet Protocol line visibility (default: verbose)
351
355
  --stdin Read prompt from stdin
@@ -430,6 +434,22 @@ def _run_agent_with_profile(profile_path: str, opts) -> int:
430
434
  if verbose:
431
435
  sys.stderr.write(json.dumps(obj, ensure_ascii=False) + "\n")
432
436
 
437
+ # Opt-in journal (spec "Event traceability"): NDJSON append to a file.
438
+ # Off by default; never touches stdout/stderr.
439
+ journal_path = getattr(opts, "journal", None)
440
+ journal_fp = None
441
+ on_journal = None
442
+ if journal_path:
443
+ try:
444
+ journal_fp = open(journal_path, "a", encoding="utf-8")
445
+ except OSError as e:
446
+ sys.stderr.write(f"error: cannot open journal file {journal_path}: {e}\n")
447
+ return 2
448
+
449
+ def on_journal(entry: Dict[str, object]) -> None:
450
+ journal_fp.write(json.dumps(entry, ensure_ascii=False) + "\n")
451
+ journal_fp.flush()
452
+
433
453
  r = run(
434
454
  profile_raw,
435
455
  RunOptions(
@@ -442,6 +462,7 @@ def _run_agent_with_profile(profile_path: str, opts) -> int:
442
462
  extra_env=extra_env,
443
463
  attachments=_build_attachments(opts),
444
464
  timeout_secs=opts.timeout,
465
+ on_journal=on_journal,
445
466
  on_partial=lambda t: _emit({"type": "partial", "text": t}),
446
467
  on_session=lambda sid: _emit({"type": "session", "id": sid}),
447
468
  on_error=lambda msg: _emit({"type": "error", "message": msg}),
@@ -458,6 +479,8 @@ def _run_agent_with_profile(profile_path: str, opts) -> int:
458
479
  sys.stderr.write(f"agentproc:session:{r.session_id}\n")
459
480
  if r.error:
460
481
  sys.stderr.write(f"agentproc:error:{r.error}\n")
482
+ if journal_fp is not None:
483
+ journal_fp.close()
461
484
  return 0 if r.exit_code == 0 else 1
462
485
 
463
486