Repository navigation
Description
What problem does this solve?
Tole has a kernel, a scheduler and a serve face (tole serve, #524), but no way to talk to it from a chat app. The owner wants a personal assistant reachable from Telegram and Discord (single user first) without growing the kernel.
Proposed solution
Owner decisions of 2026-11-17 (grilling round 1 and 2):
- Single user first. Multi-user, scopes and OIDC ([PLAN] serve auth providers: basic / OIDC beyond static bearer token #742) stay parked until a real user story exists.
- The gateway is a separate program in a NEW public repository
codecoradev/tole-gateway(Rust, Apache-2.0). The kernel stays narrow and its release cadence is not tied to the gateway. - Every client is a separate process over the
tole serveAPI: it links notole-core, holds no business logic, and an approval answered from chat goes through the same single gate (POST /approvals/{id}/decision) as from any other client. An unanswered request is a denial;Destructivetools stay unreachable through serve. - First channel: Telegram, one bot. Long polling (no inbound port), so it can be tested locally. Discord second; the channel seam is extracted only once two adapters exist.
- Chat authorization: a config allowlist of Telegram user ids, a one-time pairing code printed on the server console for first contact, approval buttons that show tool, risk and redacted arguments, timeout means denied,
Destructivenever approvable from chat. - Sessions: one chat is one tole session, profile per chat. A new session starts after 4 hours without a message from the owner (cron or bot output does not reset the clock; a pending approval or a running turn blocks the rollover), or on
/new. Older sessions stay in the append-only JSONL. The gateway keeps its own chat-to-session index (no need for feat(serve): list past sessions with a name, folder and last activity #572). - Cron results and approval requests reach the gateway through an outbound signed webhook delivery target in tole, so the gateway does not hold SSE streams (the server caps them at 8).
Plan (one issue, one branch, one PR each; issue-first, independent review for anything touching approval, sandbox, redaction or the outbound data path):
- G0a: feat(serve): answer a prompt that stops for an approval with stopReason approval_required and the approval id #571
approval_requiredstop reason with the approval id (serve protocol, no UI). - G0b: outbound signed webhook delivery target for cron results and approval requests (sub-issue of this epic).
- G1: bootstrap
codecoradev/tole-gateway(owner creates the repository): layering rules, CI,AGENTS.md, license, atole serveclient (create or resume a session, prompt, SSE withafter=seq, approvals). - G2: Telegram adapter (long polling, allowlist and pairing, approval buttons, cron result delivery, chat-to-session index, 4-hour rollover,
/new,/cancel,/status). - G3: Discord adapter as the second consumer, then extract the channel seam.
- G4: reliability (SSE reconnect with
after=seq, stream cap, backoff) and end-to-end tests against a realtole serveplus a fake channel adapter in CI. - G5 (later, only on the owner's command): thin web dashboard over
tole servewith a SQLite (FTS5) projection outside the kernel.
UI work (#523, #527-#529, #561, #572-#575) stays postponed until the owner commands it.
Alternatives considered
Adopt Nakama (MIT) as the gateway and dashboard: rejected, the sandbox, tiered approvals and redaction would be handed to another product. A gateway crate inside the tole workspace: rejected, it would tie adapter churn to the kernel's release gate.
Are you willing to contribute the implementation?
Yes, I can do it
Before submitting
- I searched existing issues and didn't find a duplicate
Activity
chore: bootstrap the repository to the team standard (#1)