krnl-code 1.0.4__py3-none-any.whl
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.
- krnl_agent/__init__.py +9 -0
- krnl_agent/__main__.py +7 -0
- krnl_agent/agent_registry.py +95 -0
- krnl_agent/agent_selector.py +69 -0
- krnl_agent/audit_log.py +155 -0
- krnl_agent/background.py +94 -0
- krnl_agent/checkpoints.py +67 -0
- krnl_agent/ci.py +73 -0
- krnl_agent/cli.py +1458 -0
- krnl_agent/commands.py +42 -0
- krnl_agent/config.py +425 -0
- krnl_agent/context.py +352 -0
- krnl_agent/depaudit.py +63 -0
- krnl_agent/deploy.py +245 -0
- krnl_agent/doctor.py +106 -0
- krnl_agent/events.py +141 -0
- krnl_agent/gitignore.py +47 -0
- krnl_agent/graph.py +928 -0
- krnl_agent/guardrails.py +70 -0
- krnl_agent/headless.py +60 -0
- krnl_agent/history.py +49 -0
- krnl_agent/hooks.py +72 -0
- krnl_agent/ingest.py +129 -0
- krnl_agent/llm.py +456 -0
- krnl_agent/loop.py +779 -0
- krnl_agent/mcp_client.py +128 -0
- krnl_agent/memory.py +61 -0
- krnl_agent/modelrouter.py +151 -0
- krnl_agent/monitor.py +112 -0
- krnl_agent/notify.py +119 -0
- krnl_agent/parallel_executor.py +139 -0
- krnl_agent/permissions.py +128 -0
- krnl_agent/plugins.py +105 -0
- krnl_agent/pricing.py +85 -0
- krnl_agent/prompts.py +60 -0
- krnl_agent/repomap.py +133 -0
- krnl_agent/sandbox.py +69 -0
- krnl_agent/scaffold.py +167 -0
- krnl_agent/schedules.py +137 -0
- krnl_agent/secrets.py +100 -0
- krnl_agent/selfheal.py +87 -0
- krnl_agent/server.py +302 -0
- krnl_agent/sessions.py +258 -0
- krnl_agent/settings.py +59 -0
- krnl_agent/skills.py +73 -0
- krnl_agent/teams.py +38 -0
- krnl_agent/tool_schemas.py +431 -0
- krnl_agent/tools.py +694 -0
- krnl_agent/webtools.py +139 -0
- krnl_code-1.0.4.dist-info/METADATA +214 -0
- krnl_code-1.0.4.dist-info/RECORD +56 -0
- krnl_code-1.0.4.dist-info/WHEEL +5 -0
- krnl_code-1.0.4.dist-info/entry_points.txt +2 -0
- krnl_code-1.0.4.dist-info/licenses/LICENSE +147 -0
- krnl_code-1.0.4.dist-info/licenses/NOTICE +4 -0
- krnl_code-1.0.4.dist-info/top_level.txt +1 -0
krnl_agent/webtools.py
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"""Model-agnostic web tools: search + fetch.
|
|
2
|
+
|
|
3
|
+
`web_search` is pluggable across backends (Tavily / Brave / SerpAPI with a key,
|
|
4
|
+
or keyless DuckDuckGo HTML as the default). `web_fetch` retrieves a URL and
|
|
5
|
+
reduces it to readable text. These are our own tools — no provider's built-in
|
|
6
|
+
web tool is required, so they work with any model.
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import html
|
|
11
|
+
import os
|
|
12
|
+
import re
|
|
13
|
+
import urllib.parse
|
|
14
|
+
|
|
15
|
+
import httpx
|
|
16
|
+
|
|
17
|
+
_UA = "Mozilla/5.0 (compatible; KrnlAgent/0.3)"
|
|
18
|
+
_TAG = re.compile(r"<[^>]+>")
|
|
19
|
+
_SCRIPT = re.compile(r"<(script|style)[^>]*>.*?</\1>", re.DOTALL | re.IGNORECASE)
|
|
20
|
+
_DDG_RESULT = re.compile(
|
|
21
|
+
r'<a[^>]*class="result__a"[^>]*href="([^"]+)"[^>]*>(.*?)</a>', re.DOTALL
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _strip_html(raw: str) -> str:
|
|
26
|
+
raw = _SCRIPT.sub(" ", raw)
|
|
27
|
+
text = _TAG.sub(" ", raw)
|
|
28
|
+
text = html.unescape(text)
|
|
29
|
+
return re.sub(r"\n\s*\n\s*\n+", "\n\n", re.sub(r"[ \t]+", " ", text)).strip()
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def web_fetch(url: str, max_chars: int = 8000, timeout: int = 20) -> tuple[bool, str]:
|
|
33
|
+
if not url.startswith(("http://", "https://")):
|
|
34
|
+
url = "https://" + url
|
|
35
|
+
try:
|
|
36
|
+
r = httpx.get(url, headers={"User-Agent": _UA}, follow_redirects=True, timeout=timeout)
|
|
37
|
+
r.raise_for_status()
|
|
38
|
+
except Exception as e: # noqa: BLE001
|
|
39
|
+
return False, f"fetch failed: {e}"
|
|
40
|
+
ctype = r.headers.get("content-type", "")
|
|
41
|
+
body = r.text if "html" in ctype or "text" in ctype or not ctype else r.text
|
|
42
|
+
text = _strip_html(body) if "html" in ctype else body
|
|
43
|
+
if len(text) > max_chars:
|
|
44
|
+
text = text[:max_chars] + "\n… (truncated)"
|
|
45
|
+
return True, f"# {url}\n\n{text}"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def web_search(
|
|
49
|
+
query: str,
|
|
50
|
+
provider: str = "duckduckgo",
|
|
51
|
+
api_key: str = "",
|
|
52
|
+
max_results: int = 5,
|
|
53
|
+
) -> tuple[bool, str]:
|
|
54
|
+
try:
|
|
55
|
+
if provider == "tavily" and api_key:
|
|
56
|
+
return _tavily(query, api_key, max_results)
|
|
57
|
+
if provider == "brave" and api_key:
|
|
58
|
+
return _brave(query, api_key, max_results)
|
|
59
|
+
if provider == "serpapi" and api_key:
|
|
60
|
+
return _serpapi(query, api_key, max_results)
|
|
61
|
+
return _duckduckgo(query, max_results)
|
|
62
|
+
except Exception as e: # noqa: BLE001
|
|
63
|
+
return False, f"search failed: {e}"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _fmt(results: list[dict]) -> tuple[bool, str]:
|
|
67
|
+
if not results:
|
|
68
|
+
return True, "(no results)"
|
|
69
|
+
lines = []
|
|
70
|
+
for i, r in enumerate(results, 1):
|
|
71
|
+
lines.append(f"{i}. {r.get('title', '')}\n {r.get('url', '')}\n {r.get('snippet', '')}")
|
|
72
|
+
return True, "\n".join(lines)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _duckduckgo(query: str, n: int) -> tuple[bool, str]:
|
|
76
|
+
url = "https://html.duckduckgo.com/html/?q=" + urllib.parse.quote(query)
|
|
77
|
+
r = httpx.get(url, headers={"User-Agent": _UA}, follow_redirects=True, timeout=20)
|
|
78
|
+
r.raise_for_status()
|
|
79
|
+
results = []
|
|
80
|
+
for href, title in _DDG_RESULT.findall(r.text)[:n]:
|
|
81
|
+
results.append({"title": _strip_html(title), "url": html.unescape(href), "snippet": ""})
|
|
82
|
+
return _fmt(results)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _tavily(query: str, key: str, n: int) -> tuple[bool, str]:
|
|
86
|
+
r = httpx.post(
|
|
87
|
+
"https://api.tavily.com/search",
|
|
88
|
+
json={"api_key": key, "query": query, "max_results": n},
|
|
89
|
+
timeout=20,
|
|
90
|
+
)
|
|
91
|
+
r.raise_for_status()
|
|
92
|
+
data = r.json()
|
|
93
|
+
results = [
|
|
94
|
+
{"title": x.get("title"), "url": x.get("url"), "snippet": x.get("content", "")[:200]}
|
|
95
|
+
for x in data.get("results", [])
|
|
96
|
+
]
|
|
97
|
+
return _fmt(results)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _brave(query: str, key: str, n: int) -> tuple[bool, str]:
|
|
101
|
+
r = httpx.get(
|
|
102
|
+
"https://api.search.brave.com/res/v1/web/search",
|
|
103
|
+
headers={"X-Subscription-Token": key, "Accept": "application/json"},
|
|
104
|
+
params={"q": query, "count": n},
|
|
105
|
+
timeout=20,
|
|
106
|
+
)
|
|
107
|
+
r.raise_for_status()
|
|
108
|
+
web = r.json().get("web", {}).get("results", [])
|
|
109
|
+
results = [
|
|
110
|
+
{"title": x.get("title"), "url": x.get("url"), "snippet": x.get("description", "")}
|
|
111
|
+
for x in web
|
|
112
|
+
]
|
|
113
|
+
return _fmt(results)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _serpapi(query: str, key: str, n: int) -> tuple[bool, str]:
|
|
117
|
+
r = httpx.get(
|
|
118
|
+
"https://serpapi.com/search.json",
|
|
119
|
+
params={"q": query, "api_key": key, "num": n},
|
|
120
|
+
timeout=20,
|
|
121
|
+
)
|
|
122
|
+
r.raise_for_status()
|
|
123
|
+
org = r.json().get("organic_results", [])[:n]
|
|
124
|
+
results = [
|
|
125
|
+
{"title": x.get("title"), "url": x.get("link"), "snippet": x.get("snippet", "")}
|
|
126
|
+
for x in org
|
|
127
|
+
]
|
|
128
|
+
return _fmt(results)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def search_config_from_env() -> tuple[str, str]:
|
|
132
|
+
"""Pick a search provider based on which API key env var is set."""
|
|
133
|
+
if os.getenv("TAVILY_API_KEY"):
|
|
134
|
+
return "tavily", os.environ["TAVILY_API_KEY"]
|
|
135
|
+
if os.getenv("BRAVE_API_KEY"):
|
|
136
|
+
return "brave", os.environ["BRAVE_API_KEY"]
|
|
137
|
+
if os.getenv("SERPAPI_API_KEY"):
|
|
138
|
+
return "serpapi", os.environ["SERPAPI_API_KEY"]
|
|
139
|
+
return "duckduckgo", ""
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: krnl-code
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: Lightweight provider-agnostic agentic coding backend (CLI + server) for the Krnl VS Code extension.
|
|
5
|
+
Author: Krnl Agent contributors
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/Saurabh7Goku/Krnl-Coding-Agent
|
|
8
|
+
Project-URL: Issues, https://github.com/Saurabh7Goku/Krnl-Coding-Agent/issues
|
|
9
|
+
Keywords: ai,agent,coding,llm,cli,vscode
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
License-File: NOTICE
|
|
18
|
+
Requires-Dist: fastapi>=0.110
|
|
19
|
+
Requires-Dist: uvicorn[standard]>=0.29
|
|
20
|
+
Requires-Dist: pydantic>=2.6
|
|
21
|
+
Requires-Dist: python-dotenv>=1.0
|
|
22
|
+
Requires-Dist: pyyaml>=6.0
|
|
23
|
+
Requires-Dist: openai>=1.30
|
|
24
|
+
Requires-Dist: httpx>=0.27
|
|
25
|
+
Requires-Dist: rich>=13.7
|
|
26
|
+
Requires-Dist: prompt_toolkit>=3.0
|
|
27
|
+
Requires-Dist: networkx>=3.0
|
|
28
|
+
Provides-Extra: anthropic
|
|
29
|
+
Requires-Dist: anthropic>=0.34; extra == "anthropic"
|
|
30
|
+
Provides-Extra: mcp
|
|
31
|
+
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
34
|
+
Provides-Extra: graph
|
|
35
|
+
Requires-Dist: tree-sitter>=0.21; extra == "graph"
|
|
36
|
+
Requires-Dist: tree-sitter-python>=0.21; extra == "graph"
|
|
37
|
+
Provides-Extra: all
|
|
38
|
+
Requires-Dist: krnl-code[anthropic,graph,mcp]; extra == "all"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
# krnl-coding-agent
|
|
42
|
+
|
|
43
|
+
The Python agent backend and standalone CLI behind the Krnl Coding Agent VS Code
|
|
44
|
+
extension. An open-source, model-agnostic agentic coding assistant that plans,
|
|
45
|
+
edits code, runs commands, searches the web, reviews diffs, coordinates teams of
|
|
46
|
+
sub-agents, and runs on cron schedules - with your approval at every step.
|
|
47
|
+
|
|
48
|
+
Provider-agnostic: works with Anthropic, OpenAI, Google Gemini, OpenRouter, Groq,
|
|
49
|
+
Cerebras, DeepSeek, Together, Mistral, xAI, Vercel AI Gateway, Krnl,
|
|
50
|
+
Ollama, LM Studio, or any OpenAI-compatible / self-hosted endpoint.
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
pip install krnl-coding-agent
|
|
55
|
+
krnl-agent update # update to the latest anytime
|
|
56
|
+
# optional extras:
|
|
57
|
+
pip install "krnl-coding-agent[anthropic]" # native Anthropic client
|
|
58
|
+
pip install "krnl-coding-agent[mcp]" # Model Context Protocol servers
|
|
59
|
+
|
|
60
|
+
Tip: install into a virtual environment for isolation. The client auto-adapts to
|
|
61
|
+
each provider's API (e.g. models needing max_completion_tokens instead of
|
|
62
|
+
max_tokens, or rejecting a custom temperature) - no model-specific config needed.
|
|
63
|
+
|
|
64
|
+
## Quick start (CLI)
|
|
65
|
+
|
|
66
|
+
krnl-agent # interactive chat in the current folder
|
|
67
|
+
krnl-agent run "add a /health route to app.py"
|
|
68
|
+
krnl-agent run "summarize the repo" --json # headless JSON output for CI/scripts
|
|
69
|
+
krnl-agent serve --host 0.0.0.0 --port 8000 # self-host with bearer-token auth
|
|
70
|
+
|
|
71
|
+
Set a provider and key right inside the chat (no files needed):
|
|
72
|
+
|
|
73
|
+
you: /provider openai # or gemini, anthropic, groq, ollama, ...
|
|
74
|
+
you: /key # paste your API key (stored in ~/.krnl-agent)
|
|
75
|
+
you: create a FastAPI hello-world app with a test
|
|
76
|
+
|
|
77
|
+
Or use environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY,
|
|
78
|
+
KRL_API_KEY, ...) or a config.yaml. Built-in provider profiles mean no config
|
|
79
|
+
file is required - just pick a provider and supply a key.
|
|
80
|
+
|
|
81
|
+
## CLI commands
|
|
82
|
+
|
|
83
|
+
krnl-agent interactive chat (remembers provider/key)
|
|
84
|
+
krnl-agent run "<task>" one-shot task ( --yes to auto-approve, --json headless )
|
|
85
|
+
krnl-agent providers list configured providers
|
|
86
|
+
krnl-agent models show the multi-model routing table (per-phase model + price)
|
|
87
|
+
krnl-agent init scaffold config.yaml + .env
|
|
88
|
+
krnl-agent serve run the API / WebSocket server ( --port 0 = auto )
|
|
89
|
+
krnl-agent --team-name <name> "<task>" multi-agent team (coordinator + specialists)
|
|
90
|
+
krnl-agent team list multi-agent teams
|
|
91
|
+
krnl-agent schedule create "<name>" --cron "0 9 * * MON-FRI" --prompt "<task>"
|
|
92
|
+
krnl-agent schedule list | run <id> | remove <id> | daemon
|
|
93
|
+
krnl-agent plugin add <dir|zip-url> | list | remove <name>
|
|
94
|
+
krnl-agent security run a security audit of the codebase
|
|
95
|
+
krnl-agent scan fast secret + dependency vulnerability scan
|
|
96
|
+
krnl-agent secfix autonomous security remediation (audit→fix→verify)
|
|
97
|
+
krnl-agent test [--all] write + run tests (--all = whole-project suite)
|
|
98
|
+
krnl-agent ship "<what>" plan→build→test→scan→deploy→monitor, end to end
|
|
99
|
+
krnl-agent deploy [--check] deploy to a live URL (or list target readiness)
|
|
100
|
+
krnl-agent monitor monitoring status (errors/uptime/providers)
|
|
101
|
+
krnl-agent heal [<url>] self-heal: health-check, auto-rollback, error→PR
|
|
102
|
+
krnl-agent doctor environment self-check
|
|
103
|
+
krnl-agent audit [--lines N] show & verify the tamper-evident action log
|
|
104
|
+
krnl-agent init-ci scaffold a GitHub Actions workflow
|
|
105
|
+
krnl-agent sessions list saved sessions (dashboard)
|
|
106
|
+
krnl-agent chat --session <id> | --resume resume a past session
|
|
107
|
+
|
|
108
|
+
In-chat commands: /provider /key /model /effort /plan /execute /review /security
|
|
109
|
+
/scan /secfix /test /testall /audit /doctor /compact /init /skills /search /usage
|
|
110
|
+
/undo /reset /yes /help /exit, plus any custom command in .krnl/commands/.
|
|
111
|
+
|
|
112
|
+
## What's new (1.4.0)
|
|
113
|
+
|
|
114
|
+
- **The full loop — one sentence to a live, monitored, self-healing app.**
|
|
115
|
+
`krnl-agent ship "build a FastAPI todo API with a Neon DB and put it live"` runs
|
|
116
|
+
plan → build → test → security-scan → **deploy** → **monitor**.
|
|
117
|
+
- **Auto-deploy** headless to Cloud Run, Cloudflare/Pages, Vercel, Netlify, Render,
|
|
118
|
+
Fly, Railway, Docker, Kubernetes/Helm, AWS (SAM/App Runner), Azure Container Apps,
|
|
119
|
+
plus Neon/Supabase databases — each via its CLI + a credential env var.
|
|
120
|
+
- **Spend gate:** free-tier targets deploy directly; billable ones are blocked unless
|
|
121
|
+
you set `deploy.allow_billable`. Secrets are read from env, never printed, and every
|
|
122
|
+
deploy/rollback is recorded in the audit log.
|
|
123
|
+
- **Monitoring** (`krnl-agent monitor`): wires Sentry / OpenTelemetry / uptime and
|
|
124
|
+
reports current errors + uptime.
|
|
125
|
+
- **Self-healing** (`krnl-agent heal`): auto-rollback to the last known-good release
|
|
126
|
+
on a failed health check; production errors become a fix + regression test in a PR
|
|
127
|
+
(never auto-merged). See docs/DEPLOY.md.
|
|
128
|
+
|
|
129
|
+
## What's new (1.3.0)
|
|
130
|
+
|
|
131
|
+
- **Multi-model routing**: assign a different model (from any provider) to each
|
|
132
|
+
phase — `planner`, `executor`, `cheap` (sub-agents), `verifier` — via `models:` +
|
|
133
|
+
`routing:` in config.yaml. Cost-aware `strategy: auto` runs cheap models where safe
|
|
134
|
+
and **auto-escalates** to a stronger model when the cheaper one keeps failing, so
|
|
135
|
+
you spend the least that still gets the job done. No provider lock-in.
|
|
136
|
+
- `krnl-agent models` / `/models`: see which model + price runs each phase.
|
|
137
|
+
- Cost is now tracked per model actually used. See docs/MULTI_MODEL.md.
|
|
138
|
+
|
|
139
|
+
## What's new (1.2.0)
|
|
140
|
+
|
|
141
|
+
- **repo_map** tool: a compact symbol/outline map of the codebase so the agent
|
|
142
|
+
reads outlines first and full file bodies only on demand (token-saving).
|
|
143
|
+
- **secret_scan** + **dependency_audit** tools, and **/scan** / **/secfix**
|
|
144
|
+
commands — find hard-coded credentials and vulnerable deps, then remediate in an
|
|
145
|
+
autonomous audit → fix → verify loop.
|
|
146
|
+
- **Tamper-evident audit log** (`.krnl/audit/`) — SHA-256 hash-chained record of
|
|
147
|
+
every action; `krnl-agent audit` / `/audit` verifies the chain.
|
|
148
|
+
- **Sandbox / egress policy** (`sandbox:`): deny-by-default command rules, allowlist,
|
|
149
|
+
and `block_network`, enforced before every shell command (even in dangerous mode).
|
|
150
|
+
- **Agent-of-agent budgets** (`subagent_max_calls`, `subagent_token_budget`),
|
|
151
|
+
**model routing** (`router: {cheap, heavy}`), an opt-in **verifier** sub-agent
|
|
152
|
+
(`verify_edits`), and **self-heal** (`self_heal: N`).
|
|
153
|
+
- **krnl-agent doctor** (environment self-check), **init-ci** (GitHub Actions),
|
|
154
|
+
and **Anthropic prompt caching** of the static system prompt.
|
|
155
|
+
|
|
156
|
+
## What's new (1.1.0)
|
|
157
|
+
|
|
158
|
+
- Drag-and-drop context: reference or drop a **file, folder, or image** path into
|
|
159
|
+
chat and it is read and used automatically. Files of any reasonable length
|
|
160
|
+
(smart head+tail truncation), folders read recursively, and images sent as
|
|
161
|
+
multimodal blocks so vision models can actually see them. No special syntax -
|
|
162
|
+
quoted paths, absolute/relative paths, bare filenames, and `@mentions` all work.
|
|
163
|
+
- Built-in **security audit** (`/security`, `krnl-agent security`): vulnerability
|
|
164
|
+
review with severity-ranked findings and concrete fixes.
|
|
165
|
+
- **Autonomous testing**: `/test [target]` writes and runs tests for a file/module;
|
|
166
|
+
`/testall` (or `krnl-agent test --all`) builds and runs a comprehensive test
|
|
167
|
+
suite for the whole project and reports coverage gaps.
|
|
168
|
+
- **Plan mode and execute mode**, switchable mid-session with `/plan` and
|
|
169
|
+
`/execute` (execute is the default).
|
|
170
|
+
- Earlier: auto-onboarding (`.krnl/` memory + skill + project doc), live status
|
|
171
|
+
line + completion summary, dangerous (YOLO) mode, `/` command autocomplete,
|
|
172
|
+
accurate per-model cost, and memory/context optimization.
|
|
173
|
+
|
|
174
|
+
## Features
|
|
175
|
+
|
|
176
|
+
- Auto-onboarding (.krnl/ memory + skill + project doc, created automatically).
|
|
177
|
+
- Agentic tool-calling loop: plan, read, search, edit, run, verify.
|
|
178
|
+
- 28 sandboxed tools: read/write/edit/multi_edit/create/delete files, glob,
|
|
179
|
+
search, run_command (streaming), background processes, git status/diff/commit/
|
|
180
|
+
branch/push, open_pr, git worktrees, web_search, web_fetch.
|
|
181
|
+
- Plan mode and execute mode, sub-agents, and multi-agent teams with persistent state.
|
|
182
|
+
- Drag-and-drop context: read files (any length), whole folders, and images.
|
|
183
|
+
- Full loop: one sentence → build → test → scan → deploy to a live URL → monitor → self-heal.
|
|
184
|
+
- Auto-deploy to 13+ targets (Cloud Run/Cloudflare/Vercel/Netlify/Fly/Railway/Render/Docker/K8s/AWS/Azure + Neon/Supabase) with a free-tier-first spend gate.
|
|
185
|
+
- Multi-model routing: a different model per phase across providers, cost-aware with auto-escalation.
|
|
186
|
+
- Token-friendly code intelligence: `repo_map` outline tool, model routing, prompt caching.
|
|
187
|
+
- Security suite: `/security`, `/scan`, `/secfix`, secret_scan + dependency_audit tools.
|
|
188
|
+
- Tamper-evident audit log + sandbox/egress policy; sub-agent budgets, verifier, self-heal.
|
|
189
|
+
- Autonomous test writing/running (`/test`, `/testall`); `doctor` + `init-ci` helpers.
|
|
190
|
+
- Scheduled agents on cron schedules (independent of any terminal).
|
|
191
|
+
- MCP servers, plugins, skills, project memory (AGENTS.md), and custom commands.
|
|
192
|
+
- Permissions (allow/ask/deny), hooks, approvals with diffs, checkpoints, undo.
|
|
193
|
+
- Web search/fetch, multimodal image input, token and cost tracking, extended
|
|
194
|
+
thinking, model fallback chains.
|
|
195
|
+
- Messaging notifications: Slack, Discord, Telegram, Google Chat, WhatsApp, Linear.
|
|
196
|
+
- Headless JSON mode and a self-hostable server with bearer-token auth.
|
|
197
|
+
|
|
198
|
+
## Server
|
|
199
|
+
|
|
200
|
+
- GET /health liveness.
|
|
201
|
+
- GET /providers configured providers.
|
|
202
|
+
- POST /agent/run one-shot, non-interactive (set "auto_approve": true).
|
|
203
|
+
- WS /ws streaming agent with per-action approval (used by the extension).
|
|
204
|
+
|
|
205
|
+
The WebSocket init message accepts provider, model, api_key, and base_url so
|
|
206
|
+
secrets never need to live on disk. Set KRNL_AGENT_TOKEN (or serve --token) to
|
|
207
|
+
require bearer auth.
|
|
208
|
+
|
|
209
|
+
See the project README at https://github.com/krnl-tech/Krnl-coding-agent for the
|
|
210
|
+
full architecture and the VS Code extension.
|
|
211
|
+
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
Apache License 2.0. Copyright 2026 Krnl Engage Sphere Technology Private Limited.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
krnl_agent/__init__.py,sha256=N0A3WMVQEZ246IOUbrtgKSx7ZyMpdPlfr5Qe0vWs8lo,254
|
|
2
|
+
krnl_agent/__main__.py,sha256=mvshP9Z-X2xHOxsJqnIxFanXxaIsJPmIlVEeMMog63o,157
|
|
3
|
+
krnl_agent/agent_registry.py,sha256=00Kj7zFtL3LjBwUvToX9Ybl3ybUe8czWlFp4LVpkQSI,3679
|
|
4
|
+
krnl_agent/agent_selector.py,sha256=qpZStfbB63MSnMlU6rFABI_omndzxMM6bOuqIrByKVk,2333
|
|
5
|
+
krnl_agent/audit_log.py,sha256=Tcqeeb9xE6NnErVXVkiEQRGTkc7dgHVOfFwAFw7PFmE,5489
|
|
6
|
+
krnl_agent/background.py,sha256=IEBA7s31qNzA1y-CUywypKSxaDPWGageiS4ooQeZMQM,2861
|
|
7
|
+
krnl_agent/checkpoints.py,sha256=2Os-EmJo-a8Godurk18234IzUqMxqCPMpbylxVTyFHk,2291
|
|
8
|
+
krnl_agent/ci.py,sha256=N1pdMZDFCLn2jsnKXM42_ESp2oiVhJEDRV_cglbvC6s,2365
|
|
9
|
+
krnl_agent/cli.py,sha256=YlPowCcRCofcU5sRkbAEMjN6sG6PACQ7slls8n9CX0Q,62980
|
|
10
|
+
krnl_agent/commands.py,sha256=vZi3k2js_dZd1paQFUC_RQIDmi4wDXB7P_IuJBspIcU,1277
|
|
11
|
+
krnl_agent/config.py,sha256=xEEALc9N-ASW8BWsXO9poL45flFGQQ23Zj-Lc8rvhSU,16007
|
|
12
|
+
krnl_agent/context.py,sha256=fgZ2mGQvPV6_6tJPGmuzo09_44RVLQNMEJfNOy6MHc4,12431
|
|
13
|
+
krnl_agent/depaudit.py,sha256=J0mRi5wuf0QIl-7LSFU48Z7Z4HRlNFghMEa8tbg60A4,2885
|
|
14
|
+
krnl_agent/deploy.py,sha256=3nrJCH8QeIVL_Wm8wet3wbPvCV2ODbnRm_jWeEaqXo4,10958
|
|
15
|
+
krnl_agent/doctor.py,sha256=0VAX3we79_a0EV_bwQkx-fbSNGM5nt4IMUrjtUROBrU,4077
|
|
16
|
+
krnl_agent/events.py,sha256=eiZ68ySKLmNmn3VSzZsEX6UpR-rpN3COZHTSD2k_Jaw,4654
|
|
17
|
+
krnl_agent/gitignore.py,sha256=FPRfFv5CoVmsgx_3VKEDSCGGhAAXMRryZIGiyEG5iCs,1640
|
|
18
|
+
krnl_agent/graph.py,sha256=18FhV09GNIMeXsE7miffzVnYI3oZ7h-3yra3o-VWCC0,35279
|
|
19
|
+
krnl_agent/guardrails.py,sha256=vIf_HqVDa4_l_glrXCASI4jhPCbZU5FuUmqoBv3ohRk,3046
|
|
20
|
+
krnl_agent/headless.py,sha256=MOJ6JLxLmaFgVRKSL0R-hPeZHodxR_pAsE8xujWWcpg,1773
|
|
21
|
+
krnl_agent/history.py,sha256=3359PjnKjOvudxfBHE_130vLJ6-JToaTjmuO-bLF88Q,1400
|
|
22
|
+
krnl_agent/hooks.py,sha256=hEvizokVdbkoEzwIU_s-oO3tWdLYIJwAK2a4DAzkxwI,2535
|
|
23
|
+
krnl_agent/ingest.py,sha256=4M9OuCS1_hAjhQcTYCjphhbOTfC1jhJx7QxkzdkrDsE,4431
|
|
24
|
+
krnl_agent/llm.py,sha256=o3GIz5wpwPM0560-rv1sn5ZBkuKXf0soyl9AsNB92Cw,17638
|
|
25
|
+
krnl_agent/loop.py,sha256=v0welK7HZHGKhSh8G6Ng-BBez9kCTeJnzwu2Uz6eeYg,35566
|
|
26
|
+
krnl_agent/mcp_client.py,sha256=av5bWA1giNAn5NAcdJ-9k8O0qhura5TqX_D8DUsJUbA,4611
|
|
27
|
+
krnl_agent/memory.py,sha256=EaOki_DPktK6nI6Sp5QNgmtwFyUfMmKOw0jlAkSEHn8,1738
|
|
28
|
+
krnl_agent/modelrouter.py,sha256=YQG9hPhJZsKEeYAVwizt7d5cJbhlLPfa8HvsFw2sxyk,6983
|
|
29
|
+
krnl_agent/monitor.py,sha256=s9IqVVS74aXv_Y-nBYYPy6f4aq6ilgYmkx-sNI9L_kQ,4873
|
|
30
|
+
krnl_agent/notify.py,sha256=stnhkEjDH0zMs_e6BhR5giA6RgcyBI1Yg2EPj56tIDE,3993
|
|
31
|
+
krnl_agent/parallel_executor.py,sha256=iMy2nUcLh_824M-rSCnNEuoOoOKZVdEQTtGnK-f_Ric,4444
|
|
32
|
+
krnl_agent/permissions.py,sha256=eKb2B-Kq-9i5wKUebyLXoKQvi-mNTiFuf_gIYmt-q4o,4502
|
|
33
|
+
krnl_agent/plugins.py,sha256=8RU7SbgPmJs3TRwsFwcso8AYdikYYRnSE1-Hlez41Z8,3294
|
|
34
|
+
krnl_agent/pricing.py,sha256=dsam3_uWdYAm-IWzBA1zkS1Wl4nizwsXXYIlT2TH1AI,2785
|
|
35
|
+
krnl_agent/prompts.py,sha256=bj8WFJ6ZYGeWZTpclU4lwujWUhC-d33Xq4xab6QNLYE,3298
|
|
36
|
+
krnl_agent/repomap.py,sha256=6hFg9rnVLfDcSNY4l8y5exa6urjSrFUaK8ump6pb-hM,5287
|
|
37
|
+
krnl_agent/sandbox.py,sha256=YjW_8gXHivnjGdZ18curIzsweIcQuHMhBAXAvkK0p6c,2435
|
|
38
|
+
krnl_agent/scaffold.py,sha256=Z8vrzFcEshnPDPXp9EDNMBno-IfS3FwKWWoBFMc7WPE,5841
|
|
39
|
+
krnl_agent/schedules.py,sha256=uiniehKZm8MdQTAu6APIkvE5BijwFro9AC9Ic4UkWRs,4273
|
|
40
|
+
krnl_agent/secrets.py,sha256=J2rNW0h2W3zDwKh1GiePXhIgixBulqQBc7OxKPpo_Es,4108
|
|
41
|
+
krnl_agent/selfheal.py,sha256=kjuyZNzmn3L8dRPY9mT2I3-KPQOALBbPd-dvq6ZsQT0,3701
|
|
42
|
+
krnl_agent/server.py,sha256=r-j1T4hGxK_Xkr7TwAxvfOYADvfjsEpKmUJLJPYTMl4,10558
|
|
43
|
+
krnl_agent/sessions.py,sha256=lnR2qsn6owaVlgvyQDKkiy-s1IqO1uEPkTsP2JHjFAQ,8869
|
|
44
|
+
krnl_agent/settings.py,sha256=mU5Hh0mjdoZAqxPdaGJhe7lurYfxyJI4XKveHOWQ1aU,1523
|
|
45
|
+
krnl_agent/skills.py,sha256=_XVKb9yoYzBfk2k5U3HTDyhJPZjyNA41OgRAw-oBFx4,2399
|
|
46
|
+
krnl_agent/teams.py,sha256=zLGUT52Z_c-t7rWl6iamegbXomhFrTr2RIC7uoerFeU,1476
|
|
47
|
+
krnl_agent/tool_schemas.py,sha256=-rbjrReTRgbNAYzL8Nfr2fVFswZClkpkdlmkK9riWGo,15111
|
|
48
|
+
krnl_agent/tools.py,sha256=pdIuVSRSLimFSGYCe-kS30-yGFF1gjNITuhnltiEopw,25941
|
|
49
|
+
krnl_agent/webtools.py,sha256=i5hEDk0LZ_lzgJMzX8TX70Ym7BAugdZ2_aqYFAJnZ0g,4771
|
|
50
|
+
krnl_code-1.0.4.dist-info/licenses/LICENSE,sha256=uMyurO4Gh_OWEvdCdr5suFpgd1JKf8x8_KX8de0tnDw,7874
|
|
51
|
+
krnl_code-1.0.4.dist-info/licenses/NOTICE,sha256=KqDP8kx4uNBN8sDbWKrDABEHW4jbqyb6B4-7K6vsJ70,158
|
|
52
|
+
krnl_code-1.0.4.dist-info/METADATA,sha256=TgyrlZ4soHyvbbj5vNcL-8bolfBbsoM_s3_Pfiaazfg,11706
|
|
53
|
+
krnl_code-1.0.4.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
54
|
+
krnl_code-1.0.4.dist-info/entry_points.txt,sha256=6LEhfxuTjeKMR_AsMnRmZVdHw__gg8ZExURgLfDwbfg,50
|
|
55
|
+
krnl_code-1.0.4.dist-info/top_level.txt,sha256=lXEJePisBJpKfzCmnlMVq38OapV3MxiLP4AwLNvqfpo,11
|
|
56
|
+
krnl_code-1.0.4.dist-info/RECORD,,
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work; and
|
|
103
|
+
|
|
104
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
105
|
+
distribution, then any Derivative Works that You distribute must
|
|
106
|
+
include a readable copy of the attribution notices contained
|
|
107
|
+
within such NOTICE file.
|
|
108
|
+
|
|
109
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
110
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
111
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
112
|
+
this License, without any additional terms or conditions.
|
|
113
|
+
|
|
114
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
115
|
+
names, trademarks, service marks, or product names of the Licensor.
|
|
116
|
+
|
|
117
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed
|
|
118
|
+
to in writing, Licensor provides the Work (and each Contributor
|
|
119
|
+
provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES
|
|
120
|
+
OR CONDITIONS OF ANY KIND, either express or implied.
|
|
121
|
+
|
|
122
|
+
8. Limitation of Liability. In no event and under no legal theory shall
|
|
123
|
+
any Contributor be liable to You for damages, including any direct,
|
|
124
|
+
indirect, special, incidental, or consequential damages of any
|
|
125
|
+
character arising as a result of this License or out of the use or
|
|
126
|
+
inability to use the Work.
|
|
127
|
+
|
|
128
|
+
9. Accepting Warranty or Additional Liability. While redistributing the
|
|
129
|
+
Work or Derivative Works thereof, You may choose to offer, and charge
|
|
130
|
+
a fee for, acceptance of support, warranty, indemnity, or other
|
|
131
|
+
liability obligations and/or rights consistent with this License.
|
|
132
|
+
|
|
133
|
+
END OF TERMS AND CONDITIONS
|
|
134
|
+
|
|
135
|
+
Copyright 2026 Krnl Engage Sphere Technology Private Limited
|
|
136
|
+
|
|
137
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
138
|
+
you may not use this file except in compliance with the License.
|
|
139
|
+
You may obtain a copy of the License at
|
|
140
|
+
|
|
141
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
142
|
+
|
|
143
|
+
Unless required by applicable law or agreed to in writing, software
|
|
144
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
145
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
146
|
+
See the License for the specific language governing permissions and
|
|
147
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
krnl_agent
|