nexrall-code 0.5.38 → 0.5.39
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 +31 -89
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -62092,74 +62092,31 @@ var import_react32 = __toESM(require_react(), 1);
|
|
|
62092
62092
|
// ../../node_modules/.pnpm/ink@7.1.1_@types+react@19.2.18_react@19.2.8/node_modules/ink/build/hooks/use-box-metrics.js
|
|
62093
62093
|
var import_react33 = __toESM(require_react(), 1);
|
|
62094
62094
|
|
|
62095
|
-
// src/ui/imeBuffer.ts
|
|
62096
|
-
function isImeLikeInput(input) {
|
|
62097
|
-
if (!input)
|
|
62098
|
-
return false;
|
|
62099
|
-
if (input.length === 1 && input.charCodeAt(0) < 128)
|
|
62100
|
-
return false;
|
|
62101
|
-
if (Buffer.byteLength(input, "utf8") > input.length)
|
|
62102
|
-
return true;
|
|
62103
|
-
if (/[\u0300-\u036F]/.test(input))
|
|
62104
|
-
return true;
|
|
62105
|
-
return false;
|
|
62106
|
-
}
|
|
62107
|
-
var ImeCompositionBuffer = class {
|
|
62108
|
-
buf = "";
|
|
62109
|
-
timer = null;
|
|
62110
|
-
timeoutMs;
|
|
62111
|
-
onFlush;
|
|
62112
|
-
constructor(options) {
|
|
62113
|
-
this.timeoutMs = options.timeoutMs ?? 50;
|
|
62114
|
-
this.onFlush = options.onFlush;
|
|
62115
|
-
}
|
|
62116
|
-
/** Buffer a chunk of IME-like input, (re)starting the auto-flush timer. */
|
|
62117
|
-
add(chunk) {
|
|
62118
|
-
this.buf += chunk;
|
|
62119
|
-
this.restartTimer();
|
|
62120
|
-
}
|
|
62121
|
-
/** Remove the last character from the buffer (used for IME backspace). */
|
|
62122
|
-
backspace() {
|
|
62123
|
-
if (!this.buf)
|
|
62124
|
-
return false;
|
|
62125
|
-
this.buf = this.buf.slice(0, -1);
|
|
62126
|
-
this.restartTimer();
|
|
62127
|
-
return true;
|
|
62128
|
-
}
|
|
62129
|
-
hasContent() {
|
|
62130
|
-
return this.buf.length > 0;
|
|
62131
|
-
}
|
|
62132
|
-
/** Flush immediately (used when an unambiguous non-IME key arrives). */
|
|
62133
|
-
flush() {
|
|
62134
|
-
this.clearTimer();
|
|
62135
|
-
if (!this.buf)
|
|
62136
|
-
return;
|
|
62137
|
-
const text = this.buf;
|
|
62138
|
-
this.buf = "";
|
|
62139
|
-
this.onFlush(text);
|
|
62140
|
-
}
|
|
62141
|
-
/** Cancel the timer without flushing (used on unmount). */
|
|
62142
|
-
destroy() {
|
|
62143
|
-
this.clearTimer();
|
|
62144
|
-
this.buf = "";
|
|
62145
|
-
}
|
|
62146
|
-
restartTimer() {
|
|
62147
|
-
this.clearTimer();
|
|
62148
|
-
this.timer = setTimeout(() => this.flush(), this.timeoutMs);
|
|
62149
|
-
}
|
|
62150
|
-
clearTimer() {
|
|
62151
|
-
if (this.timer !== null) {
|
|
62152
|
-
clearTimeout(this.timer);
|
|
62153
|
-
this.timer = null;
|
|
62154
|
-
}
|
|
62155
|
-
}
|
|
62156
|
-
};
|
|
62157
|
-
|
|
62158
62095
|
// src/ui/inkTerminal.tsx
|
|
62159
62096
|
function footerText(info) {
|
|
62160
62097
|
const modeLabel = info.autoApprove ? "yolo mode on" : info.mode === "plan" ? "plan mode on" : info.mode === "edit" ? "edit mode on" : info.mode === "ask" ? "ask mode on" : "auto mode on";
|
|
62161
62098
|
return `${modeLabel} \xB7 /help for shortcuts \xB7 /agents for agents`;
|
|
62162
62099
|
}
|
|
62100
|
+
var IntlWithSegmenter = Intl;
|
|
62101
|
+
var graphemeSegmenter = typeof IntlWithSegmenter.Segmenter === "function" ? new IntlWithSegmenter.Segmenter(void 0, { granularity: "grapheme" }) : null;
|
|
62102
|
+
function dropLastGrapheme(text) {
|
|
62103
|
+
if (!text)
|
|
62104
|
+
return "";
|
|
62105
|
+
if (graphemeSegmenter) {
|
|
62106
|
+
let lastStart = 0;
|
|
62107
|
+
for (const { index } of graphemeSegmenter.segment(text))
|
|
62108
|
+
lastStart = index;
|
|
62109
|
+
return text.slice(0, lastStart);
|
|
62110
|
+
}
|
|
62111
|
+
let end = text.length - 1;
|
|
62112
|
+
while (end > 0 && /[\u0300-\u036F\u1AB0-\u1AFF\u20D0-\u20F0]/.test(text[end]))
|
|
62113
|
+
end--;
|
|
62114
|
+
const prev = text.charCodeAt(end - 1);
|
|
62115
|
+
const curr = text.charCodeAt(end);
|
|
62116
|
+
if (end > 0 && prev >= 55296 && prev <= 56319 && curr >= 56320 && curr <= 57343)
|
|
62117
|
+
end--;
|
|
62118
|
+
return text.slice(0, end);
|
|
62119
|
+
}
|
|
62163
62120
|
var handle = null;
|
|
62164
62121
|
var inkInstance = null;
|
|
62165
62122
|
var idCounter = 0;
|
|
@@ -62168,9 +62125,15 @@ var App2 = ({ onReady }) => {
|
|
|
62168
62125
|
const [items, setItems] = (0, import_react34.useState)([]);
|
|
62169
62126
|
const [footer, setFooterState] = (0, import_react34.useState)({ mode: "auto", autoApprove: false });
|
|
62170
62127
|
const [inputEnabled, setInputEnabledState] = (0, import_react34.useState)(true);
|
|
62171
|
-
const [line,
|
|
62128
|
+
const [line, setLineState] = (0, import_react34.useState)("");
|
|
62172
62129
|
const [prompt2, setPrompt] = (0, import_react34.useState)(DEFAULT_PROMPT);
|
|
62173
62130
|
const { exit } = use_app_default();
|
|
62131
|
+
const lineRef = (0, import_react34.useRef)("");
|
|
62132
|
+
const setLine = (0, import_react34.useCallback)((next) => {
|
|
62133
|
+
const value = typeof next === "function" ? next(lineRef.current) : next;
|
|
62134
|
+
lineRef.current = value;
|
|
62135
|
+
setLineState(value);
|
|
62136
|
+
}, []);
|
|
62174
62137
|
const askResolverRef = (0, import_react34.useRef)(null);
|
|
62175
62138
|
const onLineRef = (0, import_react34.useRef)(null);
|
|
62176
62139
|
const [live, setLiveState] = (0, import_react34.useState)("");
|
|
@@ -62193,16 +62156,6 @@ var App2 = ({ onReady }) => {
|
|
|
62193
62156
|
const onLine = (0, import_react34.useCallback)((cb) => {
|
|
62194
62157
|
onLineRef.current = cb;
|
|
62195
62158
|
}, []);
|
|
62196
|
-
const imeBufferRef = (0, import_react34.useRef)(null);
|
|
62197
|
-
if (imeBufferRef.current === null) {
|
|
62198
|
-
imeBufferRef.current = new ImeCompositionBuffer({
|
|
62199
|
-
onFlush: (text) => setLine((s2) => s2 + text)
|
|
62200
|
-
});
|
|
62201
|
-
}
|
|
62202
|
-
import_react34.default.useEffect(() => {
|
|
62203
|
-
const buf = imeBufferRef.current;
|
|
62204
|
-
return () => buf?.destroy();
|
|
62205
|
-
}, []);
|
|
62206
62159
|
use_input_default((char, key) => {
|
|
62207
62160
|
if (!inputEnabled)
|
|
62208
62161
|
return;
|
|
@@ -62211,15 +62164,10 @@ var App2 = ({ onReady }) => {
|
|
|
62211
62164
|
return;
|
|
62212
62165
|
}
|
|
62213
62166
|
if (key.backspace || key.delete) {
|
|
62214
|
-
|
|
62215
|
-
imeBufferRef.current.backspace();
|
|
62216
|
-
return;
|
|
62217
|
-
}
|
|
62218
|
-
setLine((s2) => s2.slice(0, -1));
|
|
62167
|
+
setLine((s2) => dropLastGrapheme(s2));
|
|
62219
62168
|
return;
|
|
62220
62169
|
}
|
|
62221
62170
|
if (key.upArrow || key.downArrow || key.leftArrow || key.rightArrow || key.tab) {
|
|
62222
|
-
imeBufferRef.current?.flush();
|
|
62223
62171
|
return;
|
|
62224
62172
|
}
|
|
62225
62173
|
const newlineIdx = char.search(/[\r\n]/);
|
|
@@ -62227,8 +62175,7 @@ var App2 = ({ onReady }) => {
|
|
|
62227
62175
|
if (hasNewline) {
|
|
62228
62176
|
const before = newlineIdx === -1 ? char : char.slice(0, newlineIdx);
|
|
62229
62177
|
const after = newlineIdx === -1 ? "" : char.slice(newlineIdx + 1).replace(/^[\r\n]/, "");
|
|
62230
|
-
|
|
62231
|
-
const submitted = line + before;
|
|
62178
|
+
const submitted = lineRef.current + before;
|
|
62232
62179
|
setLine(after);
|
|
62233
62180
|
print(prompt2 + submitted);
|
|
62234
62181
|
const askResolve = askResolverRef.current;
|
|
@@ -62240,11 +62187,6 @@ var App2 = ({ onReady }) => {
|
|
|
62240
62187
|
}
|
|
62241
62188
|
return;
|
|
62242
62189
|
}
|
|
62243
|
-
if (isImeLikeInput(char)) {
|
|
62244
|
-
imeBufferRef.current?.add(char);
|
|
62245
|
-
return;
|
|
62246
|
-
}
|
|
62247
|
-
imeBufferRef.current?.flush();
|
|
62248
62190
|
setLine((s2) => s2 + char);
|
|
62249
62191
|
});
|
|
62250
62192
|
import_react34.default.useEffect(() => {
|
|
@@ -62320,7 +62262,7 @@ var InkReadlineAdapter = class extends EventEmitter3 {
|
|
|
62320
62262
|
};
|
|
62321
62263
|
|
|
62322
62264
|
// src/commands/chat.ts
|
|
62323
|
-
var CLI_VERSION = "0.5.
|
|
62265
|
+
var CLI_VERSION = "0.5.39";
|
|
62324
62266
|
var MODEL_LABELS = {
|
|
62325
62267
|
turbo: "Nexrall Turbo",
|
|
62326
62268
|
pro: "Nexrall Pro",
|
|
@@ -63726,7 +63668,7 @@ function pluginListCommand() {
|
|
|
63726
63668
|
|
|
63727
63669
|
// src/index.ts
|
|
63728
63670
|
var program2 = new Command();
|
|
63729
|
-
program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.
|
|
63671
|
+
program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.39");
|
|
63730
63672
|
program2.command("auth").description("Login to your Nexrall account").action(authCommand);
|
|
63731
63673
|
program2.command("logout").description("Log out of your Nexrall account").action(logoutCommand);
|
|
63732
63674
|
program2.command("update").description("Update nex to the latest version").option("-c, --check", "Check for updates without installing").option("-y, --yes", "Skip confirmation prompt").action(async (opts) => {
|