herdr-agent-bridge 0.1.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 (150) hide show
  1. herdr_agent_bridge-0.1.0/AGENTS.md +18 -0
  2. herdr_agent_bridge-0.1.0/CHANGELOG.md +15 -0
  3. herdr_agent_bridge-0.1.0/CHANGELOG.zh-CN.md +15 -0
  4. herdr_agent_bridge-0.1.0/CONTRIBUTING.md +171 -0
  5. herdr_agent_bridge-0.1.0/CONTRIBUTING.zh-CN.md +100 -0
  6. herdr_agent_bridge-0.1.0/LICENSE +202 -0
  7. herdr_agent_bridge-0.1.0/MANIFEST.in +9 -0
  8. herdr_agent_bridge-0.1.0/PKG-INFO +102 -0
  9. herdr_agent_bridge-0.1.0/README.md +79 -0
  10. herdr_agent_bridge-0.1.0/README.zh-CN.md +79 -0
  11. herdr_agent_bridge-0.1.0/SECURITY.md +17 -0
  12. herdr_agent_bridge-0.1.0/SECURITY.zh-CN.md +17 -0
  13. herdr_agent_bridge-0.1.0/assets/brand/README.md +7 -0
  14. herdr_agent_bridge-0.1.0/assets/brand/README.zh-CN.md +7 -0
  15. herdr_agent_bridge-0.1.0/assets/brand/beaver-ink.svg +14 -0
  16. herdr_agent_bridge-0.1.0/assets/brand/beaver.png +0 -0
  17. herdr_agent_bridge-0.1.0/assets/brand/beaver.svg +37 -0
  18. herdr_agent_bridge-0.1.0/docs/DEVELOPMENT.md +67 -0
  19. herdr_agent_bridge-0.1.0/docs/DEVELOPMENT.zh-CN.md +47 -0
  20. herdr_agent_bridge-0.1.0/docs/GROK.md +232 -0
  21. herdr_agent_bridge-0.1.0/docs/GROK.zh-CN.md +194 -0
  22. herdr_agent_bridge-0.1.0/docs/INSTALL.md +110 -0
  23. herdr_agent_bridge-0.1.0/docs/INSTALL.zh-CN.md +110 -0
  24. herdr_agent_bridge-0.1.0/docs/PI.md +153 -0
  25. herdr_agent_bridge-0.1.0/docs/PI.zh-CN.md +122 -0
  26. herdr_agent_bridge-0.1.0/docs/PROJECT.md +641 -0
  27. herdr_agent_bridge-0.1.0/docs/PROJECT.zh-CN.md +523 -0
  28. herdr_agent_bridge-0.1.0/docs/PROJECT_BOT_TEMPLATE.md +109 -0
  29. herdr_agent_bridge-0.1.0/docs/PROJECT_BOT_TEMPLATE.zh-CN.md +84 -0
  30. herdr_agent_bridge-0.1.0/pyproject.toml +75 -0
  31. herdr_agent_bridge-0.1.0/scripts/accept_codex.py +11 -0
  32. herdr_agent_bridge-0.1.0/scripts/accept_core_features.py +11 -0
  33. herdr_agent_bridge-0.1.0/scripts/accept_pi.py +11 -0
  34. herdr_agent_bridge-0.1.0/scripts/agent_adapters.py +11 -0
  35. herdr_agent_bridge-0.1.0/scripts/agent_bridge.py +11 -0
  36. herdr_agent_bridge-0.1.0/scripts/app_session.py +11 -0
  37. herdr_agent_bridge-0.1.0/scripts/bridge_common.py +11 -0
  38. herdr_agent_bridge-0.1.0/scripts/bridge_protocol.py +11 -0
  39. herdr_agent_bridge-0.1.0/scripts/core_events.py +11 -0
  40. herdr_agent_bridge-0.1.0/scripts/development.py +11 -0
  41. herdr_agent_bridge-0.1.0/scripts/development_task.py +11 -0
  42. herdr_agent_bridge-0.1.0/scripts/grok_bridge.py +11 -0
  43. herdr_agent_bridge-0.1.0/scripts/grok_notifications.py +11 -0
  44. herdr_agent_bridge-0.1.0/scripts/managed_watch.py +11 -0
  45. herdr_agent_bridge-0.1.0/scripts/pi_evidence.py +11 -0
  46. herdr_agent_bridge-0.1.0/scripts/project_bridge.py +11 -0
  47. herdr_agent_bridge-0.1.0/scripts/project_entry.py +3 -0
  48. herdr_agent_bridge-0.1.0/scripts/render_codex_report.py +11 -0
  49. herdr_agent_bridge-0.1.0/scripts/smoke_hc.py +11 -0
  50. herdr_agent_bridge-0.1.0/scripts/terminal_recovery.py +11 -0
  51. herdr_agent_bridge-0.1.0/setup.cfg +4 -0
  52. herdr_agent_bridge-0.1.0/skills/herdr-agent-bridge/SKILL.md +36 -0
  53. herdr_agent_bridge-0.1.0/skills/herdr-agent-bridge/references/notifications.md +45 -0
  54. herdr_agent_bridge-0.1.0/skills/herdr-agent-bridge/references/recovery.md +33 -0
  55. herdr_agent_bridge-0.1.0/skills/herdr-agent-bridge/references/setup.md +58 -0
  56. herdr_agent_bridge-0.1.0/skills/herdr-agent-bridge/references/takeover.md +20 -0
  57. herdr_agent_bridge-0.1.0/skills/herdr-agent-bridge/references/workflow.md +93 -0
  58. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/__init__.py +3 -0
  59. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/__main__.py +3 -0
  60. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/agent_adapters.py +449 -0
  61. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/agent_bridge.py +1290 -0
  62. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/agent_capabilities.py +26 -0
  63. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/app_session.py +317 -0
  64. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/bridge_common.py +88 -0
  65. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/bridge_protocol.py +214 -0
  66. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/cli.py +43 -0
  67. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/codex_evidence.py +204 -0
  68. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/codex_goals.py +193 -0
  69. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/codex_native.py +216 -0
  70. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/core_events.py +158 -0
  71. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/development.py +270 -0
  72. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/development_task.py +227 -0
  73. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/grok_bridge.py +1277 -0
  74. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/grok_notifications.py +493 -0
  75. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/hermes_registration.py +79 -0
  76. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/hermes_relay.py +205 -0
  77. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/managed_watch.py +39 -0
  78. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/native_commands.py +495 -0
  79. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/personal_entry.py +245 -0
  80. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/pi_evidence.py +447 -0
  81. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/project_bridge.py +1426 -0
  82. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/project_entry.py +105 -0
  83. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/project_registry.py +321 -0
  84. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/readiness.py +144 -0
  85. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/readonly_contracts.py +434 -0
  86. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/resource_paths.py +16 -0
  87. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/resources/__init__.py +1 -0
  88. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/resources/bridge_protocol.json +5 -0
  89. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/resources/bridge_protocol.mjs +5 -0
  90. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/resources/hermes_project_registration/__init__.py +182 -0
  91. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/resources/hermes_project_registration/plugin.yaml +3 -0
  92. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/resources/pi_development_tools.mjs +93 -0
  93. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/resources/pi_native_observer.mjs +169 -0
  94. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/resources/pi_network.mjs +130 -0
  95. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/resources/pi_oauth_session.mjs +230 -0
  96. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/runtime_paths.py +71 -0
  97. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/terminal_recovery.py +227 -0
  98. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/tools/__init__.py +1 -0
  99. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/tools/accept_codex.py +454 -0
  100. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/tools/accept_core_features.py +502 -0
  101. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/tools/accept_pi.py +297 -0
  102. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/tools/acceptance_common.py +71 -0
  103. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/tools/render_codex_report.py +445 -0
  104. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge/tools/smoke_hc.py +201 -0
  105. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge.egg-info/PKG-INFO +102 -0
  106. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge.egg-info/SOURCES.txt +148 -0
  107. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge.egg-info/dependency_links.txt +1 -0
  108. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge.egg-info/entry_points.txt +2 -0
  109. herdr_agent_bridge-0.1.0/src/herdr_agent_bridge.egg-info/top_level.txt +1 -0
  110. herdr_agent_bridge-0.1.0/tests/test_accept_codex.py +75 -0
  111. herdr_agent_bridge-0.1.0/tests/test_accept_pi.py +143 -0
  112. herdr_agent_bridge-0.1.0/tests/test_agent_adapters.py +455 -0
  113. herdr_agent_bridge-0.1.0/tests/test_agent_bridge.py +682 -0
  114. herdr_agent_bridge-0.1.0/tests/test_bridge_common.py +90 -0
  115. herdr_agent_bridge-0.1.0/tests/test_bridge_protocol.py +50 -0
  116. herdr_agent_bridge-0.1.0/tests/test_core_events.py +120 -0
  117. herdr_agent_bridge-0.1.0/tests/test_development.py +290 -0
  118. herdr_agent_bridge-0.1.0/tests/test_grok_bridge.py +765 -0
  119. herdr_agent_bridge-0.1.0/tests/test_grok_notifications.py +482 -0
  120. herdr_agent_bridge-0.1.0/tests/test_hermes_registration.py +162 -0
  121. herdr_agent_bridge-0.1.0/tests/test_hermes_relay.py +211 -0
  122. herdr_agent_bridge-0.1.0/tests/test_installed_cli.py +142 -0
  123. herdr_agent_bridge-0.1.0/tests/test_interrupt.py +153 -0
  124. herdr_agent_bridge-0.1.0/tests/test_naming_policy.py +45 -0
  125. herdr_agent_bridge-0.1.0/tests/test_native_app.py +389 -0
  126. herdr_agent_bridge-0.1.0/tests/test_native_bridge.py +143 -0
  127. herdr_agent_bridge-0.1.0/tests/test_native_codex.py +358 -0
  128. herdr_agent_bridge-0.1.0/tests/test_native_commands.py +485 -0
  129. herdr_agent_bridge-0.1.0/tests/test_native_monitor.py +413 -0
  130. herdr_agent_bridge-0.1.0/tests/test_personal_entry.py +473 -0
  131. herdr_agent_bridge-0.1.0/tests/test_pi_bridge.py +1565 -0
  132. herdr_agent_bridge-0.1.0/tests/test_pi_development_tools.py +55 -0
  133. herdr_agent_bridge-0.1.0/tests/test_pi_evidence.py +861 -0
  134. herdr_agent_bridge-0.1.0/tests/test_pi_native_observer.py +292 -0
  135. herdr_agent_bridge-0.1.0/tests/test_pi_network.py +367 -0
  136. herdr_agent_bridge-0.1.0/tests/test_pi_oauth_session.py +549 -0
  137. herdr_agent_bridge-0.1.0/tests/test_project_bridge.py +1566 -0
  138. herdr_agent_bridge-0.1.0/tests/test_project_entry.py +182 -0
  139. herdr_agent_bridge-0.1.0/tests/test_project_registry.py +177 -0
  140. herdr_agent_bridge-0.1.0/tests/test_readonly_contracts.py +470 -0
  141. herdr_agent_bridge-0.1.0/tests/test_render_codex_report.py +76 -0
  142. herdr_agent_bridge-0.1.0/tests/test_runtime_paths.py +74 -0
  143. herdr_agent_bridge-0.1.0/tests/test_smoke_hc.py +98 -0
  144. herdr_agent_bridge-0.1.0/tests/test_terminal_recovery.py +187 -0
  145. herdr_agent_bridge-0.1.0/tests/test_verification_concurrency.py +208 -0
  146. herdr_agent_bridge-0.1.0/tools/check.py +20 -0
  147. herdr_agent_bridge-0.1.0/tools/check_install.py +269 -0
  148. herdr_agent_bridge-0.1.0/tools/check_naming.py +104 -0
  149. herdr_agent_bridge-0.1.0/tools/naming_exceptions.json +47 -0
  150. herdr_agent_bridge-0.1.0/uv.lock +135 -0
