Skip to content

feat(gateway): add runtime chat interface - #8

Closed
HayronHgh wants to merge 2 commits into
mainfrom
agent/runtime-chat-gateway
Closed

feat(gateway): add runtime chat interface#8
HayronHgh wants to merge 2 commits into
mainfrom
agent/runtime-chat-gateway

Conversation

@HayronHgh

Copy link
Copy Markdown
Owner

What

Adds a browser-first Runtime Chat Gateway for Context OS without turning llama.cpp into the agent runtime.

Browser
  → Context OS Gateway :8787
  → RuntimeSession (one AgentRuntime per session)
  → tools / evidence / memory / context
  → shared LlamaClient
  → llama-server :8080
  → Qwen
  • Adds a dependency-free Node HTTP gateway and responsive vanilla HTML/CSS/JS UI.
  • Adds session creation, turn execution, SSE event replay, and a browser approval bridge.
  • Keeps conversation history and tool authority inside Runtime; the Browser holds presentation state only.
  • Exposes Runtime-derived evidence metadata so the UI does not mislabel every successful tool call as durable.
  • Adds Windows start/stop launchers and bilingual English/Traditional Chinese documentation.
  • Advances the development version to 0.2.0-dev.6.

API

  • POST /api/sessions
  • GET /api/sessions/:id
  • DELETE /api/sessions/:id
  • POST /api/sessions/:id/turn
  • GET /api/sessions/:id/events (SSE)
  • POST /api/sessions/:id/approvals/:approvalId
  • GET /api/health
  • GET /api/config

Runtime and security boundary

  • One AgentRuntime per session; the LlamaClient and llama-server are shared.
  • Single-flight turns and one active session per canonical project root.
  • Runtime-issued, single-use, fail-closed approval IDs.
  • Loopback-only listener, Host/Origin checks, JSON content-type and body limits.
  • Restrictive CSP, no CORS exposure, no inline script, and text-only model rendering.
  • Bounded SSE replay history (256 events / 2 MiB).
  • Whole session state remains Runtime-owned; only the opaque session ID is stored in Browser local storage.

Deliberate stops

This milestone does not:

  • proxy or embed the llama.cpp Web UI;
  • grant llama.cpp built-in filesystem/tool authority;
  • wire the frozen D0–D6 transformation pipeline into interactive turns;
  • add token streaming, LAN exposure, or authentication;
  • change frozen planner/proposal/validation/execution experiment inputs.

The interactive chain stops at the existing deterministic AgentRuntime turn loop.

Validation

  • npm test: 185 tests, 184 passed, 0 failed, 1 skipped (Windows symlink capability/EPERM only).
  • JavaScript syntax, JSON parsing, PowerShell parsing, git diff --check: passed.
  • 118 local Markdown links checked: passed.
  • Secret-pattern and unsafe DOM/CORS/bind-pattern audits: clean.
  • Frozen M4 and D0–D6 core paths: unchanged.
  • Real in-app browser + live Qwen/llama.cpp smoke:
    • Qwen requested read_file; the tool trace and answer were rendered correctly.
    • Qwen requested a write; the approval card was shown, Deny was enforced, and no file was created.
    • Browser console: 0 warnings/errors.

Review status

Draft freeze candidate for 0.2.0-dev.6 — Runtime Chat Gateway.

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.

1 participant