@monotykamary/localterm-server 2.75.0 → 2.76.0

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.
Files changed (83) hide show
  1. package/dist/capture-renderer.d.ts +1 -0
  2. package/dist/capture-renderer.d.ts.map +1 -1
  3. package/dist/capture-renderer.js +25 -1
  4. package/dist/capture-renderer.js.map +1 -1
  5. package/dist/constants.d.ts +4 -0
  6. package/dist/constants.d.ts.map +1 -1
  7. package/dist/constants.js +6 -0
  8. package/dist/constants.js.map +1 -1
  9. package/dist/hibernate-ledger.d.ts +16 -0
  10. package/dist/hibernate-ledger.d.ts.map +1 -0
  11. package/dist/hibernate-ledger.js +37 -0
  12. package/dist/hibernate-ledger.js.map +1 -0
  13. package/dist/hibernate-store.d.ts +18 -0
  14. package/dist/hibernate-store.d.ts.map +1 -0
  15. package/dist/hibernate-store.js +56 -0
  16. package/dist/hibernate-store.js.map +1 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +94 -72
  19. package/dist/index.js.map +1 -1
  20. package/dist/session-client-hub.d.ts.map +1 -1
  21. package/dist/session-client-hub.js +1 -0
  22. package/dist/session-client-hub.js.map +1 -1
  23. package/dist/session-manager.d.ts +4 -1
  24. package/dist/session-manager.d.ts.map +1 -1
  25. package/dist/session-manager.js +36 -1
  26. package/dist/session-manager.js.map +1 -1
  27. package/dist/session-output-coordinator.d.ts.map +1 -1
  28. package/dist/session-output-coordinator.js +2 -1
  29. package/dist/session-output-coordinator.js.map +1 -1
  30. package/dist/session.d.ts.map +1 -1
  31. package/dist/session.js +8 -0
  32. package/dist/session.js.map +1 -1
  33. package/dist/types.d.ts +1 -0
  34. package/dist/types.d.ts.map +1 -1
  35. package/dist/utils/append-to-bounded-utf8-ring.d.ts +2 -0
  36. package/dist/utils/append-to-bounded-utf8-ring.d.ts.map +1 -0
  37. package/dist/utils/append-to-bounded-utf8-ring.js +32 -0
  38. package/dist/utils/append-to-bounded-utf8-ring.js.map +1 -0
  39. package/dist/utils/create-bounded-debounce.d.ts +13 -0
  40. package/dist/utils/create-bounded-debounce.d.ts.map +1 -0
  41. package/dist/utils/create-bounded-debounce.js +43 -0
  42. package/dist/utils/create-bounded-debounce.js.map +1 -0
  43. package/dist/utils/find-terminal-safe-trim-offset.d.ts +2 -0
  44. package/dist/utils/find-terminal-safe-trim-offset.d.ts.map +1 -0
  45. package/dist/utils/find-terminal-safe-trim-offset.js +96 -0
  46. package/dist/utils/find-terminal-safe-trim-offset.js.map +1 -0
  47. package/dist/utils/main-screen-output-filter.d.ts +17 -0
  48. package/dist/utils/main-screen-output-filter.d.ts.map +1 -0
  49. package/dist/utils/main-screen-output-filter.js +185 -0
  50. package/dist/utils/main-screen-output-filter.js.map +1 -0
  51. package/dist/utils/merge-workspace-restore-entries.d.ts +9 -0
  52. package/dist/utils/merge-workspace-restore-entries.d.ts.map +1 -0
  53. package/dist/utils/merge-workspace-restore-entries.js +79 -0
  54. package/dist/utils/merge-workspace-restore-entries.js.map +1 -0
  55. package/dist/utils/normalize-hibernate-scrollback.d.ts +2 -0
  56. package/dist/utils/normalize-hibernate-scrollback.d.ts.map +1 -0
  57. package/dist/utils/normalize-hibernate-scrollback.js +23 -0
  58. package/dist/utils/normalize-hibernate-scrollback.js.map +1 -0
  59. package/dist/utils/pending-workspace-restore-tabs.d.ts +4 -0
  60. package/dist/utils/pending-workspace-restore-tabs.d.ts.map +1 -0
  61. package/dist/utils/pending-workspace-restore-tabs.js +21 -0
  62. package/dist/utils/pending-workspace-restore-tabs.js.map +1 -0
  63. package/dist/utils/plan-workspace-restore.d.ts +14 -0
  64. package/dist/utils/plan-workspace-restore.d.ts.map +1 -0
  65. package/dist/utils/plan-workspace-restore.js +12 -0
  66. package/dist/utils/plan-workspace-restore.js.map +1 -0
  67. package/dist/utils/render-buffer-line-with-sgr.d.ts +3 -0
  68. package/dist/utils/render-buffer-line-with-sgr.d.ts.map +1 -0
  69. package/dist/utils/render-buffer-line-with-sgr.js +100 -0
  70. package/dist/utils/render-buffer-line-with-sgr.js.map +1 -0
  71. package/dist/utils/render-legacy-hibernate-scrollback.d.ts +2 -0
  72. package/dist/utils/render-legacy-hibernate-scrollback.d.ts.map +1 -0
  73. package/dist/utils/render-legacy-hibernate-scrollback.js +56 -0
  74. package/dist/utils/render-legacy-hibernate-scrollback.js.map +1 -0
  75. package/dist/utils/workspace-session-ids.d.ts +3 -0
  76. package/dist/utils/workspace-session-ids.d.ts.map +1 -0
  77. package/dist/utils/workspace-session-ids.js +11 -0
  78. package/dist/utils/workspace-session-ids.js.map +1 -0
  79. package/dist/utils/write-file-atomically.d.ts +2 -0
  80. package/dist/utils/write-file-atomically.d.ts.map +1 -0
  81. package/dist/utils/write-file-atomically.js +38 -0
  82. package/dist/utils/write-file-atomically.js.map +1 -0
  83. package/package.json +1 -1
