Skip to content

Add HELM-governed Telegram channel bridge (HITL-by-phone) - #20

Merged
mindburnlabs merged 3 commits into
mainfrom
telegram-bridge
Aug 6, 2026
Merged

Add HELM-governed Telegram channel bridge (HITL-by-phone)#20
mindburnlabs merged 3 commits into
mainfrom
telegram-bridge

Conversation

@peycheff-com

Copy link
Copy Markdown
Contributor

What

Adopts Rowboat's ChannelBridge mechanism (Apache-2.0, rowboatlabs/rowboat) as governed human-in-the-loop by phone, per the Wave-2 deep study (.tmp-research/findings/x-core-services.md, mechanism 4 + recommendation 3; Rowboat sources channels/{bridge,service}.ts, channels/transports/telegram.ts). Rowboat runs channel turns with autoPermission: true and no per-command policy; this package is an original implementation that makes every hop Kernel-evaluated — the outperform wedge.

New package: packages/js/helm-channel-bridge (+ integrations/telegram/README.md), following the existing helm-tool-wrapper conventions (thin adapter, /api/v1/evaluate boundary style, node:test, no runtime deps).

Governance semantics (fail closed)

  • (c) Every inbound command is a Kernel-evaluated turn. help/list/status/resume/new/stop, chat turns, and ask_human answers each preflight with a distinct action URN (channel.<transport>.command.<name>, channel.<transport>.turn.run, channel.<transport>.ask_human.answer). Only explicit ALLOW dispatches; unknown verdicts, ESCALATE, evaluator outages, and malformed responses all deny. Unknown slash-commands are denied locally without evaluation or dispatch.
  • (b) ask_human relay. Suspended-turn questions are delivered to the chat; answers are Kernel-evaluated before routing back into the suspended turn. Denied answers never reach the engine.
  • (d) autoPermission is allowlist-only. Default allowlist: routine read-only help/list/status. Chat turns run autoPermission: false (tool effects still need approval) unless the operator deliberately allowlists chat — documented as a risky choice.
  • (a) Telegram transport. Dependency-free Bot API long polling; DMs only; explicit chat-ID allowlist (empty denies everyone); persisted poll offset so restarts never re-execute a batch; terminal 401/404 handling. Bot token via HELM_TELEGRAM_BOT_TOKEN env var only — never logged, never in code/tests/messages.
  • WhatsApp/baileys intentionally excluded (unofficial protocol, ToS/ban risk — per the study).

Test evidence

18/18 tests pass (fake transport + fake session engine + fake evaluator + in-memory event bus; no network, no credentials):

tests 18 · pass 18 · fail 0

Coverage: command→turn evaluation URNs/effect classes, dispatch on ALLOW only, DENY/ESCALATE/unknown-verdict/evaluator-outage fail-closed paths with receipt surfaced, unknown slash-command denial (evaluator untouched), ask_human round trip incl. denied-answer isolation, autoPermission default vs operator allowlist, stop-after-ALLOW, Telegram DM/allowlist/group/bot authorization, offset persistence + restart resume, terminal 401/404, token non-leakage.

Full repo validation (make validate): helm-tool-wrapper JS tests, helm-channel-bridge JS tests, 20 Python wrapper tests, and sample receipt/EvidencePack verification all pass.

CI: helm-boundary-check.yml gains install+test steps for the new package; Makefile test-js covers both packages.

Out of scope / handoff

  • ChannelSessions / ChannelTurnEventSource are minimal interfaces; wiring them to a live governed runtime (e.g. helm-ai-kernel agentruntime from Wave 1) is a Wave-3 integration task.
  • No sample receipts generated for this package yet (samples remain owned by scripts/generate_samples.py).

Adopt the Rowboat ChannelBridge mechanism (Apache-2.0) as governed
HITL-by-phone: a transport-agnostic command bridge plus a dependency-free
Telegram Bot API transport.

- Every inbound command (help/list/status/resume/new/stop, chat turns,
  ask_human answers) is preflighted through the HELM Kernel
  /api/v1/evaluate contract with a distinct action URN; only explicit
  ALLOW dispatches. Unknown verdicts, ESCALATE, evaluator outages, and
  unknown slash-commands all fail closed to denial.
- ask_human relay: suspended-turn questions are delivered to the chat and
  answers are Kernel-evaluated before being routed back into the turn.
- autoPermission only for explicitly allowlisted routine read-only
  commands (default help/list/status); chat turns run with
  autoPermission=false unless the operator deliberately allowlists them.
- Telegram transport: DMs only, explicit chat-ID allowlist (empty denies
  everyone), persisted poll offset (no re-execution after restart),
  terminal 401/404 handling. Bot token via HELM_TELEGRAM_BOT_TOKEN env
  var only; never logged or embedded in messages.
- Tests use a fake transport, fake session engine, fake evaluator, and
  an in-memory event bus: command-to-turn evaluation, ask_human round
  trip, deny-by-default paths, autoPermission allowlist, offset
  persistence, and transport authorization. No network, no credentials.

WhatsApp/baileys intentionally excluded (unofficial protocol).
@strix-security

Copy link
Copy Markdown

Strix is installed on this repository, but we couldn't run this PR security review because this workspace's trial has ended. Add a card to resume code reviews here.

peycheff-com and others added 2 commits July 31, 2026 15:41
…utes, enable dependency caching

CI efficiency sweep.

- PR gates no longer rebuild every change twice (squash-merge + up-to-date-branch policy already test against main)
- concurrency cancels superseded in-progress runs
- timeout-minutes bounds runaway jobs
@mindburnlabs
mindburnlabs merged commit d79b004 into main Aug 6, 2026
2 checks passed
@mindburnlabs
mindburnlabs deleted the telegram-bridge branch August 6, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants