minacode 0.12.0__tar.gz
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.
- minacode-0.12.0/LICENSE +28 -0
- minacode-0.12.0/MANIFEST.in +4 -0
- minacode-0.12.0/PKG-INFO +115 -0
- minacode-0.12.0/README.md +74 -0
- minacode-0.12.0/README.zh-CN.md +74 -0
- minacode-0.12.0/minacode/__init__.py +21 -0
- minacode-0.12.0/minacode/__main__.py +66 -0
- minacode-0.12.0/minacode/base.py +567 -0
- minacode-0.12.0/minacode/engine.py +1734 -0
- minacode-0.12.0/minacode/mcp.py +1252 -0
- minacode-0.12.0/minacode/session.py +1077 -0
- minacode-0.12.0/minacode/skill.py +104 -0
- minacode-0.12.0/minacode/tools.py +2127 -0
- minacode-0.12.0/minacode/tui.py +3335 -0
- minacode-0.12.0/minacode.egg-info/PKG-INFO +115 -0
- minacode-0.12.0/minacode.egg-info/SOURCES.txt +20 -0
- minacode-0.12.0/minacode.egg-info/dependency_links.txt +1 -0
- minacode-0.12.0/minacode.egg-info/entry_points.txt +2 -0
- minacode-0.12.0/minacode.egg-info/requires.txt +13 -0
- minacode-0.12.0/minacode.egg-info/top_level.txt +1 -0
- minacode-0.12.0/pyproject.toml +76 -0
- minacode-0.12.0/setup.cfg +4 -0
minacode-0.12.0/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, hit9
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its contributors
|
|
16
|
+
may be used to endorse or promote products derived from this software
|
|
17
|
+
without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF
|
|
28
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
minacode-0.12.0/PKG-INFO
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: minacode
|
|
3
|
+
Version: 0.12.0
|
|
4
|
+
Summary: A small terminal coding agent written in Python
|
|
5
|
+
Author-email: hit9 <hit9@icloud.com>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/hit9/minacode
|
|
8
|
+
Project-URL: Repository, https://github.com/hit9/minacode
|
|
9
|
+
Project-URL: Issues, https://github.com/hit9/minacode/issues
|
|
10
|
+
Project-URL: Documentation, https://minacode.readthedocs.io
|
|
11
|
+
Keywords: ai,coding-assistant,cli,terminal
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
23
|
+
Classifier: Topic :: Software Development
|
|
24
|
+
Classifier: Topic :: Terminals
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: anthropic>=0.64.0
|
|
29
|
+
Requires-Dist: code-symbol-index>=0.3.5
|
|
30
|
+
Requires-Dist: json-repair
|
|
31
|
+
Requires-Dist: fastmcp-slim[client]<4,>=3
|
|
32
|
+
Requires-Dist: openai>=2.37.0
|
|
33
|
+
Requires-Dist: prompt-toolkit>=3.0
|
|
34
|
+
Requires-Dist: rich>=13.0
|
|
35
|
+
Requires-Dist: socksio>=1.0.0
|
|
36
|
+
Requires-Dist: websockets>=15.0.1
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
39
|
+
Requires-Dist: ruff>=0.4.0; extra == "dev"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
<h1 align="center">minacode</h1>
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<img src="snapshots/minacode1.gif" alt="minacode editing code and running tools" width="600">
|
|
46
|
+
</p>
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
A coding agent I use, maintain, and customize, shipped as a small, focused Python package.
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
<p align="center"><a href="README.zh-CN.md">中文</a></p>
|
|
53
|
+
|
|
54
|
+
## Safety
|
|
55
|
+
|
|
56
|
+
**Use at your own risk.** minacode can edit files and run shell commands in the environment where it starts. It does not provide sandbox isolation; use a container or VM when needed.
|
|
57
|
+
|
|
58
|
+
## What it is
|
|
59
|
+
|
|
60
|
+
minacode does not introduce a new kind of coding agent. It combines familiar features — reading and editing files, running commands, follow-ups, sessions, diffs, MCP, and skills — into a tool I use personally.
|
|
61
|
+
|
|
62
|
+
It works on real repositories, including its own: I use minacode to build and maintain minacode. Everything ships in a small, focused Python package, so I can change the behavior directly whenever I want the workflow to work differently.
|
|
63
|
+
|
|
64
|
+
minacode is the former nanocode. It started as a single-file agent small enough to be called *nano*, but has since grown beyond a single file, so it now goes by minacode.
|
|
65
|
+
|
|
66
|
+
<p align="center">
|
|
67
|
+
<img src="snapshots/minacode2.gif" alt="minacode resuming a saved session" width="600">
|
|
68
|
+
</p>
|
|
69
|
+
<p align="center"><sub>Resuming a saved session with its conversation and tool history.</sub></p>
|
|
70
|
+
|
|
71
|
+
## Highlights
|
|
72
|
+
|
|
73
|
+
- **Prompt-cache aware:** stable request prefixes let supported providers reuse work and can reach 90–99% cache hit rates; `/status` shows the reported result.
|
|
74
|
+
- **Code navigation:** jump to definitions, callers, and implementations with a searchable code index.
|
|
75
|
+
- **Live follow-ups:** type while the agent works; `Enter` queues a message for the next model step, while `Ctrl-C` discards a draft or interrupts the task once the input is empty.
|
|
76
|
+
- **Anchored edits:** structured edits use `line:hash` anchors and reject stale file content.
|
|
77
|
+
- **Resumable sessions:** conversation, tool calls, diffs, and working memory survive `-c` or `--resume`.
|
|
78
|
+
- **Built-in diff viewer:** `/diff` shows the latest round and the net session result.
|
|
79
|
+
- **MCP and skills:** connect Model Context Protocol servers and load Markdown instruction packs on demand.
|
|
80
|
+
- **Provider compatibility:** OpenAI-compatible APIs and Anthropic.
|
|
81
|
+
|
|
82
|
+
## Install
|
|
83
|
+
|
|
84
|
+
Requires macOS or Linux, Python 3.11+, and [uv](https://docs.astral.sh/uv/).
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
uv tool install minacode
|
|
88
|
+
minacode --init-config
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Add your provider to `~/.minacode/config.toml`:
|
|
92
|
+
|
|
93
|
+
```toml
|
|
94
|
+
[provider]
|
|
95
|
+
active = "default"
|
|
96
|
+
|
|
97
|
+
[provider.default]
|
|
98
|
+
url = "https://api.deepseek.com"
|
|
99
|
+
key = "sk-..."
|
|
100
|
+
model = "deepseek-v4-flash"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Then run:
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
minacode
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Upgrade with `uv tool upgrade minacode`.
|
|
110
|
+
|
|
111
|
+
## Links
|
|
112
|
+
|
|
113
|
+
- [Documentation](https://minacode.readthedocs.io/en/latest/) — full usage guide and reference.
|
|
114
|
+
- [Blog post](https://hit9.dev/post/nanocode) — why and how it was built.
|
|
115
|
+
- [code-symbol-index](https://github.com/hit9/code-symbol-index) — the code index library minacode uses.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<h1 align="center">minacode</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="snapshots/minacode1.gif" alt="minacode editing code and running tools" width="600">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
A coding agent I use, maintain, and customize, shipped as a small, focused Python package.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center"><a href="README.zh-CN.md">中文</a></p>
|
|
12
|
+
|
|
13
|
+
## Safety
|
|
14
|
+
|
|
15
|
+
**Use at your own risk.** minacode can edit files and run shell commands in the environment where it starts. It does not provide sandbox isolation; use a container or VM when needed.
|
|
16
|
+
|
|
17
|
+
## What it is
|
|
18
|
+
|
|
19
|
+
minacode does not introduce a new kind of coding agent. It combines familiar features — reading and editing files, running commands, follow-ups, sessions, diffs, MCP, and skills — into a tool I use personally.
|
|
20
|
+
|
|
21
|
+
It works on real repositories, including its own: I use minacode to build and maintain minacode. Everything ships in a small, focused Python package, so I can change the behavior directly whenever I want the workflow to work differently.
|
|
22
|
+
|
|
23
|
+
minacode is the former nanocode. It started as a single-file agent small enough to be called *nano*, but has since grown beyond a single file, so it now goes by minacode.
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<img src="snapshots/minacode2.gif" alt="minacode resuming a saved session" width="600">
|
|
27
|
+
</p>
|
|
28
|
+
<p align="center"><sub>Resuming a saved session with its conversation and tool history.</sub></p>
|
|
29
|
+
|
|
30
|
+
## Highlights
|
|
31
|
+
|
|
32
|
+
- **Prompt-cache aware:** stable request prefixes let supported providers reuse work and can reach 90–99% cache hit rates; `/status` shows the reported result.
|
|
33
|
+
- **Code navigation:** jump to definitions, callers, and implementations with a searchable code index.
|
|
34
|
+
- **Live follow-ups:** type while the agent works; `Enter` queues a message for the next model step, while `Ctrl-C` discards a draft or interrupts the task once the input is empty.
|
|
35
|
+
- **Anchored edits:** structured edits use `line:hash` anchors and reject stale file content.
|
|
36
|
+
- **Resumable sessions:** conversation, tool calls, diffs, and working memory survive `-c` or `--resume`.
|
|
37
|
+
- **Built-in diff viewer:** `/diff` shows the latest round and the net session result.
|
|
38
|
+
- **MCP and skills:** connect Model Context Protocol servers and load Markdown instruction packs on demand.
|
|
39
|
+
- **Provider compatibility:** OpenAI-compatible APIs and Anthropic.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
Requires macOS or Linux, Python 3.11+, and [uv](https://docs.astral.sh/uv/).
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
uv tool install minacode
|
|
47
|
+
minacode --init-config
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Add your provider to `~/.minacode/config.toml`:
|
|
51
|
+
|
|
52
|
+
```toml
|
|
53
|
+
[provider]
|
|
54
|
+
active = "default"
|
|
55
|
+
|
|
56
|
+
[provider.default]
|
|
57
|
+
url = "https://api.deepseek.com"
|
|
58
|
+
key = "sk-..."
|
|
59
|
+
model = "deepseek-v4-flash"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Then run:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
minacode
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Upgrade with `uv tool upgrade minacode`.
|
|
69
|
+
|
|
70
|
+
## Links
|
|
71
|
+
|
|
72
|
+
- [Documentation](https://minacode.readthedocs.io/en/latest/) — full usage guide and reference.
|
|
73
|
+
- [Blog post](https://hit9.dev/post/nanocode) — why and how it was built.
|
|
74
|
+
- [code-symbol-index](https://github.com/hit9/code-symbol-index) — the code index library minacode uses.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<h1 align="center">minacode</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="snapshots/minacode1.gif" alt="minacode 编辑代码并运行工具" width="600">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
一个我自己在用、维护并定制的 coding agent。
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center"><a href="README.md">English</a></p>
|
|
12
|
+
|
|
13
|
+
## 安全
|
|
14
|
+
|
|
15
|
+
**使用风险自负。** minacode 会在启动环境中编辑文件并执行 shell 命令,不提供 sandbox 隔离。需要隔离时,请使用容器或虚拟机。
|
|
16
|
+
|
|
17
|
+
## 它是什么
|
|
18
|
+
|
|
19
|
+
minacode 并不想发明一种新的 coding agent。它只是把熟悉的能力 — 读取和编辑文件、运行命令、追加指令、session 恢复、diff、MCP 和 skill — 整合成我自己真正在用的工具。
|
|
20
|
+
|
|
21
|
+
它不仅用于真实项目,也用于自身开发:我用 minacode 来构建和维护 minacode。所有功能都在一个小而聚焦的 Python 包中,所以我可以随时直接修改行为,让工作流按我想要的方式运行。
|
|
22
|
+
|
|
23
|
+
minacode 即原来的 nanocode。它最初是一个小到可以称作 *nano* 的单文件 agent,但如今已不再 nano,所以改名为 minacode。
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<img src="snapshots/minacode2.gif" alt="minacode 恢复保存的 session" width="600">
|
|
27
|
+
</p>
|
|
28
|
+
<p align="center"><sub>恢复保存的 session,包括对话和工具调用历史。</sub></p>
|
|
29
|
+
|
|
30
|
+
## 亮点
|
|
31
|
+
|
|
32
|
+
- **Prompt-cache 友好:** 稳定的请求前缀让支持缓存的 provider 复用计算,缓存命中率可达 90–99%;`/status` 会显示 provider 返回的实际结果。
|
|
33
|
+
- **代码导航:** 通过可搜索的代码索引跳转到定义、调用者和实现。
|
|
34
|
+
- **实时追加指令:** agent 工作时仍可输入;`Enter` 将消息排入下一次模型调用,`Ctrl-C` 先清除草稿,输入为空时中断当前任务。
|
|
35
|
+
- **锚点编辑:** 结构化编辑使用 `line:hash` 锚点,文件内容过期时会被拒绝。
|
|
36
|
+
- **可恢复 session:** 对话、工具调用、diff 和工作记忆可通过 `-c` 或 `--resume` 恢复。
|
|
37
|
+
- **内置 diff viewer:** `/diff` 展示最新一轮改动以及整个 session 的累计变更。
|
|
38
|
+
- **MCP 与 skills:** 按需连接 Model Context Protocol server,加载 Markdown 指令包。
|
|
39
|
+
- **Provider 兼容:** 支持 OpenAI-compatible API 与 Anthropic。
|
|
40
|
+
|
|
41
|
+
## 安装
|
|
42
|
+
|
|
43
|
+
需要 macOS 或 Linux、Python 3.11+ 和 [uv](https://docs.astral.sh/uv/)。
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
uv tool install minacode
|
|
47
|
+
minacode --init-config
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
在 `~/.minacode/config.toml` 中填写 provider:
|
|
51
|
+
|
|
52
|
+
```toml
|
|
53
|
+
[provider]
|
|
54
|
+
active = "default"
|
|
55
|
+
|
|
56
|
+
[provider.default]
|
|
57
|
+
url = "https://api.deepseek.com"
|
|
58
|
+
key = "sk-..."
|
|
59
|
+
model = "deepseek-v4-flash"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
然后运行:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
minacode
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
升级:`uv tool upgrade minacode`。
|
|
69
|
+
|
|
70
|
+
## 链接
|
|
71
|
+
|
|
72
|
+
- [文档](https://minacode.readthedocs.io/zh-cn/latest/) — 完整的使用指南和参考。
|
|
73
|
+
- [博客](https://hit9.dev/post/nanocode) — 设计动机与实现过程。
|
|
74
|
+
- [code-symbol-index](https://github.com/hit9/code-symbol-index) — minacode 使用的代码索引库。
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""minacode: A small terminal coding agent written in Python.
|
|
2
|
+
|
|
3
|
+
The implementation lives in focused submodules (``base``, ``session``,
|
|
4
|
+
``skill``, ``mcp``, ``tools``, ``engine``, ``tui``) plus a ``__main__`` entry
|
|
5
|
+
point. The public names are
|
|
6
|
+
re-exported here so ``import minacode`` keeps exposing the same namespace the
|
|
7
|
+
single-file module used to provide.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from minacode.tui import *
|
|
11
|
+
from minacode.base import __version__
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def __getattr__(name: str):
|
|
15
|
+
# Lazily expose the entry point so importing minacode (and running `python -m minacode`)
|
|
16
|
+
# does not eagerly import __main__, which would raise a duplicate-module RuntimeWarning.
|
|
17
|
+
if name == "main":
|
|
18
|
+
from minacode.__main__ import main
|
|
19
|
+
|
|
20
|
+
return main
|
|
21
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""minacode entry point: command-line argument parsing and dispatch.
|
|
2
|
+
|
|
3
|
+
Invoked through the ``minacode`` console script or ``python -m minacode``.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from minacode.tui import *
|
|
9
|
+
from minacode.base import __version__
|
|
10
|
+
import argparse
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main(argv: list[str] | None = None) -> int:
|
|
14
|
+
if sys.platform == "win32":
|
|
15
|
+
print("Error: minacode does not support native Windows; use WSL instead.", file=sys.stderr)
|
|
16
|
+
return 1
|
|
17
|
+
|
|
18
|
+
parser = argparse.ArgumentParser(prog="minacode")
|
|
19
|
+
parser.add_argument("--config", default=None, help="Path to config TOML")
|
|
20
|
+
parser.add_argument("--init-config", action="store_true", help="Create a default config file")
|
|
21
|
+
parser.add_argument("--yolo", action="store_true", help="Skip confirmations for mutating tools")
|
|
22
|
+
parser.add_argument(
|
|
23
|
+
"--theme", choices=["auto", "light", "dark"], default="", help="Color theme (defaults to runtime.theme, then auto-detect via COLORFGBG)"
|
|
24
|
+
)
|
|
25
|
+
resume = parser.add_mutually_exclusive_group()
|
|
26
|
+
resume.add_argument("--resume", default="", nargs="?", const="latest", help='Resume a session by UID, or "latest"/"last" for this project\'s most recent')
|
|
27
|
+
resume.add_argument("-c", "--last", "--latest", dest="continue_project", action="store_true", help="Resume the latest session in the current project")
|
|
28
|
+
parser.add_argument("-v", "--version", action="store_true", help="Show version")
|
|
29
|
+
args = parser.parse_args(argv)
|
|
30
|
+
if args.version:
|
|
31
|
+
print(__version__)
|
|
32
|
+
return 0
|
|
33
|
+
try:
|
|
34
|
+
if args.init_config:
|
|
35
|
+
path, created = ConfigFile.init(args.config)
|
|
36
|
+
print(("Created" if created else "Exists") + " config: " + path)
|
|
37
|
+
return 0
|
|
38
|
+
if args.resume or args.continue_project:
|
|
39
|
+
data = ConfigFile.load(args.config)
|
|
40
|
+
config = Config.from_dict(data)
|
|
41
|
+
session = Session.load_snapshot(
|
|
42
|
+
args.resume or "latest",
|
|
43
|
+
config=config,
|
|
44
|
+
settings=RuntimeSettings.from_dict(data, yolo=args.yolo, theme=args.theme),
|
|
45
|
+
cwd=os.getcwd(),
|
|
46
|
+
)
|
|
47
|
+
else:
|
|
48
|
+
session = Session.from_config_file(path=args.config, yolo=args.yolo, theme=args.theme)
|
|
49
|
+
Theme.set_mode(Theme.resolve(session.settings.theme))
|
|
50
|
+
command_loop = CommandLoop(Agent(session))
|
|
51
|
+
try:
|
|
52
|
+
return command_loop.run()
|
|
53
|
+
finally:
|
|
54
|
+
command_loop.close_background_output()
|
|
55
|
+
if session.mcp is not None:
|
|
56
|
+
session.mcp.close()
|
|
57
|
+
except ConfigError as error:
|
|
58
|
+
print("ConfigError: " + str(error), file=sys.stderr)
|
|
59
|
+
return 2
|
|
60
|
+
except MinacodeError as error:
|
|
61
|
+
print("Error: " + str(error), file=sys.stderr)
|
|
62
|
+
return 1
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
if __name__ == "__main__":
|
|
66
|
+
raise SystemExit(main())
|