Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ jobs:
run: |
python -m playwright install --with-deps chromium
make test PYTHON=python
- name: HTTP API acceptance
run: make api-acceptance PYTHON=python
- name: Agent workflow acceptance
run: make agent-acceptance PYTHON=python
- name: Syntax and shell checks
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Run source release regressions
run: |
python -m unittest \
tests.test_server.ServerBoundaryTests.test_browser_token_bootstrap_uses_httponly_cookie_and_rejects_invalid_tokens \
tests.test_server.ServerBoundaryTests.test_api_token_headers_are_required_when_configured \
tests.test_task_consistency.TaskConsistencyTests.test_multi_task_plan_reconciles_receipts_without_taskdone_and_survives_restart

- name: Run clean installed-artifact smoke test
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
$bin = Join-Path $auditHome ".local\bin"
& (Join-Path $bin "kyrozen.exe") --version
& (Join-Path $bin "kyrozen.exe") --help *> $null
& (Join-Path $bin "kyrozen-web.exe") --help *> $null
& (Join-Path $bin "kyrozen-api.exe") --help *> $null
$revision = & (Join-Path $auditHome ".kyrozen\bin\openkyrozen-tui.exe") --revision
if ($revision -ne $env:RELEASE_TAG) { throw "Installed TUI revision does not match release" }

Expand All @@ -108,7 +108,7 @@ jobs:
$bin = Join-Path $auditHome ".local\bin"
& (Join-Path $bin "kyrozen.exe") --version
& (Join-Path $bin "kyrozen.exe") --help *> $null
& (Join-Path $bin "kyrozen-web.exe") --help *> $null
& (Join-Path $bin "kyrozen-api.exe") --help *> $null
$revision = & (Join-Path $auditHome ".kyrozen\bin\openkyrozen-tui.exe") --revision
if ($revision -ne $env:RELEASE_TAG) { throw "Installed TUI revision does not match release" }

Expand Down Expand Up @@ -137,5 +137,5 @@ jobs:
curl -fsSL "https://raw.githubusercontent.com/EvanProgramming/OpenKyrozen/$RELEASE_TAG/install.sh" | sh
"$HOME/.local/bin/kyrozen" --version
"$HOME/.local/bin/kyrozen" --help >/dev/null
"$HOME/.local/bin/kyrozen-web" --help >/dev/null
"$HOME/.local/bin/kyrozen-api" --help >/dev/null
test "$("$HOME/.kyrozen/bin/openkyrozen-tui" --revision)" = "$RELEASE_TAG"
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Project Structure & Module Organization

OpenKyrozen v3.0.0 is a Python 3.12–3.13 agent with terminal and web interfaces.
OpenKyrozen v3.0.0 is a Python 3.12–3.13 agent with a terminal interface and an HTTP API.

- `main.py` and `server.py` launch the packaged CLI and FastAPI server. Interface code lives in `openkyrozen/interfaces/` and the Go terminal UI lives in `tui/`.
- `openkyrozen/agent/` owns the agent loop and execution receipts. `openkyrozen/tasks/` owns plans and task lifecycle, and `openkyrozen/learning/` owns self-learning.
Expand All @@ -21,7 +21,7 @@ Use Python 3.12 or 3.13; Python 3.14 is intentionally unsupported by the Makefil
make install # create the full development environment
make install-core # install the smaller development profile
make run # start the terminal agent
make web # install web extras and start the server
make api # start the HTTP API server
make check # quick syntax and tool-inventory checks
make docs-check # check guides and the generated runtime inventory
make lint # compile-based syntax checks
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenKyrozen Docker Image
# Build: docker build -t openkyrozen .
# Run: docker run -p 8000:8000 -v kyrozen-data:/data openkyrozen
# Run: docker run -e KYROZEN_SERVER_TOKEN -p 127.0.0.1:8000:8000 -v kyrozen-data:/data openkyrozen

FROM python:3.12-slim

Expand Down Expand Up @@ -34,11 +34,11 @@ USER kyrozen

VOLUME ["/data"]

