@datnguyennnx/localterm-server 0.0.15

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 (98) hide show
  1. package/LICENSE +21 -0
  2. package/dist/agent-rpc.d.ts +27 -0
  3. package/dist/agent-rpc.d.ts.map +1 -0
  4. package/dist/agent-rpc.js +213 -0
  5. package/dist/agent-rpc.js.map +1 -0
  6. package/dist/agent-token.d.ts +21 -0
  7. package/dist/agent-token.d.ts.map +1 -0
  8. package/dist/agent-token.js +53 -0
  9. package/dist/agent-token.js.map +1 -0
  10. package/dist/constants.d.ts +54 -0
  11. package/dist/constants.d.ts.map +1 -0
  12. package/dist/constants.js +106 -0
  13. package/dist/constants.js.map +1 -0
  14. package/dist/default-shell.d.ts +2 -0
  15. package/dist/default-shell.d.ts.map +1 -0
  16. package/dist/default-shell.js +44 -0
  17. package/dist/default-shell.js.map +1 -0
  18. package/dist/ensure-spawn-helper-executable.d.ts +2 -0
  19. package/dist/ensure-spawn-helper-executable.d.ts.map +1 -0
  20. package/dist/ensure-spawn-helper-executable.js +34 -0
  21. package/dist/ensure-spawn-helper-executable.js.map +1 -0
  22. package/dist/errors.d.ts +64 -0
  23. package/dist/errors.d.ts.map +1 -0
  24. package/dist/errors.js +84 -0
  25. package/dist/errors.js.map +1 -0
  26. package/dist/index.d.ts +25 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +424 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/osc133-chunk-parser.d.ts +8 -0
  31. package/dist/osc133-chunk-parser.d.ts.map +1 -0
  32. package/dist/osc133-chunk-parser.js +29 -0
  33. package/dist/osc133-chunk-parser.js.map +1 -0
  34. package/dist/osc7-chunk-parser.d.ts +7 -0
  35. package/dist/osc7-chunk-parser.d.ts.map +1 -0
  36. package/dist/osc7-chunk-parser.js +29 -0
  37. package/dist/osc7-chunk-parser.js.map +1 -0
  38. package/dist/output-batcher.d.ts +11 -0
  39. package/dist/output-batcher.d.ts.map +1 -0
  40. package/dist/output-batcher.js +47 -0
  41. package/dist/output-batcher.js.map +1 -0
  42. package/dist/protocol.d.ts +5 -0
  43. package/dist/protocol.d.ts.map +1 -0
  44. package/dist/protocol.js +3 -0
  45. package/dist/protocol.js.map +1 -0
  46. package/dist/schemas.d.ts +66 -0
  47. package/dist/schemas.d.ts.map +1 -0
  48. package/dist/schemas.js +118 -0
  49. package/dist/schemas.js.map +1 -0
  50. package/dist/security.d.ts +5 -0
  51. package/dist/security.d.ts.map +1 -0
  52. package/dist/security.js +63 -0
  53. package/dist/security.js.map +1 -0
  54. package/dist/session-registry.d.ts +9 -0
  55. package/dist/session-registry.d.ts.map +1 -0
  56. package/dist/session-registry.js +19 -0
  57. package/dist/session-registry.js.map +1 -0
  58. package/dist/session.d.ts +62 -0
  59. package/dist/session.d.ts.map +1 -0
  60. package/dist/session.js +238 -0
  61. package/dist/session.js.map +1 -0
  62. package/dist/shell-integration/index.d.ts +7 -0
  63. package/dist/shell-integration/index.d.ts.map +1 -0
  64. package/dist/shell-integration/index.js +29 -0
  65. package/dist/shell-integration/index.js.map +1 -0
  66. package/dist/static-resolver.d.ts +7 -0
  67. package/dist/static-resolver.d.ts.map +1 -0
  68. package/dist/static-resolver.js +65 -0
  69. package/dist/static-resolver.js.map +1 -0
  70. package/dist/types.d.ts +13 -0
  71. package/dist/types.d.ts.map +1 -0
  72. package/dist/types.js +2 -0
  73. package/dist/types.js.map +1 -0
  74. package/dist/utils/format-working-directory-title.d.ts +2 -0
  75. package/dist/utils/format-working-directory-title.d.ts.map +1 -0
  76. package/dist/utils/format-working-directory-title.js +28 -0
  77. package/dist/utils/format-working-directory-title.js.map +1 -0
  78. package/dist/utils/get-heartbeat-action.d.ts +4 -0
  79. package/dist/utils/get-heartbeat-action.d.ts.map +1 -0
  80. package/dist/utils/get-heartbeat-action.js +11 -0
  81. package/dist/utils/get-heartbeat-action.js.map +1 -0
  82. package/dist/utils/parse-osc133-from-chunk.d.ts +10 -0
  83. package/dist/utils/parse-osc133-from-chunk.d.ts.map +1 -0
  84. package/dist/utils/parse-osc133-from-chunk.js +44 -0
  85. package/dist/utils/parse-osc133-from-chunk.js.map +1 -0
  86. package/dist/utils/parse-osc7-from-chunk.d.ts +2 -0
  87. package/dist/utils/parse-osc7-from-chunk.d.ts.map +1 -0
  88. package/dist/utils/parse-osc7-from-chunk.js +32 -0
  89. package/dist/utils/parse-osc7-from-chunk.js.map +1 -0
  90. package/dist/utils/resolve-cwd-for-pid.d.ts +2 -0
  91. package/dist/utils/resolve-cwd-for-pid.d.ts.map +1 -0
  92. package/dist/utils/resolve-cwd-for-pid.js +29 -0
  93. package/dist/utils/resolve-cwd-for-pid.js.map +1 -0
  94. package/dist/utils/strip-ansi.d.ts +13 -0
  95. package/dist/utils/strip-ansi.d.ts.map +1 -0
  96. package/dist/utils/strip-ansi.js +28 -0
  97. package/dist/utils/strip-ansi.js.map +1 -0
  98. package/package.json +69 -0
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Strip ANSI/VT escape sequences from terminal output, keeping visible text.
3
+ * Minimal implementation — handles the common CSI SGR/cursor/move sequences,
4
+ * OSC sequences, and other escape codes produced by modern shells and TUIs.
5
+ * Does NOT handle every possible VT sequence; coverage is bounded by the
6
+ * sequences observed in common shell output (bash/zsh prompts, common TUIs,
7
+ * build tools, package managers).
8
+ *
9
+ * Not a streaming parser — input must be a complete string chunk.
10
+ * For split sequences across chunks, the caller should concatenate first.
11
+ */
12
+ export declare const stripAnsi: (input: string) => string;
13
+ //# sourceMappingURL=strip-ansi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strip-ansi.d.ts","sourceRoot":"","sources":["../../src/utils/strip-ansi.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,KAAG,MAczC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /* eslint-disable no-control-regex -- entire purpose is stripping control characters */
2
+ /**
3
+ * Strip ANSI/VT escape sequences from terminal output, keeping visible text.
4
+ * Minimal implementation — handles the common CSI SGR/cursor/move sequences,
5
+ * OSC sequences, and other escape codes produced by modern shells and TUIs.
6
+ * Does NOT handle every possible VT sequence; coverage is bounded by the
7
+ * sequences observed in common shell output (bash/zsh prompts, common TUIs,
8
+ * build tools, package managers).
9
+ *
10
+ * Not a streaming parser — input must be a complete string chunk.
11
+ * For split sequences across chunks, the caller should concatenate first.
12
+ */
13
+ export const stripAnsi = (input) => {
14
+ return input
15
+ // OSC sequences: ESC ] ... ( ST | BEL )
16
+ .replace(/\u001b\].*?(?:\u001b\\|\u0007)/g, "")
17
+ // CSI sequences: ESC [ ... final byte
18
+ .replace(/\u001b\[[\d;]*[A-Za-z@-~]/g, "")
19
+ // Remaining ESC sequences: ESC [ intermediates ] final byte
20
+ .replace(/\u001b\[[\u0020-\u002f]*[\u0030-\u007e]/g, "")
21
+ // Other ESC sequences: ESC + optional intermediates + final
22
+ .replace(/\u001b[\u0020-\u002f]*[\u0030-\u007e]/g, "")
23
+ // 8-bit C1 control codes (CSI, OSC, etc.)
24
+ .replace(/[\u009b\u009d\u0090\u0098\u009e\u009f]/g, "")
25
+ // Remove other control chars except tab, newline, carriage return
26
+ .replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g, "");
27
+ };
28
+ //# sourceMappingURL=strip-ansi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strip-ansi.js","sourceRoot":"","sources":["../../src/utils/strip-ansi.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAU,EAAE;IACjD,OAAO,KAAK;QACV,wCAAwC;SACvC,OAAO,CAAC,iCAAiC,EAAE,EAAE,CAAC;QAC/C,sCAAsC;SACrC,OAAO,CAAC,4BAA4B,EAAE,EAAE,CAAC;QAC1C,4DAA4D;SAC3D,OAAO,CAAC,0CAA0C,EAAE,EAAE,CAAC;QACxD,4DAA4D;SAC3D,OAAO,CAAC,wCAAwC,EAAE,EAAE,CAAC;QACtD,0CAA0C;SACzC,OAAO,CAAC,yCAAyC,EAAE,EAAE,CAAC;QACvD,kEAAkE;SACjE,OAAO,CAAC,iDAAiD,EAAE,EAAE,CAAC,CAAC;AACpE,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@datnguyennnx/localterm-server",
3
+ "version": "0.0.15",
4
+ "description": "PTY-backed HTTP/WebSocket server that powers localterm, built on Hono + node-pty.",
5
+ "keywords": [
6
+ "hono",
7
+ "localterm",
8
+ "node-pty",
9
+ "pty",
10
+ "terminal",
11
+ "websocket"
12
+ ],
13
+ "homepage": "https://github.com/aidenybai/localterm#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/aidenybai/localterm/issues"
16
+ },
17
+ "license": "MIT",
18
+ "author": "Aiden Bai",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/aidenybai/localterm.git",
22
+ "directory": "packages/server"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "os": [
28
+ "darwin",
29
+ "linux"
30
+ ],
31
+ "type": "module",
32
+ "main": "./dist/index.js",
33
+ "module": "./dist/index.js",
34
+ "types": "./dist/index.d.ts",
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "import": "./dist/index.js"
39
+ },
40
+ "./protocol": {
41
+ "types": "./dist/protocol.d.ts",
42
+ "import": "./dist/protocol.js"
43
+ }
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "dependencies": {
49
+ "@hono/node-server": "^1.14.0",
50
+ "@hono/node-ws": "^1.1.1",
51
+ "hono": "^4.6.13",
52
+ "node-pty": "1.1.0",
53
+ "zod": "^4.3.6"
54
+ },
55
+ "devDependencies": {
56
+ "@types/node": "^25.5.0",
57
+ "typescript": "^5.9.3",
58
+ "vite-plus": "^0.1.12"
59
+ },
60
+ "engines": {
61
+ "node": ">=22"
62
+ },
63
+ "scripts": {
64
+ "build": "tsc -p tsconfig.build.json",
65
+ "dev": "tsc -p tsconfig.build.json --watch",
66
+ "test": "vp test --run",
67
+ "typecheck": "tsc --noEmit"
68
+ }
69
+ }