iubcli 4.2.9 → 4.2.10
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 +251 -165
- package/dist/index.js +226 -228
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ function printBanner(provider, model, workspace) {
|
|
|
62
62
|
`;
|
|
63
63
|
console.log(asciiArt);
|
|
64
64
|
console.log(
|
|
65
|
-
` ${chalk.bgHex("#003087").white.bold("
|
|
65
|
+
` ${chalk.bgHex("#003087").white.bold(" IUB CLI v2.0 ")} ${chalk.hex("#00A3FF")(
|
|
66
66
|
"Next-Gen Autonomous BYOK Terminal Coding Agent"
|
|
67
67
|
)}`
|
|
68
68
|
);
|
|
@@ -90,10 +90,10 @@ function renderCascadeNotice(fromModel, toModel, reason) {
|
|
|
90
90
|
process.stdout.write("\r\x1B[2K\n");
|
|
91
91
|
console.log(border);
|
|
92
92
|
console.log(
|
|
93
|
-
chalk.bgHex("#FF9900").black.bold("
|
|
93
|
+
chalk.bgHex("#FF9900").black.bold(" AUTO-CASCADE ACTIVATED ") + " " + chalk.white.bold(`Token / Rate limit reached on: ${chalk.yellow(fromModel)}`)
|
|
94
94
|
);
|
|
95
95
|
console.log(
|
|
96
|
-
chalk.hex("#00A3FF").bold("
|
|
96
|
+
chalk.hex("#00A3FF").bold("Seamlessly continuing with: ") + chalk.bold.cyan(toModel) + chalk.gray(` (${reason})`)
|
|
97
97
|
);
|
|
98
98
|
console.log(chalk.gray("Your task and conversation continue without any loss of context."));
|
|
99
99
|
console.log(border + "\n");
|
|
@@ -105,10 +105,10 @@ function renderModelExplorationNotice(model, provider, testedCount) {
|
|
|
105
105
|
process.stdout.write("\r\x1B[2K\n");
|
|
106
106
|
console.log(border);
|
|
107
107
|
console.log(
|
|
108
|
-
chalk.bgHex("#002B5C").hex("#00A3FF").bold("
|
|
108
|
+
chalk.bgHex("#002B5C").hex("#00A3FF").bold(" MODEL EXPLORER: FREE TOKENS DISCOVERED ") + " " + chalk.white.bold(`Scanned ${testedCount} model(s)`)
|
|
109
109
|
);
|
|
110
110
|
console.log(
|
|
111
|
-
chalk.green.bold("
|
|
111
|
+
chalk.green.bold("Selected Active Model: ") + chalk.bold.cyan(model) + chalk.gray(` [${provider.toUpperCase()}]`)
|
|
112
112
|
);
|
|
113
113
|
console.log(chalk.gray("Active free tokens verified. Seamlessly continuing your coding task..."));
|
|
114
114
|
console.log(border + "\n");
|
|
@@ -120,7 +120,7 @@ function renderRollingRateLimitNotice(model, seconds, reason) {
|
|
|
120
120
|
process.stdout.write("\r\x1B[2K\n");
|
|
121
121
|
console.log(border);
|
|
122
122
|
console.log(
|
|
123
|
-
chalk.bgHex("#1E40AF").white.bold("
|
|
123
|
+
chalk.bgHex("#1E40AF").white.bold(" ROLLING RATE LIMIT COOLDOWN (NEVER-STOP) ") + " " + chalk.white.bold(`[${chalk.yellow(model)}]`)
|
|
124
124
|
);
|
|
125
125
|
console.log(
|
|
126
126
|
chalk.cyan.bold(`Auto-cooling down for ${seconds}s before automatic retry...`) + chalk.gray(reason ? ` (${reason})` : "")
|
|
@@ -129,7 +129,7 @@ function renderRollingRateLimitNotice(model, seconds, reason) {
|
|
|
129
129
|
console.log(border + "\n");
|
|
130
130
|
}
|
|
131
131
|
async function askToolConfirmation(toolName, summary) {
|
|
132
|
-
console.log("\n" + chalk.bgHex("#FF9900").black.bold("
|
|
132
|
+
console.log("\n" + chalk.bgHex("#FF9900").black.bold(" SAFETY CONFIRMATION "));
|
|
133
133
|
console.log(
|
|
134
134
|
`${chalk.gray("Tool:")} ${chalk.cyan.bold(toolName)}`
|
|
135
135
|
);
|
|
@@ -138,9 +138,9 @@ ${chalk.white(summary)}`);
|
|
|
138
138
|
const choice = await interactiveSelect({
|
|
139
139
|
message: "Allow IUB CLI to execute this action?",
|
|
140
140
|
options: [
|
|
141
|
-
{ value: "yes", label: chalk.green("
|
|
142
|
-
{ value: "all", label: chalk.cyan("
|
|
143
|
-
{ value: "no", label: chalk.red("
|
|
141
|
+
{ value: "yes", label: chalk.green("Yes, execute this action") },
|
|
142
|
+
{ value: "all", label: chalk.cyan("Yes to ALL actions (Auto-approve for this session)") },
|
|
143
|
+
{ value: "no", label: chalk.red("No, cancel / reject this action") }
|
|
144
144
|
]
|
|
145
145
|
});
|
|
146
146
|
if (!choice) {
|
|
@@ -149,7 +149,7 @@ ${chalk.white(summary)}`);
|
|
|
149
149
|
return choice;
|
|
150
150
|
}
|
|
151
151
|
function renderToolCall(toolName, args) {
|
|
152
|
-
const badge = chalk.bgHex("#0047AB").white.bold(`
|
|
152
|
+
const badge = chalk.bgHex("#0047AB").white.bold(` TOOL: ${toolName} `);
|
|
153
153
|
console.log(`
|
|
154
154
|
${badge}`);
|
|
155
155
|
if (toolName === "write_file") {
|
|
@@ -172,10 +172,10 @@ ${badge}`);
|
|
|
172
172
|
}
|
|
173
173
|
function renderToolResult(toolName, result, isError = false) {
|
|
174
174
|
if (isError) {
|
|
175
|
-
console.log(chalk.red(
|
|
175
|
+
console.log(chalk.red(`[${toolName} error]: ${result.trim()}`));
|
|
176
176
|
} else {
|
|
177
177
|
const preview = result.length > 300 ? result.slice(0, 300) + "...\n" + chalk.dim(`(truncated ${result.length} chars)`) : result;
|
|
178
|
-
console.log(chalk.green(
|
|
178
|
+
console.log(chalk.green(`[${toolName} completed]:`));
|
|
179
179
|
console.log(chalk.dim(preview.trim()));
|
|
180
180
|
}
|
|
181
181
|
}
|
|
@@ -191,26 +191,26 @@ function renderPriorityTaskBanner(task, model, mode) {
|
|
|
191
191
|
const border = chalk.hex("#00A3FF")("\u2550".repeat(78));
|
|
192
192
|
console.log("\n" + border);
|
|
193
193
|
console.log(
|
|
194
|
-
chalk.bgHex("#00A3FF").black.bold("
|
|
194
|
+
chalk.bgHex("#00A3FF").black.bold(" [PRIORITY TASK DISPATCH] ") + " " + chalk.white.bold("Executing specific priority task first (Antigravity mode)")
|
|
195
195
|
);
|
|
196
196
|
console.log(
|
|
197
|
-
` ${chalk.gray("Selected Model:")} ${chalk.bold.hex("#00A3FF")(model)} ${chalk.gray("Mode:")} ${mode === "build" ? chalk.green.bold("
|
|
197
|
+
` ${chalk.gray("Selected Model:")} ${chalk.bold.hex("#00A3FF")(model)} ${chalk.gray("Mode:")} ${mode === "build" ? chalk.green.bold("BUILD") : chalk.yellow.bold("PLAN")} ${chalk.gray("(Press")} ${chalk.yellow.bold("Esc")} ${chalk.gray("anytime to stop)")}`
|
|
198
198
|
);
|
|
199
199
|
console.log(` ${chalk.gray("Task:")} ${chalk.cyan.bold(task)}`);
|
|
200
200
|
console.log(border + "\n");
|
|
201
201
|
}
|
|
202
202
|
function renderInterruptedNotice() {
|
|
203
203
|
console.log(
|
|
204
|
-
"\n" + chalk.bgHex("#FF3366").white.bold("
|
|
204
|
+
"\n" + chalk.bgHex("#FF3366").white.bold(" EXECUTION STOPPED ") + " " + chalk.yellow.bold("Model stopped working by user (Escape key pressed).") + "\n" + chalk.gray("Processes terminated cleanly. Returned to IUB CLI prompt.\n")
|
|
205
205
|
);
|
|
206
206
|
}
|
|
207
207
|
function renderDoctorReport(checks) {
|
|
208
208
|
const border = chalk.hex("#00A3FF")("\u2550".repeat(74));
|
|
209
209
|
console.log("\n" + border);
|
|
210
|
-
console.log(chalk.bgHex("#003087").white.bold("
|
|
210
|
+
console.log(chalk.bgHex("#003087").white.bold(" IUB CLI SYSTEM DOCTOR (SYSTEM HEALTH REPORT) "));
|
|
211
211
|
console.log(chalk.gray("Comprehensive diagnostic check of your agent environment:\n"));
|
|
212
212
|
for (const c of checks) {
|
|
213
|
-
const symbol = c.status === "ok" ? chalk.green.bold("
|
|
213
|
+
const symbol = c.status === "ok" ? chalk.green.bold(" [PASS]") : c.status === "warn" ? chalk.yellow.bold(" [WARN]") : chalk.red.bold(" [FAIL]");
|
|
214
214
|
console.log(`${symbol} ${chalk.white.bold(c.name)}: ${chalk.gray(c.detail)}`);
|
|
215
215
|
}
|
|
216
216
|
console.log(border + "\n");
|
|
@@ -218,11 +218,11 @@ function renderDoctorReport(checks) {
|
|
|
218
218
|
function renderSessionStats(stats) {
|
|
219
219
|
const border = chalk.hex("#00A3FF")("\u2500".repeat(70));
|
|
220
220
|
console.log("\n" + border);
|
|
221
|
-
console.log(chalk.bgHex("#1A237E").white.bold("
|
|
221
|
+
console.log(chalk.bgHex("#1A237E").white.bold(" LIVE SESSION INTELLIGENCE & SAVINGS (OpenCode Style) "));
|
|
222
222
|
console.log(chalk.dim("\u2500".repeat(70)));
|
|
223
223
|
console.log(` ${chalk.gray("Active Provider:")} ${chalk.bold.cyan(stats.provider)}`);
|
|
224
224
|
console.log(` ${chalk.gray("Selected Model:")} ${chalk.bold.green(stats.model)}`);
|
|
225
|
-
console.log(` ${chalk.gray("Current Mode:")} ${stats.mode === "build" ? chalk.green.bold("
|
|
225
|
+
console.log(` ${chalk.gray("Current Mode:")} ${stats.mode === "build" ? chalk.green.bold("BUILD") : chalk.yellow.bold("PLAN")}`);
|
|
226
226
|
console.log(` ${chalk.gray("Total LLM Calls:")} ${chalk.bold.yellow(stats.totalRequests)} calls`);
|
|
227
227
|
console.log(` ${chalk.gray("Total Tokens Used:")} ${chalk.bold.white(stats.totalTokens.toLocaleString())} tokens ${chalk.dim(`(Prompt: ${stats.promptTokens.toLocaleString()} \u2022 Completion: ${stats.completionTokens.toLocaleString()})`)}`);
|
|
228
228
|
console.log(` ${chalk.gray("Estimated Savings:")} ${chalk.bold.hex("#00A3FF")(`$${stats.estimatedCostSavedUsd.toFixed(3)} USD`)} ${chalk.dim("(vs commercial GPT-4 / Opus)")}`);
|
|
@@ -230,11 +230,11 @@ function renderSessionStats(stats) {
|
|
|
230
230
|
console.log(border + "\n");
|
|
231
231
|
}
|
|
232
232
|
function showHelp() {
|
|
233
|
-
console.log("\n" + chalk.bold.hex("#00A3FF")("
|
|
233
|
+
console.log("\n" + chalk.bold.hex("#00A3FF")("IUB CLI Help & Usage Guide"));
|
|
234
234
|
console.log(chalk.dim("\u2500".repeat(70)));
|
|
235
235
|
console.log(`${chalk.yellow.bold("Agent Modes (OpenCode Style):")}`);
|
|
236
|
-
console.log(` ${chalk.green.bold("
|
|
237
|
-
console.log(` ${chalk.yellow.bold("
|
|
236
|
+
console.log(` ${chalk.green.bold("BUILD Mode")} - Autonomous full-stack coder. Can create/edit files & run terminal commands.`);
|
|
237
|
+
console.log(` ${chalk.yellow.bold("PLAN Mode")} - Senior Architect. Read-only codebase investigation & step-by-step planning.`);
|
|
238
238
|
console.log(`
|
|
239
239
|
${chalk.yellow.bold("Slash Commands in Chat (OpenCode & Antigravity Style):")}`);
|
|
240
240
|
console.log(` ${chalk.cyan("/explore")} - Explore all models and auto-select the model with active free tokens (alias: /find-model, /scan)`);
|
|
@@ -301,20 +301,20 @@ ${chalk.yellow.bold("Language Support (Outputs strictly in English):")}`);
|
|
|
301
301
|
}
|
|
302
302
|
function showFreeApiKeyGuide() {
|
|
303
303
|
const line = chalk.dim("\u2500".repeat(78));
|
|
304
|
-
console.log("\n" + chalk.bgHex("#003087").white.bold("
|
|
304
|
+
console.log("\n" + chalk.bgHex("#003087").white.bold(" FREE API KEYS & MODELS GUIDE (100% Free Coding Tier) "));
|
|
305
305
|
console.log(chalk.gray("Get free API keys with generous quotas for IUB CLI - no credit card required!\n"));
|
|
306
|
-
console.log(chalk.bold.hex("#00A3FF")("1. Google Gemini (Google AI Studio) -
|
|
306
|
+
console.log(chalk.bold.hex("#00A3FF")("1. Google Gemini (Google AI Studio) - RECOMMENDED"));
|
|
307
307
|
console.log(` ${chalk.gray("Direct Link:")} ${chalk.bold.underline.cyan("https://aistudio.google.com/apikey")}`);
|
|
308
|
-
console.log(` ${chalk.gray("Steps:")} Sign in with Google
|
|
309
|
-
console.log(` ${chalk.gray("Best Free Model:")} ${chalk.bold.yellow("gemini-2.0-flash")} (
|
|
308
|
+
console.log(` ${chalk.gray("Steps:")} Sign in with Google -> Click "${chalk.white("Create API Key")}" -> Copy key.`);
|
|
309
|
+
console.log(` ${chalk.gray("Best Free Model:")} ${chalk.bold.yellow("gemini-2.0-flash")} (100% Free, flagship speed & 1,500 RPD)`);
|
|
310
310
|
console.log(` ${chalk.gray("Alternative Free Models:")} ${chalk.white("gemini-2.0-flash-lite, gemini-2.5-flash, gemini-1.5-flash")}`);
|
|
311
311
|
console.log(` ${chalk.gray("Quota:")} Free tier gives 15 Requests/min & 1,500 Requests/day for free!
|
|
312
312
|
`);
|
|
313
313
|
console.log(chalk.bold.hex("#00A3FF")("2. OpenRouter (Access 14+ 100% Free Frontier Models)"));
|
|
314
314
|
console.log(` ${chalk.gray("Direct Link:")} ${chalk.bold.underline.cyan("https://openrouter.ai/keys")}`);
|
|
315
|
-
console.log(` ${chalk.gray("Steps:")} Sign in with GitHub/Google
|
|
315
|
+
console.log(` ${chalk.gray("Steps:")} Sign in with GitHub/Google -> Click "${chalk.white("Create Key")}" -> Copy key.`);
|
|
316
316
|
console.log(` ${chalk.gray("Top Free Agent Models (Zero Cost):")}`);
|
|
317
|
-
console.log(` \u2022 ${chalk.yellow("openrouter/free")} (
|
|
317
|
+
console.log(` \u2022 ${chalk.yellow("openrouter/free")} (Auto Best Free Model - Zero downtime)`);
|
|
318
318
|
console.log(` \u2022 ${chalk.yellow("particle-ai/particle-1:free")} (1 Million token context agentic coding model)`);
|
|
319
319
|
console.log(` \u2022 ${chalk.yellow("nvidia/nemotron-3-ultra-550b-a55b:free")} (Massive 550B frontier model, 1M context)`);
|
|
320
320
|
console.log(` \u2022 ${chalk.yellow("google/gemma-4-31b-it:free")} (Google DeepMind 31B code instruction model)`);
|
|
@@ -324,9 +324,9 @@ function showFreeApiKeyGuide() {
|
|
|
324
324
|
console.log(` \u2022 ${chalk.yellow("inclusionai/ling-3.2-flash:free")} (1M token context hybrid reasoning)`);
|
|
325
325
|
console.log(` ${chalk.gray("Quota:")} 100% Free with zero payment or credit card needed!
|
|
326
326
|
`);
|
|
327
|
-
console.log(chalk.bold.hex("#00D2FF")("3. DeepSeek Platform (5,000,000 Free Tokens -
|
|
327
|
+
console.log(chalk.bold.hex("#00D2FF")("3. DeepSeek Platform (5,000,000 Free Tokens - SOTA Coding)"));
|
|
328
328
|
console.log(` ${chalk.gray("Direct Link:")} ${chalk.bold.underline.cyan("https://platform.deepseek.com")}`);
|
|
329
|
-
console.log(` ${chalk.gray("Steps:")} Sign up with Email/Google
|
|
329
|
+
console.log(` ${chalk.gray("Steps:")} Sign up with Email/Google -> Create API Key -> 5 Million free tokens credited.`);
|
|
330
330
|
console.log(` ${chalk.gray("In IUB CLI:")} Select "${chalk.white("Custom OpenAI-Compatible")}"`);
|
|
331
331
|
console.log(` ${chalk.gray("Base URL:")} ${chalk.cyan("https://api.deepseek.com/v1")}`);
|
|
332
332
|
console.log(` ${chalk.gray("Models:")} ${chalk.yellow("deepseek-chat")} (V3 Coding), ${chalk.yellow("deepseek-reasoner")} (R1 Chain-of-Thought)`);
|
|
@@ -353,12 +353,12 @@ function showFreeApiKeyGuide() {
|
|
|
353
353
|
console.log(` ${chalk.gray("API Key:")} Any text (e.g. ${chalk.white("ollama")})
|
|
354
354
|
`);
|
|
355
355
|
console.log(line);
|
|
356
|
-
console.log(chalk.cyan(
|
|
356
|
+
console.log(chalk.cyan(`Tip: Use ${chalk.yellow.bold("/provider")} or ${chalk.yellow.bold("/config")} in chat to switch anytime!
|
|
357
357
|
`));
|
|
358
358
|
}
|
|
359
359
|
function showTokenLimitsGuide() {
|
|
360
360
|
const line = chalk.dim("\u2500".repeat(88));
|
|
361
|
-
console.log("\n" + chalk.bgHex("#0047AB").white.bold("
|
|
361
|
+
console.log("\n" + chalk.bgHex("#0047AB").white.bold(" COMPLETE TOKEN LIMITS & RATE LIMITS GUIDE (ALL MODELS) "));
|
|
362
362
|
console.log(chalk.gray("Exact context window tokens, rate limits (RPM/TPM), and daily quotas for all 83+ models in IUB CLI:\n"));
|
|
363
363
|
console.log(chalk.bold.hex("#00A3FF")("1. Google Gemini Suite (Google AI Studio Free Tier)"));
|
|
364
364
|
console.log(chalk.dim("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"));
|
|
@@ -371,7 +371,7 @@ function showTokenLimitsGuide() {
|
|
|
371
371
|
console.log(chalk.dim("\u2502") + chalk.green(" gemini-2.0-flash ") + chalk.dim("\u2502") + chalk.white(" 1,048,576 toks ") + chalk.dim("\u2502") + chalk.yellow(" 15 RPM ") + chalk.dim("\u2502") + chalk.cyan(" 1,000,000 TPM") + chalk.dim("\u2502") + chalk.green(" Auto->3.5 ") + chalk.dim("\u2502"));
|
|
372
372
|
console.log(chalk.dim("\u2502") + chalk.green(" gemini-1.5-pro ") + chalk.dim("\u2502") + chalk.cyan(" 2,097,152 toks ") + chalk.dim("\u2502") + chalk.yellow(" 5 RPM ") + chalk.dim("\u2502") + chalk.cyan(" 1,000,000 TPM") + chalk.dim("\u2502") + chalk.yellow(" 50 RPD ") + chalk.dim("\u2502"));
|
|
373
373
|
console.log(chalk.dim("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"));
|
|
374
|
-
console.log(chalk.gray("
|
|
374
|
+
console.log(chalk.gray("Daily resets at 00:00 UTC. Gemini 3.5 Flash Lite is the primary autonomous coding model.\n"));
|
|
375
375
|
console.log(chalk.bold.hex("#00A3FF")("2. 100% Free OpenRouter Models (Zero-Plan Coding Fleet)"));
|
|
376
376
|
console.log(chalk.dim("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"));
|
|
377
377
|
console.log(chalk.dim("\u2502") + chalk.bold(" Model ") + chalk.dim("\u2502") + chalk.bold(" Context Window ") + chalk.dim("\u2502") + chalk.bold(" Rate Limit ") + chalk.dim("\u2502") + chalk.bold(" Free Tier ") + chalk.dim("\u2502"));
|
|
@@ -395,7 +395,7 @@ function showTokenLimitsGuide() {
|
|
|
395
395
|
console.log(chalk.dim("\u2502") + chalk.green(" liquid/lfm-3-1.7b:free ") + chalk.dim("\u2502") + chalk.white(" 32,768 toks ") + chalk.dim("\u2502") + chalk.yellow(" 20 RPM ") + chalk.dim("\u2502") + chalk.green(" Edge Free ") + chalk.dim("\u2502"));
|
|
396
396
|
console.log(chalk.dim("\u2502") + chalk.green(" recursive/flint-v1.0:free ") + chalk.dim("\u2502") + chalk.white(" 131,072 toks ") + chalk.dim("\u2502") + chalk.yellow(" 20 RPM ") + chalk.dim("\u2502") + chalk.green(" 128K Free ") + chalk.dim("\u2502"));
|
|
397
397
|
console.log(chalk.dim("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"));
|
|
398
|
-
console.log(chalk.gray("
|
|
398
|
+
console.log(chalk.gray("100% Free on OpenRouter with zero credit card required. Free tier rate limits reset daily.\n"));
|
|
399
399
|
console.log(chalk.bold.hex("#00A3FF")("3. DeepSeek Platform Models (platform.deepseek.com)"));
|
|
400
400
|
console.log(` \u2022 ${chalk.white("deepseek-chat")} (V3/V2.5) : ${chalk.cyan("128,000 tokens")} context | Rolling RPM | ${chalk.green("5,000,000 Free Starter Tokens")}`);
|
|
401
401
|
console.log(` \u2022 ${chalk.white("deepseek-reasoner")} (R1) : ${chalk.cyan("128,000 tokens")} context | Deep CoT reasoning | ${chalk.green("5,000,000 Free Starter Tokens")}`);
|
|
@@ -411,7 +411,7 @@ function showTokenLimitsGuide() {
|
|
|
411
411
|
console.log(chalk.dim("\u2502") + chalk.green(" mixtral-8x7b-32768 ") + chalk.dim("\u2502") + chalk.white(" 32,768 toks ") + chalk.dim("\u2502") + chalk.yellow(" 30 RPM ") + chalk.dim("\u2502") + chalk.cyan(" 5,000 TPM ") + chalk.dim("\u2502") + chalk.green(" 14,400 RPD ") + chalk.dim("\u2502"));
|
|
412
412
|
console.log(chalk.dim("\u2502") + chalk.green(" gemma2-9b-it ") + chalk.dim("\u2502") + chalk.white(" 8,192 toks ") + chalk.dim("\u2502") + chalk.yellow(" 30 RPM ") + chalk.dim("\u2502") + chalk.cyan(" 15,000 TPM ") + chalk.dim("\u2502") + chalk.green(" 14,400 RPD ") + chalk.dim("\u2502"));
|
|
413
413
|
console.log(chalk.dim("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"));
|
|
414
|
-
console.log(chalk.gray("
|
|
414
|
+
console.log(chalk.gray("Groq delivers 500+ tokens/second inference with a generous 14,400 requests/day free quota!\n"));
|
|
415
415
|
console.log(chalk.bold.hex("#00A3FF")("5. Frontier Flagship Coding Agents (OpenRouter / BYOK)"));
|
|
416
416
|
console.log(` \u2022 ${chalk.white("anthropic/claude-3.5-sonnet")} : ${chalk.cyan("200,000 tokens")} context | Top-ranked coding benchmark model`);
|
|
417
417
|
console.log(` \u2022 ${chalk.white("openai/gpt-4o")} : ${chalk.cyan("128,000 tokens")} context | Flagship multimodal developer agent`);
|
|
@@ -426,7 +426,7 @@ function showTokenLimitsGuide() {
|
|
|
426
426
|
console.log(line);
|
|
427
427
|
console.log(
|
|
428
428
|
chalk.cyan(
|
|
429
|
-
|
|
429
|
+
`Switch Model Anytime: Run ${chalk.yellow.bold("/agent")} or ${chalk.yellow.bold("/model [name]")} | Check Token Renewal Countdown: ${chalk.yellow.bold("/renewal")}
|
|
430
430
|
`
|
|
431
431
|
)
|
|
432
432
|
);
|
|
@@ -434,7 +434,7 @@ function showTokenLimitsGuide() {
|
|
|
434
434
|
function renderGitStatus() {
|
|
435
435
|
const border = chalk.hex("#00A3FF")("\u2500".repeat(70));
|
|
436
436
|
console.log("\n" + border);
|
|
437
|
-
console.log(chalk.bgHex("#003087").white.bold("
|
|
437
|
+
console.log(chalk.bgHex("#003087").white.bold(" GIT REPOSITORY STATUS "));
|
|
438
438
|
console.log(chalk.dim("\u2500".repeat(70)));
|
|
439
439
|
try {
|
|
440
440
|
const branch = execSync("git rev-parse --abbrev-ref HEAD 2>/dev/null || git branch --show-current", {
|
|
@@ -451,7 +451,7 @@ function renderGitStatus() {
|
|
|
451
451
|
}).trim();
|
|
452
452
|
console.log(` ${chalk.gray("Current Branch:")} ${chalk.cyan.bold(branch || "Detached / Unknown")}`);
|
|
453
453
|
if (status.length === 0) {
|
|
454
|
-
console.log(` ${chalk.gray("Working Tree:")} ${chalk.green("
|
|
454
|
+
console.log(` ${chalk.gray("Working Tree:")} ${chalk.green("Working directory is clean")}`);
|
|
455
455
|
} else {
|
|
456
456
|
const statusLines = status.split("\n");
|
|
457
457
|
console.log(` ${chalk.gray("Modified Files:")} ${chalk.yellow(statusLines.length)} file(s):`);
|
|
@@ -481,7 +481,7 @@ function renderGitStatus() {
|
|
|
481
481
|
function renderDirectoryTree(dirPath = ".", maxDepth = 2) {
|
|
482
482
|
const border = chalk.hex("#00A3FF")("\u2500".repeat(70));
|
|
483
483
|
console.log("\n" + border);
|
|
484
|
-
console.log(chalk.bgHex("#1A237E").white.bold(`
|
|
484
|
+
console.log(chalk.bgHex("#1A237E").white.bold(` WORKSPACE TREE: ${path.resolve(dirPath)} `));
|
|
485
485
|
console.log(chalk.dim("\u2500".repeat(70)));
|
|
486
486
|
const IGNORED = /* @__PURE__ */ new Set(["node_modules", ".git", ".next", "dist", "build", ".cache", "coverage"]);
|
|
487
487
|
function printTree(currentDir, prefix = "", depth = 0) {
|
|
@@ -517,7 +517,7 @@ function showAbout() {
|
|
|
517
517
|
const brand = chalk.hex("#00A3FF").bold;
|
|
518
518
|
const accentGold = chalk.hex("#FFC72C").bold;
|
|
519
519
|
const dim = chalk.gray;
|
|
520
|
-
console.log("\n" + chalk.bgHex("#003087").white.bold("
|
|
520
|
+
console.log("\n" + chalk.bgHex("#003087").white.bold(" ABOUT IUB CLI ") + "\n");
|
|
521
521
|
console.log(
|
|
522
522
|
brand(" \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\n") + brand(" \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\n") + brand(" \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\n") + accentGold(" \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\n") + accentGold(" \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\n") + dim(" \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D")
|
|
523
523
|
);
|
|
@@ -527,7 +527,7 @@ function showAbout() {
|
|
|
527
527
|
console.log(` ${chalk.bold.white("Architecture:")} Dual-Engine (BUILD & PLAN Modes) with Workspace Mesh RPC`);
|
|
528
528
|
console.log(chalk.dim("\u2500".repeat(74)));
|
|
529
529
|
console.log(`
|
|
530
|
-
${chalk.bold.hex("#00A3FF")("
|
|
530
|
+
${chalk.bold.hex("#00A3FF")("CREATOR & LEAD DEVELOPER:")}`);
|
|
531
531
|
console.log(` ${chalk.bold.white("Developer Name:")} ${chalk.bold.hex("#00A3FF")("Ifaz MD Zahin")}`);
|
|
532
532
|
console.log(
|
|
533
533
|
` ${chalk.bold.white("GitHub Account:")} ${chalk.bold.underline.cyan("https://github.com/Ifaz2611")} ${chalk.dim("(@Ifaz2611)")}`
|
|
@@ -572,11 +572,11 @@ function renderAllTokensExhaustedReport() {
|
|
|
572
572
|
const utcResetStr = "00:00:00 UTC";
|
|
573
573
|
const border = chalk.hex("#FF3366")("\u2550".repeat(76));
|
|
574
574
|
console.log("\n" + border);
|
|
575
|
-
console.log(" " + chalk.bgHex("#D32F2F").white.bold("
|
|
575
|
+
console.log(" " + chalk.bgHex("#D32F2F").white.bold(" ALL FREE MODEL TOKENS EXHAUSTED ACROSS ALL AGENTS "));
|
|
576
576
|
console.log(chalk.yellow.bold("\n IUB CLI has exhaustively cycled through all available free models in the CLI."));
|
|
577
577
|
console.log(chalk.gray(" All free daily rate limits and per-minute quotas have been temporarily reached."));
|
|
578
578
|
console.log(chalk.dim("\u2500".repeat(76)));
|
|
579
|
-
console.log(chalk.bold.hex("#00A3FF")("\n
|
|
579
|
+
console.log(chalk.bold.hex("#00A3FF")("\n NEXT GLOBAL TOKEN QUOTA RENEWAL IN:"));
|
|
580
580
|
console.log(
|
|
581
581
|
` ${chalk.bgHex("#1A237E").white.bold(
|
|
582
582
|
` ${hours} Hours, ${minutes} Minutes, ${seconds} Seconds `
|
|
@@ -586,7 +586,7 @@ function renderAllTokensExhaustedReport() {
|
|
|
586
586
|
console.log(
|
|
587
587
|
` ${chalk.dim("\u2022")} Reset Time (Local): ${chalk.green.bold(localResetStr)} (Your local timezone)`
|
|
588
588
|
);
|
|
589
|
-
console.log(chalk.bold.yellow("\n
|
|
589
|
+
console.log(chalk.bold.yellow("\n Quota Renewal Schedule by Provider:"));
|
|
590
590
|
console.log(
|
|
591
591
|
` 1. ${chalk.bold.white("Google Gemini Free Tier")} : Resets ${chalk.green("1,500 Requests/day")} & ${chalk.cyan("1M TPM")} daily at 00:00 UTC`
|
|
592
592
|
);
|
|
@@ -600,7 +600,7 @@ function renderAllTokensExhaustedReport() {
|
|
|
600
600
|
` 4. ${chalk.bold.white("DeepSeek Platform")} : Rolling RPM resets every minute; daily grants refresh at 00:00 UTC`
|
|
601
601
|
);
|
|
602
602
|
console.log(chalk.dim("\u2500".repeat(76)));
|
|
603
|
-
console.log(chalk.bold.cyan("\n
|
|
603
|
+
console.log(chalk.bold.cyan("\n WHAT YOU CAN DO RIGHT NOW (NO WAITING REQUIRED):"));
|
|
604
604
|
console.log(` 1. ${chalk.green.bold("Run Local Offline Models (UNLIMITED TOKENS, ZERO LIMITS):")}`);
|
|
605
605
|
console.log(` Use Ollama for 100% free offline coding on your local CPU/GPU.`);
|
|
606
606
|
console.log(
|
|
@@ -644,7 +644,7 @@ function undoLastChange() {
|
|
|
644
644
|
fs2.unlinkSync(targetFile);
|
|
645
645
|
return {
|
|
646
646
|
success: true,
|
|
647
|
-
message:
|
|
647
|
+
message: `Undid creation of "${lastChange.filePath}" (file removed).`
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
650
|
} else {
|
|
@@ -652,11 +652,11 @@ function undoLastChange() {
|
|
|
652
652
|
fs2.writeFileSync(targetFile, lastChange.previousContent, "utf8");
|
|
653
653
|
return {
|
|
654
654
|
success: true,
|
|
655
|
-
message:
|
|
655
|
+
message: `Reverted "${lastChange.filePath}" to its previous version (${lastChange.previousContent.length} bytes).`
|
|
656
656
|
};
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
|
-
return { success: true, message:
|
|
659
|
+
return { success: true, message: `Reverted "${lastChange.filePath}".` };
|
|
660
660
|
} catch (err) {
|
|
661
661
|
return { success: false, message: `Failed to undo "${lastChange.filePath}": ${err.message}` };
|
|
662
662
|
}
|
|
@@ -763,7 +763,7 @@ Preview (first 5 lines):
|
|
|
763
763
|
return `Action rejected: User declined writing to "${filePath}".`;
|
|
764
764
|
} else if (decision === "all") {
|
|
765
765
|
safetySession.autoApproveAll = true;
|
|
766
|
-
console.log(chalk2.cyan("
|
|
766
|
+
console.log(chalk2.cyan("Auto-approve enabled for this session."));
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
769
|
try {
|
|
@@ -838,7 +838,7 @@ With: ${effectiveReplacement.split("\n").length} line(s) (${effectiveReplacement
|
|
|
838
838
|
return `Action rejected: User declined editing "${filePath}".`;
|
|
839
839
|
} else if (decision === "all") {
|
|
840
840
|
safetySession.autoApproveAll = true;
|
|
841
|
-
console.log(chalk2.cyan("
|
|
841
|
+
console.log(chalk2.cyan("Auto-approve enabled for this session."));
|
|
842
842
|
}
|
|
843
843
|
}
|
|
844
844
|
const idx = workingContent.indexOf(effectiveTarget);
|
|
@@ -856,7 +856,7 @@ With: ${effectiveReplacement.split("\n").length} line(s) (${effectiveReplacement
|
|
|
856
856
|
fs2.writeFileSync(targetFile, updatedContent, "utf8");
|
|
857
857
|
const beforeLines = effectiveTarget.split("\n").length;
|
|
858
858
|
const afterLines = effectiveReplacement.split("\n").length;
|
|
859
|
-
return
|
|
859
|
+
return `Successfully edited "${filePath}" (surgically replaced ${beforeLines} line(s) with ${afterLines} line(s)).`;
|
|
860
860
|
}
|
|
861
861
|
var commandExecutionMutex = Promise.resolve();
|
|
862
862
|
async function runCommand(command, signal) {
|
|
@@ -919,7 +919,7 @@ ${chalk2.gray("Working Directory:")} ${process.cwd()}`;
|
|
|
919
919
|
return `Action rejected: User cancelled execution of command "${command}".`;
|
|
920
920
|
} else if (decision === "all") {
|
|
921
921
|
safetySession.autoApproveAll = true;
|
|
922
|
-
console.log(chalk2.cyan("
|
|
922
|
+
console.log(chalk2.cyan("Auto-approve enabled for this session."));
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
925
|
if (signal?.aborted) {
|
|
@@ -930,7 +930,7 @@ ${chalk2.gray("Working Directory:")} ${process.cwd()}`;
|
|
|
930
930
|
console.log(
|
|
931
931
|
chalk2.cyan(
|
|
932
932
|
`
|
|
933
|
-
|
|
933
|
+
Continuous Execution: Running ${chalk2.bold(subCommands.length)} commands strictly one by one...`
|
|
934
934
|
)
|
|
935
935
|
);
|
|
936
936
|
const stepResults = [];
|
|
@@ -940,20 +940,20 @@ ${chalk2.gray("Working Directory:")} ${process.cwd()}`;
|
|
|
940
940
|
}
|
|
941
941
|
const sub = subCommands[i];
|
|
942
942
|
console.log(chalk2.cyan(`
|
|
943
|
-
|
|
943
|
+
Step ${i + 1}/${subCommands.length}: ${chalk2.bold(sub)}`));
|
|
944
944
|
const res = await runActualProcess(sub, signal);
|
|
945
945
|
stepResults.push(`[Step ${i + 1}/${subCommands.length}: ${sub}]
|
|
946
946
|
${res}`);
|
|
947
947
|
if (res.includes("Command exited with status code") || res.includes("Command timed out") || res.includes("failed to start")) {
|
|
948
948
|
console.log(chalk2.yellow(`
|
|
949
|
-
|
|
949
|
+
Step ${i + 1} exited with error. Stopping subsequent steps immediately.`));
|
|
950
950
|
break;
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
953
|
return stepResults.join("\n\n");
|
|
954
954
|
}
|
|
955
955
|
console.log(chalk2.cyan(`
|
|
956
|
-
|
|
956
|
+
Running command: ${chalk2.bold(command)}...`));
|
|
957
957
|
return await runActualProcess(command, signal);
|
|
958
958
|
}
|
|
959
959
|
function diagnoseCommandFailure(command, stdout, stderr, code) {
|
|
@@ -961,24 +961,24 @@ function diagnoseCommandFailure(command, stdout, stderr, code) {
|
|
|
961
961
|
const nodeModuleMatch = combined.match(/(?:Cannot find module|Module not found: Can't resolve) ['"]([^'"]+)['"]/i);
|
|
962
962
|
if (nodeModuleMatch && nodeModuleMatch[1] && !nodeModuleMatch[1].startsWith(".")) {
|
|
963
963
|
const pkg = nodeModuleMatch[1].startsWith("@") ? nodeModuleMatch[1].split("/").slice(0, 2).join("/") : nodeModuleMatch[1].split("/")[0];
|
|
964
|
-
return
|
|
964
|
+
return `IUB CLI Smart Diagnostic: Missing npm package "${pkg}" detected. Recommendation: run "npm install ${pkg}" to install it.`;
|
|
965
965
|
}
|
|
966
966
|
const pyModuleMatch = combined.match(/(?:ModuleNotFoundError: No module named|ImportError: cannot import name) ['"]([^'"]+)['"]/i);
|
|
967
967
|
if (pyModuleMatch && pyModuleMatch[1]) {
|
|
968
|
-
return
|
|
968
|
+
return `IUB CLI Smart Diagnostic: Missing Python package "${pyModuleMatch[1]}" detected. Recommendation: run "pip install ${pyModuleMatch[1]}".`;
|
|
969
969
|
}
|
|
970
970
|
const portMatch = combined.match(/EADDRINUSE.*?[:\s](\d{4,5})\b/i) || combined.match(/port (\d{4,5}) is already in use/i);
|
|
971
971
|
if (portMatch) {
|
|
972
|
-
return
|
|
972
|
+
return `IUB CLI Smart Diagnostic: Port ${portMatch[1]} is already occupied. Recommendation: use a different port (e.g. PORT=${parseInt(portMatch[1], 10) + 1}) or terminate the existing process.`;
|
|
973
973
|
}
|
|
974
974
|
const tsErrorMatch = combined.match(/error TS(\d+):/i);
|
|
975
975
|
if (tsErrorMatch) {
|
|
976
|
-
return
|
|
976
|
+
return `IUB CLI Smart Diagnostic: TypeScript compilation error (TS${tsErrorMatch[1]}) detected. Inspect the file and line number shown in the error log above and use edit_file or write_file to fix it.`;
|
|
977
977
|
}
|
|
978
978
|
if (combined.includes("has no upstream branch") || combined.includes("set-upstream")) {
|
|
979
979
|
const branchMatch = combined.match(/git push --set-upstream origin ([^\s]+)/i);
|
|
980
980
|
const branchName = branchMatch ? branchMatch[1] : "main";
|
|
981
|
-
return
|
|
981
|
+
return `IUB CLI Smart Diagnostic: Git remote branch has no upstream. Recommendation: run "git push -u origin ${branchName}".`;
|
|
982
982
|
}
|
|
983
983
|
return null;
|
|
984
984
|
}
|
|
@@ -1259,7 +1259,7 @@ async function executeTool(name, args, mode = "build", signal) {
|
|
|
1259
1259
|
return "Action aborted by user (Escape).";
|
|
1260
1260
|
}
|
|
1261
1261
|
if (mode === "plan" && (name === "write_file" || name === "edit_file" || name === "run_command")) {
|
|
1262
|
-
const errorMsg =
|
|
1262
|
+
const errorMsg = `Action blocked: IUB CLI is currently in PLAN MODE. File modifications and terminal commands are disabled. Switch to BUILD mode (/build or /mode) to execute changes.`;
|
|
1263
1263
|
renderToolCall(name, args);
|
|
1264
1264
|
renderToolResult(name, errorMsg, true);
|
|
1265
1265
|
return errorMsg;
|
|
@@ -1844,7 +1844,7 @@ function loadImagePayload(filePath) {
|
|
|
1844
1844
|
if (!isImageFile(resolved)) return null;
|
|
1845
1845
|
if (stat.size > 15 * 1024 * 1024) {
|
|
1846
1846
|
console.log(chalk3.yellow(`
|
|
1847
|
-
|
|
1847
|
+
Image "${filePath}" is larger than 15MB. Skipping.
|
|
1848
1848
|
`));
|
|
1849
1849
|
return null;
|
|
1850
1850
|
}
|
|
@@ -1976,7 +1976,7 @@ function getDockedRows(rows) {
|
|
|
1976
1976
|
};
|
|
1977
1977
|
}
|
|
1978
1978
|
function renderTopBorder(width, isBuild, model, borderColor) {
|
|
1979
|
-
const modeText = isBuild ? "
|
|
1979
|
+
const modeText = isBuild ? " BUILD " : " PLAN ";
|
|
1980
1980
|
const modeBadge = isBuild ? chalk4.bgHex("#00C853").black.bold(modeText) : chalk4.bgHex("#FFB300").black.bold(modeText);
|
|
1981
1981
|
const modeWidth = stringWidth(modeText);
|
|
1982
1982
|
let rightText = " (Tab: model \u2022 Esc: clear) ";
|
|
@@ -1993,10 +1993,10 @@ function renderTopBorder(width, isBuild, model, borderColor) {
|
|
|
1993
1993
|
if (modelDisplay.includes("/")) {
|
|
1994
1994
|
modelDisplay = modelDisplay.split("/").pop() || modelDisplay;
|
|
1995
1995
|
}
|
|
1996
|
-
let modelText = `
|
|
1996
|
+
let modelText = ` ${modelDisplay} `;
|
|
1997
1997
|
while (stringWidth(modelText) > availForModel && modelDisplay.length > 1) {
|
|
1998
1998
|
modelDisplay = modelDisplay.slice(0, -1);
|
|
1999
|
-
modelText = `
|
|
1999
|
+
modelText = ` ${modelDisplay}\u2026 `;
|
|
2000
2000
|
}
|
|
2001
2001
|
const modelBadge = chalk4.bgHex("#1A237E").white.bold(modelText);
|
|
2002
2002
|
const modelWidth = stringWidth(modelText);
|
|
@@ -2063,7 +2063,7 @@ function renderHintLine(width, hintText, borderColor) {
|
|
|
2063
2063
|
return borderColor("\u2502 ") + chalk4.dim(visibleHint) + " ".repeat(paddingSpaces) + suffix;
|
|
2064
2064
|
}
|
|
2065
2065
|
function renderStatusLine(width, statusText, borderColor) {
|
|
2066
|
-
const prefix = borderColor("\u2502 ")
|
|
2066
|
+
const prefix = borderColor("\u2502 ");
|
|
2067
2067
|
const textCapacity = Math.max(1, width - 6);
|
|
2068
2068
|
let visibleText = statusText;
|
|
2069
2069
|
while (stringWidth(visibleText) > textCapacity && visibleText.length > 0) {
|
|
@@ -2260,7 +2260,7 @@ async function interactiveSelect(config) {
|
|
|
2260
2260
|
}
|
|
2261
2261
|
const chosen = config.options[cursor];
|
|
2262
2262
|
process.stdout.write(
|
|
2263
|
-
chalk4.
|
|
2263
|
+
chalk4.bold(config.message) + " " + chalk4.hex("#00A3FF").bold(chosen.label) + "\n\n"
|
|
2264
2264
|
);
|
|
2265
2265
|
resolve(chosen.value);
|
|
2266
2266
|
};
|
|
@@ -2269,11 +2269,9 @@ async function interactiveSelect(config) {
|
|
|
2269
2269
|
if (lastLineCount > 0) {
|
|
2270
2270
|
process.stdout.write(`\x1B[${lastLineCount}A\r\x1B[J`);
|
|
2271
2271
|
}
|
|
2272
|
-
process.stdout.write(
|
|
2273
|
-
chalk4.gray("\u2716 ") + chalk4.dim(`${config.message} (cancelled)
|
|
2272
|
+
process.stdout.write(chalk4.dim(`${config.message} (cancelled)
|
|
2274
2273
|
|
|
2275
|
-
`)
|
|
2276
|
-
);
|
|
2274
|
+
`));
|
|
2277
2275
|
resolve(null);
|
|
2278
2276
|
};
|
|
2279
2277
|
const onResize = () => {
|
|
@@ -2451,7 +2449,7 @@ async function interactiveInput(config) {
|
|
|
2451
2449
|
const shown = value.length === 0 && config.placeholder ? chalk4.dim(truncateWithAnsi(config.placeholder, safeWidth2 - 6)) : chalk4.white(visible);
|
|
2452
2450
|
lines.push(` ${chalk4.hex("#00A3FF").bold("\u276F")} ${shown}`);
|
|
2453
2451
|
if (errorMsg) {
|
|
2454
|
-
lines.push(chalk4.red(`
|
|
2452
|
+
lines.push(chalk4.red(` ${truncateWithAnsi(errorMsg, safeWidth2 - 6)}`));
|
|
2455
2453
|
} else {
|
|
2456
2454
|
lines.push(chalk4.dim(" Enter: confirm \u2022 Esc: cancel"));
|
|
2457
2455
|
}
|
|
@@ -2494,14 +2492,14 @@ async function interactiveInput(config) {
|
|
|
2494
2492
|
finishClear();
|
|
2495
2493
|
const shownDone = config.mask ? chalk4.dim("\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022") : chalk4.hex("#00A3FF").bold(value || "(empty)");
|
|
2496
2494
|
process.stdout.write(
|
|
2497
|
-
chalk4.
|
|
2495
|
+
chalk4.bold(config.message) + " " + shownDone + "\n\n"
|
|
2498
2496
|
);
|
|
2499
2497
|
resolve(value);
|
|
2500
2498
|
};
|
|
2501
2499
|
const cancel = () => {
|
|
2502
2500
|
cleanup();
|
|
2503
2501
|
finishClear();
|
|
2504
|
-
process.stdout.write(chalk4.
|
|
2502
|
+
process.stdout.write(chalk4.dim(`${config.message} (cancelled)
|
|
2505
2503
|
|
|
2506
2504
|
`));
|
|
2507
2505
|
resolve(null);
|
|
@@ -3115,7 +3113,7 @@ async function expandOpenCodeMentions(rawPrompt) {
|
|
|
3115
3113
|
const imgPayload = loadImagePayload(resolvedPath);
|
|
3116
3114
|
if (imgPayload) {
|
|
3117
3115
|
attachedImages.push(imgPayload);
|
|
3118
|
-
attachedFiles.push(
|
|
3116
|
+
attachedFiles.push(`@${rawPath}`);
|
|
3119
3117
|
contexts.push(
|
|
3120
3118
|
`
|
|
3121
3119
|
--- [Attached Image: @${rawPath} (${(imgPayload.size / 1024).toFixed(1)} KB, ${imgPayload.mimeType})] ---`
|
|
@@ -3161,7 +3159,7 @@ async function expandOpenCodeMentions(rawPrompt) {
|
|
|
3161
3159
|
if (payload) {
|
|
3162
3160
|
attachedImages.push(payload);
|
|
3163
3161
|
const name = path4.basename(resolvedPath);
|
|
3164
|
-
attachedFiles.push(
|
|
3162
|
+
attachedFiles.push(`${name}`);
|
|
3165
3163
|
contexts.push(
|
|
3166
3164
|
`
|
|
3167
3165
|
--- [Attached Image: ${name} (${(payload.size / 1024).toFixed(1)} KB, ${payload.mimeType})] ---`
|
|
@@ -3171,7 +3169,7 @@ async function expandOpenCodeMentions(rawPrompt) {
|
|
|
3171
3169
|
}
|
|
3172
3170
|
if (attachedFiles.length > 0) {
|
|
3173
3171
|
console.log(
|
|
3174
|
-
chalk4.bgHex("#002B5C").hex("#00A3FF").bold("
|
|
3172
|
+
chalk4.bgHex("#002B5C").hex("#00A3FF").bold(" Resource Ingestion: ") + chalk4.white(` ${attachedFiles.length} item(s): `) + chalk4.cyan.bold(attachedFiles.join(", "))
|
|
3175
3173
|
);
|
|
3176
3174
|
}
|
|
3177
3175
|
return {
|
|
@@ -3481,7 +3479,7 @@ function printSetupComplete(providerLabel, model, extraNote) {
|
|
|
3481
3479
|
const cols = process.stdout.columns || 80;
|
|
3482
3480
|
const line = chalk5.hex("#00A3FF")("\u2500".repeat(Math.max(40, Math.min(cols - 4, 68))));
|
|
3483
3481
|
console.log(line);
|
|
3484
|
-
console.log(chalk5.green.bold("
|
|
3482
|
+
console.log(chalk5.green.bold(" Configuration saved!"));
|
|
3485
3483
|
console.log(` ${chalk5.dim("Provider:")} ${chalk5.bold.cyan(providerLabel)}`);
|
|
3486
3484
|
console.log(` ${chalk5.dim("Model:")} ${chalk5.bold.hex("#00A3FF")(model)}`);
|
|
3487
3485
|
if (extraNote) {
|
|
@@ -3723,11 +3721,11 @@ async function promptVerifiedApiKey(options) {
|
|
|
3723
3721
|
options: [
|
|
3724
3722
|
{
|
|
3725
3723
|
value: "zero_key",
|
|
3726
|
-
label: `${chalk5.hex("#00A3FF").bold("
|
|
3724
|
+
label: `${chalk5.hex("#00A3FF").bold("Continue with Free Zero-Key Starter AI")} ${chalk5.green("(No Key Needed)")}`,
|
|
3727
3725
|
hint: "Start right now without creating any API key (~45s cooldown/reply)"
|
|
3728
3726
|
},
|
|
3729
|
-
{ value: "retry", label: chalk5.cyan("
|
|
3730
|
-
{ value: "cancel", label: chalk5.gray("
|
|
3727
|
+
{ value: "retry", label: chalk5.cyan("Go back and enter an API key") },
|
|
3728
|
+
{ value: "cancel", label: chalk5.gray("Exit setup") }
|
|
3731
3729
|
]
|
|
3732
3730
|
});
|
|
3733
3731
|
if (fallbackPick === "retry") continue;
|
|
@@ -3747,26 +3745,26 @@ async function promptVerifiedApiKey(options) {
|
|
|
3747
3745
|
const detected = inferProviderFromApiKey(cleanedKey);
|
|
3748
3746
|
let modelOverride;
|
|
3749
3747
|
if (detected === "gemini" && activeProvider !== "gemini") {
|
|
3750
|
-
console.log(chalk5.cyan("\n
|
|
3748
|
+
console.log(chalk5.cyan("\n Detected Google Gemini API key (AIza...) \u2014 routing cleanly to Google Gemini!\n"));
|
|
3751
3749
|
activeProvider = "gemini";
|
|
3752
3750
|
activeBaseURL = void 0;
|
|
3753
3751
|
modelOverride = DEFAULT_MODELS.gemini;
|
|
3754
3752
|
} else if (detected === "openrouter" && activeProvider !== "openrouter") {
|
|
3755
|
-
console.log(chalk5.cyan("\n
|
|
3753
|
+
console.log(chalk5.cyan("\n Detected OpenRouter API key (sk-or-...) \u2014 routing cleanly to OpenRouter!\n"));
|
|
3756
3754
|
activeProvider = "openrouter";
|
|
3757
3755
|
activeBaseURL = "https://openrouter.ai/api/v1";
|
|
3758
3756
|
modelOverride = DEFAULT_MODELS.openrouter;
|
|
3759
3757
|
} else if (detected === "groq" && (activeProvider !== "custom" || !activeBaseURL?.includes("groq.com"))) {
|
|
3760
|
-
console.log(chalk5.cyan("\n
|
|
3758
|
+
console.log(chalk5.cyan("\n Detected Groq API key (gsk_...) \u2014 routing cleanly to Groq Cloud!\n"));
|
|
3761
3759
|
activeProvider = "custom";
|
|
3762
3760
|
activeBaseURL = "https://api.groq.com/openai/v1";
|
|
3763
3761
|
modelOverride = "llama-3.3-70b-versatile";
|
|
3764
3762
|
}
|
|
3765
|
-
process.stdout.write(chalk5.cyan("
|
|
3763
|
+
process.stdout.write(chalk5.cyan(" Verifying API key..."));
|
|
3766
3764
|
const check = await verifyProviderCredentials(activeProvider, cleanedKey, activeBaseURL);
|
|
3767
3765
|
process.stdout.write("\r\x1B[2K");
|
|
3768
3766
|
if (check.ok) {
|
|
3769
|
-
console.log(chalk5.green("
|
|
3767
|
+
console.log(chalk5.green(" API key verified!\n"));
|
|
3770
3768
|
return {
|
|
3771
3769
|
provider: activeProvider,
|
|
3772
3770
|
apiKey: cleanedKey,
|
|
@@ -3774,20 +3772,20 @@ async function promptVerifiedApiKey(options) {
|
|
|
3774
3772
|
modelOverride
|
|
3775
3773
|
};
|
|
3776
3774
|
}
|
|
3777
|
-
console.log(chalk5.red(`
|
|
3775
|
+
console.log(chalk5.red(` Verification failed: ${check.error || "Invalid API key."}
|
|
3778
3776
|
`));
|
|
3779
3777
|
const action = await interactiveSelect({
|
|
3780
3778
|
message: "API key check failed. Choose next step:",
|
|
3781
3779
|
options: [
|
|
3782
|
-
{ value: "retry", label: chalk5.cyan("
|
|
3780
|
+
{ value: "retry", label: chalk5.cyan("Re-enter a different API key") },
|
|
3783
3781
|
...options.allowZeroKeyFallback ? [
|
|
3784
3782
|
{
|
|
3785
3783
|
value: "zero_key",
|
|
3786
|
-
label: chalk5.hex("#00A3FF")("
|
|
3784
|
+
label: chalk5.hex("#00A3FF")("Use Free Zero-Key Mode for now (No Key Needed)")
|
|
3787
3785
|
}
|
|
3788
3786
|
] : [],
|
|
3789
3787
|
{ value: "save_anyway", label: chalk5.yellow("Save key anyway") },
|
|
3790
|
-
{ value: "cancel", label: chalk5.gray("
|
|
3788
|
+
{ value: "cancel", label: chalk5.gray("Cancel") }
|
|
3791
3789
|
]
|
|
3792
3790
|
});
|
|
3793
3791
|
if (action === "retry") continue;
|
|
@@ -3875,7 +3873,7 @@ async function switchProviderInteractive(currentConfig) {
|
|
|
3875
3873
|
options: [
|
|
3876
3874
|
{
|
|
3877
3875
|
value: "yes",
|
|
3878
|
-
label: chalk5.green(
|
|
3876
|
+
label: chalk5.green(`Use saved API key and model (${chalk5.bold(saved.model)})`)
|
|
3879
3877
|
},
|
|
3880
3878
|
{
|
|
3881
3879
|
value: "change_model",
|
|
@@ -3995,7 +3993,7 @@ async function promptConfig(isFirstTime = false, fallbackConfig) {
|
|
|
3995
3993
|
...ollamaModels.length > 0 ? [
|
|
3996
3994
|
{
|
|
3997
3995
|
value: "ollama",
|
|
3998
|
-
label: `${chalk5.bold.hex("#00A3FF")("Local Ollama")} ${chalk5.green(`[
|
|
3996
|
+
label: `${chalk5.bold.hex("#00A3FF")("Local Ollama")} ${chalk5.green(`[Detected ${ollamaModels.length} local model(s) \u2022 No Key Needed]`)}`,
|
|
3999
3997
|
hint: `Ready now offline (${ollamaModels.slice(0, 3).join(", ")}) at localhost:11434`
|
|
4000
3998
|
}
|
|
4001
3999
|
] : [],
|
|
@@ -4089,7 +4087,7 @@ async function promptConfig(isFirstTime = false, fallbackConfig) {
|
|
|
4089
4087
|
const keyChoice = await interactiveSelect({
|
|
4090
4088
|
message: `Saved API key found for ${PROVIDER_LABELS[provider]}.`,
|
|
4091
4089
|
options: [
|
|
4092
|
-
{ value: "saved", label: chalk5.green("
|
|
4090
|
+
{ value: "saved", label: chalk5.green("Keep existing API key") },
|
|
4093
4091
|
{ value: "new", label: chalk5.yellow("Enter a new API key") }
|
|
4094
4092
|
]
|
|
4095
4093
|
});
|
|
@@ -4186,7 +4184,7 @@ import OpenAI from "openai";
|
|
|
4186
4184
|
import chalk6 from "chalk";
|
|
4187
4185
|
var AGENT_MODELS = [
|
|
4188
4186
|
// ==========================================
|
|
4189
|
-
//
|
|
4187
|
+
// Built-in Zero-Key Instant Free Model
|
|
4190
4188
|
// ==========================================
|
|
4191
4189
|
{
|
|
4192
4190
|
id: POLLINATIONS_DEFAULT_MODEL,
|
|
@@ -4199,11 +4197,11 @@ var AGENT_MODELS = [
|
|
|
4199
4197
|
baseURL: POLLINATIONS_BASE_URL
|
|
4200
4198
|
},
|
|
4201
4199
|
// ==========================================
|
|
4202
|
-
//
|
|
4200
|
+
// 100% Free OpenRouter Models (Zero Cost)
|
|
4203
4201
|
// ==========================================
|
|
4204
4202
|
{
|
|
4205
4203
|
id: "openrouter/free",
|
|
4206
|
-
name: "OpenRouter Free Agent (
|
|
4204
|
+
name: "OpenRouter Free Agent (Recommended)",
|
|
4207
4205
|
provider: "openrouter",
|
|
4208
4206
|
category: "free",
|
|
4209
4207
|
description: "Auto-routes to the best active free coding model with tool calling. 0% downtime.",
|
|
@@ -4402,7 +4400,7 @@ var AGENT_MODELS = [
|
|
|
4402
4400
|
baseURL: "https://openrouter.ai/api/v1"
|
|
4403
4401
|
},
|
|
4404
4402
|
// ==========================================
|
|
4405
|
-
//
|
|
4403
|
+
// OpenCode Console & Freebuff Zero-Key Built-in Models ($0 Endpoints)
|
|
4406
4404
|
// ==========================================
|
|
4407
4405
|
// 1. Zero-Retention / No-Training Models:
|
|
4408
4406
|
{
|
|
@@ -4599,11 +4597,11 @@ var AGENT_MODELS = [
|
|
|
4599
4597
|
contextLength: "2,097,152"
|
|
4600
4598
|
},
|
|
4601
4599
|
// ==========================================
|
|
4602
|
-
//
|
|
4600
|
+
// Google Gemini Suite (100% Free Tier: 1M Tokens, 1,500 Req/Day)
|
|
4603
4601
|
// ==========================================
|
|
4604
4602
|
{
|
|
4605
4603
|
id: "gemini-3.5-flash-lite",
|
|
4606
|
-
name: "Gemini 3.5 Flash-Lite (
|
|
4604
|
+
name: "Gemini 3.5 Flash-Lite (Verified Active Free Coder)",
|
|
4607
4605
|
provider: "gemini",
|
|
4608
4606
|
category: "gemini",
|
|
4609
4607
|
description: "Google's ultra-fast verified free model with full tool calling, instant token generation, and zero downtime.",
|
|
@@ -4728,11 +4726,11 @@ var AGENT_MODELS = [
|
|
|
4728
4726
|
contextLength: "2,097,152"
|
|
4729
4727
|
},
|
|
4730
4728
|
// ==========================================
|
|
4731
|
-
//
|
|
4729
|
+
// DeepSeek Frontier Models (Free Tokens & High Speed)
|
|
4732
4730
|
// ==========================================
|
|
4733
4731
|
{
|
|
4734
4732
|
id: "deepseek-chat",
|
|
4735
|
-
name: "DeepSeek V4.1 / V3.2 Chat (
|
|
4733
|
+
name: "DeepSeek V4.1 / V3.2 Chat (5M Free Tokens)",
|
|
4736
4734
|
provider: "custom",
|
|
4737
4735
|
category: "deepseek",
|
|
4738
4736
|
description: "DeepSeek flagship frontier coding model with 5M free tokens on platform.deepseek.com.",
|
|
@@ -4791,11 +4789,11 @@ var AGENT_MODELS = [
|
|
|
4791
4789
|
baseURL: "https://openrouter.ai/api/v1"
|
|
4792
4790
|
},
|
|
4793
4791
|
// ==========================================
|
|
4794
|
-
//
|
|
4792
|
+
// Tencent HY4 Suite (1M Token Context - Free Promotional Tokens)
|
|
4795
4793
|
// ==========================================
|
|
4796
4794
|
{
|
|
4797
4795
|
id: "tencent/hy4-flash",
|
|
4798
|
-
name: "Tencent Hy4 Flash (
|
|
4796
|
+
name: "Tencent Hy4 Flash (1M Context - Free Promo)",
|
|
4799
4797
|
provider: "openrouter",
|
|
4800
4798
|
category: "hy4",
|
|
4801
4799
|
description: "Tencent frontier Hy4 Flash model with 1,048,576 token context and ultra-fast generation.",
|
|
@@ -4824,11 +4822,11 @@ var AGENT_MODELS = [
|
|
|
4824
4822
|
baseURL: "https://openrouter.ai/api/v1"
|
|
4825
4823
|
},
|
|
4826
4824
|
// ==========================================
|
|
4827
|
-
//
|
|
4825
|
+
// Zhipu AI GLM 5.3 Suite (Daily Free Tokens - 1M Context)
|
|
4828
4826
|
// ==========================================
|
|
4829
4827
|
{
|
|
4830
4828
|
id: "z-ai/glm-5.3-flash",
|
|
4831
|
-
name: "GLM 5.3 Flash (
|
|
4829
|
+
name: "GLM 5.3 Flash (Daily Free Tokens & 1M Context)",
|
|
4832
4830
|
provider: "openrouter",
|
|
4833
4831
|
category: "glm",
|
|
4834
4832
|
description: "Z.ai latest GLM 5.3 Flash with 1,048,576 token context and daily free tokens on BigModel.",
|
|
@@ -4867,7 +4865,7 @@ var AGENT_MODELS = [
|
|
|
4867
4865
|
baseURL: "https://openrouter.ai/api/v1"
|
|
4868
4866
|
},
|
|
4869
4867
|
// ==========================================
|
|
4870
|
-
//
|
|
4868
|
+
// Groq Cloud Free Tier (14,400 Req/Day Free)
|
|
4871
4869
|
// ==========================================
|
|
4872
4870
|
{
|
|
4873
4871
|
id: "llama-3.3-70b-versatile",
|
|
@@ -4920,7 +4918,7 @@ var AGENT_MODELS = [
|
|
|
4920
4918
|
baseURL: "https://api.groq.com/openai/v1"
|
|
4921
4919
|
},
|
|
4922
4920
|
// ==========================================
|
|
4923
|
-
//
|
|
4921
|
+
// Cerebras Cloud Free Tier (1,800+ Tokens/Sec)
|
|
4924
4922
|
// ==========================================
|
|
4925
4923
|
{
|
|
4926
4924
|
id: "llama3.3-70b",
|
|
@@ -4943,7 +4941,7 @@ var AGENT_MODELS = [
|
|
|
4943
4941
|
baseURL: "https://api.cerebras.ai/v1"
|
|
4944
4942
|
},
|
|
4945
4943
|
// ==========================================
|
|
4946
|
-
//
|
|
4944
|
+
// Local Offline Models (Ollama)
|
|
4947
4945
|
// ==========================================
|
|
4948
4946
|
{
|
|
4949
4947
|
id: "qwen2.5-coder",
|
|
@@ -4966,7 +4964,7 @@ var AGENT_MODELS = [
|
|
|
4966
4964
|
baseURL: "http://localhost:11434/v1"
|
|
4967
4965
|
},
|
|
4968
4966
|
// ==========================================
|
|
4969
|
-
//
|
|
4967
|
+
// Frontier AI Coding Agents (OpenCode Flagships)
|
|
4970
4968
|
// ==========================================
|
|
4971
4969
|
{
|
|
4972
4970
|
id: "anthropic/claude-3.5-sonnet",
|
|
@@ -5175,12 +5173,12 @@ async function selectAgentModelInteractive(currentConfig, mode = "build", initia
|
|
|
5175
5173
|
const hasGroqReady = Boolean(
|
|
5176
5174
|
process.env.GROQ_API_KEY || currentConfig.savedProviders?.custom?.baseURL?.includes("groq.com") && currentConfig.savedProviders?.custom?.apiKey
|
|
5177
5175
|
);
|
|
5178
|
-
const orBadge = hasOpenRouterReady ? chalk6.green(" [
|
|
5179
|
-
const geminiBadge = hasGeminiReady ? chalk6.green(" [
|
|
5180
|
-
const groqBadge = hasGroqReady ? chalk6.green(" [
|
|
5176
|
+
const orBadge = hasOpenRouterReady ? chalk6.green(" [Ready]") : chalk6.yellow(" [Needs OpenRouter Key]");
|
|
5177
|
+
const geminiBadge = hasGeminiReady ? chalk6.green(" [Ready]") : chalk6.yellow(" [Needs Gemini Key]");
|
|
5178
|
+
const groqBadge = hasGroqReady ? chalk6.green(" [Ready]") : chalk6.yellow(" [Needs Groq Key]");
|
|
5181
5179
|
const currentPreset = AGENT_MODELS.find((m) => m.id === currentConfig.model);
|
|
5182
5180
|
const defaultCategory = currentPreset?.category || (currentConfig.provider === "gemini" ? "gemini" : currentConfig.provider === "openrouter" ? "free" : "free");
|
|
5183
|
-
console.log(chalk6.bold.hex("#00A3FF")("\
|
|
5181
|
+
console.log(chalk6.bold.hex("#00A3FF")("\nIUB CLI AI Agent & Model Selector\n"));
|
|
5184
5182
|
let categoryChoice = initialCategory;
|
|
5185
5183
|
if (!categoryChoice) {
|
|
5186
5184
|
categoryChoice = await interactiveSelect({
|
|
@@ -5190,62 +5188,62 @@ async function selectAgentModelInteractive(currentConfig, mode = "build", initia
|
|
|
5190
5188
|
options: [
|
|
5191
5189
|
{
|
|
5192
5190
|
value: "gemini",
|
|
5193
|
-
label: `${chalk6.bold.yellow("
|
|
5191
|
+
label: `${chalk6.bold.yellow("Google Gemini Free Suite")}${geminiBadge}`,
|
|
5194
5192
|
hint: "Gemini 3.5/3.1 Flash Lite, Gemma 4 \u2022 1M-2M context, 1,500 req/day free"
|
|
5195
5193
|
},
|
|
5196
5194
|
{
|
|
5197
5195
|
value: "free",
|
|
5198
|
-
label: `${chalk6.bold.green("
|
|
5196
|
+
label: `${chalk6.bold.green("Free Models & Zero-Key Starter AI")}${orBadge}`,
|
|
5199
5197
|
hint: "Includes Zero-Key GPT-OSS 20B (no key) + OpenRouter free models (Nemotron, Gemma 4)"
|
|
5200
5198
|
},
|
|
5201
5199
|
{
|
|
5202
5200
|
value: "live_sync",
|
|
5203
|
-
label: `${chalk6.bold.hex("#00FFFF")("
|
|
5201
|
+
label: `${chalk6.bold.hex("#00FFFF")("Live Sync: OpenRouter Active Free Models")}${orBadge}`,
|
|
5204
5202
|
hint: "Queries OpenRouter API live for active tool-capable free models"
|
|
5205
5203
|
},
|
|
5206
5204
|
{
|
|
5207
5205
|
value: "zen",
|
|
5208
|
-
label: `${chalk6.bold.hex("#00E5FF")("
|
|
5206
|
+
label: `${chalk6.bold.hex("#00E5FF")("OpenCode & Freebuff Built-in Roster")}${orBadge}`,
|
|
5209
5207
|
hint: "DeepSeek V4.1, GLM 5.3, Solar routed via OpenRouter"
|
|
5210
5208
|
},
|
|
5211
5209
|
{
|
|
5212
5210
|
value: "deepseek",
|
|
5213
|
-
label: `${chalk6.bold.hex("#00D2FF")("
|
|
5211
|
+
label: `${chalk6.bold.hex("#00D2FF")("DeepSeek Frontier Models")}`,
|
|
5214
5212
|
hint: "DeepSeek Platform (5M free), Groq & OpenRouter"
|
|
5215
5213
|
},
|
|
5216
5214
|
{
|
|
5217
5215
|
value: "hy4",
|
|
5218
|
-
label: `${chalk6.bold.hex("#FF6D00")("
|
|
5216
|
+
label: `${chalk6.bold.hex("#FF6D00")("Tencent HY4 Suite")}${orBadge}`,
|
|
5219
5217
|
hint: "Hy4 Flash, Hy4 1M Frontier (1M tokens context)"
|
|
5220
5218
|
},
|
|
5221
5219
|
{
|
|
5222
5220
|
value: "glm",
|
|
5223
|
-
label: `${chalk6.bold.hex("#7C4DFF")("
|
|
5221
|
+
label: `${chalk6.bold.hex("#7C4DFF")("Zhipu AI GLM 5.3 Suite")}${orBadge}`,
|
|
5224
5222
|
hint: "GLM 5.3 Flash, GLM 5.3 1M (daily free tokens)"
|
|
5225
5223
|
},
|
|
5226
5224
|
{
|
|
5227
5225
|
value: "groq",
|
|
5228
|
-
label: `${chalk6.bold.hex("#FF9900")("
|
|
5226
|
+
label: `${chalk6.bold.hex("#FF9900")("Groq & Cerebras Free Tier")}${groqBadge}`,
|
|
5229
5227
|
hint: "Llama 3.3 70B, Qwen Coder \u2022 14,400 requests/day, 500+ tok/s"
|
|
5230
5228
|
},
|
|
5231
5229
|
{
|
|
5232
5230
|
value: "flagship",
|
|
5233
|
-
label: `${chalk6.bold.hex("#FFD700")("
|
|
5231
|
+
label: `${chalk6.bold.hex("#FFD700")("Frontier Flagship Coding Agents")}${orBadge}`,
|
|
5234
5232
|
hint: "Claude 3.5 Sonnet, GPT-4o, Codestral via OpenRouter"
|
|
5235
5233
|
},
|
|
5236
5234
|
{
|
|
5237
5235
|
value: "local",
|
|
5238
|
-
label: `${chalk6.bold.magenta("
|
|
5236
|
+
label: `${chalk6.bold.magenta("Local Offline Models")} ${chalk6.green("[No API Key Needed]")}`,
|
|
5239
5237
|
hint: "Runs 100% locally via Ollama on localhost:11434"
|
|
5240
5238
|
},
|
|
5241
5239
|
{
|
|
5242
5240
|
value: "all",
|
|
5243
|
-
label: `${chalk6.bold("
|
|
5241
|
+
label: `${chalk6.bold("Browse All Model Presets")}`,
|
|
5244
5242
|
hint: "View complete catalog of all presets"
|
|
5245
5243
|
},
|
|
5246
5244
|
{
|
|
5247
5245
|
value: "custom",
|
|
5248
|
-
label: `${chalk6.bold("
|
|
5246
|
+
label: `${chalk6.bold(" Enter Custom Model ID Manually")}`,
|
|
5249
5247
|
hint: "Type any model slug for your current provider"
|
|
5250
5248
|
}
|
|
5251
5249
|
]
|
|
@@ -5261,7 +5259,7 @@ async function selectAgentModelInteractive(currentConfig, mode = "build", initia
|
|
|
5261
5259
|
if (!customModel) return null;
|
|
5262
5260
|
currentConfig.model = customModel.trim();
|
|
5263
5261
|
saveConfig(currentConfig);
|
|
5264
|
-
console.log(chalk6.green(
|
|
5262
|
+
console.log(chalk6.green(`Active Agent Model set to: ${chalk6.bold(currentConfig.model)}
|
|
5265
5263
|
`));
|
|
5266
5264
|
return currentConfig;
|
|
5267
5265
|
}
|
|
@@ -5272,11 +5270,11 @@ async function selectAgentModelInteractive(currentConfig, mode = "build", initia
|
|
|
5272
5270
|
const liveModels = await fetchLiveOpenRouterFreeModels();
|
|
5273
5271
|
spinner.stop();
|
|
5274
5272
|
if (liveModels.length > 0) {
|
|
5275
|
-
console.log(chalk6.green(
|
|
5273
|
+
console.log(chalk6.green(`Found ${liveModels.length} active free tool-capable models on OpenRouter!
|
|
5276
5274
|
`));
|
|
5277
5275
|
modelsToShow = liveModels;
|
|
5278
5276
|
} else {
|
|
5279
|
-
console.log(chalk6.yellow("
|
|
5277
|
+
console.log(chalk6.yellow("Could not connect to OpenRouter live API. Falling back to built-in presets.\n"));
|
|
5280
5278
|
modelsToShow = AGENT_MODELS.filter((m) => m.category === "free");
|
|
5281
5279
|
}
|
|
5282
5280
|
} else if (categoryChoice === "local") {
|
|
@@ -5319,7 +5317,7 @@ async function selectAgentModelInteractive(currentConfig, mode = "build", initia
|
|
|
5319
5317
|
if (!updatedConfig) return null;
|
|
5320
5318
|
console.log(
|
|
5321
5319
|
chalk6.green(
|
|
5322
|
-
|
|
5320
|
+
`Active Agent Model: ${chalk6.bold(preset.name)}
|
|
5323
5321
|
Provider: ${chalk6.bold(formatProviderLabel(updatedConfig))} \u2022 Model ID: ${chalk6.cyan(preset.id)}
|
|
5324
5322
|
`
|
|
5325
5323
|
)
|
|
@@ -5360,12 +5358,12 @@ async function resolveAndSavePreset(preset, currentConfig) {
|
|
|
5360
5358
|
options: [
|
|
5361
5359
|
{
|
|
5362
5360
|
value: "cancel",
|
|
5363
|
-
label: chalk6.green(
|
|
5361
|
+
label: chalk6.green(`Keep using current model (${currentConfig.model})`),
|
|
5364
5362
|
hint: "Do not ask for a key \u2014 keep working immediately"
|
|
5365
5363
|
},
|
|
5366
5364
|
{
|
|
5367
5365
|
value: "enter",
|
|
5368
|
-
label: chalk6.cyan(
|
|
5366
|
+
label: chalk6.cyan(`Enter API Key for ${serviceName}`),
|
|
5369
5367
|
hint: serviceUrl
|
|
5370
5368
|
}
|
|
5371
5369
|
]
|
|
@@ -5536,7 +5534,7 @@ function detectProjectContext(rootDir = process.cwd()) {
|
|
|
5536
5534
|
} catch {
|
|
5537
5535
|
}
|
|
5538
5536
|
const summaryLines = [
|
|
5539
|
-
`###
|
|
5537
|
+
`### DETECTED WORKSPACE ENVIRONMENT:`,
|
|
5540
5538
|
`- Framework / Stack: ${framework} (${language}${hasTypeScript ? ", TypeScript" : ""}${hasTailwind ? ", Tailwind CSS" : ""})`,
|
|
5541
5539
|
`- Package Manager: ${packageManager}`
|
|
5542
5540
|
];
|
|
@@ -5650,7 +5648,7 @@ async function probeCandidate(candidate) {
|
|
|
5650
5648
|
async function exploreAndSelectFreeModel(config, excludedModels = /* @__PURE__ */ new Set(), silent = false) {
|
|
5651
5649
|
if (!silent) {
|
|
5652
5650
|
process.stdout.write(
|
|
5653
|
-
chalk7.cyan("\
|
|
5651
|
+
chalk7.cyan("\nExploring all available models across providers to find active free tokens...\n")
|
|
5654
5652
|
);
|
|
5655
5653
|
}
|
|
5656
5654
|
const geminiKey = config.savedProviders?.gemini?.apiKey || (config.provider === "gemini" ? config.apiKey : void 0) || getEnvProviderKey("gemini");
|
|
@@ -5813,7 +5811,7 @@ function getSystemPrompt(mode = "build") {
|
|
|
5813
5811
|
const peers = meshNode.listPeers().filter((p) => p.nodeId !== meshNode.nodeId);
|
|
5814
5812
|
if (peers.length > 0) {
|
|
5815
5813
|
meshContext = `
|
|
5816
|
-
###
|
|
5814
|
+
### CONNECTED WORKSPACE MESH PEERS (CROSS-INSTANCE COLLABORATION):
|
|
5817
5815
|
This instance role is [${meshNode.role.toUpperCase()}] at "${meshNode.workspace}".
|
|
5818
5816
|
Active connected peer instances in the mesh:
|
|
5819
5817
|
` + peers.map(
|
|
@@ -5831,7 +5829,7 @@ Example: To inspect backend endpoints from frontend, call peer_call_tool("backen
|
|
|
5831
5829
|
if (mode === "plan") {
|
|
5832
5830
|
return `You are IUB CLI, a world-class Principal Software Architect and Systems Designer running directly in the user's terminal. You are designed to be more intelligent, thorough, and reliable than other agents like OpenCode or FreeBuf.
|
|
5833
5831
|
|
|
5834
|
-
###
|
|
5832
|
+
### CRITICAL DIRECTIVE 1: STRICTLY 100% ENGLISH OUTPUT ONLY (MANDATORY)
|
|
5835
5833
|
- YOU MUST COMMUNICATE AND RESPOND EXCLUSIVELY IN ENGLISH.
|
|
5836
5834
|
- UNDER NO CIRCUMSTANCES SHOULD YOU OUTPUT BENGALI SCRIPT (\u09AC\u09BE\u0982\u09B2\u09BE).
|
|
5837
5835
|
- Monospace terminal consoles and Windows fonts cannot render complex Bengali ligatures and conjuncts properly, resulting in broken, overlapping characters.
|
|
@@ -5839,7 +5837,7 @@ Example: To inspect backend endpoints from frontend, call peer_call_tool("backen
|
|
|
5839
5837
|
|
|
5840
5838
|
${envContext.summary}
|
|
5841
5839
|
${meshContext}
|
|
5842
|
-
###
|
|
5840
|
+
### CURRENT ACTIVE MODE: PLAN MODE (ARCHITECT & PLANNING ONLY)
|
|
5843
5841
|
- You are strictly in PLAN MODE. You act as an expert senior software architect.
|
|
5844
5842
|
- Your primary duty is to deeply investigate the workspace, analyze requirements, explore existing code, and formulate a comprehensive, battle-tested, numbered step-by-step architectural plan.
|
|
5845
5843
|
- In this mode, you ONLY have read-only tools:
|
|
@@ -5854,12 +5852,12 @@ ${meshContext}
|
|
|
5854
5852
|
9. peer_send_message(peer, message): Coordinate architectural contracts with peers.
|
|
5855
5853
|
- YOU CANNOT AND MUST NOT write files or run terminal commands. Any attempt will be safely blocked.
|
|
5856
5854
|
- Your architectural breakdown MUST be thorough and structured:
|
|
5857
|
-
1.
|
|
5858
|
-
2.
|
|
5859
|
-
3.
|
|
5860
|
-
4.
|
|
5861
|
-
5.
|
|
5862
|
-
6.
|
|
5855
|
+
1. Executive Architecture Summary & Requirements Analysis.
|
|
5856
|
+
2. Proposed Project & Directory Structure.
|
|
5857
|
+
3. Dependencies, Libraries & Versions needed.
|
|
5858
|
+
4. Core Components, Modules, Data Models & API Contracts.
|
|
5859
|
+
5. Step-by-Step Implementation Roadmap (ordered sequence of files to create/edit).
|
|
5860
|
+
6. Verification & Testing Strategy.
|
|
5863
5861
|
|
|
5864
5862
|
### 1. LANGUAGE & COMMUNICATION RULES (CRITICAL):
|
|
5865
5863
|
- ALWAYS write all responses, architectural plans, explanations, code, and terminal guidance in clear, professional ENGLISH.
|
|
@@ -5868,7 +5866,7 @@ ${meshContext}
|
|
|
5868
5866
|
}
|
|
5869
5867
|
return `You are IUB CLI v2.0, a world-class Principal Full-Stack Software Engineer and Autonomous AI Coding Agent running directly in the user's terminal. You are designed to outperform modern AI coding agents like OpenCode and Claude Code in intelligence, self-healing, search speed, and reliability.
|
|
5870
5868
|
|
|
5871
|
-
###
|
|
5869
|
+
### CRITICAL DIRECTIVE 1: STRICTLY 100% ENGLISH OUTPUT ONLY (MANDATORY)
|
|
5872
5870
|
- YOU MUST COMMUNICATE AND RESPOND EXCLUSIVELY IN ENGLISH.
|
|
5873
5871
|
- UNDER NO CIRCUMSTANCES SHOULD YOU OUTPUT BENGALI SCRIPT (\u09AC\u09BE\u0982\u09B2\u09BE).
|
|
5874
5872
|
- Monospace terminal consoles and Windows fonts cannot render complex Bengali ligatures and conjuncts properly, resulting in broken, overlapping characters.
|
|
@@ -5876,7 +5874,7 @@ ${meshContext}
|
|
|
5876
5874
|
|
|
5877
5875
|
${envContext.summary}
|
|
5878
5876
|
${meshContext}
|
|
5879
|
-
###
|
|
5877
|
+
### CURRENT ACTIVE MODE: BUILD MODE (AUTONOMOUS BUILDER)
|
|
5880
5878
|
- You are 100% in BUILD MODE right now. You are NOT in plan mode.
|
|
5881
5879
|
- File creation (write_file), surgical editing (edit_file), and terminal command execution (run_command) are FULLY UNLOCKED AND ACTIVE.
|
|
5882
5880
|
- NEVER claim or state that you are in plan mode, and NEVER claim you cannot write or edit files.
|
|
@@ -5897,7 +5895,7 @@ ${meshContext}
|
|
|
5897
5895
|
11. peer_call_tool(peer, tool, args): Remotely execute tools (read_file, write_file, edit_file, run_command, list_files) in peer workspaces.
|
|
5898
5896
|
12. peer_send_message(peer, message): Coordinate schemas, contracts, or tasks with peer instances.
|
|
5899
5897
|
|
|
5900
|
-
###
|
|
5898
|
+
### INTELLIGENT AGENT PROTOCOL (FOLLOW RIGOROUSLY):
|
|
5901
5899
|
1. **Investigate Before Acting**:
|
|
5902
5900
|
- Always explore the workspace with list_files, read_file, or grep_search first. Never code blindly without understanding existing dependencies and architecture.
|
|
5903
5901
|
2. **Surgical Editing Preference (CRITICAL)**:
|
|
@@ -6035,13 +6033,13 @@ var IUBAgent = class {
|
|
|
6035
6033
|
if (this.mode === "build") {
|
|
6036
6034
|
this.openAIMessages.push({
|
|
6037
6035
|
role: "system",
|
|
6038
|
-
content: "[SYSTEM DIRECTIVE: The user has switched the agent to
|
|
6036
|
+
content: "[SYSTEM DIRECTIVE: The user has switched the agent to BUILD MODE. You have full authority to use write_file, edit_file, and run_command immediately. Any previous PLAN MODE restrictions or tool blocks are completely lifted. Code and build the solution right now.]"
|
|
6039
6037
|
});
|
|
6040
6038
|
this.geminiContents.push({
|
|
6041
6039
|
role: "user",
|
|
6042
6040
|
parts: [
|
|
6043
6041
|
{
|
|
6044
|
-
text: "[SYSTEM NOTIFICATION: IUB CLI is now in
|
|
6042
|
+
text: "[SYSTEM NOTIFICATION: IUB CLI is now in BUILD MODE. Autonomous file creation, editing, and terminal commands are active.]"
|
|
6045
6043
|
}
|
|
6046
6044
|
]
|
|
6047
6045
|
});
|
|
@@ -6056,13 +6054,13 @@ var IUBAgent = class {
|
|
|
6056
6054
|
} else {
|
|
6057
6055
|
this.openAIMessages.push({
|
|
6058
6056
|
role: "system",
|
|
6059
|
-
content: "[SYSTEM DIRECTIVE: The user has switched the agent to
|
|
6057
|
+
content: "[SYSTEM DIRECTIVE: The user has switched the agent to PLAN MODE. Act as Senior Architect formulating structured plans without modifying workspace files.]"
|
|
6060
6058
|
});
|
|
6061
6059
|
this.geminiContents.push({
|
|
6062
6060
|
role: "user",
|
|
6063
6061
|
parts: [
|
|
6064
6062
|
{
|
|
6065
|
-
text: "[SYSTEM NOTIFICATION: IUB CLI is now in
|
|
6063
|
+
text: "[SYSTEM NOTIFICATION: IUB CLI is now in PLAN MODE. Only read-only tools are enabled.]"
|
|
6066
6064
|
}
|
|
6067
6065
|
]
|
|
6068
6066
|
});
|
|
@@ -6382,7 +6380,7 @@ ${String(out).slice(0, 6e3)}`);
|
|
|
6382
6380
|
const cooldownSec = 10;
|
|
6383
6381
|
renderRollingRateLimitNotice(currentModel, cooldownSec, "All free models in rolling rate limit");
|
|
6384
6382
|
for (let rem = cooldownSec; rem > 0; rem--) {
|
|
6385
|
-
const msg =
|
|
6383
|
+
const msg = `Free rate limits active \u2022 Auto-cooling down (${rem}s) [Never-Stop Mode]... (Esc to cancel)`;
|
|
6386
6384
|
updateFixedBottomStatus(msg, { mode: this.mode, model: this.config.model });
|
|
6387
6385
|
await new Promise((r) => setTimeout(r, 1e3));
|
|
6388
6386
|
}
|
|
@@ -6501,10 +6499,10 @@ ${String(out).slice(0, 6e3)}`);
|
|
|
6501
6499
|
*/
|
|
6502
6500
|
async chat(userInput, options) {
|
|
6503
6501
|
if (options?.signal?.aborted) {
|
|
6504
|
-
return chalk8.yellow("\
|
|
6502
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6505
6503
|
}
|
|
6506
6504
|
this.resetCascadeAttempts();
|
|
6507
|
-
const modeDirective = this.mode === "build" ? `[SYSTEM STATUS: ACTIVE MODE =
|
|
6505
|
+
const modeDirective = this.mode === "build" ? `[SYSTEM STATUS: ACTIVE MODE = BUILD MODE. All coding tools (write_file, edit_file, run_command) are FULLY UNLOCKED AND ACTIVE. You MUST NOT claim you are in PLAN mode or ask the user to type /build. You are ALREADY in BUILD mode. Immediately call your tools to implement, create, or edit code.]` : `[SYSTEM STATUS: ACTIVE MODE = PLAN MODE. You are in read-only planning mode. Formulate comprehensive step-by-step plans without modifying files.]`;
|
|
6508
6506
|
const englishEnforcedInput = `[CRITICAL: You must provide all explanations, responses, and terminal output strictly in clear ENGLISH. Do not use Bengali script under any circumstances.]
|
|
6509
6507
|
${modeDirective}
|
|
6510
6508
|
|
|
@@ -6517,7 +6515,7 @@ ${userInput}`;
|
|
|
6517
6515
|
}
|
|
6518
6516
|
} catch (err) {
|
|
6519
6517
|
if (options?.signal?.aborted) {
|
|
6520
|
-
return chalk8.yellow("\
|
|
6518
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6521
6519
|
}
|
|
6522
6520
|
const nextModel = await this.cascadeModel(this.config.model, "Provider failure auto-recovery");
|
|
6523
6521
|
if (nextModel) {
|
|
@@ -6527,7 +6525,7 @@ ${userInput}`;
|
|
|
6527
6525
|
return await this.chatOpenAI(englishEnforcedInput, options);
|
|
6528
6526
|
}
|
|
6529
6527
|
}
|
|
6530
|
-
return chalk8.yellow("\
|
|
6528
|
+
return chalk8.yellow("\nAll free model tokens are currently exhausted across all providers. Check the renewal countdown above.");
|
|
6531
6529
|
}
|
|
6532
6530
|
}
|
|
6533
6531
|
shouldNudgePassiveBuildReply(userPrompt, replyText, toolsExecutedInChat, alreadyNudged) {
|
|
@@ -6548,7 +6546,7 @@ ${userInput}`;
|
|
|
6548
6546
|
*/
|
|
6549
6547
|
async chatGemini(userInput, options) {
|
|
6550
6548
|
if (options?.signal?.aborted) {
|
|
6551
|
-
return chalk8.yellow("\
|
|
6549
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6552
6550
|
}
|
|
6553
6551
|
if (!this.geminiClient) {
|
|
6554
6552
|
throw new Error("Gemini client is not initialized.");
|
|
@@ -6577,7 +6575,7 @@ ${userInput}`;
|
|
|
6577
6575
|
let nudgedBuildExecution = false;
|
|
6578
6576
|
while (turnCount < maxTurns) {
|
|
6579
6577
|
if (options?.signal?.aborted) {
|
|
6580
|
-
return chalk8.yellow("\
|
|
6578
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6581
6579
|
}
|
|
6582
6580
|
turnCount++;
|
|
6583
6581
|
updateFixedBottomStatus(
|
|
@@ -6600,14 +6598,14 @@ ${userInput}`;
|
|
|
6600
6598
|
for (const candidateModel of modelCandidates) {
|
|
6601
6599
|
if (options?.signal?.aborted) {
|
|
6602
6600
|
spinner.stop();
|
|
6603
|
-
return chalk8.yellow("\
|
|
6601
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6604
6602
|
}
|
|
6605
6603
|
let attempts = 0;
|
|
6606
6604
|
const maxModelAttempts = 2;
|
|
6607
6605
|
while (attempts < maxModelAttempts) {
|
|
6608
6606
|
if (options?.signal?.aborted) {
|
|
6609
6607
|
spinner.stop();
|
|
6610
|
-
return chalk8.yellow("\
|
|
6608
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6611
6609
|
}
|
|
6612
6610
|
attempts++;
|
|
6613
6611
|
let timeoutId;
|
|
@@ -6649,7 +6647,7 @@ ${userInput}`;
|
|
|
6649
6647
|
if (timeoutId) clearTimeout(timeoutId);
|
|
6650
6648
|
if (options?.signal?.aborted || err?.message === "ABORTED_BY_USER") {
|
|
6651
6649
|
spinner.stop();
|
|
6652
|
-
return chalk8.yellow("\
|
|
6650
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6653
6651
|
}
|
|
6654
6652
|
lastError = err;
|
|
6655
6653
|
this.attemptedModelsInCascade.add(candidateModel);
|
|
@@ -6694,7 +6692,7 @@ ${userInput}`;
|
|
|
6694
6692
|
}
|
|
6695
6693
|
return chalk8.red(
|
|
6696
6694
|
`
|
|
6697
|
-
|
|
6695
|
+
Gemini API Key Error: Your API key appears to be invalid or expired.
|
|
6698
6696
|
Please run ${chalk8.yellow("/config")} to update your API key.`
|
|
6699
6697
|
);
|
|
6700
6698
|
} else {
|
|
@@ -6710,7 +6708,7 @@ Please run ${chalk8.yellow("/config")} to update your API key.`
|
|
|
6710
6708
|
}
|
|
6711
6709
|
}
|
|
6712
6710
|
return chalk8.yellow(
|
|
6713
|
-
"\
|
|
6711
|
+
"\nAll free model tokens are currently exhausted across all providers. Check the renewal countdown above."
|
|
6714
6712
|
);
|
|
6715
6713
|
}
|
|
6716
6714
|
}
|
|
@@ -6762,7 +6760,7 @@ Please run ${chalk8.yellow("/config")} to update your API key.`
|
|
|
6762
6760
|
const toolResponseParts = [];
|
|
6763
6761
|
for (const call of functionCalls) {
|
|
6764
6762
|
if (options?.signal?.aborted) {
|
|
6765
|
-
return chalk8.yellow("\
|
|
6763
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6766
6764
|
}
|
|
6767
6765
|
const toolName = call.name;
|
|
6768
6766
|
const toolArgs = call.args || {};
|
|
@@ -6773,7 +6771,7 @@ Please run ${chalk8.yellow("/config")} to update your API key.`
|
|
|
6773
6771
|
toolsExecutedInChat++;
|
|
6774
6772
|
const output = await executeTool(toolName, toolArgs, this.mode, options?.signal);
|
|
6775
6773
|
if (options?.signal?.aborted) {
|
|
6776
|
-
return chalk8.yellow("\
|
|
6774
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6777
6775
|
}
|
|
6778
6776
|
toolResponseParts.push({
|
|
6779
6777
|
functionResponse: {
|
|
@@ -6795,7 +6793,7 @@ Please run ${chalk8.yellow("/config")} to update your API key.`
|
|
|
6795
6793
|
*/
|
|
6796
6794
|
async chatOpenAI(userInput, options) {
|
|
6797
6795
|
if (options?.signal?.aborted) {
|
|
6798
|
-
return chalk8.yellow("\
|
|
6796
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6799
6797
|
}
|
|
6800
6798
|
if (!this.openAIClient || !this.config.apiKey) {
|
|
6801
6799
|
const nextModel = await this.cascadeModel(
|
|
@@ -6839,7 +6837,7 @@ Please run ${chalk8.yellow("/config")} to update your API key.`
|
|
|
6839
6837
|
let nudgedBuildExecution = false;
|
|
6840
6838
|
while (turnCount < maxTurns) {
|
|
6841
6839
|
if (options?.signal?.aborted) {
|
|
6842
|
-
return chalk8.yellow("\
|
|
6840
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6843
6841
|
}
|
|
6844
6842
|
turnCount++;
|
|
6845
6843
|
updateFixedBottomStatus(
|
|
@@ -6856,7 +6854,7 @@ Please run ${chalk8.yellow("/config")} to update your API key.`
|
|
|
6856
6854
|
while (cascadeAttempts < maxCascadeAttempts) {
|
|
6857
6855
|
if (options?.signal?.aborted) {
|
|
6858
6856
|
spinner.stop();
|
|
6859
|
-
return chalk8.yellow("\
|
|
6857
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6860
6858
|
}
|
|
6861
6859
|
if (!this.openAIClient) {
|
|
6862
6860
|
break;
|
|
@@ -6896,7 +6894,7 @@ Please run ${chalk8.yellow("/config")} to update your API key.`
|
|
|
6896
6894
|
if (timeoutId) clearTimeout(timeoutId);
|
|
6897
6895
|
if (options?.signal?.aborted || err?.message === "ABORTED_BY_USER") {
|
|
6898
6896
|
spinner.stop();
|
|
6899
|
-
return chalk8.yellow("\
|
|
6897
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6900
6898
|
}
|
|
6901
6899
|
const errMsg = err?.message || String(err);
|
|
6902
6900
|
const lowerErr = errMsg.toLowerCase();
|
|
@@ -6909,7 +6907,7 @@ Please run ${chalk8.yellow("/config")} to update your API key.`
|
|
|
6909
6907
|
for (let rem = waitSec; rem > 0; rem--) {
|
|
6910
6908
|
if (options?.signal?.aborted) {
|
|
6911
6909
|
spinner.stop();
|
|
6912
|
-
return chalk8.yellow("\
|
|
6910
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6913
6911
|
}
|
|
6914
6912
|
const note = `Rolling rate limit cooldown (${rem}s) on [${this.config.model}] \u2022 Auto-resuming...`;
|
|
6915
6913
|
spinner.text = chalk8.cyan(note);
|
|
@@ -6932,7 +6930,7 @@ Please run ${chalk8.yellow("/config")} to update your API key.`
|
|
|
6932
6930
|
for (let rem = waitSec; rem > 0; rem--) {
|
|
6933
6931
|
if (options?.signal?.aborted) {
|
|
6934
6932
|
spinner.stop();
|
|
6935
|
-
return chalk8.yellow("\
|
|
6933
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6936
6934
|
}
|
|
6937
6935
|
const note = `Free Zero-Key cooldown (${rem}s) \u2022 Tip: /config for instant free Gemini key`;
|
|
6938
6936
|
spinner.text = chalk8.cyan(note);
|
|
@@ -6969,18 +6967,18 @@ Please run ${chalk8.yellow("/config")} to update your API key.`
|
|
|
6969
6967
|
if (lowerErr.includes("401") || lowerErr.includes("invalid_api_key") || lowerErr.includes("user not found")) {
|
|
6970
6968
|
return chalk8.red(
|
|
6971
6969
|
`
|
|
6972
|
-
|
|
6970
|
+
API Key Error: Authentication failed for ${this.config.provider}.
|
|
6973
6971
|
Please run ${chalk8.yellow("/provider")} or ${chalk8.yellow("/config")} to configure a valid key.`
|
|
6974
6972
|
);
|
|
6975
6973
|
}
|
|
6976
6974
|
return chalk8.yellow(
|
|
6977
|
-
"\
|
|
6975
|
+
"\nAll free model tokens are currently exhausted across all providers. Check the renewal countdown above."
|
|
6978
6976
|
);
|
|
6979
6977
|
}
|
|
6980
6978
|
}
|
|
6981
6979
|
spinner.stop();
|
|
6982
6980
|
if (options?.signal?.aborted) {
|
|
6983
|
-
return chalk8.yellow("\
|
|
6981
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
6984
6982
|
}
|
|
6985
6983
|
if (!completion) {
|
|
6986
6984
|
const nextModel = await this.cascadeModel(this.config.model, "Cascade auto-recovery");
|
|
@@ -6992,7 +6990,7 @@ Please run ${chalk8.yellow("/provider")} or ${chalk8.yellow("/config")} to confi
|
|
|
6992
6990
|
}
|
|
6993
6991
|
}
|
|
6994
6992
|
return chalk8.yellow(
|
|
6995
|
-
"\
|
|
6993
|
+
"\nAll free model tokens are currently exhausted across all providers. Check the renewal countdown above."
|
|
6996
6994
|
);
|
|
6997
6995
|
}
|
|
6998
6996
|
const choice = completion.choices?.[0];
|
|
@@ -7041,7 +7039,7 @@ Please run ${chalk8.yellow("/provider")} or ${chalk8.yellow("/config")} to confi
|
|
|
7041
7039
|
}
|
|
7042
7040
|
for (const toolCall of message.tool_calls) {
|
|
7043
7041
|
if (options?.signal?.aborted) {
|
|
7044
|
-
return chalk8.yellow("\
|
|
7042
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
7045
7043
|
}
|
|
7046
7044
|
if (toolCall.type !== "function") continue;
|
|
7047
7045
|
const fnName = toolCall.function.name;
|
|
@@ -7067,7 +7065,7 @@ Please run ${chalk8.yellow("/provider")} or ${chalk8.yellow("/config")} to confi
|
|
|
7067
7065
|
toolsExecutedInChat++;
|
|
7068
7066
|
const toolResult = await executeTool(fnName, fnArgs, this.mode, options?.signal);
|
|
7069
7067
|
if (options?.signal?.aborted) {
|
|
7070
|
-
return chalk8.yellow("\
|
|
7068
|
+
return chalk8.yellow("\nTask cancelled by user (Escape key pressed).");
|
|
7071
7069
|
}
|
|
7072
7070
|
this.openAIMessages.push({
|
|
7073
7071
|
role: "tool",
|
|
@@ -7832,12 +7830,12 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
7832
7830
|
model: localOllama[0],
|
|
7833
7831
|
baseURL: "http://localhost:11434/v1"
|
|
7834
7832
|
};
|
|
7835
|
-
console.log(chalk9.cyan(
|
|
7833
|
+
console.log(chalk9.cyan(` Auto-detected Local Ollama (${localOllama[0]}).`));
|
|
7836
7834
|
} else {
|
|
7837
7835
|
config = createZeroKeyConfig();
|
|
7838
7836
|
console.log(
|
|
7839
7837
|
chalk9.cyan(
|
|
7840
|
-
'
|
|
7838
|
+
' No API key configured \u2014 starting with Free Zero-Key AI. Run "iubcli config" anytime to add a free Gemini key.'
|
|
7841
7839
|
)
|
|
7842
7840
|
);
|
|
7843
7841
|
}
|
|
@@ -7867,7 +7865,7 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
7867
7865
|
workspace: process.cwd(),
|
|
7868
7866
|
onRemoteToolExecution: async (tool, args, fromRole) => {
|
|
7869
7867
|
console.log(chalk9.cyan(`
|
|
7870
|
-
|
|
7868
|
+
[Mesh RPC from ${chalk9.bold(fromRole)}] Executing tool: ${chalk9.bold(tool)}`));
|
|
7871
7869
|
updateFixedBottomStatus(`[Mesh: ${fromRole}] Executing ${tool}...`, {
|
|
7872
7870
|
mode: agent.getMode(),
|
|
7873
7871
|
model: config?.model || "unknown"
|
|
@@ -7879,7 +7877,7 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
7879
7877
|
onPeerMessage: (message, fromRole) => {
|
|
7880
7878
|
console.log(
|
|
7881
7879
|
chalk9.bgHex("#002B5C").hex("#00A3FF").bold(`
|
|
7882
|
-
|
|
7880
|
+
[Mesh Message from ${fromRole}]: `) + chalk9.white(message) + "\n"
|
|
7883
7881
|
);
|
|
7884
7882
|
},
|
|
7885
7883
|
onPeerConnect: (peer) => {
|
|
@@ -7893,7 +7891,7 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
7893
7891
|
}
|
|
7894
7892
|
console.log(
|
|
7895
7893
|
chalk9.green(`
|
|
7896
|
-
|
|
7894
|
+
[Mesh] Connected to peer [${chalk9.bold(peer.role)}] (${peer.workspace})
|
|
7897
7895
|
`)
|
|
7898
7896
|
);
|
|
7899
7897
|
updateFixedBottomStatus(`Peer connected: ${peer.role}`, {
|
|
@@ -7912,7 +7910,7 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
7912
7910
|
}
|
|
7913
7911
|
console.log(
|
|
7914
7912
|
chalk9.yellow(`
|
|
7915
|
-
|
|
7913
|
+
[Mesh] Peer disconnected: [${chalk9.bold(peer.role)}] (${peer.workspace})
|
|
7916
7914
|
`)
|
|
7917
7915
|
);
|
|
7918
7916
|
}
|
|
@@ -7957,7 +7955,7 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
7957
7955
|
console.log(
|
|
7958
7956
|
chalk9.cyan(
|
|
7959
7957
|
`
|
|
7960
|
-
|
|
7958
|
+
Running single prompt with ${formatProviderLabel(config)} (${config.model}) in [${initialMode.toUpperCase()} MODE]:`
|
|
7961
7959
|
)
|
|
7962
7960
|
);
|
|
7963
7961
|
console.log(chalk9.white(options.prompt) + "\n");
|
|
@@ -7985,7 +7983,7 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
7985
7983
|
renderInterruptedNotice();
|
|
7986
7984
|
} else {
|
|
7987
7985
|
console.error(chalk9.red(`
|
|
7988
|
-
|
|
7986
|
+
Error: ${err.message}
|
|
7989
7987
|
`));
|
|
7990
7988
|
process.exitCode = 1;
|
|
7991
7989
|
}
|
|
@@ -8020,7 +8018,7 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
8020
8018
|
}
|
|
8021
8019
|
const lowerCmd = trimmed.toLowerCase();
|
|
8022
8020
|
if (lowerCmd === "/exit" || lowerCmd === "/quit") {
|
|
8023
|
-
console.log(chalk9.hex("#00A3FF")("\nThanks for using IUB CLI. Happy coding! \
|
|
8021
|
+
console.log(chalk9.hex("#00A3FF")("\nThanks for using IUB CLI. Happy coding! \n"));
|
|
8024
8022
|
gracefulExit(0);
|
|
8025
8023
|
return;
|
|
8026
8024
|
}
|
|
@@ -8038,7 +8036,7 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
8038
8036
|
agent.getMode()
|
|
8039
8037
|
);
|
|
8040
8038
|
} else {
|
|
8041
|
-
console.log(chalk9.yellow("\
|
|
8039
|
+
console.log(chalk9.yellow("\nAll free models currently have zero available quota across all providers.\n"));
|
|
8042
8040
|
}
|
|
8043
8041
|
continue;
|
|
8044
8042
|
}
|
|
@@ -8052,12 +8050,12 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
8052
8050
|
capturedPath = resolved;
|
|
8053
8051
|
} else {
|
|
8054
8052
|
console.log(chalk9.red(`
|
|
8055
|
-
|
|
8053
|
+
Could not find image file at: ${cleanArg}
|
|
8056
8054
|
`));
|
|
8057
8055
|
continue;
|
|
8058
8056
|
}
|
|
8059
8057
|
} else {
|
|
8060
|
-
process.stdout.write(chalk9.cyan("\
|
|
8058
|
+
process.stdout.write(chalk9.cyan("\nChecking system clipboard for screenshot / image...\n"));
|
|
8061
8059
|
capturedPath = captureClipboardImage();
|
|
8062
8060
|
}
|
|
8063
8061
|
if (capturedPath) {
|
|
@@ -8066,19 +8064,19 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
8066
8064
|
stagedImages.push(payload);
|
|
8067
8065
|
const kb = (payload.size / 1024).toFixed(1);
|
|
8068
8066
|
console.log(
|
|
8069
|
-
"\n" + chalk9.bgHex("#002B5C").hex("#00A3FF").bold("
|
|
8067
|
+
"\n" + chalk9.bgHex("#002B5C").hex("#00A3FF").bold(" IMAGE STAGED SUCCESSFULLY ") + `
|
|
8070
8068
|
${chalk9.gray("File:")} ${chalk9.white(path8.basename(payload.path))}
|
|
8071
8069
|
${chalk9.gray("Format:")} ${chalk9.cyan(payload.mimeType)} (${kb} KB)
|
|
8072
8070
|
${chalk9.gray("Saved to:")} ${chalk9.dim(payload.path)}
|
|
8073
8071
|
|
|
8074
|
-
` + chalk9.green.bold("
|
|
8072
|
+
` + chalk9.green.bold("Ready!") + chalk9.white(' Type your question or prompt (e.g. "Explain this error" or "Code this UI") and press Enter.\n')
|
|
8075
8073
|
);
|
|
8076
8074
|
} else {
|
|
8077
|
-
console.log(chalk9.yellow("\
|
|
8075
|
+
console.log(chalk9.yellow("\nCould not read image payload (file might be damaged or larger than 15MB).\n"));
|
|
8078
8076
|
}
|
|
8079
8077
|
} else {
|
|
8080
8078
|
console.log(
|
|
8081
|
-
"\n" + chalk9.bgHex("#FF9900").black.bold("
|
|
8079
|
+
"\n" + chalk9.bgHex("#FF9900").black.bold(" NO IMAGE FOUND IN CLIPBOARD ") + "\n" + chalk9.white("No image data was found in your clipboard.\n\n") + chalk9.yellow("How to paste a screenshot:") + `
|
|
8082
8080
|
1. Take a screenshot: ${chalk9.bold("Win + Shift + S")} on Windows, or ${chalk9.bold("Cmd + Shift + 4")} on macOS
|
|
8083
8081
|
2. Return here and run ${chalk9.cyan.bold("/image")}
|
|
8084
8082
|
3. Or mention an image file: ${chalk9.cyan.bold("@screenshot.png")} or drag-and-drop the image path into prompt.
|
|
@@ -8107,12 +8105,12 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
8107
8105
|
options: [
|
|
8108
8106
|
{
|
|
8109
8107
|
value: "build",
|
|
8110
|
-
label: "
|
|
8108
|
+
label: "BUILD Mode (Autonomous Full-Stack Coding)",
|
|
8111
8109
|
hint: "Full tool access: inspect, create/update files & run terminal commands"
|
|
8112
8110
|
},
|
|
8113
8111
|
{
|
|
8114
8112
|
value: "plan",
|
|
8115
|
-
label: "
|
|
8113
|
+
label: "PLAN Mode (Senior Architect & Planning)",
|
|
8116
8114
|
hint: "Read-only: inspect files, explore architecture & design step-by-step plans"
|
|
8117
8115
|
}
|
|
8118
8116
|
]
|
|
@@ -8121,7 +8119,7 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
8121
8119
|
agent.setMode(modeChoice);
|
|
8122
8120
|
meshNode?.updateState({ mode: modeChoice });
|
|
8123
8121
|
console.log(chalk9.green(`
|
|
8124
|
-
|
|
8122
|
+
Agent mode switched to: ${modeChoice === "build" ? "BUILD Mode" : "PLAN Mode"}
|
|
8125
8123
|
`));
|
|
8126
8124
|
}
|
|
8127
8125
|
continue;
|
|
@@ -8134,7 +8132,7 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
8134
8132
|
config.model,
|
|
8135
8133
|
"plan"
|
|
8136
8134
|
);
|
|
8137
|
-
console.log(chalk9.hex("#FFB300")("\
|
|
8135
|
+
console.log(chalk9.hex("#FFB300")("\nActive mode switched to PLAN MODE (Senior Architect & Read-Only Planning).\n"));
|
|
8138
8136
|
continue;
|
|
8139
8137
|
}
|
|
8140
8138
|
if (lowerCmd === "/build" || lowerCmd === "/mode build" || lowerCmd === "build mode" || lowerCmd === "switch to build mode" || lowerCmd === "switch build") {
|
|
@@ -8145,7 +8143,7 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
8145
8143
|
config.model,
|
|
8146
8144
|
"build"
|
|
8147
8145
|
);
|
|
8148
|
-
console.log(chalk9.hex("#00A3FF")("\
|
|
8146
|
+
console.log(chalk9.hex("#00A3FF")("\nActive mode switched to BUILD MODE (Autonomous Full-Stack Coding & Execution Enabled).\n"));
|
|
8149
8147
|
continue;
|
|
8150
8148
|
}
|
|
8151
8149
|
if (lowerCmd.includes("you are in build mode") && agent.getMode() !== "build") {
|
|
@@ -8224,9 +8222,9 @@ program.name("iubcli").description("IUB CLI \u2014 Next-Gen Autonomous BYOK term
|
|
|
8224
8222
|
if (lowerCmd === "/diff" || lowerCmd === "/changes") {
|
|
8225
8223
|
const changes = getSessionChanges();
|
|
8226
8224
|
if (changes.length === 0) {
|
|
8227
|
-
console.log(chalk9.yellow("\n
|
|
8225
|
+
console.log(chalk9.yellow("\n No file modifications or creations recorded in this session.\n"));
|
|
8228
8226
|
} else {
|
|
8229
|
-
console.log("\n" + chalk9.bold.hex("#00A3FF")("
|
|
8227
|
+
console.log("\n" + chalk9.bold.hex("#00A3FF")("Files Modified / Created in this Session:"));
|
|
8230
8228
|
console.log(chalk9.dim("\u2500".repeat(60)));
|
|
8231
8229
|
changes.forEach((c, idx) => {
|
|
8232
8230
|
const status = c.isNew ? chalk9.green("[NEW]") : chalk9.yellow("[MODIFIED]");
|
|
@@ -8245,7 +8243,7 @@ ${result.message}
|
|
|
8245
8243
|
`));
|
|
8246
8244
|
} else {
|
|
8247
8245
|
console.log(chalk9.yellow(`
|
|
8248
|
-
|
|
8246
|
+
${result.message}
|
|
8249
8247
|
`));
|
|
8250
8248
|
}
|
|
8251
8249
|
continue;
|
|
@@ -8260,7 +8258,7 @@ ${result.message}
|
|
|
8260
8258
|
}
|
|
8261
8259
|
if (lowerCmd === "/detect" || lowerCmd === "/stack") {
|
|
8262
8260
|
const ctx = detectProjectContext();
|
|
8263
|
-
console.log("\n" + chalk9.bold.hex("#00A3FF")("
|
|
8261
|
+
console.log("\n" + chalk9.bold.hex("#00A3FF")("Detected Workspace Environment"));
|
|
8264
8262
|
console.log(chalk9.dim("\u2500".repeat(60)));
|
|
8265
8263
|
console.log(ctx.summary.split("\n").slice(1).map((l) => " " + l).join("\n"));
|
|
8266
8264
|
console.log(chalk9.dim("\u2500".repeat(60)) + "\n");
|
|
@@ -8271,8 +8269,8 @@ ${result.message}
|
|
|
8271
8269
|
console.log(
|
|
8272
8270
|
chalk9.green(
|
|
8273
8271
|
`
|
|
8274
|
-
|
|
8275
|
-
Turns before: ${chalk9.yellow(result.turnsBefore)}
|
|
8272
|
+
Conversation history compacted!
|
|
8273
|
+
Turns before: ${chalk9.yellow(result.turnsBefore)} -> Turns after: ${chalk9.green(result.turnsAfter)}
|
|
8276
8274
|
Context window optimized for faster responses and lower token load.
|
|
8277
8275
|
`
|
|
8278
8276
|
)
|
|
@@ -8282,11 +8280,11 @@ Context window optimized for faster responses and lower token load.
|
|
|
8282
8280
|
if (lowerCmd === "/session" || lowerCmd === "/status") {
|
|
8283
8281
|
const changes = getSessionChanges();
|
|
8284
8282
|
const mem = agent.getHistoryStats();
|
|
8285
|
-
console.log("\n" + chalk9.bold.hex("#00A3FF")("
|
|
8283
|
+
console.log("\n" + chalk9.bold.hex("#00A3FF")("Active Session Status (OpenCode Style)"));
|
|
8286
8284
|
console.log(chalk9.dim("\u2500".repeat(60)));
|
|
8287
8285
|
console.log(` ${chalk9.gray("Provider:")} ${chalk9.bold(PROVIDER_LABELS[config.provider])}`);
|
|
8288
8286
|
console.log(` ${chalk9.gray("Active Model:")} ${chalk9.cyan.bold(config.model)}`);
|
|
8289
|
-
console.log(` ${chalk9.gray("Active Mode:")} ${agent.getMode() === "build" ? chalk9.green.bold("
|
|
8287
|
+
console.log(` ${chalk9.gray("Active Mode:")} ${agent.getMode() === "build" ? chalk9.green.bold("BUILD") : chalk9.yellow.bold("PLAN")}`);
|
|
8290
8288
|
console.log(` ${chalk9.gray("Working Dir:")} ${chalk9.white(process.cwd())}`);
|
|
8291
8289
|
console.log(` ${chalk9.gray("Files Touched:")} ${chalk9.yellow(changes.length)} files`);
|
|
8292
8290
|
console.log(` ${chalk9.gray("Auto-Approve:")} ${safetySession.autoApproveAll ? chalk9.green("Enabled (-y)") : chalk9.gray("Confirm per action")}`);
|
|
@@ -8297,16 +8295,16 @@ Context window optimized for faster responses and lower token load.
|
|
|
8297
8295
|
if (lowerCmd === "/peers" || lowerCmd === "/mesh") {
|
|
8298
8296
|
const mesh = getActiveMeshNode();
|
|
8299
8297
|
if (!mesh) {
|
|
8300
|
-
console.log(chalk9.yellow("\
|
|
8298
|
+
console.log(chalk9.yellow("\nCross-instance mesh is disabled on this instance (--no-mesh).\n"));
|
|
8301
8299
|
} else {
|
|
8302
8300
|
const allPeers = mesh.listPeers();
|
|
8303
8301
|
const remotePeers = allPeers.filter((p) => p.nodeId !== mesh.nodeId);
|
|
8304
|
-
console.log("\n" + chalk9.bold.hex("#00A3FF")("
|
|
8302
|
+
console.log("\n" + chalk9.bold.hex("#00A3FF")("Cross-Instance Workspace Mesh (Multi-Agent Sync)"));
|
|
8305
8303
|
console.log(chalk9.dim("\u2500".repeat(70)));
|
|
8306
8304
|
console.log(` ${chalk9.bold("This Instance:")} [${chalk9.cyan.bold(mesh.role.toUpperCase())}] (Node: ${chalk9.gray(mesh.nodeId)})`);
|
|
8307
8305
|
console.log(` ${chalk9.gray("Workspace:")} ${mesh.workspace}`);
|
|
8308
8306
|
console.log(` ${chalk9.gray("Mesh Status:")} ${mesh["isHost"] ? chalk9.green("Broker Host") : chalk9.blue("Peer Client")} on 127.0.0.1:${mesh.port}`);
|
|
8309
|
-
console.log(` ${chalk9.gray("Active Mode:")} ${mesh.mode === "build" ? chalk9.green("
|
|
8307
|
+
console.log(` ${chalk9.gray("Active Mode:")} ${mesh.mode === "build" ? chalk9.green("BUILD") : chalk9.yellow("PLAN")}`);
|
|
8310
8308
|
console.log(chalk9.dim("\u2500".repeat(70)));
|
|
8311
8309
|
if (remotePeers.length === 0) {
|
|
8312
8310
|
console.log(chalk9.yellow(` No other IUB CLI instances connected yet.`));
|
|
@@ -8318,8 +8316,8 @@ Context window optimized for faster responses and lower token load.
|
|
|
8318
8316
|
const roleBadge = chalk9.bold.hex("#00A3FF")(`[${p.role.toUpperCase()}]`);
|
|
8319
8317
|
const modeBadge = p.mode === "build" ? chalk9.green("BUILD") : chalk9.yellow("PLAN");
|
|
8320
8318
|
console.log(` ${idx + 1}. ${roleBadge} (nodeId: ${chalk9.gray(p.nodeId)})`);
|
|
8321
|
-
console.log(`
|
|
8322
|
-
console.log(`
|
|
8319
|
+
console.log(` Workspace: ${chalk9.white(p.workspace)}`);
|
|
8320
|
+
console.log(` Mode: ${modeBadge} \u2022 Model: ${chalk9.cyan(p.model)} (${p.provider})`);
|
|
8323
8321
|
});
|
|
8324
8322
|
console.log(chalk9.dim("\u2500".repeat(70)) + "\n");
|
|
8325
8323
|
}
|
|
@@ -8330,14 +8328,14 @@ Context window optimized for faster responses and lower token load.
|
|
|
8330
8328
|
const parts = trimmed.split(/\s+/);
|
|
8331
8329
|
const mesh = getActiveMeshNode();
|
|
8332
8330
|
if (!mesh) {
|
|
8333
|
-
console.log(chalk9.yellow("\
|
|
8331
|
+
console.log(chalk9.yellow("\nMesh is not active on this instance.\n"));
|
|
8334
8332
|
continue;
|
|
8335
8333
|
}
|
|
8336
8334
|
if (parts.length > 1) {
|
|
8337
8335
|
const newRole = parts.slice(1).join("-").trim();
|
|
8338
8336
|
mesh.updateState({ role: newRole });
|
|
8339
8337
|
console.log(chalk9.green(`
|
|
8340
|
-
|
|
8338
|
+
Instance role updated to: [${chalk9.bold(newRole)}]
|
|
8341
8339
|
`));
|
|
8342
8340
|
} else {
|
|
8343
8341
|
console.log(chalk9.cyan(`
|
|
@@ -8356,18 +8354,18 @@ Current instance role: [${chalk9.bold(mesh.role)}] (Usage: /role <frontend|backe
|
|
|
8356
8354
|
const msg = parts.slice(2).join(" ");
|
|
8357
8355
|
const mesh = getActiveMeshNode();
|
|
8358
8356
|
if (!mesh) {
|
|
8359
|
-
console.log(chalk9.yellow("\
|
|
8357
|
+
console.log(chalk9.yellow("\nMesh is not active on this instance.\n"));
|
|
8360
8358
|
continue;
|
|
8361
8359
|
}
|
|
8362
8360
|
const result = await mesh.sendMessage(target, msg);
|
|
8363
8361
|
console.log(chalk9.green(`
|
|
8364
|
-
|
|
8362
|
+
${result}
|
|
8365
8363
|
`));
|
|
8366
8364
|
continue;
|
|
8367
8365
|
}
|
|
8368
8366
|
if (lowerCmd === "/clear" || lowerCmd === "/cls" || lowerCmd === "/reset") {
|
|
8369
8367
|
agent.resetHistory();
|
|
8370
|
-
console.log(chalk9.green("
|
|
8368
|
+
console.log(chalk9.green("Conversation history cleared! Session memory reset.\n"));
|
|
8371
8369
|
continue;
|
|
8372
8370
|
}
|
|
8373
8371
|
if (lowerCmd === "/provider") {
|
|
@@ -8381,7 +8379,7 @@ Current instance role: [${chalk9.bold(mesh.role)}] (Usage: /role <frontend|backe
|
|
|
8381
8379
|
config = newConfig;
|
|
8382
8380
|
agent.updateConfig(newConfig);
|
|
8383
8381
|
console.log(chalk9.green(`
|
|
8384
|
-
|
|
8382
|
+
Provider updated to: ${formatProviderLabel(config)} (${config.model})
|
|
8385
8383
|
`));
|
|
8386
8384
|
}
|
|
8387
8385
|
continue;
|
|
@@ -8396,7 +8394,7 @@ Current instance role: [${chalk9.bold(mesh.role)}] (Usage: /role <frontend|backe
|
|
|
8396
8394
|
config = newConfig;
|
|
8397
8395
|
agent.updateConfig(newConfig);
|
|
8398
8396
|
console.log(chalk9.green(`
|
|
8399
|
-
|
|
8397
|
+
Configuration updated: ${formatProviderLabel(config)} (${config.model})
|
|
8400
8398
|
`));
|
|
8401
8399
|
continue;
|
|
8402
8400
|
}
|
|
@@ -8417,7 +8415,7 @@ Current instance role: [${chalk9.bold(mesh.role)}] (Usage: /role <frontend|backe
|
|
|
8417
8415
|
config = newConfig;
|
|
8418
8416
|
agent.updateConfig(newConfig);
|
|
8419
8417
|
console.log(chalk9.green(`
|
|
8420
|
-
|
|
8418
|
+
Active model updated to: ${config.model} [${config.provider.toUpperCase()}]
|
|
8421
8419
|
`));
|
|
8422
8420
|
}
|
|
8423
8421
|
continue;
|
|
@@ -8471,7 +8469,7 @@ Current instance role: [${chalk9.bold(mesh.role)}] (Usage: /role <frontend|backe
|
|
|
8471
8469
|
config = newConfig;
|
|
8472
8470
|
agent.updateConfig(newConfig);
|
|
8473
8471
|
console.log(chalk9.green(`
|
|
8474
|
-
|
|
8472
|
+
Active model updated to: ${config.model} [${config.provider.toUpperCase()}]
|
|
8475
8473
|
`));
|
|
8476
8474
|
}
|
|
8477
8475
|
continue;
|
|
@@ -8498,7 +8496,7 @@ Current instance role: [${chalk9.bold(mesh.role)}] (Usage: /role <frontend|backe
|
|
|
8498
8496
|
hasAborted = true;
|
|
8499
8497
|
abortController.abort();
|
|
8500
8498
|
renderInterruptedNotice();
|
|
8501
|
-
updateFixedBottomStatus("
|
|
8499
|
+
updateFixedBottomStatus("Stopped by Escape key", {
|
|
8502
8500
|
mode: agent.getMode(),
|
|
8503
8501
|
model: config?.model || "unknown"
|
|
8504
8502
|
});
|
|
@@ -8517,7 +8515,7 @@ Current instance role: [${chalk9.bold(mesh.role)}] (Usage: /role <frontend|backe
|
|
|
8517
8515
|
if (abortController.signal.aborted || hasAborted) {
|
|
8518
8516
|
} else {
|
|
8519
8517
|
console.error(chalk9.red(`
|
|
8520
|
-
|
|
8518
|
+
Agent Error: ${err.message}
|
|
8521
8519
|
`));
|
|
8522
8520
|
}
|
|
8523
8521
|
} finally {
|
|
@@ -8543,9 +8541,9 @@ program.command("agent").alias("model").description("OpenCode-style AI agent & m
|
|
|
8543
8541
|
await selectAgentModelInteractive(config, "build");
|
|
8544
8542
|
});
|
|
8545
8543
|
program.command("mode").description("Switch agent mode between BUILD (autonomous coder) and PLAN (architect)").action(async () => {
|
|
8546
|
-
console.log(chalk9.bold.hex("#00A3FF")("\
|
|
8547
|
-
console.log(` ${chalk9.green.bold("
|
|
8548
|
-
console.log(` ${chalk9.yellow.bold("
|
|
8544
|
+
console.log(chalk9.bold.hex("#00A3FF")("\nIUB CLI Agent Modes (OpenCode Style):\n"));
|
|
8545
|
+
console.log(` ${chalk9.green.bold("BUILD Mode:")} Autonomous full-stack coder. Inspects, writes files & runs terminal commands.`);
|
|
8546
|
+
console.log(` ${chalk9.yellow.bold("PLAN Mode:")} Senior Architect. Read-only codebase investigation & architectural planning.
|
|
8549
8547
|
`);
|
|
8550
8548
|
console.log(chalk9.gray('Use "/mode", "/plan", or "/build" inside interactive chat or launch with "iubcli -M plan".\n'));
|
|
8551
8549
|
});
|
|
@@ -8620,7 +8618,7 @@ program.command("peers").alias("mesh").description("Discover and display connect
|
|
|
8620
8618
|
const node = new MeshNode({ role: "cli-scanner", workspace: process.cwd() });
|
|
8621
8619
|
await node.start();
|
|
8622
8620
|
const peers = node.listPeers().filter((p) => p.nodeId !== node.nodeId);
|
|
8623
|
-
console.log("\n" + chalk9.bold.hex("#00A3FF")("
|
|
8621
|
+
console.log("\n" + chalk9.bold.hex("#00A3FF")("Cross-Instance Workspace Mesh Status:"));
|
|
8624
8622
|
console.log(chalk9.dim("\u2500".repeat(70)));
|
|
8625
8623
|
if (peers.length === 0) {
|
|
8626
8624
|
console.log(chalk9.yellow(" No other active IUB CLI instances detected on 127.0.0.1:49152."));
|
|
@@ -8629,8 +8627,8 @@ program.command("peers").alias("mesh").description("Discover and display connect
|
|
|
8629
8627
|
console.log(chalk9.bold(` Active Peers (${peers.length}):`));
|
|
8630
8628
|
peers.forEach((p, idx) => {
|
|
8631
8629
|
console.log(` ${idx + 1}. [${chalk9.cyan.bold(p.role.toUpperCase())}] (${chalk9.gray(p.nodeId)})`);
|
|
8632
|
-
console.log(`
|
|
8633
|
-
console.log(`
|
|
8630
|
+
console.log(` Workspace: ${chalk9.white(p.workspace)}`);
|
|
8631
|
+
console.log(` Mode: ${p.mode.toUpperCase()} \u2022 Model: ${p.model} (${p.provider})`);
|
|
8634
8632
|
});
|
|
8635
8633
|
console.log(chalk9.dim("\u2500".repeat(70)) + "\n");
|
|
8636
8634
|
}
|