@orbit-build/cli 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +178 -65
- package/package.json +22 -9
- package/dist/FullscreenTui-BNSSKSLN.js +0 -14
- package/dist/chunk-QYRH36M4.js +0 -1919
- package/src/commands/LSPServer.ts +0 -231
- package/src/commands/config.ts +0 -8
- package/src/commands/customCommands.test.ts +0 -62
- package/src/commands/customCommands.ts +0 -127
- package/src/commands/doctor.ts +0 -63
- package/src/commands/exec.test.ts +0 -112
- package/src/commands/init.ts +0 -26
- package/src/commands/login.ts +0 -120
- package/src/commands/run.test.ts +0 -290
- package/src/commands/run.ts +0 -196
- package/src/index.ts +0 -97
- package/src/runtime/CommandRouter.test.ts +0 -107
- package/src/runtime/CommandRouter.ts +0 -2025
- package/src/runtime/ReplController.test.ts +0 -36
- package/src/runtime/ReplController.ts +0 -539
- package/src/tui/FullscreenTui.ts +0 -2548
- package/tsconfig.json +0 -8
- package/verify_agent_loop.js +0 -91
package/dist/index.js
CHANGED
|
@@ -118,7 +118,7 @@ import { join as join6 } from "path";
|
|
|
118
118
|
// src/tui/FullscreenTui.ts
|
|
119
119
|
import { join as join4, dirname as dirname2 } from "path";
|
|
120
120
|
import { homedir as homedir3 } from "os";
|
|
121
|
-
import { existsSync as existsSync4, readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync } from "fs";
|
|
121
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync, statSync } from "fs";
|
|
122
122
|
import { exec } from "child_process";
|
|
123
123
|
import readline from "readline";
|
|
124
124
|
import { Prompt as Prompt2, Renderer } from "@orbit-build/tui";
|
|
@@ -128,7 +128,7 @@ import { ConfigSchema } from "@orbit-build/config";
|
|
|
128
128
|
import { Prompt } from "@orbit-build/tui";
|
|
129
129
|
import picocolors4 from "picocolors";
|
|
130
130
|
import glob from "fast-glob";
|
|
131
|
-
import { existsSync as existsSync3, readFileSync as readFileSync2, readdirSync as readdirSync2 } from "fs";
|
|
131
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2, readdirSync as readdirSync2, unlinkSync } from "fs";
|
|
132
132
|
import { join as join3, dirname, resolve } from "path";
|
|
133
133
|
import { homedir as homedir2 } from "os";
|
|
134
134
|
import { PermissionEngine } from "@orbit-build/permissions";
|
|
@@ -241,7 +241,8 @@ var BUILTIN_SLASH_COMMANDS = [
|
|
|
241
241
|
"/add",
|
|
242
242
|
"/drop",
|
|
243
243
|
"/mode",
|
|
244
|
-
"/copy"
|
|
244
|
+
"/copy",
|
|
245
|
+
"/update"
|
|
245
246
|
];
|
|
246
247
|
var CommandRouter = class {
|
|
247
248
|
constructor(cwd, config, providerInstance, setProviderInstance, loop, tui, useFullscreenTui, getCandidates, setCandidates, getLocalState2, saveLocalState, tuiInteraction, multi) {
|
|
@@ -421,6 +422,7 @@ Running shell command: ${shellCmd}...`)
|
|
|
421
422
|
` ${picocolors4.green("/config")} ${picocolors4.cyan("[k=v]")} - \u67E5\u770B\u6216\u4EA4\u4E92\u5F0F/\u76F4\u63A5\u4FEE\u6539\u914D\u7F6E\u53C2\u6570`,
|
|
422
423
|
` ${picocolors4.green("/model")} ${picocolors4.cyan("[name]")} - \u52A8\u6001\u67E5\u8BE2\u6216\u5207\u6362\u6B63\u5728\u4F7F\u7528\u7684 AI \u8BED\u8A00\u5927\u6A21\u578B`,
|
|
423
424
|
` ${picocolors4.green("/mode")} ${picocolors4.cyan("[mode]")} - \u5207\u6362\u5B89\u5168\u786E\u8BA4\u6A21\u5F0F (strict, normal, auto, plan)`,
|
|
425
|
+
` ${picocolors4.green("/update")} - \u68C0\u6D4B\u5E76\u66F4\u65B0\u9879\u76EE\u4F9D\u8D56\u5305 (\u5982 npm install)`,
|
|
424
426
|
"",
|
|
425
427
|
picocolors4.bold(picocolors4.yellow(" [ Git \u63D0\u4EA4 (Git) ]")),
|
|
426
428
|
` ${picocolors4.green("/commit")} ${picocolors4.cyan("[msg]")} - \u6682\u5B58\u5DE5\u4F5C\u533A\u4FEE\u6539\u5E76\u751F\u6210\u63D0\u4EA4 (\u7A7A\u6D88\u606F\u65F6\u4F7F\u7528 LLM \u81EA\u52A8\u751F\u6210)`,
|
|
@@ -429,7 +431,7 @@ Running shell command: ${shellCmd}...`)
|
|
|
429
431
|
` ${picocolors4.green("/help")} - \u663E\u793A\u6B64\u5E2E\u52A9\u4FE1\u606F`,
|
|
430
432
|
` ${picocolors4.green("/exit")} / ${picocolors4.green("/quit")} - \u5B89\u5168\u9000\u51FA\u4EA4\u4E92\u5F0F\u7EC8\u7AEF`,
|
|
431
433
|
"",
|
|
432
|
-
picocolors4.bold(picocolors4.cyan(" [
|
|
434
|
+
picocolors4.bold(picocolors4.cyan(" [ \u7CFB\u7EDF\u63A7\u5236 (System) ]")),
|
|
433
435
|
` ${picocolors4.green("!<cmd>")} - \u76F4\u63A5\u6267\u884C\u7CFB\u7EDF\u539F\u751F Shell \u547D\u4EE4 (\u4F8B\u5982: !git diff)`,
|
|
434
436
|
""
|
|
435
437
|
].join("\n");
|
|
@@ -453,6 +455,7 @@ Running shell command: ${shellCmd}...`)
|
|
|
453
455
|
` ${picocolors4.green("/config")} ${picocolors4.cyan("[k=v]")} - View or modify configurations interactively or via key=value`,
|
|
454
456
|
` ${picocolors4.green("/model")} ${picocolors4.cyan("[name]")} - Query or dynamically swap the active AI model`,
|
|
455
457
|
` ${picocolors4.green("/mode")} ${picocolors4.cyan("[mode]")} - Switch permission safety mode (strict, normal, auto, plan)`,
|
|
458
|
+
` ${picocolors4.green("/update")} - Detect and update project dependencies (npm/pnpm/yarn install)`,
|
|
456
459
|
"",
|
|
457
460
|
picocolors4.bold(picocolors4.yellow(" [ Git Operations ]")),
|
|
458
461
|
` ${picocolors4.green("/commit")} ${picocolors4.cyan("[msg]")} - Stage all changes and commit (generates message via LLM if empty)`,
|
|
@@ -538,7 +541,7 @@ Running shell command: ${shellCmd}...`)
|
|
|
538
541
|
try {
|
|
539
542
|
const fullP = resolve(cwd, file);
|
|
540
543
|
if (existsSync3(fullP)) {
|
|
541
|
-
|
|
544
|
+
unlinkSync(fullP);
|
|
542
545
|
}
|
|
543
546
|
} catch {
|
|
544
547
|
}
|
|
@@ -568,6 +571,53 @@ Running shell command: ${shellCmd}...`)
|
|
|
568
571
|
}
|
|
569
572
|
return { shouldExit: false, processed: true };
|
|
570
573
|
}
|
|
574
|
+
if (command === "/update") {
|
|
575
|
+
const isZh = config.language === "zh";
|
|
576
|
+
const wasActive = useFullscreenTui && tui.isActive;
|
|
577
|
+
const packageJsonPath = join3(cwd, "package.json");
|
|
578
|
+
if (!existsSync3(packageJsonPath)) {
|
|
579
|
+
console.log(
|
|
580
|
+
isZh ? picocolors4.yellow("\u5F53\u524D\u5DE5\u4F5C\u533A\u6CA1\u6709\u68C0\u6D4B\u5230 package.json\uFF0C\u4E0D\u652F\u6301 npm \u66F4\u65B0\u3002") : picocolors4.yellow("No package.json found in the workspace. npm update not supported.")
|
|
581
|
+
);
|
|
582
|
+
return { shouldExit: false, processed: true };
|
|
583
|
+
}
|
|
584
|
+
let installCmd = "npm install";
|
|
585
|
+
if (existsSync3(join3(cwd, "pnpm-lock.yaml"))) {
|
|
586
|
+
installCmd = "pnpm install";
|
|
587
|
+
} else if (existsSync3(join3(cwd, "yarn.lock"))) {
|
|
588
|
+
installCmd = "yarn install";
|
|
589
|
+
} else if (existsSync3(join3(cwd, "bun.lockb"))) {
|
|
590
|
+
installCmd = "bun install";
|
|
591
|
+
}
|
|
592
|
+
if (wasActive) tui.stop();
|
|
593
|
+
try {
|
|
594
|
+
const approved = await Prompt.askApproval(
|
|
595
|
+
isZh ? `\u68C0\u6D4B\u5230\u9879\u76EE\u4F9D\u8D56\u9700\u8981\u66F4\u65B0\uFF0C\u662F\u5426\u8FD0\u884C "${installCmd}"\uFF1F` : `NPM dependencies need update. Run "${installCmd}"?`
|
|
596
|
+
);
|
|
597
|
+
if (approved) {
|
|
598
|
+
console.log(picocolors4.cyan(`
|
|
599
|
+
\u25CF Running "${installCmd}"...`));
|
|
600
|
+
const { execSync: execSync2 } = await import("child_process");
|
|
601
|
+
execSync2(installCmd, { cwd, stdio: "inherit" });
|
|
602
|
+
console.log(picocolors4.green(`\u2714 Dependencies updated successfully.
|
|
603
|
+
`));
|
|
604
|
+
tui.npmNeedsUpdate = false;
|
|
605
|
+
tui.lastNpmCheckTime = Date.now();
|
|
606
|
+
} else {
|
|
607
|
+
console.log(picocolors4.yellow(`
|
|
608
|
+
\u2716 Update cancelled by user.
|
|
609
|
+
`));
|
|
610
|
+
}
|
|
611
|
+
} catch (err) {
|
|
612
|
+
console.log(picocolors4.red(`
|
|
613
|
+
\u2716 Update failed: ${err.message}
|
|
614
|
+
`));
|
|
615
|
+
} finally {
|
|
616
|
+
tui.syncFromLoop(loop);
|
|
617
|
+
if (wasActive) tui.start(config.budgetLimit);
|
|
618
|
+
}
|
|
619
|
+
return { shouldExit: false, processed: true };
|
|
620
|
+
}
|
|
571
621
|
if (command === "/status") {
|
|
572
622
|
const activeConfig = loop.getConfig();
|
|
573
623
|
const activeModel = loop.getModelOverride() || activeConfig.models.default;
|
|
@@ -932,14 +982,6 @@ Running shell command: ${shellCmd}...`)
|
|
|
932
982
|
{
|
|
933
983
|
value: "deepseek-v4-pro",
|
|
934
984
|
label: "deepseek-v4-pro (DeepSeek-V4 / Advanced & Pro)"
|
|
935
|
-
},
|
|
936
|
-
{
|
|
937
|
-
value: "deepseek-chat",
|
|
938
|
-
label: "deepseek-chat (DeepSeek-V3 / Chat)"
|
|
939
|
-
},
|
|
940
|
-
{
|
|
941
|
-
value: "deepseek-reasoner",
|
|
942
|
-
label: "deepseek-reasoner (DeepSeek-R1 / Reasoner)"
|
|
943
985
|
}
|
|
944
986
|
];
|
|
945
987
|
} else if (providerId === "ollama") {
|
|
@@ -1199,7 +1241,7 @@ ${diff.substring(0, 2e4)}`
|
|
|
1199
1241
|
return { shouldExit: false, processed: true };
|
|
1200
1242
|
}
|
|
1201
1243
|
const { isAbsolute, relative, resolve: pathResolve } = await import("path");
|
|
1202
|
-
const { statSync } = await import("fs");
|
|
1244
|
+
const { statSync: statSync2 } = await import("fs");
|
|
1203
1245
|
const absPath = isAbsolute(fileArg) ? fileArg : pathResolve(cwd, fileArg);
|
|
1204
1246
|
const relPath = relative(cwd, absPath).replace(/\\/g, "/");
|
|
1205
1247
|
if (!existsSync3(absPath)) {
|
|
@@ -1245,7 +1287,7 @@ ${matched.map((m) => ` \u2022 ${m}`).join("\n")}`
|
|
|
1245
1287
|
return { shouldExit: false, processed: true };
|
|
1246
1288
|
}
|
|
1247
1289
|
try {
|
|
1248
|
-
const stat =
|
|
1290
|
+
const stat = statSync2(absPath);
|
|
1249
1291
|
if (stat.isDirectory()) {
|
|
1250
1292
|
const files = await glob("**/*", {
|
|
1251
1293
|
cwd: absPath,
|
|
@@ -1514,7 +1556,7 @@ ${matched.map((m) => ` \u2022 ${m}`).join("\n")}`
|
|
|
1514
1556
|
idToDelete = await Prompt.askSelect(
|
|
1515
1557
|
"Choose a session to delete:",
|
|
1516
1558
|
deleteOptions
|
|
1517
|
-
);
|
|
1559
|
+
) ?? "";
|
|
1518
1560
|
} else {
|
|
1519
1561
|
const idx = parseInt(idToDelete, 10);
|
|
1520
1562
|
if (!isNaN(idx) && idx >= 1 && idx <= sessions.length) {
|
|
@@ -1541,7 +1583,7 @@ ${matched.map((m) => ` \u2022 ${m}`).join("\n")}`
|
|
|
1541
1583
|
{ value: "yes", label: "Yes, delete it" },
|
|
1542
1584
|
{ value: "no", label: "No, cancel" }
|
|
1543
1585
|
]
|
|
1544
|
-
);
|
|
1586
|
+
) ?? "no";
|
|
1545
1587
|
}
|
|
1546
1588
|
if (confirm === "yes") {
|
|
1547
1589
|
handleDelete(idToDelete);
|
|
@@ -1635,6 +1677,7 @@ ${matched.map((m) => ` \u2022 ${m}`).join("\n")}`
|
|
|
1635
1677
|
value: "cancel",
|
|
1636
1678
|
label: "Cancel"
|
|
1637
1679
|
});
|
|
1680
|
+
stopTuiIfNeeded();
|
|
1638
1681
|
const selectedSessionId = await Prompt.askSelect(
|
|
1639
1682
|
"Choose a session to load:",
|
|
1640
1683
|
sessionOptions
|
|
@@ -2034,6 +2077,22 @@ async function pageText(text) {
|
|
|
2034
2077
|
process.stdin.pause();
|
|
2035
2078
|
}
|
|
2036
2079
|
}
|
|
2080
|
+
var MORANDI = {
|
|
2081
|
+
user: (s) => `\x1B[38;2;142;163;175m${s}\x1B[0m`,
|
|
2082
|
+
userBold: (s) => `\x1B[1;38;2;142;163;175m${s}\x1B[0m`,
|
|
2083
|
+
asst: (s) => `\x1B[38;2;143;153;129m${s}\x1B[0m`,
|
|
2084
|
+
asstBold: (s) => `\x1B[1;38;2;143;153;129m${s}\x1B[0m`,
|
|
2085
|
+
cyan: (s) => `\x1B[38;2;142;163;175m${s}\x1B[0m`,
|
|
2086
|
+
accent: (s) => `\x1B[38;2;200;170;120m${s}\x1B[0m`,
|
|
2087
|
+
completed: (s) => `\x1B[38;2;135;165;130m${s}\x1B[0m`,
|
|
2088
|
+
failed: (s) => `\x1B[38;2;180;120;120m${s}\x1B[0m`,
|
|
2089
|
+
warn: (s) => `\x1B[38;2;180;140;130m${s}\x1B[0m`,
|
|
2090
|
+
white: (s) => `\x1B[38;2;230;225;215m${s}\x1B[0m`,
|
|
2091
|
+
whiteBold: (s) => `\x1B[1;38;2;230;225;215m${s}\x1B[0m`,
|
|
2092
|
+
gray: (s) => `\x1B[38;2;150;150;150m${s}\x1B[0m`,
|
|
2093
|
+
dim: (s) => `\x1B[2;38;2;110;110;110m${s}\x1B[0m`
|
|
2094
|
+
};
|
|
2095
|
+
var INPUT_PREFIX_WIDTH = 12;
|
|
2037
2096
|
var FullscreenTui = class {
|
|
2038
2097
|
constructor(cwd, modelName, version, config) {
|
|
2039
2098
|
this.cwd = cwd;
|
|
@@ -2080,6 +2139,9 @@ var FullscreenTui = class {
|
|
|
2080
2139
|
thoughtElapsed = 0;
|
|
2081
2140
|
isThinking = false;
|
|
2082
2141
|
sessionCost = 0;
|
|
2142
|
+
lastNpmCheckTime = 0;
|
|
2143
|
+
isCheckingNpm = false;
|
|
2144
|
+
npmNeedsUpdate = false;
|
|
2083
2145
|
totalInputTokens = 0;
|
|
2084
2146
|
totalCacheReadTokens = 0;
|
|
2085
2147
|
totalOutputTokens = 0;
|
|
@@ -2099,6 +2161,8 @@ var FullscreenTui = class {
|
|
|
2099
2161
|
modelNameGetter = () => this.modelName;
|
|
2100
2162
|
permissionsMode = "normal";
|
|
2101
2163
|
hideAutocomplete = false;
|
|
2164
|
+
/** Cached logo-line widths — static strings, computed once. */
|
|
2165
|
+
_cachedLogoWidths = null;
|
|
2102
2166
|
cachedPlanLines = [];
|
|
2103
2167
|
lastPlanReadTime = 0;
|
|
2104
2168
|
activeContextFiles = [];
|
|
@@ -2133,7 +2197,7 @@ var FullscreenTui = class {
|
|
|
2133
2197
|
const planItems = [];
|
|
2134
2198
|
for (const line of lines) {
|
|
2135
2199
|
const trimmed = line.trim();
|
|
2136
|
-
if (trimmed.startsWith("- [ ") || trimmed.startsWith("- [x") || trimmed.startsWith("- [/")
|
|
2200
|
+
if (trimmed.startsWith("- [ ") || trimmed.startsWith("- [x") || trimmed.startsWith("- [/")) {
|
|
2137
2201
|
planItems.push(trimmed);
|
|
2138
2202
|
}
|
|
2139
2203
|
}
|
|
@@ -2291,6 +2355,53 @@ var FullscreenTui = class {
|
|
|
2291
2355
|
}
|
|
2292
2356
|
process.stdout.write = this.originalWrite;
|
|
2293
2357
|
}
|
|
2358
|
+
getNpmNeedsUpdate() {
|
|
2359
|
+
const now = Date.now();
|
|
2360
|
+
if (now - this.lastNpmCheckTime > 8e3) {
|
|
2361
|
+
this.refreshNpmStatusAsync().catch(() => {
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
return this.npmNeedsUpdate;
|
|
2365
|
+
}
|
|
2366
|
+
async refreshNpmStatusAsync() {
|
|
2367
|
+
if (this.isCheckingNpm) return;
|
|
2368
|
+
this.isCheckingNpm = true;
|
|
2369
|
+
this.lastNpmCheckTime = Date.now();
|
|
2370
|
+
try {
|
|
2371
|
+
const packageJsonPath = join4(this.cwd, "package.json");
|
|
2372
|
+
if (!existsSync4(packageJsonPath)) {
|
|
2373
|
+
this.npmNeedsUpdate = false;
|
|
2374
|
+
this.isCheckingNpm = false;
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
2377
|
+
const nodeModulesPath = join4(this.cwd, "node_modules");
|
|
2378
|
+
if (!existsSync4(nodeModulesPath)) {
|
|
2379
|
+
this.npmNeedsUpdate = true;
|
|
2380
|
+
this.isCheckingNpm = false;
|
|
2381
|
+
this.draw();
|
|
2382
|
+
return;
|
|
2383
|
+
}
|
|
2384
|
+
const packageJsonStat = statSync(packageJsonPath);
|
|
2385
|
+
let maxConfigMtime = packageJsonStat.mtimeMs;
|
|
2386
|
+
const lockfiles = ["package-lock.json", "pnpm-lock.yaml", "yarn.lock", "bun.lockb"];
|
|
2387
|
+
for (const lf of lockfiles) {
|
|
2388
|
+
const lfPath = join4(this.cwd, lf);
|
|
2389
|
+
if (existsSync4(lfPath)) {
|
|
2390
|
+
const stat = statSync(lfPath);
|
|
2391
|
+
if (stat.mtimeMs > maxConfigMtime) {
|
|
2392
|
+
maxConfigMtime = stat.mtimeMs;
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
const nodeModulesStat = statSync(nodeModulesPath);
|
|
2397
|
+
this.npmNeedsUpdate = maxConfigMtime > nodeModulesStat.mtimeMs;
|
|
2398
|
+
} catch {
|
|
2399
|
+
this.npmNeedsUpdate = false;
|
|
2400
|
+
} finally {
|
|
2401
|
+
this.isCheckingNpm = false;
|
|
2402
|
+
this.draw();
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2294
2405
|
getGitSummary() {
|
|
2295
2406
|
const now = Date.now();
|
|
2296
2407
|
if (!this.cachedGitSummary) {
|
|
@@ -2416,7 +2527,7 @@ var FullscreenTui = class {
|
|
|
2416
2527
|
if (this.handleScrollInput(str, key)) {
|
|
2417
2528
|
return;
|
|
2418
2529
|
}
|
|
2419
|
-
if (key && key.ctrl && key.name === "c") {
|
|
2530
|
+
if (key && (key.name === "escape" || key.ctrl && key.name === "c")) {
|
|
2420
2531
|
if (this.inputBuffer.length > 0) {
|
|
2421
2532
|
this.inputBuffer = "";
|
|
2422
2533
|
this.cursorPosition = 0;
|
|
@@ -2610,16 +2721,12 @@ var FullscreenTui = class {
|
|
|
2610
2721
|
if (defaultProvider?.includes("deepseek")) {
|
|
2611
2722
|
models = [
|
|
2612
2723
|
"deepseek-v4-flash",
|
|
2613
|
-
"deepseek-v4-pro"
|
|
2614
|
-
"deepseek-chat",
|
|
2615
|
-
"deepseek-reasoner"
|
|
2724
|
+
"deepseek-v4-pro"
|
|
2616
2725
|
];
|
|
2617
2726
|
} else {
|
|
2618
2727
|
models = [
|
|
2619
2728
|
"gpt-4o",
|
|
2620
|
-
"gpt-4o-mini"
|
|
2621
|
-
"deepseek-chat",
|
|
2622
|
-
"deepseek-reasoner"
|
|
2729
|
+
"gpt-4o-mini"
|
|
2623
2730
|
];
|
|
2624
2731
|
}
|
|
2625
2732
|
} else if (providerType === "ollama") {
|
|
@@ -2727,11 +2834,13 @@ var FullscreenTui = class {
|
|
|
2727
2834
|
const localIdx = localAsstIdx[i];
|
|
2728
2835
|
if (localIdx !== void 0) {
|
|
2729
2836
|
this.history[localIdx].text = textBlock.text;
|
|
2837
|
+
this.history[localIdx].model = loopMsg.metadata?.model;
|
|
2730
2838
|
} else {
|
|
2731
2839
|
this.history.push({
|
|
2732
2840
|
role: "assistant",
|
|
2733
2841
|
text: textBlock.text,
|
|
2734
|
-
attempt: i + 1
|
|
2842
|
+
attempt: i + 1,
|
|
2843
|
+
model: loopMsg.metadata?.model
|
|
2735
2844
|
});
|
|
2736
2845
|
}
|
|
2737
2846
|
}
|
|
@@ -2759,7 +2868,8 @@ var FullscreenTui = class {
|
|
|
2759
2868
|
this.history.push({
|
|
2760
2869
|
role: "assistant",
|
|
2761
2870
|
text: textBlock?.text || "",
|
|
2762
|
-
attempt
|
|
2871
|
+
attempt,
|
|
2872
|
+
model: msg.metadata?.model
|
|
2763
2873
|
});
|
|
2764
2874
|
} else if (msg.role === "system") {
|
|
2765
2875
|
const text = msg.content.map((c) => c.type === "text" ? c.text : "").join("");
|
|
@@ -3066,7 +3176,13 @@ var FullscreenTui = class {
|
|
|
3066
3176
|
}
|
|
3067
3177
|
} else if (key && key.name === "escape") {
|
|
3068
3178
|
this.activeCommandIndex = 0;
|
|
3069
|
-
this.hideAutocomplete
|
|
3179
|
+
if (!this.hideAutocomplete) {
|
|
3180
|
+
this.hideAutocomplete = true;
|
|
3181
|
+
} else if (this.inputBuffer.length > 0) {
|
|
3182
|
+
this.inputBuffer = "";
|
|
3183
|
+
this.cursorPosition = 0;
|
|
3184
|
+
}
|
|
3185
|
+
this.render();
|
|
3070
3186
|
} else if (str && !/[\u0000-\u001f\u007f]/.test(str) && (!key || !key.ctrl && !key.meta && key.name !== "tab")) {
|
|
3071
3187
|
this.activeCommandIndex = 0;
|
|
3072
3188
|
this.hideAutocomplete = false;
|
|
@@ -3180,21 +3296,7 @@ var FullscreenTui = class {
|
|
|
3180
3296
|
render(forceFull = false) {
|
|
3181
3297
|
const columns = Math.max(40, process.stdout.columns || 80);
|
|
3182
3298
|
const rows = Math.max(10, process.stdout.rows || 24);
|
|
3183
|
-
const morandi =
|
|
3184
|
-
user: (s) => `\x1B[38;2;142;163;175m${s}\x1B[0m`,
|
|
3185
|
-
userBold: (s) => `\x1B[1;38;2;142;163;175m${s}\x1B[0m`,
|
|
3186
|
-
asst: (s) => `\x1B[38;2;143;153;129m${s}\x1B[0m`,
|
|
3187
|
-
asstBold: (s) => `\x1B[1;38;2;143;153;129m${s}\x1B[0m`,
|
|
3188
|
-
cyan: (s) => `\x1B[38;2;142;163;175m${s}\x1B[0m`,
|
|
3189
|
-
accent: (s) => `\x1B[38;2;200;170;120m${s}\x1B[0m`,
|
|
3190
|
-
completed: (s) => `\x1B[38;2;135;165;130m${s}\x1B[0m`,
|
|
3191
|
-
failed: (s) => `\x1B[38;2;180;120;120m${s}\x1B[0m`,
|
|
3192
|
-
warn: (s) => `\x1B[38;2;180;140;130m${s}\x1B[0m`,
|
|
3193
|
-
white: (s) => `\x1B[38;2;230;225;215m${s}\x1B[0m`,
|
|
3194
|
-
whiteBold: (s) => `\x1B[1;38;2;230;225;215m${s}\x1B[0m`,
|
|
3195
|
-
gray: (s) => `\x1B[38;2;150;150;150m${s}\x1B[0m`,
|
|
3196
|
-
dim: (s) => `\x1B[2;38;2;110;110;110m${s}\x1B[0m`
|
|
3197
|
-
};
|
|
3299
|
+
const morandi = MORANDI;
|
|
3198
3300
|
const isWaitingInput = this.resolveInput !== null;
|
|
3199
3301
|
const isInputActive = isWaitingInput || this.thinkingKeypressListener !== null;
|
|
3200
3302
|
const hasInput = isInputActive && this.inputBuffer.length > 0;
|
|
@@ -3302,7 +3404,7 @@ var FullscreenTui = class {
|
|
|
3302
3404
|
let rightPart = "";
|
|
3303
3405
|
let rightW = 0;
|
|
3304
3406
|
if (hint) {
|
|
3305
|
-
const availableRightW = maxPopupWidth - leftW -
|
|
3407
|
+
const availableRightW = maxPopupWidth - leftW - 1 - 4;
|
|
3306
3408
|
if (availableRightW >= 5) {
|
|
3307
3409
|
const rawRightW = this.getStringWidth(hint);
|
|
3308
3410
|
if (rawRightW <= availableRightW) {
|
|
@@ -3370,20 +3472,25 @@ var FullscreenTui = class {
|
|
|
3370
3472
|
);
|
|
3371
3473
|
bottomLines.push(" " + statusText + " ".repeat(spacing) + keybindings);
|
|
3372
3474
|
const bottomHeight = bottomLines.length;
|
|
3373
|
-
const cleanModel = this.modelNameGetter().replace(/\[
|
|
3475
|
+
const cleanModel = this.modelNameGetter().replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "");
|
|
3374
3476
|
const gitSummary = this.getGitSummary();
|
|
3375
3477
|
const gitBranch = gitSummary.branch;
|
|
3478
|
+
const heartColor = this.getNpmNeedsUpdate() ? `\x1B[38;2;230;190;80m` : `\x1B[38;2;230;110;110m`;
|
|
3376
3479
|
const logoLines = [
|
|
3377
3480
|
`\x1B[38;2;142;163;175m /\\___/\\ \x1B[0m`,
|
|
3378
3481
|
`\x1B[38;2;142;163;175m ( o.o ) \x1B[0m`,
|
|
3379
|
-
`\x1B[38;2;142;163;175m /
|
|
3482
|
+
`\x1B[38;2;142;163;175m / >${heartColor}\u2665\x1B[38;2;142;163;175m< \\ \x1B[0m`,
|
|
3380
3483
|
`\x1B[38;2;142;163;175m (__/ \\__) \x1B[0m`
|
|
3381
3484
|
];
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3485
|
+
if (!this._cachedLogoWidths) {
|
|
3486
|
+
const w02 = this.getStringWidth(logoLines[0]);
|
|
3487
|
+
const w12 = this.getStringWidth(logoLines[1]);
|
|
3488
|
+
const w22 = this.getStringWidth(logoLines[2]);
|
|
3489
|
+
const w32 = this.getStringWidth(logoLines[3]);
|
|
3490
|
+
const maxW = Math.max(w02, w12, w22, w32);
|
|
3491
|
+
this._cachedLogoWidths = { w0: w02, w1: w12, w2: w22, w3: w32, maxW };
|
|
3492
|
+
}
|
|
3493
|
+
const { w0, w1, w2, w3, maxW: maxLogoW } = this._cachedLogoWidths;
|
|
3387
3494
|
const pad0 = " ".repeat(maxLogoW - w0);
|
|
3388
3495
|
const pad1 = " ".repeat(maxLogoW - w1);
|
|
3389
3496
|
const pad2 = " ".repeat(maxLogoW - w2);
|
|
@@ -3439,19 +3546,17 @@ var FullscreenTui = class {
|
|
|
3439
3546
|
const cleanHeaderModel = cleanModel.split("/").pop() || cleanModel;
|
|
3440
3547
|
let headerLines;
|
|
3441
3548
|
if (columns < 76) {
|
|
3442
|
-
const modelWidth = Math.max(8, columns - 16);
|
|
3443
|
-
const displayModel = this.getStringWidth(cleanHeaderModel) > modelWidth ? this.truncateToWidth(cleanHeaderModel, modelWidth - 3) + "..." : cleanHeaderModel;
|
|
3444
3549
|
const compactPath = truncatePath(shortCwd, Math.max(8, columns - 15));
|
|
3445
3550
|
const compactBranch = gitBranch === "no-git" ? "" : ` \xB7 ${gitBranch.length > 12 ? gitBranch.slice(0, 9) + "..." : gitBranch}`;
|
|
3446
3551
|
headerLines = [
|
|
3447
|
-
` ${morandi.whiteBold("O R B I T")}
|
|
3552
|
+
` ${morandi.whiteBold("O R B I T")}`,
|
|
3448
3553
|
` ${morandi.dim("workspace:")} ${morandi.gray(compactPath)}`,
|
|
3449
3554
|
` ${morandi.dim(cacheText)}${morandi.dim(compactBranch)}`
|
|
3450
3555
|
];
|
|
3451
3556
|
} else {
|
|
3452
|
-
const headerLine1 = ` ${logoLines[0]}${pad0}
|
|
3453
|
-
const headerLine2 = ` ${logoLines[1]}${pad1} ${" "
|
|
3454
|
-
const headerLine3 = ` ${logoLines[2]}${pad2}
|
|
3557
|
+
const headerLine1 = ` ${logoLines[0]}${pad0}`;
|
|
3558
|
+
const headerLine2 = ` ${logoLines[1]}${pad1} ${morandi.whiteBold("O R B I T")} ${morandi.dim("workspace:")} ${morandi.gray(displayPath)}${branchText}`;
|
|
3559
|
+
const headerLine3 = ` ${logoLines[2]}${pad2} ${morandi.dim(cacheText)}`;
|
|
3455
3560
|
const headerLine4 = ` ${logoLines[3]}${pad3}`;
|
|
3456
3561
|
headerLines = [headerLine1, headerLine2, headerLine3, headerLine4];
|
|
3457
3562
|
}
|
|
@@ -3576,13 +3681,15 @@ var FullscreenTui = class {
|
|
|
3576
3681
|
}
|
|
3577
3682
|
asstLines.push(...asstObj._formattedCached);
|
|
3578
3683
|
}
|
|
3684
|
+
const turnModel = turn.assistant?.model || cleanModel;
|
|
3685
|
+
const cleanTurnModel = turnModel.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "");
|
|
3579
3686
|
let footerStatusLine = "";
|
|
3580
3687
|
const lastSys = turn.system[turn.system.length - 1];
|
|
3581
3688
|
if (lastSys && lastSys.text.includes("Failed")) {
|
|
3582
|
-
footerStatusLine = `${morandi.failed("failed")} \xB7 ${morandi.dim(
|
|
3689
|
+
footerStatusLine = `${morandi.failed("failed")} \xB7 ${morandi.dim(cleanTurnModel)}`;
|
|
3583
3690
|
} else if (turn.assistant.totalTime !== void 0) {
|
|
3584
3691
|
const sec = (turn.assistant.totalTime / 1e3).toFixed(1);
|
|
3585
|
-
footerStatusLine = `${morandi.completed("completed")} \xB7 ${morandi.dim(
|
|
3692
|
+
footerStatusLine = `${morandi.completed("completed")} \xB7 ${morandi.dim(cleanTurnModel)} \xB7 ${morandi.dim(sec + "s")}`;
|
|
3586
3693
|
}
|
|
3587
3694
|
if (footerStatusLine) {
|
|
3588
3695
|
asstLines.push("");
|
|
@@ -3593,7 +3700,7 @@ var FullscreenTui = class {
|
|
|
3593
3700
|
wrappedAsstLines.push(...this.wrapLine(line, columns - 10));
|
|
3594
3701
|
}
|
|
3595
3702
|
renderedLines.push(
|
|
3596
|
-
" " + morandi.asstBold(`\u{1F916} Orbit (${
|
|
3703
|
+
" " + morandi.asstBold(`\u{1F916} Orbit (${cleanTurnModel})`)
|
|
3597
3704
|
);
|
|
3598
3705
|
renderedLines.push(aBorder);
|
|
3599
3706
|
for (const line of wrappedAsstLines) {
|
|
@@ -3738,7 +3845,7 @@ var FullscreenTui = class {
|
|
|
3738
3845
|
}
|
|
3739
3846
|
tempLen += line.length;
|
|
3740
3847
|
}
|
|
3741
|
-
const lineStartX = cursorLineIndex === 0 ?
|
|
3848
|
+
const lineStartX = cursorLineIndex === 0 ? INPUT_PREFIX_WIDTH : 12;
|
|
3742
3849
|
const targetX = lineStartX + xOffset;
|
|
3743
3850
|
const linesUp = formattedLines.length - cursorLineIndex + 1;
|
|
3744
3851
|
cursorSequence2 = `\x1B[${linesUp}A\x1B[${targetX + 1}G\x1B[?25h`;
|
|
@@ -3767,7 +3874,7 @@ var FullscreenTui = class {
|
|
|
3767
3874
|
}
|
|
3768
3875
|
tempLen += line.length;
|
|
3769
3876
|
}
|
|
3770
|
-
const lineStartX = cursorLineIndex === 0 ?
|
|
3877
|
+
const lineStartX = cursorLineIndex === 0 ? INPUT_PREFIX_WIDTH : 12;
|
|
3771
3878
|
const targetX = lineStartX + xOffset;
|
|
3772
3879
|
const linesUp = formattedLines.length - cursorLineIndex + 1;
|
|
3773
3880
|
cursorSequence = `\x1B[${linesUp}A\x1B[${targetX + 1}G\x1B[?25h`;
|
|
@@ -3959,7 +4066,7 @@ import {
|
|
|
3959
4066
|
eventBus,
|
|
3960
4067
|
AutocompleteEngine
|
|
3961
4068
|
} from "@orbit-build/core";
|
|
3962
|
-
import { Prompt as Prompt3, Renderer as Renderer2 } from "@orbit-build/tui";
|
|
4069
|
+
import { Prompt as Prompt3, Renderer as Renderer2, DiffView } from "@orbit-build/tui";
|
|
3963
4070
|
import picocolors5 from "picocolors";
|
|
3964
4071
|
import { existsSync as existsSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync3, mkdirSync as mkdirSync2, watch } from "fs";
|
|
3965
4072
|
import { join as join5, dirname as dirname3, resolve as resolve2 } from "path";
|
|
@@ -4122,6 +4229,12 @@ Risk Warning: ${reason}`);
|
|
|
4122
4229
|
});
|
|
4123
4230
|
if (resumeSessionId && useFullscreenTui) {
|
|
4124
4231
|
tui.loadHistory(loop.getHistory());
|
|
4232
|
+
tui.setCost(
|
|
4233
|
+
loop.getSessionCost(),
|
|
4234
|
+
loop.getTotalInputTokens(),
|
|
4235
|
+
loop.getTotalCacheReadTokens(),
|
|
4236
|
+
loop.getTotalOutputTokens()
|
|
4237
|
+
);
|
|
4125
4238
|
}
|
|
4126
4239
|
tui.setModelNameGetter(
|
|
4127
4240
|
() => loop.getModelOverride() || this.config.models.default
|
|
@@ -4433,10 +4546,10 @@ async function runAgent(cwd, task, cliOverrides, multi, options) {
|
|
|
4433
4546
|
}
|
|
4434
4547
|
if (config.models) {
|
|
4435
4548
|
if (config.models.default) {
|
|
4436
|
-
config.models.default = config.models.default.replace(/\[
|
|
4549
|
+
config.models.default = config.models.default.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "");
|
|
4437
4550
|
}
|
|
4438
4551
|
if (config.models.fast) {
|
|
4439
|
-
config.models.fast = config.models.fast.replace(/\[
|
|
4552
|
+
config.models.fast = config.models.fast.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "");
|
|
4440
4553
|
}
|
|
4441
4554
|
}
|
|
4442
4555
|
const providerName = config.provider.default;
|
package/package.json
CHANGED
|
@@ -1,27 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbit-build/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"orbit": "./dist/index.js"
|
|
7
7
|
},
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
10
23
|
"dependencies": {
|
|
11
24
|
"picocolors": "^1.0.1",
|
|
12
25
|
"commander": "^12.1.0",
|
|
13
26
|
"fast-glob": "^3.3.2",
|
|
14
27
|
"yaml": "^2.4.5",
|
|
15
28
|
"zod": "^3.23.8",
|
|
16
|
-
"@orbit-build/shared": "0.1.
|
|
17
|
-
"@orbit-build/config": "0.1.
|
|
18
|
-
"@orbit-build/
|
|
19
|
-
"@orbit-build/
|
|
20
|
-
"@orbit-build/
|
|
21
|
-
"@orbit-build/permissions": "0.1.
|
|
22
|
-
"@orbit-build/tui": "0.1.
|
|
29
|
+
"@orbit-build/shared": "0.1.1",
|
|
30
|
+
"@orbit-build/config": "0.1.1",
|
|
31
|
+
"@orbit-build/model-providers": "0.1.1",
|
|
32
|
+
"@orbit-build/context-engine": "0.1.1",
|
|
33
|
+
"@orbit-build/core": "0.1.1",
|
|
34
|
+
"@orbit-build/permissions": "0.1.1",
|
|
35
|
+
"@orbit-build/tui": "0.1.1"
|
|
23
36
|
},
|
|
24
37
|
"scripts": {
|
|
25
|
-
"build": "tsup src/index.ts --format esm --dts"
|
|
38
|
+
"build": "tsup src/index.ts --format esm --dts --clean"
|
|
26
39
|
}
|
|
27
40
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FullscreenTui,
|
|
3
|
-
nextCodePointIndex,
|
|
4
|
-
pageText,
|
|
5
|
-
parseMouseWheelDirection,
|
|
6
|
-
previousCodePointIndex
|
|
7
|
-
} from "./chunk-QYRH36M4.js";
|
|
8
|
-
export {
|
|
9
|
-
FullscreenTui,
|
|
10
|
-
nextCodePointIndex,
|
|
11
|
-
pageText,
|
|
12
|
-
parseMouseWheelDirection,
|
|
13
|
-
previousCodePointIndex
|
|
14
|
-
};
|