refactor: simplify runtime, config, and telegram (#85)

This commit is contained in:
banteg
2026-01-11 14:48:39 +04:00
committed by GitHub
parent 2380b3e5e9
commit 194cc02bba
42 changed files with 3204 additions and 3717 deletions
+6 -6
View File
@@ -138,7 +138,7 @@ classDiagram
ActionEvent --> Action
CompletedEvent --> ResumeToken
note for Action "ActionKind: command | tool | file_change |\nweb_search | subagent | note | turn | warning"
note for Action "ActionKind: command | tool | file_change |\nweb_search | subagent | note | turn | warning | telemetry"
```
---
@@ -202,9 +202,9 @@ flowchart TD
C --> D{Engine?}
D -->|Claude| D1["claude --print --output-format stream-json<br/>[--resume id] prompt"]
D -->|Codex| D2["codex exec --output jsonl<br/>[--reconnect id] prompt"]
D -->|Pi| D3["pi --output jsonl<br/>[--session id] prompt"]
D -->|OpenCode| D4["opencode --output jsonl<br/>[--session id] prompt"]
D -->|Codex| D2["codex exec --json<br/>[resume &lt;token&gt;] -"]
D -->|Pi| D3["pi --print --mode json<br/>--session &lt;id&gt; &lt;prompt&gt;"]
D -->|OpenCode| D4["opencode run --format json<br/>[--session id] -- &lt;prompt&gt;"]
D1 --> E[Spawn Subprocess<br/>anyio.open_process]
D2 --> E
@@ -320,14 +320,14 @@ flowchart TD
flowchart LR
subgraph Config["~/.takopi/"]
toml[takopi.toml]
lock[.takopi.lock]
lock[takopi.lock]
end
subgraph toml_contents["takopi.toml"]
direction TB
global["transport<br/>default_engine<br/>default_project"]
telegram_cfg["[transports.telegram]<br/>bot_token = ...<br/>chat_id = ..."]
plugins_cfg["[plugins]<br/>enabled = [\"...\"]"]
plugins_cfg["[plugins]<br/>enabled = [...]"]
plugins_extra["[plugins.mycommand]<br/>setting = ..."]
claude_cfg["[claude]<br/>model = ..."]
codex_cfg["[codex]<br/>model = ..."]
+3 -5
View File
@@ -17,7 +17,7 @@ See `public-api.md` for the stable API surface you should depend on.
## Entrypoint groups
Takopi uses two Python entrypoint groups:
Takopi uses three Python entrypoint groups:
```toml
[project.entry-points."takopi.engine_backends"]
@@ -36,6 +36,7 @@ mycommand = "mycommand.backend:BACKEND"
- The entrypoint value must resolve to a **backend object**:
- Engine backend -> `EngineBackend`
- Transport backend -> `TransportBackend`
- Command backend -> `CommandBackend`
- The backend object **must** have `id == entrypoint name`.
Takopi validates this at load time and will report errors via `takopi plugins --load`.
@@ -76,15 +77,12 @@ Takopi supports a simple enabled list to control which plugins are visible.
```toml
[plugins]
enabled = ["takopi-transport-slack", "takopi-engine-acme"]
auto_install = false
```
- `enabled = []` (default) -> load all installed plugins.
- If `enabled` is non-empty, **only distributions with matching names** are visible.
- Distribution names are taken from package metadata (case-insensitive).
- If a plugin has no resolvable distribution name and an enabled list is set, it is hidden.
- `auto_install` is **reserved** and not implemented yet.
This enabled list affects:
- Engine subcommands registered in the CLI
@@ -289,7 +287,7 @@ Takopi exposes a **stable plugin API** via `takopi.api`.
- Depend on a compatible Takopi version range, for example:
```toml
dependencies = ["takopi>=0.11,<0.12"]
dependencies = ["takopi>=0.14,<0.15"]
```
When the plugin API changes, Takopi will bump the API version and document
+1 -1
View File
@@ -17,7 +17,7 @@ subject to change. The API version is tracked by `TAKOPI_PLUGIN_API_VERSION`.
- Plugins should pin to a compatible Takopi range, e.g.:
```toml
dependencies = ["takopi>=0.11,<0.12"]
dependencies = ["takopi>=0.14,<0.15"]
```
---
+1 -2
View File
@@ -10,7 +10,7 @@ This document captures current behavior so transport changes stay intentional.
## Flow
1. CLI emits JSON events.
1. Engine CLI emits JSONL events.
2. We render progress on every step and diff against the last output.
3. Only deltas enqueue a Telegram edit.
4. High-value messages enqueue a send.
@@ -91,7 +91,6 @@ Scheduling:
- Ordered by `(priority, queued_at)`.
- Priorities: send=0, delete=1, edit=2.
- Within a priority tier, the oldest pending op runs first.
- `updated_at` is kept for debugging only.
## Rate limiting + backoff