@tractorscorch/clank 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +118 -0
- package/LICENSE +21 -0
- package/README.md +172 -0
- package/dist/index.js +7161 -0
- package/dist/index.js.map +1 -0
- package/dist/web/index.html +365 -0
- package/dist/workspace/templates/AGENTS.md +11 -0
- package/dist/workspace/templates/BOOTSTRAP.md +26 -0
- package/dist/workspace/templates/HEARTBEAT.md +4 -0
- package/dist/workspace/templates/IDENTITY.md +11 -0
- package/dist/workspace/templates/MEMORY.md +7 -0
- package/dist/workspace/templates/SOUL.md +41 -0
- package/dist/workspace/templates/TOOLS.md +17 -0
- package/dist/workspace/templates/USER.md +18 -0
- package/package.json +58 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Clank will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## [1.1.0] — 2026-03-22
|
|
10
|
+
|
|
11
|
+
### Security Hardening
|
|
12
|
+
- **Bash tool:** expanded blocklist from 5 to 25 patterns — covers flag variations, shell-in-shell, encoded payloads, PowerShell, system damage commands
|
|
13
|
+
- **Path traversal:** all file tools (read, write, edit, list, search, glob) now enforce workspace containment via `guardPath()` — blocks absolute paths and `../` traversal outside workspace
|
|
14
|
+
- **Config redaction:** API keys, bot tokens, and auth tokens are stripped from config before exposing to LLM context or WebSocket clients
|
|
15
|
+
- **Prototype pollution:** config.set RPC blocks `__proto__`, `constructor`, `prototype` keys
|
|
16
|
+
- **SSRF protection:** web_fetch blocks localhost, cloud metadata endpoints (169.254.169.254), .internal/.local hostnames, file:// protocol
|
|
17
|
+
- **Gateway auth:** auto-generates token on startup if mode is "token" but no token configured — prevents accidental open gateways
|
|
18
|
+
- **Status endpoint:** /status now requires Bearer token authentication
|
|
19
|
+
- **Tool confirmations:** gateway respects autoApprove config instead of blindly approving — 30s timeout defaults to deny
|
|
20
|
+
- **.gitignore:** added config.json5, *.pem, *.key, credentials.json to prevent accidental secret commits
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
- **Telegram bot not responding:** `bot.start()` was blocking (awaited) which prevented the gateway from finishing startup. Now runs non-blocking with `onStart` callback.
|
|
24
|
+
- **Telegram allowFrom:** now matches both `@username` and numeric user IDs (was only matching numeric)
|
|
25
|
+
- **grammY missing:** added as real dependency (was dynamic import that failed silently)
|
|
26
|
+
- **Local server URL not saved:** setup wizard now saves detected server baseUrl for all local providers (was only saving Ollama)
|
|
27
|
+
- **Port conflict:** default port changed to 18790 (was 18789, conflicted with OpenClaw/Claude Code)
|
|
28
|
+
- **--web flag:** `clank chat --web` now auto-starts gateway and opens browser
|
|
29
|
+
- **Gateway text/message param:** accepts both `message` and `text` fields from clients
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
- **TUI:** rich terminal UI with streaming, tool cards, thinking blocks, agent/session/model pickers, slash commands, shell integration (`!command`)
|
|
33
|
+
- **Web Control UI:** 8-panel dashboard — Chat, Agents, Sessions, Config (JSON editor), Pipelines, Cron, Logs, Channels
|
|
34
|
+
- **Telegram slash commands:** /help, /status, /agents, /agent, /sessions, /new, /reset, /model, /think
|
|
35
|
+
- **CLI commands:** tui, dashboard, pipeline, cron, channels, uninstall
|
|
36
|
+
- **Background gateway:** runs as detached process, Telegram/Discord stay alive while CLI/TUI/Web run on top
|
|
37
|
+
- **Gateway singleton:** refuses to start if already running on the port
|
|
38
|
+
- **Self-config tools (8):** config, manage_channel, manage_agent, manage_model, manage_session, manage_cron, gateway_status, send_message
|
|
39
|
+
- **Google Gemini provider** with streaming and function calling
|
|
40
|
+
- **Memory system:** TF-IDF cosine similarity with decay scoring, categorized storage
|
|
41
|
+
- **Encryption:** AES-256-GCM for API keys, PIN hashing with timing-safe comparison
|
|
42
|
+
- **Web search:** Brave Search API integration
|
|
43
|
+
- **Config hot-reload:** watches config.json5 for changes
|
|
44
|
+
- **`clank uninstall`:** removes all data, daemon, and npm package
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
- Default command (`clank` with no args) starts gateway in background then launches TUI
|
|
48
|
+
- `clank gateway start` now runs in background by default (`--foreground` for blocking mode)
|
|
49
|
+
- `clank gateway restart` fully implemented (stop + start)
|
|
50
|
+
- Protocol updated to v1 spec with 17 RPC methods and 11 event types
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## [1.0.0] — 2026-03-22
|
|
55
|
+
|
|
56
|
+
Initial release — Clank Gateway foundation.
|
|
57
|
+
|
|
58
|
+
### Architecture
|
|
59
|
+
- Single gateway daemon (HTTP + WebSocket on port 18789)
|
|
60
|
+
- WebSocket JSON-RPC protocol v1 with 17 RPC methods and 11 event types
|
|
61
|
+
- All interfaces are equal — CLI, TUI, Web UI, Telegram, Discord
|
|
62
|
+
|
|
63
|
+
### Engine
|
|
64
|
+
- AgentEngine with ReAct loop (stream → tool calls → execute → loop, max 50 iterations)
|
|
65
|
+
- Pluggable ContextEngine with compaction optimized for local models (60% threshold vs 80% cloud)
|
|
66
|
+
- Tool tiering: full/core/auto — reduces tool count for smaller models
|
|
67
|
+
- PromptFallbackProvider for models without native function calling
|
|
68
|
+
|
|
69
|
+
### Providers
|
|
70
|
+
- Ollama (primary) — auto-detect, dynamic context window, tool support checking
|
|
71
|
+
- Anthropic Claude — Messages API with SSE streaming
|
|
72
|
+
- OpenAI — also covers LM Studio, vLLM, llama.cpp (OpenAI-compatible)
|
|
73
|
+
- Google Gemini — streaming with function calling
|
|
74
|
+
- Provider router with fallback chain and local server auto-detection
|
|
75
|
+
- Reasoning/thinking content support (Qwen, DeepSeek, etc.)
|
|
76
|
+
|
|
77
|
+
### Tools (18 total)
|
|
78
|
+
- **Core (10):** read_file, write_file, edit_file, list_directory, search_files, glob_files, bash, git, web_search (Brave), web_fetch
|
|
79
|
+
- **Self-config (8):** config, manage_channel, manage_agent, manage_model, manage_session, manage_cron, gateway_status, send_message
|
|
80
|
+
|
|
81
|
+
### Interfaces
|
|
82
|
+
- **CLI:** 12 commands — chat, gateway, setup, fix, models, agents, daemon, tui, dashboard, pipeline, cron, channels
|
|
83
|
+
- **TUI:** Rich terminal UI with streaming, tool cards, thinking blocks, agent/session/model pickers, slash commands, shell integration
|
|
84
|
+
- **Web Control UI:** 8-panel SPA — Chat, Agents, Sessions, Config (JSON editor), Pipelines, Cron, Logs, Channels
|
|
85
|
+
- **Telegram:** Full adapter with slash commands, typing indicators, response chunking, permission allowlists, group mention checking
|
|
86
|
+
- **Discord:** Full adapter with typing, reply threading, response chunking
|
|
87
|
+
|
|
88
|
+
### Multi-Agent
|
|
89
|
+
- Named agents with separate models, workspaces, and tool access
|
|
90
|
+
- Config-driven routing with binding priority tiers (peer → guild → team → channel → default)
|
|
91
|
+
- Normalized session keys for cross-channel continuity (dm:telegram:123, cli:main, etc.)
|
|
92
|
+
|
|
93
|
+
### Systems
|
|
94
|
+
- **Memory:** TF-IDF cosine similarity with decay scoring, categorized storage (identity/knowledge/lessons/context)
|
|
95
|
+
- **Sessions:** JSON transcript persistence, prune/cap/reset, cross-channel shared sessions
|
|
96
|
+
- **Config:** JSON5 with env var substitution, hot-reload watcher, defaults with deep merge
|
|
97
|
+
- **Cron:** JSONL job store, 30s tick interval, run logging, retry tracking
|
|
98
|
+
- **Pipelines:** Sequential step execution with agent handoffs, state persistence
|
|
99
|
+
- **Plugins:** Discovery (~/.clank/plugins/ + node_modules/clank-plugin-*), 25+ hook types
|
|
100
|
+
- **Heartbeat:** Periodic probes from HEARTBEAT.md, quiet hours
|
|
101
|
+
- **Voice:** TTS (ElevenLabs + piper), STT (whisper.cpp)
|
|
102
|
+
- **Daemon:** Cross-platform service — macOS (launchd), Windows (Task Scheduler), Linux (systemd)
|
|
103
|
+
|
|
104
|
+
### Security
|
|
105
|
+
- AES-256-GCM encryption for API keys (PBKDF2, 100K iterations)
|
|
106
|
+
- PIN verification with timing-safe comparison
|
|
107
|
+
- 3-tier tool safety system (low/medium/high) with auto-approve settings
|
|
108
|
+
- Gateway binds to localhost by default, token-based auth
|
|
109
|
+
|
|
110
|
+
### Onboarding
|
|
111
|
+
- `clank setup` wizard — Quick Start (under 2 minutes) and Advanced flows
|
|
112
|
+
- Auto-detects local model servers (Ollama, LM Studio, llama.cpp, vLLM)
|
|
113
|
+
- Configures cloud providers, Telegram, Discord, Brave Search, voice, agents
|
|
114
|
+
- `clank fix` diagnostics with auto-repair
|
|
115
|
+
|
|
116
|
+
### Workspace
|
|
117
|
+
- Bootstrap templates: SOUL.md, USER.md, IDENTITY.md, BOOTSTRAP.md, AGENTS.md, TOOLS.md, MEMORY.md, HEARTBEAT.md
|
|
118
|
+
- System prompt builder loads workspace files + project context (.clank.md)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ItsTrag1c
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/ItsTrag1c/Clank/main/docs/banner.png" alt="Clank" width="100%" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Clank</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<b>Local-first AI agent gateway.</b> Open-source alternative to OpenClaw, optimized for local models.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://github.com/ItsTrag1c/Clank/releases/latest"><img src="https://img.shields.io/badge/version-1.1.0-blue.svg" alt="Version" /></a>
|
|
13
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License" /></a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/clank"><img src="https://img.shields.io/npm/v/clank.svg" alt="npm" /></a>
|
|
15
|
+
<a href="https://github.com/ItsTrag1c/Clank/stargazers"><img src="https://img.shields.io/github/stars/ItsTrag1c/Clank.svg" alt="Stars" /></a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="https://clanksuite.dev">Website</a> ·
|
|
20
|
+
<a href="https://github.com/ItsTrag1c/Clank/blob/main/docs/INSTALL.md">Install Guide</a> ·
|
|
21
|
+
<a href="https://github.com/ItsTrag1c/Clank/blob/main/docs/USER_GUIDE.md">User Guide</a> ·
|
|
22
|
+
<a href="https://github.com/ItsTrag1c/Clank/blob/main/CHANGELOG.md">Changelog</a> ·
|
|
23
|
+
<a href="https://x.com/ClankSuite">Twitter</a> ·
|
|
24
|
+
<a href="https://reddit.com/u/ClankSuite">Reddit</a>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## What is Clank?
|
|
30
|
+
|
|
31
|
+
Clank is a personal AI gateway — **one daemon, many frontends**. It connects your preferred interfaces (CLI, TUI, browser, Telegram, Discord) to AI agents running local or cloud models. All interfaces share sessions, memory, and agent state.
|
|
32
|
+
|
|
33
|
+
**Built for people who want the OpenClaw experience without the token costs.**
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
┌─────────────────────────────┐
|
|
37
|
+
│ Clank Gateway │
|
|
38
|
+
│ (single daemon) │
|
|
39
|
+
│ │
|
|
40
|
+
│ Agent Pool + Routing │
|
|
41
|
+
│ Sessions, Memory, Pipelines │
|
|
42
|
+
│ Cron, Tools, Plugins │
|
|
43
|
+
└──────────────┬───────────────┘
|
|
44
|
+
│
|
|
45
|
+
WebSocket + HTTP (port 18790)
|
|
46
|
+
│
|
|
47
|
+
┌──────────┬───────────┼───────────┬──────────┐
|
|
48
|
+
│ │ │ │ │
|
|
49
|
+
CLI Web UI Telegram Discord TUI
|
|
50
|
+
(direct) (browser) (bot) (bot) (terminal)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install -g clank
|
|
57
|
+
clank setup
|
|
58
|
+
clank
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
That's it. Setup auto-detects your local models, configures the gateway, and gets you chatting in under 2 minutes. See the [full install guide](docs/INSTALL.md) for details.
|
|
62
|
+
|
|
63
|
+
## Features
|
|
64
|
+
|
|
65
|
+
| Feature | Description |
|
|
66
|
+
|---------|-------------|
|
|
67
|
+
| **Local-first** | Auto-detects Ollama, LM Studio, llama.cpp, vLLM. Cloud providers optional. |
|
|
68
|
+
| **Multi-agent** | Named agents with separate models, workspaces, tools, and routing. |
|
|
69
|
+
| **Multi-channel** | CLI, TUI, Web UI, Telegram, Discord — all equal, all share sessions. |
|
|
70
|
+
| **Self-configuring** | After setup, configure everything through conversation. |
|
|
71
|
+
| **18 tools** | File ops, bash, git, web search (Brave), plus 8 self-config tools. |
|
|
72
|
+
| **Web Control UI** | 8-panel dashboard: Chat, Agents, Sessions, Config, Pipelines, Cron, Logs, Channels. |
|
|
73
|
+
| **Pipeline orchestration** | Chain agents together for multi-step workflows. |
|
|
74
|
+
| **Plugin system** | Extend with custom tools, channels, and providers. 25+ hook types. |
|
|
75
|
+
| **Cron scheduler** | Recurring and one-shot scheduled agent tasks. |
|
|
76
|
+
| **Voice** | Cloud (ElevenLabs) or fully local (whisper.cpp + piper). |
|
|
77
|
+
| **Memory** | TF-IDF with decay scoring. Agent learns and remembers across sessions. |
|
|
78
|
+
| **Security** | AES-256-GCM encryption, SSRF protection, path containment, config redaction. |
|
|
79
|
+
|
|
80
|
+
## Commands
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Start — gateway + TUI (Telegram/Discord stay alive in background)
|
|
84
|
+
clank
|
|
85
|
+
|
|
86
|
+
# Chat interfaces
|
|
87
|
+
clank chat # Direct mode (no gateway needed)
|
|
88
|
+
clank chat --web # Auto-start gateway + open Web UI
|
|
89
|
+
clank tui # Rich TUI connected to gateway
|
|
90
|
+
clank dashboard # Open Web UI in browser
|
|
91
|
+
|
|
92
|
+
# Gateway
|
|
93
|
+
clank gateway start # Start in background
|
|
94
|
+
clank gateway stop # Stop
|
|
95
|
+
clank gateway status # Show status, clients, sessions
|
|
96
|
+
clank gateway restart # Restart
|
|
97
|
+
|
|
98
|
+
# Setup & diagnostics
|
|
99
|
+
clank setup # Onboarding wizard
|
|
100
|
+
clank fix # Diagnostics & auto-repair
|
|
101
|
+
|
|
102
|
+
# Model & agent management
|
|
103
|
+
clank models list # Detect + list models
|
|
104
|
+
clank models add # Add a provider (Anthropic, OpenAI, Google, Brave)
|
|
105
|
+
clank models test # Test connectivity
|
|
106
|
+
clank agents list # List agents
|
|
107
|
+
clank agents add # Create an agent
|
|
108
|
+
|
|
109
|
+
# Scheduled tasks
|
|
110
|
+
clank cron list # List jobs
|
|
111
|
+
clank cron add # Schedule a task
|
|
112
|
+
|
|
113
|
+
# System
|
|
114
|
+
clank daemon install # Auto-start at login (Windows/macOS/Linux)
|
|
115
|
+
clank channels # Channel status
|
|
116
|
+
clank uninstall # Remove everything
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Providers
|
|
120
|
+
|
|
121
|
+
| Provider | Type | How |
|
|
122
|
+
|----------|------|-----|
|
|
123
|
+
| **Ollama** | Local | Auto-detected at `localhost:11434` |
|
|
124
|
+
| **LM Studio** | Local | Auto-detected at `localhost:1234` |
|
|
125
|
+
| **llama.cpp** | Local | Auto-detected at `localhost:8080` |
|
|
126
|
+
| **vLLM** | Local | Auto-detected at `localhost:8000` |
|
|
127
|
+
| **Anthropic** | Cloud | API key via `clank setup` or config |
|
|
128
|
+
| **OpenAI** | Cloud | API key via `clank setup` or config |
|
|
129
|
+
| **Google Gemini** | Cloud | API key via `clank setup` or config |
|
|
130
|
+
|
|
131
|
+
Models without native tool calling automatically use prompt-based fallback — tools are injected into the system prompt and parsed from text output.
|
|
132
|
+
|
|
133
|
+
## Security
|
|
134
|
+
|
|
135
|
+
Clank is designed to be safe by default:
|
|
136
|
+
|
|
137
|
+
- **Workspace containment** — file tools blocked outside workspace
|
|
138
|
+
- **Bash protection** — 25-pattern blocklist for destructive commands
|
|
139
|
+
- **API key redaction** — keys never sent to LLM context
|
|
140
|
+
- **SSRF protection** — web_fetch blocks localhost, cloud metadata, internal hosts
|
|
141
|
+
- **Gateway auth** — token-based, auto-generated, localhost-only by default
|
|
142
|
+
- **Encryption** — AES-256-GCM for API keys at rest
|
|
143
|
+
|
|
144
|
+
See [SECURITY.md](SECURITY.md) for the full security model.
|
|
145
|
+
|
|
146
|
+
## Documentation
|
|
147
|
+
|
|
148
|
+
- **[Install Guide](docs/INSTALL.md)** — Detailed installation and setup instructions
|
|
149
|
+
- **[User Guide](docs/USER_GUIDE.md)** — How to use Clank day-to-day
|
|
150
|
+
- **[Changelog](CHANGELOG.md)** — Version history
|
|
151
|
+
- **[Privacy Policy](PRIVACY_POLICY.md)** — Data handling
|
|
152
|
+
- **[Security Policy](SECURITY.md)** — Security model and vulnerability reporting
|
|
153
|
+
|
|
154
|
+
## Links
|
|
155
|
+
|
|
156
|
+
| | |
|
|
157
|
+
|--|--|
|
|
158
|
+
| **Website** | [clanksuite.dev](https://clanksuite.dev) |
|
|
159
|
+
| **GitHub** | [ItsTrag1c/Clank](https://github.com/ItsTrag1c/Clank) |
|
|
160
|
+
| **npm** | [npmjs.com/package/clank](https://www.npmjs.com/package/clank) |
|
|
161
|
+
| **Twitter/X** | [@ClankSuite](https://x.com/ClankSuite) |
|
|
162
|
+
| **Reddit** | [u/ClankSuite](https://reddit.com/u/ClankSuite) |
|
|
163
|
+
| **Legacy** | [Clank-Legacy](https://github.com/ItsTrag1c/Clank-Legacy) (archived CLI v2.7.0 + Desktop v2.6.1) |
|
|
164
|
+
|
|
165
|
+
## Requirements
|
|
166
|
+
|
|
167
|
+
- Node.js 20+
|
|
168
|
+
- A local model server (Ollama recommended) or cloud API key
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
MIT — see [LICENSE](LICENSE)
|