@vietor/easy-agent 0.4.2 → 0.4.3
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/README.md +13 -3
- package/dist/cmds/builtin.js +1 -1
- package/dist/main.js +2 -2
- package/dist/tui/App.js +11 -9
- package/dist/tui/LogList.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -27,15 +27,25 @@ Create `~/.easy-agent.json` in your home directory:
|
|
|
27
27
|
```json
|
|
28
28
|
{
|
|
29
29
|
"llm": {
|
|
30
|
-
"baseUrl": "https://api.
|
|
30
|
+
"baseUrl": "https://api.deepseek.com/v1",
|
|
31
31
|
"apiKey": "your-api-key",
|
|
32
|
-
"model": "
|
|
32
|
+
"model": "deepseek-v4-flash"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
`llm.baseUrl`, `llm.apiKey`, and `llm.model` are all required. Point `baseUrl` at any OpenAI-compatible endpoint (OpenAI, Azure OpenAI, local servers, etc.) and set `model` to a model that endpoint serves.
|
|
38
38
|
|
|
39
|
+
### Proxy
|
|
40
|
+
|
|
41
|
+
The agent automatically routes HTTP requests through a proxy when the standard environment variables are set:
|
|
42
|
+
|
|
43
|
+
- `HTTPS_PROXY` / `https_proxy` — proxy URL for HTTPS (preferred)
|
|
44
|
+
- `HTTP_PROXY` / `http_proxy` — proxy URL for HTTP (fallback)
|
|
45
|
+
- `NO_PROXY` / `no_proxy` — comma-separated hosts/domains to bypass the proxy
|
|
46
|
+
|
|
47
|
+
No extra configuration is needed — just set the env vars before launching `easy-agent`.
|
|
48
|
+
|
|
39
49
|
### MCP servers (optional)
|
|
40
50
|
|
|
41
51
|
Add an `mcpServers` map to expose external tools through the Model Context Protocol. Each entry is either a local process (stdio) or a remote endpoint (Streamable HTTP):
|
|
@@ -128,7 +138,7 @@ Type a prompt and press Enter. The agent streams its reply and calls tools as ne
|
|
|
128
138
|
## Build from source
|
|
129
139
|
|
|
130
140
|
```bash
|
|
131
|
-
git clone
|
|
141
|
+
git clone https://github.com/vietor/easy-agent.git
|
|
132
142
|
cd easy-agent
|
|
133
143
|
pnpm install
|
|
134
144
|
pnpm build # build core → CLI
|
package/dist/cmds/builtin.js
CHANGED
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { loadConfig } from "./config.js";
|
|
4
|
-
import { tryLoadSkills, tryReadFileText,
|
|
4
|
+
import { tryLoadSkills, tryReadFileText, createSession, } from "@vietor/easy-agent-core";
|
|
5
5
|
import { builtinCommands } from "./cmds/builtin.js";
|
|
6
6
|
import { startApp } from "./tui/App.js";
|
|
7
7
|
const SYSTEM_PROMPT_BASE = [
|
|
@@ -27,7 +27,7 @@ export async function main() {
|
|
|
27
27
|
const systemPrompt = [SYSTEM_PROMPT_BASE, globalPrompt, projectPrompt]
|
|
28
28
|
.filter(Boolean)
|
|
29
29
|
.join("\n\n=================\n\n");
|
|
30
|
-
const session = await
|
|
30
|
+
const session = await createSession({
|
|
31
31
|
systemPrompt,
|
|
32
32
|
llmConfig: config.llm,
|
|
33
33
|
mcpServers: config.mcpServers,
|
package/dist/tui/App.js
CHANGED
|
@@ -12,20 +12,20 @@ import { compactDisplay } from "../util/format.js";
|
|
|
12
12
|
const STREAM_FRAME_MS = 120;
|
|
13
13
|
export function App({ session }) {
|
|
14
14
|
const { exit } = useApp();
|
|
15
|
-
const
|
|
15
|
+
const view = useSyncExternalStore(session.subscribe, session.getSnapshot);
|
|
16
16
|
const [runState, setRunState] = useState({ running: false, elapsed: 0, promptTokens: 0, completionTokens: 0 });
|
|
17
17
|
const [streamingText, setStreamingText] = useState("");
|
|
18
18
|
const streamingRef = useRef("");
|
|
19
19
|
const renderTimerRef = useRef(undefined);
|
|
20
20
|
const allCmds = useMemo(() => session.commandSchemas, [session]);
|
|
21
|
-
const pendingQuestion =
|
|
21
|
+
const pendingQuestion = session.getPendingQuestion();
|
|
22
22
|
useEffect(() => {
|
|
23
|
-
session.
|
|
24
|
-
|
|
23
|
+
session.setRunHandler({
|
|
24
|
+
onStream: (text) => {
|
|
25
25
|
streamingRef.current = text;
|
|
26
26
|
scheduleStreamingRender();
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
onState: setRunState,
|
|
29
29
|
});
|
|
30
30
|
}, []);
|
|
31
31
|
const scheduleStreamingRender = () => {
|
|
@@ -54,12 +54,14 @@ export function App({ session }) {
|
|
|
54
54
|
});
|
|
55
55
|
async function handleCommand(name, args) {
|
|
56
56
|
await session.executeCommand(name, args);
|
|
57
|
-
if (session.
|
|
57
|
+
if (session.localStore.get("exitRequested"))
|
|
58
58
|
exit();
|
|
59
59
|
}
|
|
60
60
|
async function handlePrompt(text) {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const [first, ...rest] = text.split(/\s+/);
|
|
62
|
+
if (first.startsWith("/") || session.isCommand(first)) {
|
|
63
|
+
const name = first.startsWith("/") ? first.slice(1) : first;
|
|
64
|
+
await handleCommand(name, rest.join(" "));
|
|
63
65
|
}
|
|
64
66
|
else {
|
|
65
67
|
await session.startPrompt(text);
|
|
@@ -77,7 +79,7 @@ export function App({ session }) {
|
|
|
77
79
|
runningView = (_jsx(Box, { marginTop: 1, paddingLeft: 1, children: _jsx(Spinner, { label: "thinking", elapsed: runState.elapsed, promptTokens: runState.promptTokens, completionTokens: runState.completionTokens }) }));
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
|
-
return (_jsxs(Box, { flexDirection: "column", minWidth: 80, children: [_jsx(AppHeader, {}), _jsx(LogList, { session: session }),
|
|
82
|
+
return (_jsxs(Box, { flexDirection: "column", minWidth: 80, children: [_jsx(AppHeader, {}), _jsx(LogList, { session: session }), view.todos.length > 0 ? _jsx(TodoView, { todos: view.todos }) : null, runningView, !runState.running ? (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Text, { dimColor: true, children: ["[CTX ", compactDisplay(session.contextTokens), "] \u00B7 ESC to stop \u00B7 type / for commands"] }), _jsx(PromptOrCommandInput, { commands: allCmds, onCommand: handleCommand, onPrompt: handlePrompt })] })) : null] }));
|
|
81
83
|
}
|
|
82
84
|
export function startApp(session) {
|
|
83
85
|
process.stdout.write("[2J[H");
|
package/dist/tui/LogList.js
CHANGED
|
@@ -3,7 +3,7 @@ import { memo, useSyncExternalStore } from "react";
|
|
|
3
3
|
import { Box } from "ink";
|
|
4
4
|
import { LogView } from "./LogView.js";
|
|
5
5
|
export const LogList = memo(function LogList({ session }) {
|
|
6
|
-
useSyncExternalStore(session.subscribe, session.getSnapshot);
|
|
7
|
-
const entries =
|
|
6
|
+
const view = useSyncExternalStore(session.subscribe, session.getSnapshot);
|
|
7
|
+
const entries = view.logEntries;
|
|
8
8
|
return (_jsx(Box, { flexDirection: "column", paddingLeft: 1, paddingRight: 1, children: entries.map((entry, i) => (_jsx(LogView, { entry: entry }, i))) }));
|
|
9
9
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vietor/easy-agent",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"react": "^19.2.7",
|
|
23
23
|
"string-width": "^8.2.1",
|
|
24
24
|
"zod": "^4.4.3",
|
|
25
|
-
"@vietor/easy-agent-core": "0.4.
|
|
25
|
+
"@vietor/easy-agent-core": "0.4.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.0.0",
|