# Expose web server port
# Expose the API port
EXPOSE 8000

HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/', timeout=3)"
CMD python -c "import os, urllib.request; token = os.environ.get('KYROZEN_SERVER_TOKEN', '').strip(); req = urllib.request.Request('http://127.0.0.1:8000/api/health', headers={'Authorization': 'Bearer ' + token} if token else {}); urllib.request.urlopen(req, timeout=3).close()"

# Default: run web server
CMD ["python", "-m", "openkyrozen.interfaces.web.app", "--project", "/app", "--host", "0.0.0.0", "--port", "8000"]
# Default: run the HTTP API
CMD ["kyrozen-api", "--project", "/app", "--host", "0.0.0.0", "--port", "8000"]
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: install install-core run clean lint test test-core tui-test check docs-check shell-check benchmark agent-acceptance subagent-acceptance tui-acceptance wheel-smoke docker-smoke git-status git-diff git-log web
.PHONY: install install-core run clean lint test test-core tui-test check docs-check shell-check benchmark agent-acceptance subagent-acceptance tui-acceptance wheel-smoke docker-smoke git-status git-diff git-log web api api-acceptance

# Tests parse the benchmark target's stdout as JSON; do not inject GNU make's
# recursive directory banners into that machine-readable output.
Expand Down Expand Up @@ -35,12 +35,22 @@ install: install-core

run:
@command -v $(PYTHON) >/dev/null 2>&1 || { echo "Error: venv requires $(PYTHON). Run 'make install' with $(PYTHON) installed."; exit 1; }
$(VENV_PYTHON) -m openkyrozen.interfaces.cli.launcher --project .
@if [ -t 0 ] && [ -t 1 ] && [ "$${KYROZEN_DISABLE_TUI:-0}" != 1 ] && command -v go >/dev/null; then \
binary=$$(mktemp "$${TMPDIR:-/tmp}/openkyrozen-dev.XXXXXX") || exit 1; \
trap 'rm -f "$$binary"' EXIT; \
(cd tui && go build -o "$$binary" .) && \
KYROZEN_BACKEND_PYTHON="$(VENV_PYTHON)" KYROZEN_EXECUTION_SURFACE=tui \
KYROZEN_TUI_CAPABILITIES="$${KYROZEN_TUI_CAPABILITIES:-full}" "$$binary" --project .; \
else \
$(VENV_PYTHON) -m openkyrozen.interfaces.cli.launcher --project .; \
fi

tui-test:
@if command -v go >/dev/null 2>&1; then (cd tui && go test ./...); else echo "Go toolchain not found; TUI tests skipped (install Go 1.27.1 or run install.sh)."; fi

web:
web: api

api:
@command -v $(PYTHON) >/dev/null 2>&1 || { echo "Error: venv requires $(PYTHON)."; exit 1; }
$(VENV_PYTHON) -m pip install fastapi uvicorn -q && $(VENV_PYTHON) -m openkyrozen.interfaces.web.app --project .

Expand Down Expand Up @@ -91,6 +101,9 @@ wheel-smoke:
$(VENV_PYTHON) -m pip install build -q
$(VENV_PYTHON) scripts/wheel_smoke.py

api-acceptance:
$(VENV_PYTHON) scripts/api_workflow_acceptance.py

agent-acceptance:
$(VENV_PYTHON) scripts/agent_workflow_acceptance.py

Expand Down
10 changes: 2 additions & 8 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,7 @@ uv tool install --python 3.12 --force --with fastapi --with uvicorn https://gith
/quit 終了する
```

ブラウザー UI のメンテナンスは終了しました。通常は `kyrozen` でターミナル UI を起動してください。既存のブラウザー UI は次のコマンドで開けます。

```bash
kyrozen-web
```

既定の URL は http://localhost:8000 です。特定のプロジェクトを操作する場合は kyrozen --project /path/to/project または kyrozen-web --project /path/to/project を使います。通常の kyrozen は ~/.kyrozen/workspace のグローバルワークスペースを使います。
対話操作には `kyrozen` を使います。外部プログラムから REST、SSE、MCP を利用するには、ソース版では `kyrozen-api`(v3.0.0 では `kyrozen-web`)を起動します。`http://127.0.0.1:8000/api/health` で状態を確認できます。`--project /path/to/project` で対象を指定でき、省略時は `~/.kyrozen/workspace` を使います。