@@ -0,0 +1,18 @@
1
+ # Working in this source repository
2
+
3
+ - Start with `README.md` and the usage documentation relevant to the change. Read code, contracts and tests as evidence requires it.
4
+ - These rules apply to the shared source, regardless of the developer's harness. Keep development plans, research, progress records and personal skills in the developer's chosen harness; product implementation, tests and usage documentation belong here.
5
+ - Inspect the working tree before editing, preserve others' changes, and make the smallest change that fulfills the task. Follow the existing module and CLI contracts.
6
+ - The initial execution backend is herdr-core (`hc`). Herdr TUI and Herdr App are separate integration surfaces.
7
+ - Prefer an existing maintained component when it meets the task contract. Record limitations and verification before adopting it.
8
+ - Preserve the distinction between submitted input, observed terminal state, returned evidence, and verified task success.
9
+ - Treat a timeout or lost reply as uncertain delivery until reconciled. Do not blindly replay task creation or prompts.
10
+ - Use dedicated test sessions and scratch XDG configuration/state/runtime paths. Do not inspect, stop, or modify a user's unrelated sessions.
11
+ - Never silently approve a coding agent's permission or trust dialog.
12
+ - Match checks to changed behavior. Do not claim real-agent or Grok integration based on fixture tests.
13
+ - Keep credentials, private project contents, raw local transcripts, and machine-specific configuration out of commits. Generated artifacts live in .artifacts/.
14
+ - Use `uv sync --locked --python 3.11` for development and `uv run --locked --python 3.11 python tools/check.py test` for product regressions. These tests use fake backends and disposable local fixtures; some require Node.js. The real smoke and model-backed acceptance commands are documented in `CONTRIBUTING.md` and have separate prerequisites and effects.
15
+ - Keep the source independently usable and testable. Product code, prerequisite checks and acceptance programs must not require an adjacent harness, its roadmap, its decisions or its skills.
16
+ - Preserve runtime directory contracts and existing `.artifacts/` journals, notification state and raw evidence. A repository cleanup does not authorize moving or rewriting runtime state.
17
+ - For architecture or operational changes, update the affected product usage documentation and return actual verification and limitations to the caller's development workflow. Do not mark unfinished work or human acceptance complete.
18
+ - For delegation, assign bounded ownership, preserve concurrent edits, and inspect the resulting artifacts and verification.
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ English · [简体中文](CHANGELOG.zh-CN.md)
4
+
5
+ ## 0.1.0
6
+
7
+ The first public release connects Hermes Desktop or Grok Bot to a local Pi or Codex session through herdr-core. A request can continue across turns and return verified changes to its original conversation.
8
+
9
+ - Bind a single project or discover authorized Git projects with the Personal Agent entry. A trusted operator confirms new registrations.
10
+ - Keep the same native agent session for follow-ups, interrupts, human takeover and supported recovery.
11
+ - Check the diff, file scope and exit status of named commands before accepting a development task.
12
+ - Deliver result events through the local Hermes relay or a Grok HTTPS routine. Saved request and event IDs support reconciliation after a lost reply.
13
+ - Install the Python CLI with uv and run a local smoke without a model. The wheel includes the operating skill and its references.
14
+
15
+ See [compatibility](README.md#compatibility) for supported runtimes, native commands, platform coverage and Pi history limits.
@@ -0,0 +1,15 @@
1
+ # 更新日志
2
+
3
+ [English](CHANGELOG.md) · 简体中文
4
+
5
+ ## 0.1.0
6
+
7
+ 首个公开版本通过 herdr-core 把 Hermes Desktop 或 Grok Bot 对话接入本机的 Pi 或 Codex。一个请求可以连续执行多轮,并把经过核验的改动带回原对话。
8
+
9
+ - 绑定单一项目,或通过 Personal Agent 入口发现获授权的 Git 项目。新登记由可信操作者确认。
10
+ - 在原生 Agent 会话内追加需求、打断执行、人工接管,并在支持的情况下恢复原会话。
11
+ - 在接受开发任务前,检查 diff、改动范围和登记命令的退出码。
12
+ - 通过 Hermes 本机中继或 Grok HTTPS 例程回传结果。回复丢失后,可凭保存的请求和事件标识核对原任务。
13
+ - 用 uv 安装 Python CLI,无需模型即可运行本地 smoke。wheel 内含操作 skill 和配套参考文档。
14
+
15
+ 支持的运行模式、原生命令、平台范围和 Pi 会话限制见[兼容范围](README.zh-CN.md#compatibility)。
@@ -0,0 +1,171 @@
1
+ # Contributing
2
+
3
+ [简体中文](CONTRIBUTING.zh-CN.md) · [Install and first run](docs/INSTALL.md)
4
+
5
+ Read [AGENTS.md](AGENTS.md) and the relevant product usage documentation before changing source. Developers may use their own development harness; this repository contains the shared implementation, tests and usage contract.
6
+
7
+ For a change, explain the concrete problem, the resulting behavior, and what was verified. Keep refactors and unrelated cleanup separate. Update affected product documentation here; development plans, research, decisions and acceptance summaries belong in your chosen harness. Distinguish proposals from behavior backed by a real integration.
8
+
9
+ Set up the editable project and pinned developer tools with [uv](https://docs.astral.sh/uv/getting-started/installation/), Python 3.11 and Node.js for JavaScript fixtures:
10
+
11
+ ```sh
12
+ uv sync --locked --python 3.11
13
+ uv run --locked --python 3.11 python tools/check.py all
14
+ uv run --locked --python 3.11 python tools/check_install.py
15
+ ```
16
+
17
+ `check.py all` runs the quality gates and local regression suite. `check_install.py` builds wheel and sdist, rebuilds a wheel from sdist, and runs clean installs and regressions outside the checkout. The fixtures use fake hc, disposable repositories, local processes and loopback HTTP; they do not invoke real agents or models. To run only the regression suite:
18
+
19
+ ```sh
20
+ uv run --locked --python 3.11 python -m unittest discover -s tests -v
21
+ ```
22
+
23
+ To check a real installed hc without a model, follow the isolated [smoke instructions](docs/INSTALL.md#first-success-without-a-model). It creates a dedicated session; do not run experiments against a user's active work.
24
+
25
+ For ordinary bugs, use [GitHub Issues](https://github.com/M1racleShih/herdr-agent-bridge/issues) with a minimal reproducible example, versions, expected and observed behavior, and sanitized evidence. Keep local paths, transcripts and credentials out of shared reports. Report vulnerabilities privately through the channel in [SECURITY.md](SECURITY.md).
26
+
27
+ ## Contribute a coding-agent adapter
28
+
29
+ Start with the existing [capability declarations](src/herdr_agent_bridge/agent_capabilities.py), [adapter](src/herdr_agent_bridge/agent_adapters.py), [native command handling](src/herdr_agent_bridge/native_commands.py), and the [development contract](docs/DEVELOPMENT.md). These are coordinated implementation points, not a stable plug-in API: a new agent also needs protocol selection, native evidence and lifecycle integration where applicable. Identify the agent version and supported runtime, startup and resume behavior, model selection, permission boundaries, and native commands before implementing.
30
+
31
+ Use synthetic, sanitized native-history fixtures and fake hc. Extend [adapter tests](tests/test_agent_adapters.py), evidence tests and [native-command contract tests](tests/test_native_commands.py) as appropriate. Cover exact submitted input, session and turn identity, final answer and completion ordering; reject missing, ambiguous, malformed or unsupported evidence. Test startup, follow-up, interruption and recovery only where supported, as well as permission prompts, ordinary-input conflicts, duplicate operation IDs and uncertain send or notification delivery. Unknown delivery must be reconciled, not replayed. Preserve existing journal formats, original paths and identities, and do not treat terminal `done` as verified success.
32
+
33
+ In a contribution, distinguish fixture results from a real integration. For a supported real-agent claim, separately record the OS, hc, agent and model versions, authorized setup, actual correlated native session/turn evidence, independent verification, failure or uncertainty cases, and cleanup of dedicated resources. A local runner does not prove Bot dispatch or delivery. Publish sanitized summaries only; keep credentials, raw transcripts, private project files, machine-specific configuration and runtime artifacts out of Git. Update the support documentation to match the evidence, and clearly mark untested features rather than implying support.
34
+
35
+ ## Real interactive Codex acceptance
36
+
37
+ The local bridge and real-agent acceptance runner require **Python 3.11+**, `hc`,
38
+ `codex`, and existing working Codex authentication/provider configuration. The
39
+ read-only tests have passed on Linux with hc 0.1.22 and Codex CLI 0.171.0. The real check
40
+ uses model access; the unit tests above do not.
41
+
42
+ ```sh
43
+ herdr-bridge tool accept_codex
44
+ ```
45
+
46
+ This starts interactive Codex with `--no-daemon`, `read-only` and `on-request`
47
+ approvals in a private hc session. It independently checks source facts and
48
+ citations, follows up in the same native thread, handles a clarification, then
49
+ checks timeout, uncertain delivery and hc control cases. A real send reply is
50
+ locally discarded once; this is not a real network outage. The clarification
51
+ answer is supplied by the test script, not a live human. Control-case programs
52
+ are fixtures, not extra Codex runs. No permission or trust dialog is approved.
53
+
54
+ Run it in an environment where Codex can start its own sandbox. A nested Codex
55
+ sandbox may hide the shared socket directory and cause `blocked`; that is a
56
+ failed run requiring inspection, not permission to relax the inner sandbox.
57
+
58
+ The random session name, recovery directory and task intent are written before
59
+ side effects. Each run writes private evidence to `.artifacts/acceptance/codex/<run>/`:
60
+ `acceptance.json` (checks/results), `calls.json` (attempts), and
61
+ `bridge/journal.json` (task, terminal and native turn mapping). A private copy of this isolated run’s JSONL is saved before cleanup as
62
+ `codex-session-*.jsonl`. The independent
63
+ Codex home and XDG directories are temporary. Only provider configuration,
64
+ authentication and pre-existing trust for the exact project are reused; hooks,
65
+ plugins, MCP servers and unrelated project trust are not imported. This is
66
+ state isolation, not an isolation boundary against same-user processes.
67
+ Successful cleanup removes the temporary home, including copied authentication.
68
+ If cleanup fails, retain the journal and reconcile its exact terminal before
69
+ retrying cleanup; the recovery directory can still contain authentication.
70
+
71
+ The minimal bridge can also be driven manually:
72
+
73
+ ```sh
74
+ herdr-bridge agent --run .artifacts/manual-run start --project "$PWD"
75
+ herdr-bridge agent --run .artifacts/manual-run observe --wait 20
76
+ herdr-bridge agent --run .artifacts/manual-run submit analysis-1 --prompt-file /tmp/task.txt
77
+ herdr-bridge agent --run .artifacts/manual-run observe --task-id analysis-1 --wait 20
78
+ herdr-bridge agent --run .artifacts/manual-run submit followup-1 --parent analysis-1 --prompt-file /tmp/followup.txt
79
+ herdr-bridge agent --run .artifacts/manual-run close
80
+ ```
81
+
82
+ Wait for readiness before submitting, and inspect the first task until correlated
83
+ completed evidence is available before following up. Reuse of a task ID and a
84
+ new prompt while delivery is unresolved are refused. `needs_human` can mean an
85
+ Agent question or a native permission dialog; the tool never answers a dialog.
86
+ Terminal status and returned evidence do not set `verified_success`: a caller
87
+ must perform independent checks through `Bridge.verify`, as the acceptance
88
+ runner does. This is a local, single-writer adapter; it has no Grok transport,
89
+ notification queue or automatic recovery/replay.
90
+
91
+ Optionally render a compact Chinese-language HTML report from a **passed** acceptance record:
92
+
93
+ ```sh
94
+ herdr-bridge tool render_codex_report .artifacts/acceptance/codex/<run>/acceptance.json \
95
+ --output .artifacts/acceptance/codex/report.html --regression-count 34
96
+ ```
97
+
98
+ The HTML contains a sanitized summary and the private record's SHA-256. Keep
99
+ raw transcripts, provider configuration and machine paths out of shared records.
100
+ The renderer also supports failed records and must label them as not passed.
101
+
102
+ ## Grok management boundary
103
+
104
+ Use `herdr-bridge manager probe` for isolated local readiness and the
105
+ existing unittest command for regression. Both avoid models and user sessions.
106
+ The manager wraps the local agent bridge with a fixed Bot/conversation binding,
107
+ compact evidence output, deterministic acceptance contracts, and a durable
108
+ official-routine webhook outbox. See [the operational contract](docs/GROK.md)
109
+ for commands, private credential format, observer lifecycle and recovery.
110
+
111
+ The first `idle` report can precede input readiness in hc 0.1.18. The manager
112
+ waits out that version's 10-second startup guard using the terminal creation
113
+ time and checks live state again; require `input_ready=true` before submission.
114
+ No startup send is attempted while that condition is false.
115
+
116
+ Tests use fake hc, disposable journals and loopback HTTP fixtures. A locally
117
+ started real Codex check also does not establish Grok-originated dispatch or
118
+ Grok receipt. Grok integration acceptance needs real Grok conversation/local-tool evidence,
119
+ correlated source verification, an actual question/answer continuation, webhook
120
+ and receipt association, and cleanup of the dedicated core, copied temporary
121
+ authentication and observer process. Keep those raw records in `.artifacts/`.
122
+
123
+ ## Pi integration
124
+
125
+ Use `herdr-bridge manager probe --agent pi` and the same local unittest
126
+ command. Pi parser/bridge/SDK-launcher tests use disposable native-history
127
+ fixtures, fake hc, and synthetic SDK packages; they do not access real auth or
128
+ models. The SDK fixture tests invoke Node.js and skip if it is unavailable.
129
+ Networking fixtures also substitute Pi's SDK-relative public undici dependency;
130
+ they check proxy/timeout behavior and dispatcher cleanup without network calls.
131
+
132
+ `herdr-bridge tool accept_pi` invokes the configured real model and keeps its
133
+ own hc session, settings, cache and native history. API keys are copied only for
134
+ the selected provider; OAuth uses Pi's original native auth file and normal
135
+ lock/refresh semantics, so it requires authorization for that persistent refresh.
136
+ Never refresh OAuth in a disposable copy and delete the replacement token.
137
+ Trust is declined, executable resources disabled, and only read/grep/find/ls
138
+ are exposed. This tool selection is not an OS sandbox.
139
+
140
+ The real local check covers four deterministic turns, source/citation checks,
141
+ discarded-send-reply reconciliation without replay, and cleanup. Its language
142
+ answer is preset and it does not invoke Grok. Before cleanup it snapshots this
143
+ run's native history on success or failure, without copying auth into the
144
+ evidence directory. See [Pi operation and evidence boundaries](docs/PI.md).
145
+
146
+ ## Reproducible quality gates
147
+
148
+ Use Python 3.11 and the lockfile for pinned developer tools:
149
+
150
+ ```sh
151
+ uv sync --locked --python 3.11
152
+ uv run --locked --python 3.11 python tools/check.py all
153
+ ```
154
+
155
+ `lint`, `format`, `types`, `naming` and `test` run separately in CI through the same
156
+ `tools/check.py` entry. Ruff checks E4/E7/E9/F and import order across Python
157
+ code; formatting is a separate gate. Regression runs on Python 3.11 and 3.15
158
+ with Node 24, including the existing JS fixtures through unittest.
159
+
160
+ Mypy currently checks `bridge_common`, `bridge_protocol`, and `development_task`,
161
+ with normal import following and checks inside untyped functions. Persistence
162
+ and hc transport have fully annotated signatures and reject unparameterized
163
+ generics. Policy selections and verification tickets constrain model and state
164
+ boundaries. Dynamic journal dictionaries, most state methods, adapters and CLI
165
+ modules remain incremental typing work; this is not full strict coverage.
166
+ No missing-import suppression or skipped-import replacement is used.
167
+
168
+ The `naming` gate checks filenames and text for development-stage names. Narrow
169
+ historical-input exceptions are recorded as exact lines with reasons in
170
+ `tools/naming_exceptions.json`; new public aliases and output paths are not exceptions.
171
+ Protocol state fields named `phase` and upstream version numbers are unchanged.
@@ -0,0 +1,100 @@
1
+ # 贡献指南
2
+
3
+ [English](CONTRIBUTING.md) · [安装与首次运行](docs/INSTALL.zh-CN.md)
4
+
5
+ 修改源码前,请阅读 [AGENTS.md](AGENTS.md) 和相关产品文档。开发者可以选择自己的开发 harness;本仓库维护共享实现、测试和产品使用契约。
6
+
7
+ 说明具体问题、修改后的行为及实际验证。将重构和无关清理分开;在本仓库更新受影响的产品文档。区分方案、fixture 结果和有真实集成证据的行为。
8
+
9
+ 使用 [uv](https://docs.astral.sh/uv/getting-started/installation/)、Python 3.11 和供 JavaScript fixture 使用的 Node.js,安装可编辑项目和锁定的开发工具:
10
+
11
+ ```sh
12
+ uv sync --locked --python 3.11
13
+ uv run --locked --python 3.11 python tools/check.py all
14
+ uv run --locked --python 3.11 python tools/check_install.py
15
+ ```
16
+
17
+ `check.py all` 运行质量门禁和本地回归;`check_install.py` 构建 wheel 和 sdist、从 sdist 重建 wheel,并在源码目录外进行干净安装与回归。fixture 使用 fake hc、临时仓库、本地进程和回环 HTTP,不调用真实 Agent 或模型。只运行回归:
18
+
19
+ ```sh
20
+ uv run --locked --python 3.11 python -m unittest discover -s tests -v
21
+ ```
22
+
23
+ 如需无模型地检查真实安装的 hc,请按[隔离 smoke 说明](docs/INSTALL.zh-CN.md#不调用模型的首次成功)操作。它创建专用 session;不要对用户的活动会话做实验。
24
+
25
+ 普通问题请到 [GitHub Issues](https://github.com/M1racleShih/herdr-agent-bridge/issues) 提交最小复现、版本、预期与实际行为和脱敏证据。不要公开本机路径、原始对话或凭据。漏洞请通过 [SECURITY.md](SECURITY.zh-CN.md) 中的渠道私下报告。
26
+
27
+ ## 贡献 coding-agent 适配
28
+
29
+ 从现有的[能力声明](src/herdr_agent_bridge/agent_capabilities.py)、[适配代码](src/herdr_agent_bridge/agent_adapters.py)、[原生命令处理](src/herdr_agent_bridge/native_commands.py)和[开发契约](docs/DEVELOPMENT.zh-CN.md)入手。这些是协同工作的实现位置,并非稳定的插件 API:新 Agent 还需要按实际情况接入协议选择、原生证据和生命周期。实现前确定 Agent 版本、支持的运行模式、启动与恢复行为、模型选择、权限边界及原生命令。
30
+
31
+ 使用合成且脱敏的原生历史 fixture 和 fake hc,按需扩展[适配测试](tests/test_agent_adapters.py)、证据测试和[原生命令契约测试](tests/test_native_commands.py)。覆盖精确提交的输入、session 和轮次身份、最终回答及完成顺序;对缺失、有歧义、损坏或不支持的证据安全拒绝。根据支持范围测试启动、追问、打断和恢复,并覆盖权限提示、普通输入冲突、重复操作 ID,以及未知的输入或通知送达。送达未知必须核对,不能重放。保留原 journal 格式、路径和身份,不能将终端 `done` 当作核验成功。
32
+
33
+ 贡献说明应区分 fixture 结果和真实集成。要声明某项真实 Agent 支持,另行记录系统、hc、Agent 和模型版本,授权的环境,关联的真实原生 session/轮次证据,独立核验,失败或未知状态,以及专用资源的清理。本机运行器不能证明 Bot 派单或回传。只公开脱敏摘要;凭据、原始对话、私有项目文件、本机配置和运行产物不得提交到 Git。让支持文档与证据一致,明确标示未验证功能。
34
+
35
+ ## 真实交互 Codex 验收
36
+
37
+ 本机 bridge 和真实 Agent 验收需要 **Python 3.11+**、`hc`、`codex` 及可用的现有 Codex 认证/provider 配置。只读测试曾在 Linux 的 hc 0.1.22、Codex CLI 0.171.0 通过。真实检查使用模型;上面的单元测试不使用模型。
38
+
39
+ ```sh
40
+ herdr-bridge tool accept_codex
41
+ ```
42
+
43
+ 该命令在私有 hc session 以 `--no-daemon`、`read-only` 和 `on-request` 权限启动交互式 Codex,独立检查源码事实与引用,在同一原生线程追问并处理澄清,再检查超时、送达未知及 hc 控制情况。它仅在本机丢弃一次真实 send 回复,并非真实网络中断;澄清答案由脚本提供,不是真人。控制程序是 fixture,不是额外 Codex 运行。不会自动批准权限或信任提示。
44
+
45
+ 在 Codex 可以启动自身 sandbox 的环境中运行。嵌套 sandbox 可能隐藏共享 socket 目录并导致 `blocked`;这是需要检查的失败,不构成放宽内层 sandbox 的许可。
46
+
47
+ 随机 session 名称、恢复目录和任务意图在副作用之前写入。每次运行将私有证据写到 `.artifacts/acceptance/codex/<run>/`:`acceptance.json` 保存检查与结果,`calls.json` 保存尝试,`bridge/journal.json` 保存任务、终端和原生轮次映射;清理前会保存专用 run 的 `codex-session-*.jsonl` 私有副本。独立 Codex home 和 XDG 目录是临时的,只复用 provider 配置、认证和对该准确项目已有的信任,不导入 hooks、插件、MCP server 或无关项目的信任。这是状态隔离,不是防御同一用户进程的隔离边界。成功清理会删除含复制认证的临时 home;如果清理失败,保留 journal 并核对原终端后再清理,恢复目录可能仍含认证。
48
+
49
+ 也可以手动驱动最小 bridge:
50
+
51
+ ```sh
52
+ herdr-bridge agent --run .artifacts/manual-run start --project "$PWD"
53
+ herdr-bridge agent --run .artifacts/manual-run observe --wait 20
54
+ herdr-bridge agent --run .artifacts/manual-run submit analysis-1 --prompt-file /tmp/task.txt
55
+ herdr-bridge agent --run .artifacts/manual-run observe --task-id analysis-1 --wait 20
56
+ herdr-bridge agent --run .artifacts/manual-run submit followup-1 --parent analysis-1 --prompt-file /tmp/followup.txt
57
+ herdr-bridge agent --run .artifacts/manual-run close
58
+ ```
59
+
60
+ 提交前等待就绪;追问前检查首个任务,直到有相关联的完成证据。送达未解决时,复用任务 ID 和新 prompt 都会被拒绝。`needs_human` 可能是 Agent 问题或原生权限对话框,工具不会替人回答。终端状态和返回证据不会设置 `verified_success`;调用方必须像验收程序一样通过 `Bridge.verify` 独立核验。此适配器是本机单写入者接口,不提供 Grok 传输、通知队列或自动恢复/重放。
61
+
62
+ 可选:从**通过**的验收记录生成中文精简 HTML 报告:
63
+
64
+ ```sh
65
+ herdr-bridge tool render_codex_report .artifacts/acceptance/codex/<run>/acceptance.json \
66
+ --output .artifacts/acceptance/codex/report.html --regression-count 34
67
+ ```
68
+
69
+ HTML 含脱敏摘要及私有记录的 SHA-256;原始对话、provider 配置和本机路径不得公开。渲染器也接受失败记录,但必须标为未通过。
70
+
71
+ ## Grok 管理边界
72
+
73
+ `herdr-bridge manager probe` 可检查隔离的本机就绪情况;配合上述 unittest 回归,两者均不使用模型或用户 session。Manager 将本机 Agent bridge 与固定 Bot/对话绑定、精简证据、确定性验收契约和持久的官方 routine webhook outbox 组合。命令、私有凭据格式、观察器生命周期及恢复见[操作契约](docs/GROK.zh-CN.md)。
74
+
75
+ hc 0.1.18 的首次 `idle` 可能早于可输入状态。Manager 使用终端创建时间等待该版本的 10 秒启动保护并再次检查实时状态;提交前必须有 `input_ready=true`。
76
+
77
+ 测试使用 fake hc、临时 journal 和回环 HTTP fixture。本机真实 Codex 检查也不能证明 Grok 发起派单或收到结果。Grok 集成验收需要真实 Grok 对话/本机工具证据、关联源码核验、实际问答续轮、webhook 和收据关联,以及专用 core、复制的临时认证和观察器进程的清理。原始记录保存在 `.artifacts/`。
78
+
79
+ ## Pi 集成
80
+
81
+ 使用 `herdr-bridge manager probe --agent pi` 和相同的本地 unittest。Pi 解析器、bridge、SDK 启动器测试使用临时原生历史 fixture、fake hc 和合成 SDK 包,不访问真实认证或模型。SDK fixture 测试调用 Node.js,未安装时跳过;网络 fixture 替换 Pi SDK 相对位置的公共 undici 依赖,检查代理/超时和 dispatcher 清理,不访问网络。
82
+
83
+ `herdr-bridge tool accept_pi` 会调用配置的真实模型,使用专用 hc session、设置、缓存和原生历史。API key 只为选定 provider 复制;OAuth 使用 Pi 原生认证文件及正常锁/刷新语义,因此其持久刷新需要授权。切勿在一次性副本中刷新 OAuth 后删除替换 token。测试拒绝信任、禁用可执行资源,仅开放 read/grep/find/ls;这些工具选择不是 OS sandbox。
84
+
85
+ 真实本机检查覆盖四个确定性轮次、源码/引用核验、丢弃 send 回复后不重放的核对,以及清理。语言答案由脚本预设,不调用 Grok。成功或失败时,清理前都会尝试保存该 run 的原生历史,不将认证复制到证据目录。见 [Pi 操作与证据边界](docs/PI.zh-CN.md)。
86
+
87
+ ## 可复现质量门禁
88
+
89
+ 使用 Python 3.11 和锁文件中的开发工具:
90
+
91
+ ```sh
92
+ uv sync --locked --python 3.11
93
+ uv run --locked --python 3.11 python tools/check.py all
94
+ ```
95
+
96
+ CI 通过同一 `tools/check.py` 入口分别运行 `lint`、`format`、`types`、`naming` 和 `test`。Ruff 检查 Python 代码的 E4/E7/E9/F 和导入顺序,格式化为独立门禁。回归在 Python 3.11 和 3.15、Node 24 上运行,并通过 unittest 包含现有 JS fixture。
97
+
98
+ Mypy 当前检查 `bridge_common`、`bridge_protocol` 和 `development_task`,正常跟随导入并检查无类型函数内部。持久化和 hc 传输要求完整签名并拒绝未参数化泛型;策略选择及核验票据约束模型和状态边界。动态 journal 字典、大部分状态方法、适配器和 CLI 模块仍是渐进类型工作,并非全面 strict 覆盖;不使用忽略缺失导入或跳过导入的替代方式。
99
+
100
+ `naming` 门禁检查文件名和文本中的开发阶段名称。精确历史输入例外及理由记录在 `tools/naming_exceptions.json`;新公共别名或输出路径不能列为例外。协议状态字段 `phase` 和上游版本号不变。
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,9 @@
1
+ include AGENTS.md uv.lock
2
+ include README.md README.zh-CN.md CHANGELOG.md CHANGELOG.zh-CN.md
3
+ include CONTRIBUTING.md CONTRIBUTING.zh-CN.md SECURITY.md SECURITY.zh-CN.md
4
+ recursive-include assets/brand *.png *.svg README*.md
5
+ recursive-include docs *.md
6
+ recursive-include scripts *.py
7
+ recursive-include tools *.py *.json
8
+ recursive-include tests *.py
9
+ recursive-include skills *.md
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.4
2
+ Name: herdr-agent-bridge
3
+ Version: 0.1.0
4
+ Summary: Local coding-agent task bridge over herdr-core
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/M1racleShih/herdr-agent-bridge
7
+ Project-URL: Repository, https://github.com/M1racleShih/herdr-agent-bridge
8
+ Project-URL: Issues, https://github.com/M1racleShih/herdr-agent-bridge/issues
9
+ Classifier: Environment :: Console
10
+ Classifier: Operating System :: MacOS
11
+ Classifier: Operating System :: POSIX :: Linux
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Programming Language :: Python :: 3.15
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Dynamic: license-file
23
+
24
+ # herdr-agent-bridge
25
+
26
+ English · [简体中文](README.zh-CN.md)
27
+
28
+ <img src="assets/brand/beaver.png" width="144" height="144" alt="A beaver delivering an envelope across a bridge">
29
+
30
+ Run Pi or Codex on your machine from a Hermes or Grok chat. Ask for a change, let the agent work in a local terminal, and get the diff and check results back in the conversation that asked for them.
31
+
32
+ ## A task from chat to checkout
33
+
34
+ ```mermaid
35
+ sequenceDiagram
36
+ actor User
37
+ participant Chat as Hermes or Grok
38
+ participant Bridge as Local bridge
39
+ participant Agent as Pi or Codex via hc
40
+ User->>Chat: Fix the upper bound and run the unit tests
41
+ Chat->>Bridge: Start a request in the bound project
42
+ Bridge->>Agent: Submit one round
43
+ Agent-->>Bridge: Return evidence for that round
44
+ Bridge-->>Chat: Notify the original conversation
45
+ Chat->>Bridge: Read the diff and run the named checks
46
+ Chat-->>User: Report changes and test results
47
+ User->>Chat: Add a test for equal bounds
48
+ Chat->>Bridge: Continue the request
49
+ Bridge->>Agent: Resume work in the same session
50
+ ```
51
+
52
+ | When you need to… | What the bridge gives you |
53
+ | --- | --- |
54
+ | Follow up on a fix | A request keeps its native session and parent round. Ask for the next change without pasting the previous conversation. |
55
+ | Check the agent's work | The bridge compares the worktree to its baseline, checks the allowed paths and records the exit status of your named commands. You can inspect the evidence before accepting a change. |
56
+ | Work on two projects | Independent projects can run concurrently. One active development task per project prevents two bound callers from writing the same project at once when its shared task slot is enabled. |
57
+ | Take over or reconnect | Pause automatic input, inspect the live terminal and hand it back after reconciling the session. If a send times out, inspect the original request before retrying. |
58
+
59
+ ## Try it locally
60
+
61
+ Install [uv](https://docs.astral.sh/uv/getting-started/installation/) and [herdr-core](https://github.com/herdrdev/herdr-core#install) (`hc`). With Git on your PATH, run:
62
+
63
+ ```sh
64
+ uv tool install --python 3.11 'git+https://github.com/M1racleShih/herdr-agent-bridge.git@v0.1.0'
65
+ export PATH="$(uv tool dir --bin):$PATH"
66
+ herdr-bridge --version
67
+ herdr-bridge tool smoke_hc --output "$(mktemp -d)/results.json"
68
+ ```
69
+
70
+ Expect `herdr-bridge 0.1.0` and a JSON result with `"passed": true`. The smoke sends a task and a follow-up to a small local program, checks that blocked input is refused and cleans up its own terminal. It requires no bot, model or API key. Each invocation writes its report to a new temporary directory and prints the path.
71
+
72
+ **Give this to your agent:** “Follow the [v0.1.0 installation guide](https://github.com/M1racleShih/herdr-agent-bridge/blob/v0.1.0/docs/INSTALL.md). Install the CLI with uv and run the local smoke. Show me the version and checks before connecting a bot or using a model.”
73
+
74
+ For a first coding task, select an authenticated Pi or Codex CLI and a disposable Git project. Register a named check, set the allowed files, submit a round and verify the result using the [project guide](docs/PROJECT.md). The [installation guide](docs/INSTALL.md) also covers installing a release wheel and finding the bundled agent skill.
75
+
76
+ <a id="compatibility"></a>
77
+
78
+ ## Compatibility
79
+
80
+ | Execution mode | Pi | Codex CLI |
81
+ | --- | --- | --- |
82
+ | Read-only tasks with correlated replies | Isolated SDK | Isolated CLI |
83
+ | Development in the normal agent environment | Native | Native |
84
+ | Development with the restricted SDK tool set | Supported | Unavailable |
85
+ | Direct native commands through the bridge | `/name` | `/fast`, `/goal`, `/model` |
86
+
87
+ The Linux integration baseline includes herdr-core 0.1.22, Pi 1.5.2 and Codex CLI 0.171.0. Hermes Desktop and Grok Bot have each dispatched work to both native agents and received verified results back in the original chat. Hermes uses a local relay. Grok needs its desktop device connection and an HTTPS routine. Allow for device disconnects during callbacks.
88
+
89
+ Python 3.11+ is required. The Linux and macOS local smoke supports a POSIX terminal. The real-agent baseline covers Linux. Pi requires Node.js and a short, linear history for result correlation. A fork, compaction or unsupported context edit can stop verification. Other agent adapters are open for contribution.
90
+
91
+ ## Guides
92
+
93
+ | Goal | Start here |
94
+ | --- | --- |
95
+ | Install, diagnose PATH issues or locate the skill | [Installation](docs/INSTALL.md) |
96
+ | Bind one or more projects, submit, verify or recover | [Project operations](docs/PROJECT.md) |
97
+ | Connect a chat and handle completion notifications | [Bot instructions](docs/PROJECT_BOT_TEMPLATE.md) · [Grok management](docs/GROK.md) |
98
+ | Inspect native evidence, contracts or takeover controls | [Pi integration](docs/PI.md) · [Development tasks](docs/DEVELOPMENT.md) |
99
+ | Give an agent the operating instructions | [Bundled skill](skills/herdr-agent-bridge/SKILL.md) |
100
+ | Run the suite or contribute an adapter | [Contributing](CONTRIBUTING.md) · [Security](SECURITY.md) |
101
+
102
+ [Release notes](CHANGELOG.md) · [Apache-2.0 license](LICENSE) · [Logo assets](assets/brand/README.md)