@ikyyofc/gemini-cli 1.0.2 → 1.0.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/index.js +2 -2
- package/package.json +1 -1
- package/src/agent.js +19 -20
package/index.js
CHANGED
|
@@ -127,7 +127,7 @@ async function send(userText) {
|
|
|
127
127
|
}
|
|
128
128
|
} else {
|
|
129
129
|
const { default: ora } = await import("ora");
|
|
130
|
-
const sp = ora({ text: "thinking…", spinner: "dots", color: "cyan", prefixText: " " }).start();
|
|
130
|
+
const sp = ora({ text: "thinking…", spinner: "dots", color: "cyan", prefixText: " ", discardStdin: false }).start();
|
|
131
131
|
const msgs = [];
|
|
132
132
|
if (sysInstruction()) msgs.push({ role: "system", content: sysInstruction() });
|
|
133
133
|
msgs.push(...history, { role: "user", content: userText });
|
|
@@ -360,4 +360,4 @@ async function main() {
|
|
|
360
360
|
main().catch(e => {
|
|
361
361
|
console.error(chalk.red("fatal:"), e.message);
|
|
362
362
|
process.exit(1);
|
|
363
|
-
});
|
|
363
|
+
});
|
package/package.json
CHANGED
package/src/agent.js
CHANGED
|
@@ -34,10 +34,11 @@ export async function runAgentLoop(userMessage, history, {
|
|
|
34
34
|
|
|
35
35
|
// ── Call Gemini API with tools ──────────────────────────
|
|
36
36
|
const spinner = ora({
|
|
37
|
-
text:
|
|
38
|
-
spinner:
|
|
39
|
-
color:
|
|
40
|
-
prefixText:
|
|
37
|
+
text: chalk.dim(iteration === 1 ? "thinking…" : `step ${iteration}…`),
|
|
38
|
+
spinner: "dots",
|
|
39
|
+
color: "cyan",
|
|
40
|
+
prefixText: " ",
|
|
41
|
+
discardStdin: false, // prevent ora from pausing stdin after stop
|
|
41
42
|
}).start();
|
|
42
43
|
|
|
43
44
|
let parts;
|
|
@@ -60,9 +61,7 @@ export async function runAgentLoop(userMessage, history, {
|
|
|
60
61
|
const textContent = textParts.map(p => p.text).join("").trim();
|
|
61
62
|
if (textContent && callParts.length > 0) {
|
|
62
63
|
process.stdout.write(
|
|
63
|
-
"
|
|
64
|
-
" 💭 " + textContent.replace(/\n/g, "\n ")
|
|
65
|
-
) + "\n\n"
|
|
64
|
+
chalk.dim(" … " + textContent.replace(/\n/g, "\n ")) + "\n"
|
|
66
65
|
);
|
|
67
66
|
}
|
|
68
67
|
|
|
@@ -110,32 +109,32 @@ function printToolCall(name, args = {}) {
|
|
|
110
109
|
const preview = Object.entries(args)
|
|
111
110
|
.map(([k, v]) => {
|
|
112
111
|
const s = String(v);
|
|
113
|
-
return chalk.
|
|
114
|
-
chalk.hex("#CE9178")(s.length > 60 ? s.slice(0, 60) + "…" : s);
|
|
112
|
+
return chalk.dim(k + ":") + (s.length > 60 ? s.slice(0, 60) + "…" : s);
|
|
115
113
|
})
|
|
116
114
|
.join(" ");
|
|
117
115
|
|
|
118
116
|
process.stdout.write(
|
|
119
|
-
chalk.
|
|
120
|
-
chalk.hex("#569CD6")
|
|
121
|
-
(preview ? chalk.
|
|
117
|
+
" " + chalk.dim("run") + " " +
|
|
118
|
+
chalk.hex("#569CD6")(name) +
|
|
119
|
+
(preview ? chalk.dim(" " + preview) : "") + "\n"
|
|
122
120
|
);
|
|
123
121
|
}
|
|
124
122
|
|
|
125
123
|
function printToolResult(result, name) {
|
|
126
|
-
const text = typeof result === "object"
|
|
124
|
+
const text = typeof result === "object"
|
|
125
|
+
? (result.result ?? result.error ?? JSON.stringify(result))
|
|
126
|
+
: String(result);
|
|
127
127
|
const isErr = typeof result === "object" && result.error;
|
|
128
|
-
const color = isErr ? chalk.
|
|
129
|
-
const lines = text.split("\n").slice(0,
|
|
130
|
-
const more = text.split("\n").length >
|
|
128
|
+
const color = isErr ? chalk.red : chalk.dim;
|
|
129
|
+
const lines = text.split("\n").slice(0, 12);
|
|
130
|
+
const more = text.split("\n").length > 12
|
|
131
|
+
? chalk.dim(`\n … +${text.split("\n").length - 12} lines`) : "";
|
|
131
132
|
|
|
132
133
|
process.stdout.write(
|
|
133
|
-
color("
|
|
134
|
-
chalk.hex("#858585")(lines.join("\n ")) +
|
|
135
|
-
more + "\n\n"
|
|
134
|
+
" " + color(lines.join("\n ")) + more + "\n"
|
|
136
135
|
);
|
|
137
136
|
}
|
|
138
137
|
|
|
139
138
|
function clearLine() {
|
|
140
139
|
if (process.stdout.clearLine) { process.stdout.clearLine(0); process.stdout.cursorTo(0); }
|
|
141
|
-
}
|
|
140
|
+
}
|