## OpenKyrozen の要点

Expand All @@ -110,7 +104,7 @@ kyrozen-web
| コマンド、権限、ローカルデータ | [コマンド一覧](docs/commands.md) · [セキュリティ](docs/security.md) · [ストレージ](docs/memory-and-storage.md) |
| タスク、履歴、拡張機能 | [タスク](docs/tasks-and-automation.md) · [履歴とロールバック](docs/history-and-rollback.md) · [拡張機能](docs/extensions.md) |
| 使用量、費用、トラブル対応 | [使用量](docs/usage-and-cost.md) · [トラブルシューティング](docs/troubleshooting.md) |
| Web、REST、MCP | [API ガイド](docs/api.md) |
| REST、SSE、MCP | [API ガイド](docs/api.md) |
| 自動サブエージェント、独立コンテキスト、相互検証 | [サブエージェントガイド](docs/subagents.md) |
| 自己学習、メモリ、証拠 | [自己学習ガイド](docs/self-evolution.md) |
| Jev Decision と校正された証拠 | [Jev Decision](docs/decision-assist-validation.md) · [System One](docs/system-one-benchmark.md) |
Expand Down
10 changes: 2 additions & 8 deletions README.ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,7 @@ uv tool install --python 3.12 --force --with fastapi --with uvicorn https://gith
/quit 종료
```

브라우저 UI는 더 이상 유지보수하지 않습니다. 평소에는 `kyrozen`으로 터미널 UI를 실행하세요. 기존 브라우저 UI는 다음 명령으로 열 수 있습니다.

```bash
kyrozen-web
```

기본 주소는 http://localhost:8000입니다. 특정 프로젝트를 사용하려면 kyrozen --project /path/to/project 또는 kyrozen-web --project /path/to/project를 사용합니다. 일반 kyrozen은 ~/.kyrozen/workspace 전역 workspace를 사용합니다.
대화형 작업에는 `kyrozen`을 사용하세요. 다른 프로그램에서 REST, SSE 또는 MCP를 사용하려면 소스 설치판에서 `kyrozen-api`를 실행하세요(v3.0.0에서는 `kyrozen-web`). `http://127.0.0.1:8000/api/health`에서 상태를 확인할 수 있습니다. `--project /path/to/project`로 프로젝트를 지정할 수 있으며, 기본 작업 공간은 `~/.kyrozen/workspace`입니다.

## OpenKyrozen 핵심 기능

Expand All @@ -110,7 +104,7 @@ kyrozen-web
| 명령, 권한, 로컬 데이터 | [명령 참고](docs/commands.md) · [보안](docs/security.md) · [저장소](docs/memory-and-storage.md) |
| 작업, 기록, 확장 | [작업](docs/tasks-and-automation.md) · [기록 및 롤백](docs/history-and-rollback.md) · [확장](docs/extensions.md) |
| 사용량, 비용, 문제 해결 | [사용량](docs/usage-and-cost.md) · [문제 해결](docs/troubleshooting.md) |
| Web, REST, MCP | [API 가이드](docs/api.md) |
| REST, SSE, MCP | [API 가이드](docs/api.md) |
| 자동 하위 에이전트, 독립 컨텍스트, 상호 검증 | [하위 에이전트 가이드](docs/subagents.md) |
| self-learning, memory, evidence | [Self-learning 가이드](docs/self-evolution.md) |
| Jev Decision 및 교정 증거 | [Jev Decision](docs/decision-assist-validation.md) · [System One](docs/system-one-benchmark.md) |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ You: accept the plan and fix the test
You: search for the latest Python release and cite the source
```

`kyrozen` opens the global workspace; `kyrozen --project /path/to/repo` binds a session to a project. The browser UI is unmaintained. To open the existing UI, run `kyrozen-web --host 127.0.0.1 --port 8000` and visit `http://127.0.0.1:8000`. Configure `KYROZEN_SERVER_TOKEN` before binding beyond loopback.
`kyrozen` opens the global workspace; `kyrozen --project /path/to/repo` binds a session to a project. For HTTP integrations, a source install provides `kyrozen-api` (called `kyrozen-web` in v3.0.0). Use `GET /api/health` to check the server. Configure `KYROZEN_SERVER_TOKEN` before binding beyond loopback.

