reasonix 0.5.7 → 0.5.8
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/cli/index.js +65 -0
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -6999,6 +6999,18 @@ function formatTokens(n) {
|
|
|
6999
6999
|
return k >= 100 ? `${k.toFixed(0)}K` : `${k.toFixed(1)}K`;
|
|
7000
7000
|
}
|
|
7001
7001
|
|
|
7002
|
+
// src/cli/ui/bang.ts
|
|
7003
|
+
function detectBangCommand(text) {
|
|
7004
|
+
if (!text.startsWith("!")) return null;
|
|
7005
|
+
const body = text.slice(1).trim();
|
|
7006
|
+
if (!body) return null;
|
|
7007
|
+
return body;
|
|
7008
|
+
}
|
|
7009
|
+
function formatBangUserMessage(cmd, output) {
|
|
7010
|
+
return `[!${cmd}]
|
|
7011
|
+
${output}`;
|
|
7012
|
+
}
|
|
7013
|
+
|
|
7002
7014
|
// src/cli/ui/slash.ts
|
|
7003
7015
|
import { spawnSync } from "child_process";
|
|
7004
7016
|
|
|
@@ -7250,6 +7262,16 @@ function handleSlash(cmd, args, loop, ctx = {}) {
|
|
|
7250
7262
|
" /clear clear displayed scrollback only (context kept \u2014 model still sees it)",
|
|
7251
7263
|
" /exit quit",
|
|
7252
7264
|
"",
|
|
7265
|
+
"Shell shortcut:",
|
|
7266
|
+
" !<cmd> run <cmd> in the sandbox root; output goes into",
|
|
7267
|
+
" the conversation so the model sees it next turn.",
|
|
7268
|
+
" No allowlist gate \u2014 user-typed = explicit consent.",
|
|
7269
|
+
" Example: !git status !ls src/ !npm test",
|
|
7270
|
+
"",
|
|
7271
|
+
"File references (code mode):",
|
|
7272
|
+
" @path/to/file inline file content under [Referenced files] on send.",
|
|
7273
|
+
" Type `@` to open the picker (\u2191\u2193 navigate, Tab/Enter pick).",
|
|
7274
|
+
"",
|
|
7253
7275
|
"Presets:",
|
|
7254
7276
|
" fast deepseek-chat no harvest no branch ~1\xA2/100turns \u2190 default",
|
|
7255
7277
|
" smart reasoner harvest ~10x cost, slower",
|
|
@@ -8478,6 +8500,49 @@ function App({
|
|
|
8478
8500
|
promptHistory.current.push(text);
|
|
8479
8501
|
return;
|
|
8480
8502
|
}
|
|
8503
|
+
const bangCmd = detectBangCommand(text);
|
|
8504
|
+
if (bangCmd !== null) {
|
|
8505
|
+
const bangRoot = codeMode?.rootDir ?? process.cwd();
|
|
8506
|
+
promptHistory.current.push(text);
|
|
8507
|
+
setHistorical((prev) => [
|
|
8508
|
+
...prev,
|
|
8509
|
+
{
|
|
8510
|
+
id: `bang-u-${Date.now()}`,
|
|
8511
|
+
role: "user",
|
|
8512
|
+
text,
|
|
8513
|
+
leadSeparator: prev.length > 0
|
|
8514
|
+
}
|
|
8515
|
+
]);
|
|
8516
|
+
setBusy(true);
|
|
8517
|
+
try {
|
|
8518
|
+
const result = await runCommand(bangCmd, {
|
|
8519
|
+
cwd: bangRoot,
|
|
8520
|
+
timeoutSec: 60,
|
|
8521
|
+
maxOutputChars: 32e3
|
|
8522
|
+
});
|
|
8523
|
+
const formatted = formatCommandResult(bangCmd, result);
|
|
8524
|
+
setHistorical((prev) => [
|
|
8525
|
+
...prev,
|
|
8526
|
+
{ id: `bang-o-${Date.now()}`, role: "info", text: formatted }
|
|
8527
|
+
]);
|
|
8528
|
+
loop.log.append({
|
|
8529
|
+
role: "user",
|
|
8530
|
+
content: formatBangUserMessage(bangCmd, formatted)
|
|
8531
|
+
});
|
|
8532
|
+
} catch (err) {
|
|
8533
|
+
setHistorical((prev) => [
|
|
8534
|
+
...prev,
|
|
8535
|
+
{
|
|
8536
|
+
id: `bang-e-${Date.now()}`,
|
|
8537
|
+
role: "warning",
|
|
8538
|
+
text: `! command failed: ${err.message}`
|
|
8539
|
+
}
|
|
8540
|
+
]);
|
|
8541
|
+
} finally {
|
|
8542
|
+
setBusy(false);
|
|
8543
|
+
}
|
|
8544
|
+
return;
|
|
8545
|
+
}
|
|
8481
8546
|
const slash = parseSlash(text);
|
|
8482
8547
|
if (slash) {
|
|
8483
8548
|
const result = handleSlash(slash.cmd, slash.args, loop, {
|