@mcp-graph-workflow/agent-graph-flow 0.4.0 → 0.6.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/dist/cli/index.js +22 -5
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { stat, readFile, access, constants } from 'fs/promises';
|
|
|
13
13
|
import { execFile, execSync, spawn } from 'child_process';
|
|
14
14
|
import { render, useApp, useInput, Box, Text } from 'ink';
|
|
15
15
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
16
|
-
import { createElement, useState, useEffect, useCallback } from 'react';
|
|
16
|
+
import { createElement, useState, useEffect, useRef, useCallback } from 'react';
|
|
17
17
|
import TextInput from 'ink-text-input';
|
|
18
18
|
import Spinner from 'ink-spinner';
|
|
19
19
|
import { Command } from 'commander';
|
|
@@ -6370,6 +6370,9 @@ async function runAutopilot(port, options) {
|
|
|
6370
6370
|
options.onStep?.(step);
|
|
6371
6371
|
};
|
|
6372
6372
|
for (let i = 0; i < options.maxIterations; i++) {
|
|
6373
|
+
if (options.signal?.aborted === true) {
|
|
6374
|
+
return { steps, completed, escalated, stopped: "aborted" };
|
|
6375
|
+
}
|
|
6373
6376
|
const next = port.nextTask();
|
|
6374
6377
|
if (next === null) {
|
|
6375
6378
|
return { steps, completed, escalated, stopped: "no_more_tasks" };
|
|
@@ -9104,9 +9107,17 @@ function InteractiveApp({ dashboard, port, asyncPort, liveRunner, skillCommands
|
|
|
9104
9107
|
const [history, setHistory] = useState([]);
|
|
9105
9108
|
const [histCursor, setHistCursor] = useState(-1);
|
|
9106
9109
|
const [draft, setDraft] = useState("");
|
|
9110
|
+
const abortRef = useRef(null);
|
|
9107
9111
|
const append = (line) => setLog((prev) => [...prev, line].slice(-MAX_LOG_LINES));
|
|
9108
9112
|
useInput((_input, key) => {
|
|
9109
|
-
if (phase
|
|
9113
|
+
if (phase === "dashboard" && running) {
|
|
9114
|
+
if (key.escape && abortRef.current) {
|
|
9115
|
+
abortRef.current.abort();
|
|
9116
|
+
append("\u26D4 interrompendo\u2026 (para ap\xF3s o passo atual)");
|
|
9117
|
+
}
|
|
9118
|
+
return;
|
|
9119
|
+
}
|
|
9120
|
+
if (phase !== "dashboard") return;
|
|
9110
9121
|
if (!key.upArrow && !key.downArrow) return;
|
|
9111
9122
|
const effectiveDraft = histCursor === -1 ? input : draft;
|
|
9112
9123
|
if (histCursor === -1) setDraft(input);
|
|
@@ -9134,8 +9145,13 @@ function InteractiveApp({ dashboard, port, asyncPort, liveRunner, skillCommands
|
|
|
9134
9145
|
if ((parsed.cmd === "run" || parsed.cmd === "autopilot") && liveRunner) {
|
|
9135
9146
|
append(`\u203A ${text}`);
|
|
9136
9147
|
setRunning(true);
|
|
9137
|
-
const
|
|
9138
|
-
|
|
9148
|
+
const controller = new AbortController();
|
|
9149
|
+
abortRef.current = controller;
|
|
9150
|
+
const task = parsed.cmd === "run" ? liveRunner.run(parsed.args, append) : liveRunner.autopilot(parseInt(parsed.args, 10) || 5, append, controller.signal);
|
|
9151
|
+
task.then((summary) => append(summary)).catch((err) => append(`erro: ${err instanceof Error ? err.message : String(err)}`)).finally(() => {
|
|
9152
|
+
abortRef.current = null;
|
|
9153
|
+
setRunning(false);
|
|
9154
|
+
});
|
|
9139
9155
|
return;
|
|
9140
9156
|
}
|
|
9141
9157
|
if (ASYNC_CMDS.includes(parsed.cmd) && asyncPort) {
|
|
@@ -10602,13 +10618,14 @@ function ledgerCostUsd(ledger) {
|
|
|
10602
10618
|
}
|
|
10603
10619
|
function buildLiveRunner(store2) {
|
|
10604
10620
|
return {
|
|
10605
|
-
async autopilot(maxIterations, onLine) {
|
|
10621
|
+
async autopilot(maxIterations, onLine, signal) {
|
|
10606
10622
|
const ledger = new TokenLedger();
|
|
10607
10623
|
const live = buildLiveImplement({ store: store2, dir: process.cwd(), testCmd: "npm test", retries: 2, ledger, onLog: onLine });
|
|
10608
10624
|
const port = makeStorePort(store2);
|
|
10609
10625
|
const result = await runAutopilot(port, {
|
|
10610
10626
|
maxIterations,
|
|
10611
10627
|
implement: live.implement,
|
|
10628
|
+
signal,
|
|
10612
10629
|
onStep: (s) => onLine(`${STEP_ICON[s.action] ?? "\xB7"} ${s.title} [${s.action}] ${s.detail}`)
|
|
10613
10630
|
});
|
|
10614
10631
|
const t = ledger.totals();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-graph-workflow/agent-graph-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Agente SWE autônomo, local-first e token-frugal: PRD → grafo de execução persistente, TDD obrigatório, custo de token brutalmente baixo. AGPL v3.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|