@made-by-moonlight/athene-plugin-runtime-process 0.9.1
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/LICENSE +22 -0
- package/dist/__tests__/index.test.d.ts +2 -0
- package/dist/__tests__/index.test.d.ts.map +1 -0
- package/dist/__tests__/index.test.js +674 -0
- package/dist/__tests__/index.test.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +489 -0
- package/dist/index.js.map +1 -0
- package/dist/pty-client.d.ts +55 -0
- package/dist/pty-client.d.ts.map +1 -0
- package/dist/pty-client.js +248 -0
- package/dist/pty-client.js.map +1 -0
- package/dist/pty-host.d.ts +51 -0
- package/dist/pty-host.d.ts.map +1 -0
- package/dist/pty-host.js +354 -0
- package/dist/pty-host.js.map +1 -0
- package/package.json +49 -0
package/dist/pty-host.js
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pty-host.ts
|
|
3
|
+
*
|
|
4
|
+
* Dual-purpose file:
|
|
5
|
+
* 1. Module — exports protocol constants, encodeMessage(), and MessageParser
|
|
6
|
+
* (imported by pty-client.ts)
|
|
7
|
+
* 2. Standalone script — when run as `node pty-host.js <args>` it owns a
|
|
8
|
+
* ConPTY session and exposes it over a Windows named pipe so multiple
|
|
9
|
+
* clients can attach/detach (analogous to the tmux daemon).
|
|
10
|
+
*
|
|
11
|
+
* Usage (standalone):
|
|
12
|
+
* node pty-host.js <sessionId> <pipePath> <cwd> <shellCmd> <shellArg1> [shellArg2...]
|
|
13
|
+
*
|
|
14
|
+
* Binary protocol over named pipe:
|
|
15
|
+
* [1-byte type][4-byte big-endian length][payload]
|
|
16
|
+
*
|
|
17
|
+
* 0x01 terminal data host → client raw PTY output bytes
|
|
18
|
+
* 0x02 terminal input client → host raw keystrokes for PTY
|
|
19
|
+
* 0x03 resize client → host JSON { cols, rows }
|
|
20
|
+
* 0x04 get-output req client → host JSON { lines: number }
|
|
21
|
+
* 0x05 get-output res host → client UTF-8 text (last N lines joined)
|
|
22
|
+
* 0x06 status req client → host empty payload
|
|
23
|
+
* 0x07 status res host → client JSON { alive, pid, exitCode? }
|
|
24
|
+
* 0x08 kill req client → host empty payload
|
|
25
|
+
*/
|
|
26
|
+
import net from "node:net";
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
// Protocol constants (exported for pty-client.ts)
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
export const MSG_TERMINAL_DATA = 0x01;
|
|
31
|
+
export const MSG_TERMINAL_INPUT = 0x02;
|
|
32
|
+
export const MSG_RESIZE = 0x03;
|
|
33
|
+
export const MSG_GET_OUTPUT_REQ = 0x04;
|
|
34
|
+
export const MSG_GET_OUTPUT_RES = 0x05;
|
|
35
|
+
export const MSG_STATUS_REQ = 0x06;
|
|
36
|
+
export const MSG_STATUS_RES = 0x07;
|
|
37
|
+
export const MSG_KILL_REQ = 0x08;
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// Protocol helpers (exported for pty-client.ts)
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
/**
|
|
42
|
+
* Encode a message into the binary framing format.
|
|
43
|
+
* @param type One of the MSG_* constants.
|
|
44
|
+
* @param payload String (UTF-8 encoded) or raw Buffer.
|
|
45
|
+
*/
|
|
46
|
+
export function encodeMessage(type, payload) {
|
|
47
|
+
const body = typeof payload === "string" ? Buffer.from(payload, "utf-8") : payload;
|
|
48
|
+
const frame = Buffer.allocUnsafe(5 + body.length);
|
|
49
|
+
frame.writeUInt8(type, 0);
|
|
50
|
+
frame.writeUInt32BE(body.length, 1);
|
|
51
|
+
body.copy(frame, 5);
|
|
52
|
+
return frame;
|
|
53
|
+
}
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// MessageParser (exported for pty-client.ts)
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
/**
|
|
58
|
+
* Streaming parser for the binary framing protocol.
|
|
59
|
+
* Feed arbitrary-sized chunks from a TCP/pipe stream and receive complete
|
|
60
|
+
* decoded messages via the onMessage callback.
|
|
61
|
+
*/
|
|
62
|
+
export class MessageParser {
|
|
63
|
+
_buf = Buffer.alloc(0);
|
|
64
|
+
_onMessage;
|
|
65
|
+
constructor(onMessage) {
|
|
66
|
+
this._onMessage = onMessage;
|
|
67
|
+
}
|
|
68
|
+
feed(chunk) {
|
|
69
|
+
this._buf = Buffer.concat([this._buf, chunk]);
|
|
70
|
+
// Process as many complete frames as are available
|
|
71
|
+
while (this._buf.length >= 5) {
|
|
72
|
+
const payloadLen = this._buf.readUInt32BE(1);
|
|
73
|
+
const frameLen = 5 + payloadLen;
|
|
74
|
+
if (this._buf.length < frameLen)
|
|
75
|
+
break;
|
|
76
|
+
const type = this._buf.readUInt8(0);
|
|
77
|
+
const payload = this._buf.slice(5, frameLen);
|
|
78
|
+
this._buf = this._buf.slice(frameLen);
|
|
79
|
+
this._onMessage(type, payload);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
// Standalone entry-point
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
const isMain = process.argv[1]?.endsWith("pty-host.js") || process.argv[1]?.endsWith("pty-host.ts");
|
|
87
|
+
if (isMain) {
|
|
88
|
+
void runPtyHost();
|
|
89
|
+
}
|
|
90
|
+
async function runPtyHost() {
|
|
91
|
+
// Parse CLI arguments
|
|
92
|
+
// argv: [node, pty-host.js, sessionId, pipePath, cwd, shellCmd, shellArg1, ...]
|
|
93
|
+
const [, , sessionId, pipePath, cwd, shellCmd, ...shellArgs] = process.argv;
|
|
94
|
+
if (!sessionId || !pipePath || !cwd || !shellCmd) {
|
|
95
|
+
process.stderr.write("Usage: node pty-host.js <sessionId> <pipePath> <cwd> <shellCmd> [shellArg...]\n");
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
// Dynamically import node-pty so the module side of this file can be
|
|
99
|
+
// imported without requiring node-pty to be present on the client host.
|
|
100
|
+
const { spawn: ptySpawn } = await import("node-pty");
|
|
101
|
+
// node-pty on Windows requires the full executable name (with .exe).
|
|
102
|
+
// getShell() may return bare "pwsh" or "powershell" — append .exe if needed.
|
|
103
|
+
let resolvedShellCmd = shellCmd;
|
|
104
|
+
if (process.platform === "win32" &&
|
|
105
|
+
!shellCmd.includes("\\") &&
|
|
106
|
+
!shellCmd.includes("/") &&
|
|
107
|
+
!shellCmd.endsWith(".exe") &&
|
|
108
|
+
!shellCmd.endsWith(".cmd")) {
|
|
109
|
+
resolvedShellCmd = shellCmd + ".exe";
|
|
110
|
+
}
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
// State
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
const MAX_OUTPUT_LINES = 1000;
|
|
115
|
+
/** Raw terminal output lines (ANSI codes preserved for xterm.js replay). */
|
|
116
|
+
const outputBuffer = [];
|
|
117
|
+
let ptyExitCode;
|
|
118
|
+
const clients = new Set();
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
// Spawn the PTY
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
const pty = ptySpawn(resolvedShellCmd, shellArgs, {
|
|
123
|
+
name: "xterm-256color",
|
|
124
|
+
cols: 220,
|
|
125
|
+
rows: 50,
|
|
126
|
+
cwd,
|
|
127
|
+
env: process.env,
|
|
128
|
+
encoding: null, // receive raw Buffers
|
|
129
|
+
});
|
|
130
|
+
// Signal readiness to the parent process
|
|
131
|
+
process.stdout.write(`READY:${pty.pid}\n`);
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
// Rolling output buffer
|
|
134
|
+
// ---------------------------------------------------------------------------
|
|
135
|
+
let partialLine = "";
|
|
136
|
+
function appendOutput(raw) {
|
|
137
|
+
// Store raw bytes in the buffer for ANSI-faithful replay
|
|
138
|
+
const text = partialLine + raw.toString("utf-8");
|
|
139
|
+
const lines = text.split("\n");
|
|
140
|
+
// The last element is either "" (text ended with \n) or a partial line
|
|
141
|
+
partialLine = lines.pop();
|
|
142
|
+
for (const line of lines) {
|
|
143
|
+
outputBuffer.push(line + "\n");
|
|
144
|
+
}
|
|
145
|
+
if (outputBuffer.length > MAX_OUTPUT_LINES) {
|
|
146
|
+
outputBuffer.splice(0, outputBuffer.length - MAX_OUTPUT_LINES);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
// Broadcast helpers
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
function broadcast(msg) {
|
|
153
|
+
for (const sock of clients) {
|
|
154
|
+
if (!sock.destroyed) {
|
|
155
|
+
sock.write(msg);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function sendToSocket(sock, msg) {
|
|
160
|
+
if (!sock.destroyed) {
|
|
161
|
+
sock.write(msg);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
// PTY event handlers
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
// node-pty emits data as string when encoding is set, Buffer when null.
|
|
168
|
+
// We set encoding: null so we receive Buffers.
|
|
169
|
+
pty.onData((data) => {
|
|
170
|
+
// Convert to Buffer if node-pty gave us a string (shouldn't happen with
|
|
171
|
+
// encoding: null, but guard defensively).
|
|
172
|
+
const buf = typeof data === "string" ? Buffer.from(data, "utf-8") : Buffer.from(data);
|
|
173
|
+
appendOutput(buf);
|
|
174
|
+
broadcast(encodeMessage(MSG_TERMINAL_DATA, buf));
|
|
175
|
+
});
|
|
176
|
+
pty.onExit(({ exitCode }) => {
|
|
177
|
+
ptyExitCode = exitCode;
|
|
178
|
+
// Flush any trailing partial line
|
|
179
|
+
if (partialLine) {
|
|
180
|
+
outputBuffer.push(partialLine);
|
|
181
|
+
partialLine = "";
|
|
182
|
+
}
|
|
183
|
+
const statusMsg = encodeMessage(MSG_STATUS_RES, JSON.stringify({ alive: false, pid: pty.pid, exitCode }));
|
|
184
|
+
broadcast(statusMsg);
|
|
185
|
+
// Keep the PTY host alive after the agent exits — mirrors tmux behavior
|
|
186
|
+
// where the shell session persists after the command finishes. This keeps
|
|
187
|
+
// the named pipe reachable so:
|
|
188
|
+
// - isAlive() returns true (pipe connectable)
|
|
189
|
+
// - Clients can still connect and view scrollback output
|
|
190
|
+
// - The STATUS_RES reports alive:false so getActivityState sees "exited"
|
|
191
|
+
// - athene session kill / athene stop will destroy the pipe server via MSG_KILL_REQ
|
|
192
|
+
});
|
|
193
|
+
// ---------------------------------------------------------------------------
|
|
194
|
+
// Named pipe server
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
const server = net.createServer((sock) => {
|
|
197
|
+
clients.add(sock);
|
|
198
|
+
// Send current output buffer to newly connected client (like tmux attach
|
|
199
|
+
// showing scrollback).
|
|
200
|
+
if (outputBuffer.length > 0) {
|
|
201
|
+
const scrollback = Buffer.from(outputBuffer.join(""), "utf-8");
|
|
202
|
+
sendToSocket(sock, encodeMessage(MSG_TERMINAL_DATA, scrollback));
|
|
203
|
+
}
|
|
204
|
+
const parser = new MessageParser((type, payload) => {
|
|
205
|
+
handleClientMessage(sock, type, payload);
|
|
206
|
+
});
|
|
207
|
+
sock.on("data", (chunk) => {
|
|
208
|
+
parser.feed(chunk);
|
|
209
|
+
});
|
|
210
|
+
sock.on("close", () => {
|
|
211
|
+
clients.delete(sock);
|
|
212
|
+
});
|
|
213
|
+
sock.on("error", () => {
|
|
214
|
+
clients.delete(sock);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
// ---------------------------------------------------------------------------
|
|
218
|
+
// Client message handler
|
|
219
|
+
// ---------------------------------------------------------------------------
|
|
220
|
+
function handleClientMessage(sock, type, payload) {
|
|
221
|
+
switch (type) {
|
|
222
|
+
case MSG_TERMINAL_INPUT: {
|
|
223
|
+
if (ptyExitCode === undefined) {
|
|
224
|
+
pty.write(payload.toString("utf-8"));
|
|
225
|
+
}
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
case MSG_RESIZE: {
|
|
229
|
+
if (ptyExitCode === undefined) {
|
|
230
|
+
try {
|
|
231
|
+
const { cols, rows } = JSON.parse(payload.toString("utf-8"));
|
|
232
|
+
if (typeof cols === "number" && typeof rows === "number") {
|
|
233
|
+
pty.resize(cols, rows);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
// Malformed resize — ignore
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
case MSG_GET_OUTPUT_REQ: {
|
|
243
|
+
let lines = 50;
|
|
244
|
+
try {
|
|
245
|
+
const req = JSON.parse(payload.toString("utf-8"));
|
|
246
|
+
if (typeof req.lines === "number")
|
|
247
|
+
lines = req.lines;
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
// Use default
|
|
251
|
+
}
|
|
252
|
+
const start = Math.max(0, outputBuffer.length - lines);
|
|
253
|
+
const text = outputBuffer.slice(start).join("");
|
|
254
|
+
sendToSocket(sock, encodeMessage(MSG_GET_OUTPUT_RES, text));
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
case MSG_STATUS_REQ: {
|
|
258
|
+
const alive = ptyExitCode === undefined;
|
|
259
|
+
const status = {
|
|
260
|
+
alive,
|
|
261
|
+
pid: pty.pid,
|
|
262
|
+
};
|
|
263
|
+
if (!alive)
|
|
264
|
+
status.exitCode = ptyExitCode;
|
|
265
|
+
sendToSocket(sock, encodeMessage(MSG_STATUS_RES, JSON.stringify(status)));
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
case MSG_KILL_REQ: {
|
|
269
|
+
// Full teardown — dispose the ConPTY handle, drop clients, close the
|
|
270
|
+
// pipe server, then exit. Previously we only called pty.kill() and
|
|
271
|
+
// kept the pipe alive, which left a stale host lingering until the OS
|
|
272
|
+
// reaped it (and caused the orphaned conpty_console_list_agent
|
|
273
|
+
// helpers that show Windows Error Reporting dialogs).
|
|
274
|
+
shutdown("MSG_KILL_REQ");
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
default:
|
|
278
|
+
// Unknown message type — ignore
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// ---------------------------------------------------------------------------
|
|
283
|
+
// Start listening
|
|
284
|
+
// ---------------------------------------------------------------------------
|
|
285
|
+
await new Promise((resolve, reject) => {
|
|
286
|
+
server.once("error", reject);
|
|
287
|
+
server.listen(pipePath, () => {
|
|
288
|
+
server.removeListener("error", reject);
|
|
289
|
+
resolve();
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
// -------------------------------------------------------------------------
|
|
293
|
+
// Graceful shutdown
|
|
294
|
+
//
|
|
295
|
+
// If this process dies without first disposing the ConPTY handle, node-pty's
|
|
296
|
+
// `conpty_console_list_agent.exe` helper gets its pipe severed mid-operation
|
|
297
|
+
// and Windows Error Reporting pops a "0x800700e8" dialog. Intercept every
|
|
298
|
+
// common exit path and run the same teardown (pty.kill → close clients →
|
|
299
|
+
// close server) so the helper can shut down cleanly.
|
|
300
|
+
// -------------------------------------------------------------------------
|
|
301
|
+
let shuttingDown = false;
|
|
302
|
+
function shutdown(reason) {
|
|
303
|
+
if (shuttingDown)
|
|
304
|
+
return;
|
|
305
|
+
shuttingDown = true;
|
|
306
|
+
try {
|
|
307
|
+
if (ptyExitCode === undefined) {
|
|
308
|
+
try {
|
|
309
|
+
pty.kill();
|
|
310
|
+
}
|
|
311
|
+
catch { /* already dead */ }
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
catch { /* noop */ }
|
|
315
|
+
for (const sock of clients) {
|
|
316
|
+
try {
|
|
317
|
+
sock.destroy();
|
|
318
|
+
}
|
|
319
|
+
catch { /* noop */ }
|
|
320
|
+
}
|
|
321
|
+
clients.clear();
|
|
322
|
+
try {
|
|
323
|
+
server.close();
|
|
324
|
+
}
|
|
325
|
+
catch { /* noop */ }
|
|
326
|
+
// Give node-pty a tick to release the ConPTY handle before the event loop
|
|
327
|
+
// exits. Without this, the conpty_console_list_agent helper may still be
|
|
328
|
+
// mid-cleanup when the parent node process terminates.
|
|
329
|
+
setTimeout(() => process.exit(0), 50).unref();
|
|
330
|
+
process.stderr.write(`pty-host [${sessionId}] shutdown: ${reason}\n`);
|
|
331
|
+
}
|
|
332
|
+
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
333
|
+
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
334
|
+
process.on("SIGHUP", () => shutdown("SIGHUP"));
|
|
335
|
+
process.on("SIGBREAK", () => shutdown("SIGBREAK"));
|
|
336
|
+
process.on("beforeExit", () => shutdown("beforeExit"));
|
|
337
|
+
process.on("uncaughtException", (err) => {
|
|
338
|
+
process.stderr.write(`pty-host [${sessionId}] uncaught: ${String(err)}\n`);
|
|
339
|
+
shutdown("uncaughtException");
|
|
340
|
+
});
|
|
341
|
+
process.on("unhandledRejection", (reason) => {
|
|
342
|
+
process.stderr.write(`pty-host [${sessionId}] unhandled rejection: ${String(reason)}\n`);
|
|
343
|
+
});
|
|
344
|
+
// Last resort: dispose the PTY even on a clean exit before the event loop
|
|
345
|
+
// unwinds so node-pty's native cleanup gets a chance to run.
|
|
346
|
+
process.on("exit", () => {
|
|
347
|
+
try {
|
|
348
|
+
if (ptyExitCode === undefined)
|
|
349
|
+
pty.kill();
|
|
350
|
+
}
|
|
351
|
+
catch { /* noop */ }
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
//# sourceMappingURL=pty-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pty-host.js","sourceRoot":"","sources":["../src/pty-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,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B,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE;QAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,SAAS,0BAA0B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;IACH,0EAA0E;IAC1E,6DAA6D;IAC7D,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACtB,IAAI,CAAC;YACH,IAAI,WAAW,KAAK,SAAS;gBAAE,GAAG,CAAC,IAAI,EAAE,CAAC;QAC5C,CAAC;QAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;AAEL,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@made-by-moonlight/athene-plugin-runtime-process",
|
|
3
|
+
"version": "0.9.1",
|
|
4
|
+
"description": "Runtime plugin: child processes",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/slievr/Athene.git",
|
|
21
|
+
"directory": "packages/plugins/runtime-process"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/slievr/Athene",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/slievr/Athene/issues"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20.0.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"node-pty": "^1.0.0",
|
|
32
|
+
"@made-by-moonlight/athene-core": "0.9.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^25.2.3",
|
|
36
|
+
"typescript": "^5.7.0",
|
|
37
|
+
"vitest": "^3.0.0"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc",
|
|
44
|
+
"typecheck": "tsc --noEmit",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"test:watch": "vitest",
|
|
47
|
+
"clean": "rm -rf dist"
|
|
48
|
+
}
|
|
49
|
+
}
|