The interaction modes make authority visible: Ask and Plan are read/network-only; Agent carries out explicitly requested or accepted work under capability and approval checks. Managed shell commands also use an available OS filesystem sandbox; see [security and permissions](docs/security.md) for supported backends and limitations.

Expand Down
10 changes: 2 additions & 8 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,7 @@ uv tool install --python 3.12 --force --with fastapi --with uvicorn https://gith
/quit 退出
```

浏览器界面已停止维护。日常使用请运行 `kyrozen` 打开终端界面。如需打开现有的网页界面,可运行以下命令。

```bash
kyrozen-web
```

默认打开 http://localhost:8000。若要操作指定项目,使用 kyrozen --project /path/to/project 或 kyrozen-web --project /path/to/project。直接运行 kyrozen 使用 ~/.kyrozen/workspace 全局工作区。
交互使用请运行 `kyrozen`。若要从其他程序接入 REST、SSE 或 MCP,源码版可运行 `kyrozen-api`(v3.0.0 的命令为 `kyrozen-web`),再请求 `http://127.0.0.1:8000/api/health` 检查服务。通过 `--project /path/to/project` 绑定项目,默认使用 `~/.kyrozen/workspace` 全局工作区。

## OpenKyrozen 的主要能力

Expand All @@ -107,7 +101,7 @@ kyrozen-web
| 命令、模式和工作区 | [使用指南](docs/usage.md) |
| 运行时流程和安全边界 | [架构](docs/architecture.md) |
| 服务商、环境变量和状态目录 | [配置](docs/configuration.md) |
| Web、REST 和 MCP | [API 指南](docs/api.md) |
| REST、SSE 和 MCP | [API 指南](docs/api.md) |
| 命令、权限和本地数据 | [命令参考](docs/commands.md) · [安全](docs/security.md) · [存储](docs/memory-and-storage.md) |
| 任务、恢复与扩展 | [任务](docs/tasks-and-automation.md) · [历史与回滚](docs/history-and-rollback.md) · [扩展](docs/extensions.md) |
| 用量与常见问题 | [费用说明](docs/usage-and-cost.md) · [故障排查](docs/troubleshooting.md) |
Expand Down
2 changes: 1 addition & 1 deletion SUPPORT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Support

OpenKyrozen maintains the CLI and terminal UI for interactive use. The browser UI bundled with v3.0.0 is unmaintained.
Use the CLI or terminal UI for interactive work. Integrations can use the HTTP API for REST, streaming chat, webhooks, and MCP. See the [API guide](docs/api.md).

For setup and usage, start with the [documentation index](docs/index.md), [installation](docs/installation.md), [usage](docs/usage.md), [configuration](docs/configuration.md), and [development](docs/development.md) guides.

Expand Down
2 changes: 1 addition & 1 deletion docs/agentic-runtime-roadmap.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Agentic runtime roadmap

OpenKyrozen now has one durable interaction state machine across the classic
CLI, Bubble Tea TUI, web UI, REST, and SSE. Ask and Plan are read-only; accepted
CLI, Bubble Tea TUI, REST, and SSE. Ask and Plan are read-only; accepted
plans become evidence-gated `TaskManager` work in Agent mode. V3 supports native tool calls on capable providers, archives older tool results and compacts history while preserving call and reply identities. Managed shell commands can use filesystem sandboxing on Linux and macOS. [Provider contracts](providers.md) · [Context and receipts](architecture.md) · [Sandbox availability](security.md)

