Repository navigation
feat: tole serve — token-authenticated HTTP daemon (D3 v1, issue #96) - #131
Merged
Merged
Conversation
tole as a long-running HTTP daemon: REST endpoints for the session
host — create/list sessions, run turns, poll status. Remote clients
drive durable tole sessions without SSH-ing into the box.
- session_host.rs: the session machinery extracted from acp.rs into a
shared module — ONE implementation used by both ACP and serve
(open_session takes the session's approver as a parameter: ACP wires
the interactive editor prompt, serve wires a non-interactive
allowlist; Destructive registers only behind interactive approvers,
so serve mode keeps Destructive structurally absent). plan_mode
filters to read-only tools; run_session_turn returns
(stop_reason, final_text).
- tole serve: hand-rolled HTTP/1.1 on std::net (zero new deps),
Content-Length bodies, Connection: close, 30s read/write timeouts
(thread-exhaustion DoS — CodeCora finding), bearer-token auth on
everything except /health, refuses to start without a token.
- Endpoints: GET /health, POST/GET /sessions, GET
/sessions/{id}[.status] (non-blocking: try_lock — never blocks on a
running turn, CodeCora finding), POST /sessions/{id}/prompt
(serialized per session — concurrent prompts get 409).
- Live E2E: health/auth-matrix (401 without/wrong token)/create/
prompt (real provider turn)/list/status, all green.
MCP-over-HTTP on the same daemon is the remaining D3 follow-up; issue
#96 stays open for it.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
tole serve: tole as a long-running, token-authenticated HTTP daemon — REST endpoints for the session host (create/list sessions, run turns, poll status). Server-side durable JSONL sessions; turn execution serialized per session.Why
The ecosystem already operates this way for uteke (uteke-serve): shared services on the box, reachable from any device. tole's capabilities (durable sessions, jailed tools, memory loop) should be reachable the same way — without SSH-ing into the machine.
Changes
tole-cli/src/serve.rs: hand-rolled HTTP/1.1 on std::net (zero new deps — Content-Length bodies, Connection: close), bearer-token auth on everything except/health, refuses to start without a token; 30s read/write timeouts (thread-exhaustion DoS — CodeCora finding); routes: health/sessions-create/list/status/prompt; non-blocking status route (try_lock — never blocks on a running turn)tole-cli/src/session_host.rs(refactor): the session machinery extracted from acp.rs into a shared module used by BOTH acp and serve —open_sessiontakes the approver as a parameter (ACP: interactive editor prompt; serve: non-interactive allowlist; Destructive registers only behind interactive approvers, so serve keeps Destructive structurally absent); plan_mode filters to read-only toolsTesting
Remaining (issue #96 stays open)
MCP Streamable HTTP transport on the same daemon; auth hardening beyond a static token.