@agent-commons/cli 0.1.12 → 0.1.13
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/bin.js +38 -2
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -106,7 +106,7 @@ var sym = {
|
|
|
106
106
|
bullet: import_chalk.default.dim("\u2022"),
|
|
107
107
|
dot: import_chalk.default.dim("\xB7")
|
|
108
108
|
};
|
|
109
|
-
function banner(version = "0.1.
|
|
109
|
+
function banner(version = "0.1.13") {
|
|
110
110
|
const line = import_chalk.default.cyan(" \u2500".padEnd(2) + "\u2500".repeat(44));
|
|
111
111
|
console.log("");
|
|
112
112
|
console.log(line);
|
|
@@ -1743,6 +1743,42 @@ ${sym.fail} ${c.error(err.message ?? String(err))}`);
|
|
|
1743
1743
|
process.stdout.write(tok);
|
|
1744
1744
|
agentContent += tok;
|
|
1745
1745
|
hasOutput = true;
|
|
1746
|
+
} else if (event.type === "cli_tool_request" && localToolsCfg) {
|
|
1747
|
+
const { requestId, tool: toolName, args } = event;
|
|
1748
|
+
const displayName = String(toolName).replace("cli_", "");
|
|
1749
|
+
if (hasOutput) {
|
|
1750
|
+
process.stdout.write("\n");
|
|
1751
|
+
hasOutput = false;
|
|
1752
|
+
}
|
|
1753
|
+
process.stdout.write(c.dim(` [local] ${displayName}\u2026`));
|
|
1754
|
+
let result;
|
|
1755
|
+
try {
|
|
1756
|
+
const localToolName = String(toolName).replace("cli_", "");
|
|
1757
|
+
result = await runLocalTool({ tool: localToolName, args: args ?? {} }, localToolsCfg);
|
|
1758
|
+
process.stdout.write(c.dim(" \u2713\n"));
|
|
1759
|
+
} catch (err) {
|
|
1760
|
+
result = `Error: ${err?.message ?? String(err)}`;
|
|
1761
|
+
process.stdout.write(c.dim(" \u2717\n"));
|
|
1762
|
+
}
|
|
1763
|
+
appendSessionLog(sessionId, {
|
|
1764
|
+
type: "local_tool_result",
|
|
1765
|
+
tool: toolName,
|
|
1766
|
+
result: result.slice(0, 4e3),
|
|
1767
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1768
|
+
});
|
|
1769
|
+
try {
|
|
1770
|
+
await fetch(`${cfg.apiUrl}/v1/agents/cli-tool-result`, {
|
|
1771
|
+
method: "POST",
|
|
1772
|
+
headers: {
|
|
1773
|
+
"Content-Type": "application/json",
|
|
1774
|
+
"Authorization": `Bearer ${cfg.apiKey}`
|
|
1775
|
+
},
|
|
1776
|
+
body: JSON.stringify({ requestId, result })
|
|
1777
|
+
});
|
|
1778
|
+
} catch (postErr) {
|
|
1779
|
+
console.error(c.warn(`
|
|
1780
|
+
[local] Failed to submit tool result: ${postErr?.message}`));
|
|
1781
|
+
}
|
|
1746
1782
|
} else if (event.type === "toolStart") {
|
|
1747
1783
|
const name = event.toolName ?? "";
|
|
1748
1784
|
if (hasOutput) process.stdout.write("\n");
|
|
@@ -3182,7 +3218,7 @@ async function pickAgentInteractively(action) {
|
|
|
3182
3218
|
return agentId;
|
|
3183
3219
|
}
|
|
3184
3220
|
var program = new import_commander16.Command();
|
|
3185
|
-
program.name("agc").description("Agent Commons CLI \u2014 interact with the Agent Commons platform").version("0.1.
|
|
3221
|
+
program.name("agc").description("Agent Commons CLI \u2014 interact with the Agent Commons platform").version("0.1.13", "-v, --version").action(async () => {
|
|
3186
3222
|
await interactiveMenu();
|
|
3187
3223
|
});
|
|
3188
3224
|
program.addCommand(loginCommand());
|