## Further work
Expand Down
17 changes: 10 additions & 7 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Web, REST, streaming, webhooks, and MCP
# HTTP API, streaming, webhooks, and MCP

The browser UI is unmaintained. For interactive use, start the terminal UI with `kyrozen`.
Start `kyrozen` for interactive terminal sessions. Integrations use `kyrozen-api` to access the same runtime, workspace, SQLite store, and permission gates over HTTP. The compatibility command `kyrozen-web` also works and is the name shipped in v3.0.0.

`kyrozen-web` serves the browser UI and API through the same runtime, workspace, SQLite store, permission gates, provider configuration, and tool adapters used by the terminal. Bind to loopback for local use:
```sh
kyrozen-api --host 127.0.0.1 --port 8000
```

In another terminal, request service health and the JSON OpenAPI schema:

```sh
kyrozen-web --host 127.0.0.1 --port 8000
curl http://127.0.0.1:8000/api/health
curl http://127.0.0.1:8000/openapi.json
```

The [generated runtime inventory](tool-inventory.md) is authoritative for every live HTTP method/path, tool, capability label, and MCP input schema. This guide explains common payloads and the shared boundaries. `server:app` remains an import-compatible application object; lifecycle setup is performed when the ASGI application starts.
Expand All @@ -21,8 +25,6 @@ Authorization: Bearer <server-token>

or `X-Kyrozen-Token: <server-token>`. The token is compared as a secret. Do not put it in a URL, client-side source, logs, or a public curl example. To bind beyond loopback, always configure it; otherwise direct non-loopback API requests receive HTTP 503. Use HTTPS through a trusted reverse proxy for remote traffic.

The browser login endpoint accepts `POST /api/auth/session` with `{"token":"..."}` and returns `{"authenticated":true}` plus a short-lived HttpOnly, SameSite=Strict cookie when a token is configured. `DELETE /api/auth/session` revokes that in-memory cookie and clears it. This browser session does not issue a bearer token for scripts. If no server token is set, login returns authenticated for local UI startup.

REST handlers expect JSON objects for JSON bodies. Invalid JSON or a non-object body returns 400. Session IDs are at most 128 characters and allow letters, digits, `_`, `.`, `:`, and `-`. Chat messages are limited to 12,000 characters. Profiles are `auto`, `coder`, or `researcher`. The web process assigns one server actor (`KYROZEN_SERVER_ACTOR`); a request body cannot select another private user.

Common errors are HTTP 400 for invalid payloads, 401 for a missing/invalid configured token, 403 for a capability refusal, 404 for a missing scoped record, 409 for stale state or unmet evidence, 413 for oversized input, 429 for bounded webhook registration capacity, 500 for an unexpected handler failure, and 503 for provider unavailability or a non-loopback request without configured server authentication. Individual endpoints can use other status codes; check the response `detail` and the handler contract.
Expand Down Expand Up @@ -68,7 +70,8 @@ All protected routes require the authentication above. Exact parameter spelling

| Route group | Operations and effects |
|---|---|
| Health and UI: `/`, `/manifest.json`, `/api/health` | Serve the chat page/PWA manifest or report service health. Health is authenticated when a server token is configured. |
| Health: `/api/health` | Report service and provider status. Requires authentication when a server token is configured. |
| Schema: `/openapi.json` | Retrieve the public JSON API description. |
| Cost: `/api/cost`, `/api/cost/reset` | Read usage/cost for a requested supported scope or reset selected local counters. Reset is a destructive local bookkeeping action, not a provider refund. |
| Decisions: `/api/v2/decision-assist`, `/api/v2/system-one/diagnostics`, `/api/v2/fast/diagnostics` | Read backend state and session-scoped decision/usage diagnostics. A diagnostic query can initialize the named session. |
| Memory: `/api/memory`, `/api/v2/memory`, `/api/v2/memory/claims` | Read or create scoped claims and inspect/delete a particular claim. Creation is a durable write. Deletion deactivates the claim and handles dependent learning state; it is not a database wipe. |
Expand Down
Loading
Loading