@sma1lboy/kobe 0.8.130 → 0.8.133
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 +404 -404
- package/dist/cli/kobe.js +404 -404
- package/dist/cli/pty-host-node.mjs +43 -24
- package/dist/cli/rove.js +404 -404
- package/package.json +1 -1
|
@@ -450,9 +450,6 @@ function clearFrozenSessions(dir = defaultPtyFreezeDir()) {
|
|
|
450
450
|
} catch {}
|
|
451
451
|
}
|
|
452
452
|
|
|
453
|
-
// ../kobe-daemon/src/daemon/pty-host.ts
|
|
454
|
-
import { StringDecoder as StringDecoder2 } from "node:string_decoder";
|
|
455
|
-
|
|
456
453
|
// ../kobe-daemon/src/daemon/platform-shell.js
|
|
457
454
|
import { existsSync } from "node:fs";
|
|
458
455
|
function windowsBashCandidates(env) {
|
|
@@ -524,6 +521,32 @@ function embeddedTerminalEnv(base, overrides = {}) {
|
|
|
524
521
|
return { ...env, ...overrides };
|
|
525
522
|
}
|
|
526
523
|
|
|
524
|
+
// ../kobe-daemon/src/daemon/pty-host-types.ts
|
|
525
|
+
import { StringDecoder as StringDecoder2 } from "node:string_decoder";
|
|
526
|
+
function freshSessionState(key, spec, argv) {
|
|
527
|
+
return {
|
|
528
|
+
key,
|
|
529
|
+
cwd: spec.cwd,
|
|
530
|
+
proc: null,
|
|
531
|
+
alive: true,
|
|
532
|
+
chunks: [],
|
|
533
|
+
bytes: 0,
|
|
534
|
+
totalBytes: 0,
|
|
535
|
+
cols: spec.cols ?? 80,
|
|
536
|
+
rows: spec.rows ?? 24,
|
|
537
|
+
command: argv,
|
|
538
|
+
title: "",
|
|
539
|
+
titleCarry: "",
|
|
540
|
+
titleDecoder: new StringDecoder2("utf8"),
|
|
541
|
+
sinks: new Map,
|
|
542
|
+
parked: false,
|
|
543
|
+
parkedScreenBytes: 0,
|
|
544
|
+
exit: null,
|
|
545
|
+
restored: false,
|
|
546
|
+
lastFreezeAtMs: 0
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
|
|
527
550
|
// ../kobe-daemon/src/daemon/pty-observability.ts
|
|
528
551
|
function sessionInfo(s) {
|
|
529
552
|
return {
|
|
@@ -801,6 +824,18 @@ class PtyHost {
|
|
|
801
824
|
this.opts.freeze?.drop(key);
|
|
802
825
|
return this.endChild(session);
|
|
803
826
|
}
|
|
827
|
+
rename(from, to) {
|
|
828
|
+
const session = this.sessions.get(from);
|
|
829
|
+
if (!session || from === to || this.sessions.has(to))
|
|
830
|
+
return false;
|
|
831
|
+
this.sessions.delete(from);
|
|
832
|
+
session.key = to;
|
|
833
|
+
this.sessions.set(to, session);
|
|
834
|
+
this.opts.freeze?.drop(from);
|
|
835
|
+
this.maybeFreeze(session, true);
|
|
836
|
+
this.opts.log?.("pty", `renamed session ${from} → ${to}`);
|
|
837
|
+
return true;
|
|
838
|
+
}
|
|
804
839
|
detach(key, token, parked = false, parkedScreenBytes = 0) {
|
|
805
840
|
const session = this.sessions.get(key);
|
|
806
841
|
if (!session)
|
|
@@ -898,27 +933,7 @@ class PtyHost {
|
|
|
898
933
|
}
|
|
899
934
|
spawn(key, spec, spare = false) {
|
|
900
935
|
const argv = spec.command && spec.command.length > 0 ? [...spec.command] : [spec.shell ?? resolveLoginShell()];
|
|
901
|
-
const session =
|
|
902
|
-
key,
|
|
903
|
-
cwd: spec.cwd,
|
|
904
|
-
proc: null,
|
|
905
|
-
alive: true,
|
|
906
|
-
chunks: [],
|
|
907
|
-
bytes: 0,
|
|
908
|
-
totalBytes: 0,
|
|
909
|
-
cols: spec.cols ?? 80,
|
|
910
|
-
rows: spec.rows ?? 24,
|
|
911
|
-
command: argv,
|
|
912
|
-
title: "",
|
|
913
|
-
titleCarry: "",
|
|
914
|
-
titleDecoder: new StringDecoder2("utf8"),
|
|
915
|
-
sinks: new Map,
|
|
916
|
-
parked: false,
|
|
917
|
-
parkedScreenBytes: 0,
|
|
918
|
-
exit: null,
|
|
919
|
-
restored: false,
|
|
920
|
-
lastFreezeAtMs: 0
|
|
921
|
-
};
|
|
936
|
+
const session = freshSessionState(key, spec, argv);
|
|
922
937
|
this.startChild(session);
|
|
923
938
|
if (session.alive) {
|
|
924
939
|
this.opts.log?.("pty", `spawned ${argv[0]} for ${key} (pid ${session.proc?.pid})`);
|
|
@@ -1143,6 +1158,10 @@ async function startPtyHostServer(options = {}) {
|
|
|
1143
1158
|
case "pty.kill":
|
|
1144
1159
|
ptys.kill(requireString(objectPayload(req.payload), "key"));
|
|
1145
1160
|
return {};
|
|
1161
|
+
case "pty.rename": {
|
|
1162
|
+
const payload = objectPayload(req.payload);
|
|
1163
|
+
return { renamed: ptys.rename(requireString(payload, "from"), requireString(payload, "to")) };
|
|
1164
|
+
}
|
|
1146
1165
|
case "pty.detach":
|
|
1147
1166
|
{
|
|
1148
1167
|
const payload = objectPayload(req.payload);
|