@@ -0,0 +1,100 @@
1
+ const ESC = "\x1b";
2
+ const RESET_SEQUENCE = `${ESC}[0m`;
3
+ const BASIC_PALETTE_SIZE = 8;
4
+ const BRIGHT_PALETTE_LIMIT = 16;
5
+ const COLOR_COMPONENT_MASK = 0xff;
6
+ const RED_COMPONENT_SHIFT = 16;
7
+ const GREEN_COMPONENT_SHIFT = 8;
8
+ const SGR_BOLD = 1;
9
+ const SGR_DIM = 2;
10
+ const SGR_ITALIC = 3;
11
+ const SGR_UNDERLINE = 4;
12
+ const SGR_BLINK = 5;
13
+ const SGR_INVERSE = 7;
14
+ const SGR_INVISIBLE = 8;
15
+ const SGR_STRIKETHROUGH = 9;
16
+ const SGR_FOREGROUND_BASE = 30;
17
+ const SGR_BACKGROUND_BASE = 40;
18
+ const SGR_EXTENDED_FOREGROUND = 38;
19
+ const SGR_EXTENDED_BACKGROUND = 48;
20
+ const SGR_BRIGHT_FOREGROUND_BASE = 90;
21
+ const SGR_BRIGHT_BACKGROUND_BASE = 100;
22
+ const SGR_OVERLINE = 53;
23
+ const SGR_RGB_MODE = 2;
24
+ const SGR_PALETTE_MODE = 5;
25
+ const appendPaletteColor = (parameters, color, standardBase, brightBase, extendedCode) => {
26
+ if (color < BASIC_PALETTE_SIZE) {
27
+ parameters.push(standardBase + color);
28
+ return;
29
+ }
30
+ if (color < BRIGHT_PALETTE_LIMIT) {
31
+ parameters.push(brightBase + color - BASIC_PALETTE_SIZE);
32
+ return;
33
+ }
34
+ parameters.push(extendedCode, SGR_PALETTE_MODE, color);
35
+ };
36
+ const appendRgbColor = (parameters, color, extendedCode) => {
37
+ parameters.push(extendedCode, SGR_RGB_MODE, (color >> RED_COMPONENT_SHIFT) & COLOR_COMPONENT_MASK, (color >> GREEN_COMPONENT_SHIFT) & COLOR_COMPONENT_MASK, color & COLOR_COMPONENT_MASK);
38
+ };
39
+ const styleParameters = (cell) => {
40
+ const parameters = [];
41
+ if (cell.isBold())
42
+ parameters.push(SGR_BOLD);
43
+ if (cell.isDim())
44
+ parameters.push(SGR_DIM);
45
+ if (cell.isItalic())
46
+ parameters.push(SGR_ITALIC);
47
+ if (cell.isUnderline())
48
+ parameters.push(SGR_UNDERLINE);
49
+ if (cell.isBlink())
50
+ parameters.push(SGR_BLINK);
51
+ if (cell.isInverse())
52
+ parameters.push(SGR_INVERSE);
53
+ if (cell.isInvisible())
54
+ parameters.push(SGR_INVISIBLE);
55
+ if (cell.isStrikethrough())
56
+ parameters.push(SGR_STRIKETHROUGH);
57
+ if (cell.isOverline())
58
+ parameters.push(SGR_OVERLINE);
59
+ if (cell.isFgPalette()) {
60
+ appendPaletteColor(parameters, cell.getFgColor(), SGR_FOREGROUND_BASE, SGR_BRIGHT_FOREGROUND_BASE, SGR_EXTENDED_FOREGROUND);
61
+ }
62
+ else if (cell.isFgRGB()) {
63
+ appendRgbColor(parameters, cell.getFgColor(), SGR_EXTENDED_FOREGROUND);
64
+ }
65
+ if (cell.isBgPalette()) {
66
+ appendPaletteColor(parameters, cell.getBgColor(), SGR_BACKGROUND_BASE, SGR_BRIGHT_BACKGROUND_BASE, SGR_EXTENDED_BACKGROUND);
67
+ }
68
+ else if (cell.isBgRGB()) {
69
+ appendRgbColor(parameters, cell.getBgColor(), SGR_EXTENDED_BACKGROUND);
70
+ }
71
+ return parameters;
72
+ };
73
+ // Convert an already-rendered xterm row into text plus SGR only. Resetting before
74
+ // every style run makes each row independently replayable if older rows are evicted.
75
+ export const renderBufferLineWithSgr = (line, cell) => {
76
+ const plainText = line.translateToString(true);
77
+ if (!plainText)
78
+ return "";
79
+ let activeStyle = "";
80
+ let consumedCodeUnits = 0;
81
+ let rendered = "";
82
+ for (let column = 0; column < line.length && consumedCodeUnits < plainText.length; column += 1) {
83
+ const current = line.getCell(column, cell);
84
+ if (!current || current.getWidth() === 0)
85
+ continue;
86
+ const characters = current.getChars() || " ";
87
+ const parameters = styleParameters(current);
88
+ const style = parameters.join(";");
89
+ if (style !== activeStyle) {
90
+ rendered += style ? `${ESC}[0;${style}m` : RESET_SEQUENCE;
91
+ activeStyle = style;
92
+ }
93
+ rendered += characters;
94
+ consumedCodeUnits += characters.length;
95
+ }
96
+ if (activeStyle)
97
+ rendered += RESET_SEQUENCE;
98
+ return rendered;
99
+ };
100
+ //# sourceMappingURL=render-buffer-line-with-sgr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-buffer-line-with-sgr.js","sourceRoot":"","sources":["../../src/utils/render-buffer-line-with-sgr.ts"],"names":[],"mappings":"AAEA,MAAM,GAAG,GAAG,MAAM,CAAC;AACnB,MAAM,cAAc,GAAG,GAAG,GAAG,KAAK,CAAC;AAEnC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAChC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,MAAM,OAAO,GAAG,CAAC,CAAC;AAClB,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,aA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AC,CAAC,GAAG,GAAG,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC;YAC1D,WAAW,GAAG,KAAK,CAAC;QACtB,CAAC;QACD,QAAQ,IAAI,UAAU,CAAC;QACvB,iBAAiB,IAAI,UAAU,CAAC,MAAM,CAAC;IACzC,CAAC;IAED,IAAI,WAAW;QAAE,QAAQ,IAAI,cAAc,CAAC;IAC5C,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const renderLegacyHibernateScrollback: (data: string) => string;
2
+ //# sourceMappingURL=render-legacy-hibernate-scrollback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-legacy-hibernate-scrollback.d.ts","sourceRoot":"","sources":["../../src/utils/render-legacy-hibernate-scrollback.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,+BAA+B,SAAU,MAAM,KAAG,MA6B9D,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { createRequire } from "node:module";
2
+ import { DEFAULT_COLS, DEFAULT_ROWS, SESSION_SCROLLBACK_REPLAY_BYTES } from "../constants.js";
3
+ const require = createRequire(import.meta.url);
4
+ const { Terminal } = require("@xterm/headless");
5
+ const writeSynchronously = (terminal, data) => {
6
+ // The exact headless-xterm beta is pinned. Its public write API is async, but
7
+ // seed normalization runs before PTY spawn; use the pinned write buffer only
8
+ // for this one-time legacy migration and fail loudly if its shape ever moves.
9
+ const core = Reflect.get(terminal, "_core");
10
+ if (!core || typeof core !== "object")
11
+ throw new Error("xterm core unavailable");
12
+ const writeBuffer = Reflect.get(core, "_writeBuffer");
13
+ if (!writeBuffer || typeof writeBuffer !== "object") {
14
+ throw new Error("xterm write buffer unavailable");
15
+ }
16
+ const writeSync = Reflect.get(writeBuffer, "writeSync");
17
+ if (typeof writeSync !== "function")
18
+ throw new Error("xterm synchronous write unavailable");
19
+ Reflect.apply(writeSync, writeBuffer, [data]);
20
+ };
21
+ // Old hibernate rings may begin halfway through a TUI after its alt-entry bytes
22
+ // were evicted. Rendering collapses cursor/erase redraws into stable normal-
23
+ // buffer rows, so the first fixed restart cannot replay legacy screen poison.
24
+ export const renderLegacyHibernateScrollback = (data) => {
25
+ if (!data)
26
+ return "";
27
+ const terminal = new Terminal({
28
+ cols: DEFAULT_COLS,
29
+ rows: DEFAULT_ROWS,
30
+ // A byte can encode a whole blank row (LF), so the byte cap is also the
31
+ // conservative maximum row count for a legacy hibernate generation.
32
+ scrollback: SESSION_SCROLLBACK_REPLAY_BYTES,
33
+ allowProposedApi: true,
34
+ });
35
+ try {
36
+ writeSynchronously(terminal, data);
37
+ const buffer = terminal.buffer.normal;
38
+ const cursorRow = Math.min(buffer.baseY + buffer.cursorY, buffer.length - 1);
39
+ let lastRow = Math.max(cursorRow, 0);
40
+ for (let row = buffer.length - 1; row > lastRow; row -= 1) {
41
+ if (buffer.getLine(row)?.translateToString(true)) {
42
+ lastRow = row;
43
+ break;
44
+ }
45
+ }
46
+ const rows = [];
47
+ for (let row = 0; row <= lastRow; row += 1) {
48
+ rows.push(buffer.getLine(row)?.translateToString(true) ?? "");
49
+ }
50
+ return rows.join("\r\n");
51
+ }
52
+ finally {
53
+ terminal.dispose();
54
+ }
55
+ };
56
+ //# sourceMappingURL=render-legacy-hibernate-scrollback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-legacy-hibernate-scrollback.js","sourceRoot":"","sources":["../../src/utils/render-legacy-hibernate-scrollback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAC;AAE9F,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAqC,CAAC;AAEpF,MAAM,kBAAkB,GAAG,CAAC,QAAuC,EA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AG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC7E,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QACrC,KAAK,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;YAC1D,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;gBACjD,OAAO,GAAG,GAAG,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QACD,MAAM,IAAI,GAAa,EAAE,CAAC;QAC1B,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,IAAI,OAAO,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { WorkspaceEntry } from "../workspace-store.js";
2
+ export declare const workspaceSessionIds: (entries: readonly WorkspaceEntry[]) => Set<string>;
3
+ //# sourceMappingURL=workspace-session-ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-session-ids.d.ts","sourceRoot":"","sources":["../../src/utils/workspace-session-ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,eAAO,MAAM,mBAAmB,YAAa,SAAS,cAAc,EAAE,KAAG,GAAG,CAAC,MAAM,CAQlF,CAAC"}
@@ -0,0 +1,11 @@
1
+ export const workspaceSessionIds = (entries) => {
2
+ const sessionIds = new Set();
3
+ for (const entry of entries) {
4
+ for (const tab of entry.tabs) {
5
+ if (tab.sessionId)
6
+ sessionIds.add(tab.sessionId);
7
+ }
8
+ }
9
+ return sessionIds;
10
+ };
11
+ //# sourceMappingURL=workspace-session-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-session-ids.js","sourceRoot":"","sources":["../../src/utils/workspace-session-ids.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAkC,EAAe,EAAE;IACrF,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IACrC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YAC7B,IAAI,GAAG,CAAC,SAAS;gBAAE,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const writeFileAtomically: (filePath: string, data: string, mode: number) => void;
2
+ //# sourceMappingURL=write-file-atomically.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write-file-atomically.d.ts","sourceRoot":"","sources":["../../src/utils/write-file-atomically.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,aAAc,MAAM,QAAQ,MAAM,QAAQ,MAAM,KAAG,IA4BlF,CAAC"}
@@ -0,0 +1,38 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ // Atomic and power-loss ordered: fsync file contents before rename, then fsync
4
+ // the containing directory so the rename itself is durable. The pid-specific
5
+ // temp path avoids cross-process source collisions during restart overlap.
6
+ export const writeFileAtomically = (filePath, data, mode) => {
7
+ const dirPath = path.dirname(filePath);
8
+ fs.mkdirSync(dirPath, { recursive: true });
9
+ const tmpPath = `${filePath}.${process.pid}.tmp`;
10
+ let fileDescriptor = null;
11
+ try {
12
+ fileDescriptor = fs.openSync(tmpPath, "w", mode);
13
+ fs.writeFileSync(fileDescriptor, data, "utf8");
14
+ fs.fsyncSync(fileDescriptor);
15
+ fs.closeSync(fileDescriptor);
16
+ fileDescriptor = null;
17
+ fs.renameSync(tmpPath, filePath);
18
+ const dirDescriptor = fs.openSync(dirPath, "r");
19
+ try {
20
+ fs.fsyncSync(dirDescriptor);
21
+ }
22
+ finally {
23
+ fs.closeSync(dirDescriptor);
24
+ }
25
+ }
26
+ catch (error) {
27
+ if (fileDescriptor !== null)
28
+ fs.closeSync(fileDescriptor);
29
+ try {
30
+ fs.rmSync(tmpPath, { force: true });
31
+ }
32
+ catch {
33
+ /* preserve the original write error */
34
+ }
35
+ throw error;
36
+ }
37
+ };
38
+ //# sourceMappingURL=write-file-atomically.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write-file-atomically.js","sourceRoot":"","sources":["../../src/utils/write-file-atomically.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,+EAA+E;AAC/E,6EAA6E;AAC7E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAgB,EAAE,IAAY,EAAE,IAAY,EAAQ,EAAE;IACxF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,GAAG,QAAQ,IAAI,OAAO,CAAC,GAAG,MAAM,CAAC;IACjD,IAAI,cAAc,GAAkB,IAAI,CAAC;IACzC,IAAI,CAAC;QACH,cAAc,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACjD,EAAE,CAAC,aAAa,CAAC,cAAc,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/C,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC7B,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC7B,cAAc,GAAG,IAAI,CAAC;QACtB,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEjC,MAAM,aAAa,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAChD,IAAI,CAAC;YACH,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QAC9B,CAAC;gBAAS,CAAC;YACT,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,cAAc,KAAK,IAAI;YAAE,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC1D,IAAI,CAAC;YACH,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,uCAAuC;QACzC,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monotykamary/localterm-server",
3
- "version": "2.75.0",
3
+ "version": "2.76.0",
4
4
  "description": "PTY-backed HTTP/WebSocket server that powers localterm, built on Hono + node-pty.",
5
5
  "keywords": [
6
6
  "hono",