open-agents-ai 0.31.1 → 0.31.2
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 +80 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11662,7 +11662,9 @@ ${tail}`;
|
|
|
11662
11662
|
return sum;
|
|
11663
11663
|
}, 0);
|
|
11664
11664
|
const estimatedTokens = totalChars / 4;
|
|
11665
|
-
|
|
11665
|
+
const ctxWinThreshold = this.options.contextWindowSize > 0 ? Math.floor(this.options.contextWindowSize * 0.75) : Infinity;
|
|
11666
|
+
const effectiveThreshold = Math.min(this.options.compactionThreshold, ctxWinThreshold);
|
|
11667
|
+
if (estimatedTokens < effectiveThreshold) {
|
|
11666
11668
|
return messages;
|
|
11667
11669
|
}
|
|
11668
11670
|
const ctxWin = this.options.contextWindowSize;
|
|
@@ -20348,6 +20350,35 @@ var init_status_bar = __esm({
|
|
|
20348
20350
|
setInputStateProvider(provider) {
|
|
20349
20351
|
this.inputStateProvider = provider;
|
|
20350
20352
|
}
|
|
20353
|
+
/** Sorted list of slash command/skill completions (e.g. ["/help", "/model", ...]) */
|
|
20354
|
+
_completions = [];
|
|
20355
|
+
/**
|
|
20356
|
+
* Set the list of available slash commands and skills for ghost-text autocomplete.
|
|
20357
|
+
* Should include the leading "/" (e.g. "/help", "/model", "/ralph").
|
|
20358
|
+
*/
|
|
20359
|
+
setCompletions(completions) {
|
|
20360
|
+
this._completions = completions.slice().sort();
|
|
20361
|
+
}
|
|
20362
|
+
/**
|
|
20363
|
+
* Find the best completion match for current input.
|
|
20364
|
+
* Returns the suffix to show as ghost text, or empty string if no match.
|
|
20365
|
+
* Only shows ghost when cursor is at end of input.
|
|
20366
|
+
*/
|
|
20367
|
+
getGhostText(inputLine, cursorPos) {
|
|
20368
|
+
if (!inputLine.startsWith("/") || inputLine.length < 2)
|
|
20369
|
+
return "";
|
|
20370
|
+
if (cursorPos !== void 0 && cursorPos < inputLine.length)
|
|
20371
|
+
return "";
|
|
20372
|
+
if (inputLine.includes(" "))
|
|
20373
|
+
return "";
|
|
20374
|
+
const lower = inputLine.toLowerCase();
|
|
20375
|
+
for (const cmd of this._completions) {
|
|
20376
|
+
if (cmd.toLowerCase().startsWith(lower) && cmd.length > inputLine.length) {
|
|
20377
|
+
return cmd.slice(inputLine.length);
|
|
20378
|
+
}
|
|
20379
|
+
}
|
|
20380
|
+
return "";
|
|
20381
|
+
}
|
|
20351
20382
|
/** Set recording indicator state (blinking red ●) */
|
|
20352
20383
|
setRecording(active) {
|
|
20353
20384
|
this._recording = active;
|
|
@@ -20679,9 +20710,11 @@ var init_status_bar = __esm({
|
|
|
20679
20710
|
const inputState = this.inputStateProvider?.();
|
|
20680
20711
|
const fullLine = inputState?.line ?? "";
|
|
20681
20712
|
const cursorPos = inputState?.cursor ?? 0;
|
|
20713
|
+
const ghost = this.getGhostText(fullLine, cursorPos);
|
|
20682
20714
|
if (fullLine.length <= availWidth) {
|
|
20715
|
+
const displayLine = ghost ? fullLine + `\x1B[2m\x1B[38;5;240m${ghost}\x1B[0m` : fullLine;
|
|
20683
20716
|
return {
|
|
20684
|
-
lines: [
|
|
20717
|
+
lines: [displayLine],
|
|
20685
20718
|
cursorRow: 0,
|
|
20686
20719
|
cursorCol: this.promptWidth + cursorPos + 1
|
|
20687
20720
|
};
|
|
@@ -21508,14 +21541,58 @@ async function startInteractive(config, repoPath) {
|
|
|
21508
21541
|
const idlePrompt = `${c2.bold(c2.white("\u276F "))}`;
|
|
21509
21542
|
const activePrompt = `${c2.bold(c2.white("+ "))}`;
|
|
21510
21543
|
const pausedPrompt = `${c2.bold(c2.yellow("| "))}`;
|
|
21544
|
+
const BUILTIN_COMMANDS = [
|
|
21545
|
+
"/help",
|
|
21546
|
+
"/quit",
|
|
21547
|
+
"/exit",
|
|
21548
|
+
"/clear",
|
|
21549
|
+
"/verbose",
|
|
21550
|
+
"/config",
|
|
21551
|
+
"/cost",
|
|
21552
|
+
"/evaluate",
|
|
21553
|
+
"/eval",
|
|
21554
|
+
"/task-type",
|
|
21555
|
+
"/stats",
|
|
21556
|
+
"/metrics",
|
|
21557
|
+
"/dashboard",
|
|
21558
|
+
"/model",
|
|
21559
|
+
"/models",
|
|
21560
|
+
"/endpoint",
|
|
21561
|
+
"/update",
|
|
21562
|
+
"/upgrade",
|
|
21563
|
+
"/voice",
|
|
21564
|
+
"/stream",
|
|
21565
|
+
"/dream",
|
|
21566
|
+
"/listen",
|
|
21567
|
+
"/bruteforce",
|
|
21568
|
+
"/brute",
|
|
21569
|
+
"/emojis",
|
|
21570
|
+
"/colors",
|
|
21571
|
+
"/tools",
|
|
21572
|
+
"/skills",
|
|
21573
|
+
"/pause",
|
|
21574
|
+
"/stop",
|
|
21575
|
+
"/resume"
|
|
21576
|
+
];
|
|
21577
|
+
const discoveredSkillNames = discoverSkills(repoRoot).map((s) => `/${s.name}`);
|
|
21578
|
+
const allCompletions = [.../* @__PURE__ */ new Set([...BUILTIN_COMMANDS, ...discoveredSkillNames])].sort();
|
|
21579
|
+
function completer(line) {
|
|
21580
|
+
if (!line.startsWith("/"))
|
|
21581
|
+
return [[], line];
|
|
21582
|
+
const lower = line.toLowerCase();
|
|
21583
|
+
const hits = allCompletions.filter((c3) => c3.toLowerCase().startsWith(lower));
|
|
21584
|
+
return [hits, line];
|
|
21585
|
+
}
|
|
21511
21586
|
const rl = readline2.createInterface({
|
|
21512
21587
|
input: process.stdin,
|
|
21513
21588
|
output: process.stdout,
|
|
21514
21589
|
prompt: idlePrompt,
|
|
21515
21590
|
terminal: true,
|
|
21516
|
-
historySize: 100
|
|
21591
|
+
historySize: 100,
|
|
21592
|
+
completer
|
|
21517
21593
|
});
|
|
21518
21594
|
statusBar.setPromptText(idlePrompt, 2);
|
|
21595
|
+
statusBar.setCompletions(allCompletions);
|
|
21519
21596
|
if (statusBar.isActive) {
|
|
21520
21597
|
rl.output = new Writable({ write: (_c, _e, cb) => cb() });
|
|
21521
21598
|
statusBar.setInputStateProvider(() => ({
|
package/package.json
CHANGED