sakuraai 0.0.5 → 0.0.6
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 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1369,6 +1369,18 @@ var init_stream = __esm({
|
|
|
1369
1369
|
// src/daemon/terminal.ts
|
|
1370
1370
|
import os6 from "os";
|
|
1371
1371
|
import { spawn as spawn6 } from "child_process";
|
|
1372
|
+
function cleanOutput(t, chunk) {
|
|
1373
|
+
let s = t.buf + chunk;
|
|
1374
|
+
s = s.replace(OSC, "").replace(CSI, "").replace(ESC2, "");
|
|
1375
|
+
const esc = s.lastIndexOf(ESC);
|
|
1376
|
+
if (esc !== -1) {
|
|
1377
|
+
t.buf = s.slice(esc);
|
|
1378
|
+
s = s.slice(0, esc);
|
|
1379
|
+
} else {
|
|
1380
|
+
t.buf = "";
|
|
1381
|
+
}
|
|
1382
|
+
return s.replace(OTHER_CTRL, "");
|
|
1383
|
+
}
|
|
1372
1384
|
function defaultShell() {
|
|
1373
1385
|
return process.env.SHELL || (process.platform === "win32" ? "cmd.exe" : "/bin/zsh");
|
|
1374
1386
|
}
|
|
@@ -1376,9 +1388,19 @@ function openTerminal(ws, opts) {
|
|
|
1376
1388
|
const shell = defaultShell();
|
|
1377
1389
|
const child = spawn6(shell, ["-i"], {
|
|
1378
1390
|
cwd: opts?.cwd && opts.cwd.trim() ? opts.cwd : os6.homedir(),
|
|
1379
|
-
env: {
|
|
1391
|
+
env: {
|
|
1392
|
+
...process.env,
|
|
1393
|
+
TERM: "dumb",
|
|
1394
|
+
// Quiet common shell-integration noise so output stays clean.
|
|
1395
|
+
WARP_HONOR_PS1: "0",
|
|
1396
|
+
ITERM_SHELL_INTEGRATION_INSTALLED: ""
|
|
1397
|
+
}
|
|
1380
1398
|
});
|
|
1381
|
-
const
|
|
1399
|
+
const term = { child, buf: "" };
|
|
1400
|
+
terminals.set(ws, term);
|
|
1401
|
+
const sendOut = (raw) => {
|
|
1402
|
+
const data = cleanOutput(term, raw);
|
|
1403
|
+
if (!data) return;
|
|
1382
1404
|
try {
|
|
1383
1405
|
ws.send(JSON.stringify({ type: "output", data }));
|
|
1384
1406
|
} catch {
|
|
@@ -1395,7 +1417,6 @@ function openTerminal(ws, opts) {
|
|
|
1395
1417
|
child.on("error", (e) => sendOut(`
|
|
1396
1418
|
[shell error: ${e.message}]
|
|
1397
1419
|
`));
|
|
1398
|
-
terminals.set(ws, { child });
|
|
1399
1420
|
try {
|
|
1400
1421
|
ws.send(JSON.stringify({ type: "ready", shell, cwd: opts?.cwd || os6.homedir() }));
|
|
1401
1422
|
} catch {
|
|
@@ -1418,11 +1439,16 @@ function closeTerminal(ws) {
|
|
|
1418
1439
|
}
|
|
1419
1440
|
terminals.delete(ws);
|
|
1420
1441
|
}
|
|
1421
|
-
var terminals;
|
|
1442
|
+
var terminals, ESC, OSC, CSI, ESC2, OTHER_CTRL;
|
|
1422
1443
|
var init_terminal = __esm({
|
|
1423
1444
|
"src/daemon/terminal.ts"() {
|
|
1424
1445
|
"use strict";
|
|
1425
1446
|
terminals = /* @__PURE__ */ new WeakMap();
|
|
1447
|
+
ESC = String.fromCharCode(27);
|
|
1448
|
+
OSC = new RegExp("\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\\\)", "g");
|
|
1449
|
+
CSI = new RegExp("\\u001B\\[[0-9;?]*[ -/]*[@-~]", "g");
|
|
1450
|
+
ESC2 = new RegExp("\\u001B[@-Z\\\\-_]", "g");
|
|
1451
|
+
OTHER_CTRL = new RegExp("[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F\\u007F]", "g");
|
|
1426
1452
|
}
|
|
1427
1453
|
});
|
|
1428
1454
|
|
|
@@ -1991,7 +2017,7 @@ var init_pair = __esm({
|
|
|
1991
2017
|
import { Command } from "commander";
|
|
1992
2018
|
|
|
1993
2019
|
// src/version.ts
|
|
1994
|
-
var VERSION = "0.0.
|
|
2020
|
+
var VERSION = "0.0.6";
|
|
1995
2021
|
|
|
1996
2022
|
// src/index.ts
|
|
1997
2023
|
init_config();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sakuraai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Sakura Agent CLI + local runtime for managing AI coding sessions (Claude Code, Codex, OpenCode) and reaching them privately from the Sakura mobile app over Tailscale",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|