@agent-commons/cli 0.1.11 → 0.1.12
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 +37 -19
- package/package.json +2 -2
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.12") {
|
|
110
110
|
const line = import_chalk.default.cyan(" \u2500".padEnd(2) + "\u2500".repeat(44));
|
|
111
111
|
console.log("");
|
|
112
112
|
console.log(line);
|
|
@@ -1541,7 +1541,8 @@ var LOCAL_TOOLS_DISCLAIMER = `
|
|
|
1541
1541
|
${c.dim("Session activity is logged to")} ${c.primary("~/.agc/sessions/")}
|
|
1542
1542
|
`;
|
|
1543
1543
|
function chatCommand() {
|
|
1544
|
-
return new import_commander8.Command("chat").description("Start an interactive chat REPL with an agent").option("--agent <agentId>", "Agent ID (or set defaultAgentId in config)").option("--resume <sessionId>", "Resume an existing session by ID").option("--no-stream", "Disable token streaming (wait for full response)").option("--local", "
|
|
1544
|
+
return new import_commander8.Command("chat").description("Start an interactive chat REPL with an agent").option("--agent <agentId>", "Agent ID (or set defaultAgentId in config)").option("--resume <sessionId>", "Resume an existing session by ID").option("--no-stream", "Disable token streaming (wait for full response)").option("--no-local", "Disable local file system access for the agent").action(async (opts) => {
|
|
1545
|
+
const localEnabled = opts.local !== false;
|
|
1545
1546
|
const cfg = loadConfig();
|
|
1546
1547
|
const agentId = opts.agent ?? cfg.defaultAgentId;
|
|
1547
1548
|
if (!agentId) {
|
|
@@ -1618,10 +1619,10 @@ ${c.bold("Agent Commons Chat")}`);
|
|
|
1618
1619
|
["Session", c.id(sessionId) + (isResume ? c.dim(" (resumed)") : c.dim(" (new)"))]
|
|
1619
1620
|
];
|
|
1620
1621
|
if (walletLine) headerRows.push(["Wallet", walletLine]);
|
|
1621
|
-
if (
|
|
1622
|
+
if (localEnabled) headerRows.push(["Local tools", c.success("enabled") + c.dim(" (read, write, search, run)")]);
|
|
1622
1623
|
detail(headerRows);
|
|
1623
1624
|
let localToolsCfg = null;
|
|
1624
|
-
if (
|
|
1625
|
+
if (localEnabled) {
|
|
1625
1626
|
console.log(LOCAL_TOOLS_DISCLAIMER);
|
|
1626
1627
|
const rootDir = process.cwd();
|
|
1627
1628
|
localToolsCfg = {
|
|
@@ -1663,7 +1664,7 @@ Session saved. Resume with: agc chat --resume ${sessionId}`));
|
|
|
1663
1664
|
}
|
|
1664
1665
|
if (input === "/tools") {
|
|
1665
1666
|
if (!localToolsCfg) {
|
|
1666
|
-
console.log(c.dim(` Local tools are disabled.
|
|
1667
|
+
console.log(c.dim(` Local tools are disabled. Remove ${c.bold("--no-local")} flag to re-enable them.`));
|
|
1667
1668
|
} else {
|
|
1668
1669
|
console.log(`
|
|
1669
1670
|
${c.bold("Local tools")} ${c.success("enabled")}`);
|
|
@@ -1704,14 +1705,14 @@ Session saved. Resume with: agc chat --resume ${sessionId}`));
|
|
|
1704
1705
|
content: input,
|
|
1705
1706
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1706
1707
|
});
|
|
1707
|
-
const outgoingMessages = localToolsCfg ? [
|
|
1708
|
-
{ role: "system", content: buildLocalToolsManifest(localToolsCfg.rootDir) },
|
|
1709
|
-
{ role: "user", content: input }
|
|
1710
|
-
] : [{ role: "user", content: input }];
|
|
1711
1708
|
const params = {
|
|
1712
1709
|
agentId,
|
|
1713
1710
|
sessionId,
|
|
1714
|
-
messages:
|
|
1711
|
+
messages: [{ role: "user", content: input }],
|
|
1712
|
+
// Inject the tool manifest into the agent's system prompt server-side so
|
|
1713
|
+
// the LLM receives it as part of its actual instructions, not as a stray
|
|
1714
|
+
// second system message appended after the conversation history.
|
|
1715
|
+
...localToolsCfg && { cliContext: buildLocalToolsManifest(localToolsCfg.rootDir) }
|
|
1715
1716
|
};
|
|
1716
1717
|
process.stdout.write(c.primary("agent") + c.dim(" \u203A "));
|
|
1717
1718
|
if (opts.noStream) {
|
|
@@ -3084,9 +3085,18 @@ async function interactiveMenu() {
|
|
|
3084
3085
|
if (action === "exit") {
|
|
3085
3086
|
process.exit(0);
|
|
3086
3087
|
}
|
|
3088
|
+
const agentId = cfg.defaultAgentId ?? await pickAgentInteractively(action);
|
|
3089
|
+
if ((action === "chat" || action === "run") && !agentId) return;
|
|
3090
|
+
if (action === "run") {
|
|
3091
|
+
const prompt2 = await askPrompt("Enter your prompt:");
|
|
3092
|
+
if (!prompt2) return;
|
|
3093
|
+
runSubcommand(["run", "--agent", agentId, prompt2]);
|
|
3094
|
+
return;
|
|
3095
|
+
}
|
|
3087
3096
|
const commandMap = {
|
|
3088
|
-
chat:
|
|
3089
|
-
run:
|
|
3097
|
+
chat: ["chat", "--agent", agentId],
|
|
3098
|
+
run: [],
|
|
3099
|
+
// handled above
|
|
3090
3100
|
sessions: ["sessions", "list"],
|
|
3091
3101
|
agents: ["agents", "list"],
|
|
3092
3102
|
tasks: ["task", "list"],
|
|
@@ -3099,14 +3109,22 @@ async function interactiveMenu() {
|
|
|
3099
3109
|
config: ["config", "get"],
|
|
3100
3110
|
exit: []
|
|
3101
3111
|
};
|
|
3102
|
-
if ((action === "chat" || action === "run") && !cfg.defaultAgentId) {
|
|
3103
|
-
const pickedId = await pickAgentInteractively(action);
|
|
3104
|
-
if (!pickedId) return;
|
|
3105
|
-
runSubcommand([action, "--agent", pickedId]);
|
|
3106
|
-
return;
|
|
3107
|
-
}
|
|
3108
3112
|
runSubcommand(commandMap[action]);
|
|
3109
3113
|
}
|
|
3114
|
+
async function askPrompt(question) {
|
|
3115
|
+
const { createInterface: createInterface4 } = await import("readline");
|
|
3116
|
+
return new Promise((resolve2) => {
|
|
3117
|
+
const rl = createInterface4({ input: process.stdin, output: process.stdout });
|
|
3118
|
+
process.stdout.write(`
|
|
3119
|
+
${c.bold(question)}
|
|
3120
|
+
${c.primary("\u203A")} `);
|
|
3121
|
+
rl.once("line", (line) => {
|
|
3122
|
+
rl.close();
|
|
3123
|
+
const trimmed = line.trim();
|
|
3124
|
+
resolve2(trimmed || null);
|
|
3125
|
+
});
|
|
3126
|
+
});
|
|
3127
|
+
}
|
|
3110
3128
|
function runSubcommand(args) {
|
|
3111
3129
|
const child = (0, import_child_process3.spawn)(process.argv[0], [process.argv[1], ...args], {
|
|
3112
3130
|
stdio: "inherit"
|
|
@@ -3164,7 +3182,7 @@ async function pickAgentInteractively(action) {
|
|
|
3164
3182
|
return agentId;
|
|
3165
3183
|
}
|
|
3166
3184
|
var program = new import_commander16.Command();
|
|
3167
|
-
program.name("agc").description("Agent Commons CLI \u2014 interact with the Agent Commons platform").version("0.1.
|
|
3185
|
+
program.name("agc").description("Agent Commons CLI \u2014 interact with the Agent Commons platform").version("0.1.12", "-v, --version").action(async () => {
|
|
3168
3186
|
await interactiveMenu();
|
|
3169
3187
|
});
|
|
3170
3188
|
program.addCommand(loginCommand());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-commons/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Agent Commons CLI — chat, run, and manage agents from your terminal",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"commander": "^12.1.0",
|
|
15
15
|
"chalk": "^5.3.0",
|
|
16
16
|
"ora": "^8.1.1",
|
|
17
|
-
"@agent-commons/sdk": "0.1.
|
|
17
|
+
"@agent-commons/sdk": "0.1.12"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"tsup": "^8.3.5",
|