@koneeric/onetool 0.0.0-stage → 0.3.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.
- package/LICENSE +21 -0
- package/README.md +76 -2
- package/auth/src/index.js +302 -0
- package/bin/onetool.js +4 -0
- package/core/src/index.js +843 -0
- package/guide/pages/INSTALL.md +810 -0
- package/guide/pages/settings.example.json +6 -0
- package/hosts/src/adapters/claude-code.js +136 -0
- package/hosts/src/index.js +107 -0
- package/library/src/index.js +544 -0
- package/package.json +36 -4
- package/practice/src/rows.js +15 -0
- package/practice/src/server.js +187 -0
- package/practice/src/signin.js +242 -0
- package/sandbox/src/child.mjs +441 -0
- package/sandbox/src/index.js +301 -0
- package/sandbox/src/last-expression.mjs +134 -0
- package/sandbox/src/probe.mjs +42 -0
- package/server/src/connect.js +190 -0
- package/server/src/descriptions.js +62 -0
- package/server/src/host.js +116 -0
- package/server/src/init.js +243 -0
- package/server/src/library.js +207 -0
- package/server/src/main.js +142 -0
- package/server/src/prompt.js +15 -0
- package/server/src/record.js +131 -0
- package/server/src/sign.js +98 -0
- package/server/src/tools.js +553 -0
- package/shell/src/index.js +270 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
// The process of the program. It reads one JSON object per line on standard input and writes one per line on
|
|
2
|
+
// standard output; see index.js for the lines. The program runs in a context of its own, and only strings cross
|
|
3
|
+
// between that context and this code, so nothing of this realm (and so no `process`) reaches the program.
|
|
4
|
+
import vm from "node:vm";
|
|
5
|
+
import { withLastExpression } from "./last-expression.mjs";
|
|
6
|
+
|
|
7
|
+
// Runs inside the context. It may use nothing from outside but `host`, which is held by its closures alone.
|
|
8
|
+
function bootstrap(host) {
|
|
9
|
+
"use strict";
|
|
10
|
+
const { stringify, parse } = JSON;
|
|
11
|
+
const text = String;
|
|
12
|
+
const AsyncFunction = (async function () {}).constructor;
|
|
13
|
+
const { getPrototypeOf } = Object;
|
|
14
|
+
const ObjectPrototype = Object.prototype;
|
|
15
|
+
const define = (name, value) =>
|
|
16
|
+
Object.defineProperty(globalThis, name, { value, writable: true, configurable: true, enumerable: false });
|
|
17
|
+
|
|
18
|
+
// A stack trace would hand the program the functions of the frames that made it.
|
|
19
|
+
Object.defineProperty(Error, "prepareStackTrace", { value: undefined, writable: false, configurable: false });
|
|
20
|
+
|
|
21
|
+
const describe = (thrown) => {
|
|
22
|
+
try {
|
|
23
|
+
return thrown instanceof Error ? thrown.name + ": " + thrown.message : text(thrown);
|
|
24
|
+
} catch (_) {
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const toText = (argument) => {
|
|
30
|
+
if (typeof argument === "string") return argument;
|
|
31
|
+
if (argument === undefined) return "undefined";
|
|
32
|
+
try {
|
|
33
|
+
const json = stringify(argument);
|
|
34
|
+
if (json !== undefined) return json;
|
|
35
|
+
} catch (_) {}
|
|
36
|
+
try {
|
|
37
|
+
return text(argument);
|
|
38
|
+
} catch (_) {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const console = {};
|
|
43
|
+
for (const name of ["log", "info", "warn", "error", "debug"]) {
|
|
44
|
+
console[name] = (...args) => host.log(args.map(toText).join(" "));
|
|
45
|
+
}
|
|
46
|
+
define("console", console);
|
|
47
|
+
|
|
48
|
+
// `progress`, when the caller gave onProgress: a line built as console.log builds its string, posted at once.
|
|
49
|
+
const defineProgress = () => {
|
|
50
|
+
define("progress", function progress(...args) {
|
|
51
|
+
host.progress(args.map(toText).join(" "));
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const timers = new Map();
|
|
56
|
+
let timerId = 0;
|
|
57
|
+
define("setTimeout", function setTimeout(callback, delay, ...args) {
|
|
58
|
+
if (typeof callback !== "function") throw new TypeError("The callback must be a function");
|
|
59
|
+
delay = Number(delay);
|
|
60
|
+
if (!(delay >= 1)) delay = 1;
|
|
61
|
+
const id = ++timerId;
|
|
62
|
+
timers.set(id, [callback, args]);
|
|
63
|
+
host.timer(id, Math.min(delay, 2147483647));
|
|
64
|
+
return id;
|
|
65
|
+
});
|
|
66
|
+
define("clearTimeout", function clearTimeout(id) {
|
|
67
|
+
if (timers.delete(id)) host.untimer(id);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// The global `state`, when the caller gave one; the object the result is read from.
|
|
71
|
+
let kept = null;
|
|
72
|
+
const readState = () => {
|
|
73
|
+
if (kept === null) return undefined;
|
|
74
|
+
try {
|
|
75
|
+
const json = stringify(kept);
|
|
76
|
+
const back = typeof json === "string" ? parse(json) : null;
|
|
77
|
+
if (typeof back === "object" && back !== null && !Array.isArray(back)) return json;
|
|
78
|
+
} catch (_) {}
|
|
79
|
+
return null;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const pending = new Map();
|
|
83
|
+
let callId = 0;
|
|
84
|
+
const makeTool = (server, tool) =>
|
|
85
|
+
async function (args) {
|
|
86
|
+
let json;
|
|
87
|
+
try {
|
|
88
|
+
json = args === undefined ? "{}" : stringify(args);
|
|
89
|
+
} catch (_) {
|
|
90
|
+
throw new Error("the arguments cannot be sent as JSON");
|
|
91
|
+
}
|
|
92
|
+
if (json === undefined) json = "{}";
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
94
|
+
const id = ++callId;
|
|
95
|
+
pending.set(id, [resolve, reject]);
|
|
96
|
+
host.call(id, server, tool, json);
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// A server given as `true`: every name that is a string is a tool, made when first asked for. `then` and
|
|
101
|
+
// `toJSON` are not, so that awaiting or serialising the object calls nothing; the object has no key of its own.
|
|
102
|
+
const everyName = (server) => {
|
|
103
|
+
const made = new Map();
|
|
104
|
+
return new Proxy(Object.create(null), {
|
|
105
|
+
get(target, name) {
|
|
106
|
+
if (typeof name !== "string" || name === "then" || name === "toJSON") return undefined;
|
|
107
|
+
let tool = made.get(name);
|
|
108
|
+
if (tool === undefined) {
|
|
109
|
+
tool = makeTool(server, name);
|
|
110
|
+
made.set(name, tool);
|
|
111
|
+
}
|
|
112
|
+
return tool;
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// The four names of `shell: true`: more ways to make a tool call of the server "shell", nothing else.
|
|
118
|
+
const defineShell = () => {
|
|
119
|
+
const callRead = makeTool("shell", "read");
|
|
120
|
+
const callWrite = makeTool("shell", "write");
|
|
121
|
+
const callEdit = makeTool("shell", "edit");
|
|
122
|
+
const callRun = makeTool("shell", "run");
|
|
123
|
+
|
|
124
|
+
define("read", async function read(path) {
|
|
125
|
+
return callRead({ path });
|
|
126
|
+
});
|
|
127
|
+
define("write", async function write(path, text) {
|
|
128
|
+
return callWrite({ path, text });
|
|
129
|
+
});
|
|
130
|
+
define("edit", async function edit(path, old, replacement) {
|
|
131
|
+
return callEdit({ path, old, new: replacement });
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const quote = (value) => "'" + value.split("'").join("'\\''") + "'";
|
|
135
|
+
const word = (value) => {
|
|
136
|
+
const kind = typeof value;
|
|
137
|
+
if (kind === "string") return quote(value);
|
|
138
|
+
if (kind === "number" || kind === "boolean") return quote(text(value));
|
|
139
|
+
throw new TypeError("a value in a command must be a string, a number, a boolean or a list of them");
|
|
140
|
+
};
|
|
141
|
+
const insert = (value) => {
|
|
142
|
+
if (!Array.isArray(value)) return word(value);
|
|
143
|
+
let out = "";
|
|
144
|
+
for (let i = 0; i < value.length; i++) out += (i > 0 ? " " : "") + word(value[i]);
|
|
145
|
+
return out;
|
|
146
|
+
};
|
|
147
|
+
const failure = ({ exitCode, stdout, stderr }) => {
|
|
148
|
+
const detail = stderr.trim().slice(0, 500);
|
|
149
|
+
const error = new Error("the command failed with exit code " + exitCode + (detail === "" ? "" : ": " + detail));
|
|
150
|
+
error.exitCode = exitCode;
|
|
151
|
+
error.stdout = stdout;
|
|
152
|
+
error.stderr = stderr;
|
|
153
|
+
return error;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// A command object starts nothing until `then` or `text` is called; then it makes the one call.
|
|
157
|
+
const command = (commandText) => {
|
|
158
|
+
let started = null;
|
|
159
|
+
let throws = true;
|
|
160
|
+
const start = () => {
|
|
161
|
+
if (started === null) {
|
|
162
|
+
started = callRun({ command: commandText }).then((result) => {
|
|
163
|
+
if (throws && result.exitCode !== 0) throw failure(result);
|
|
164
|
+
return result;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
return started;
|
|
168
|
+
};
|
|
169
|
+
const object = {
|
|
170
|
+
then: (onDone, onFail) => start().then(onDone, onFail),
|
|
171
|
+
text: () => start().then((result) => result.stdout),
|
|
172
|
+
nothrow() {
|
|
173
|
+
throws = false;
|
|
174
|
+
return object;
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
return object;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
define("$", function $(first) {
|
|
181
|
+
if (typeof first === "string") return command(first);
|
|
182
|
+
if (Array.isArray(first) && Array.isArray(first.raw)) {
|
|
183
|
+
const raw = first.raw;
|
|
184
|
+
let out = raw[0];
|
|
185
|
+
for (let i = 1; i < arguments.length; i++) out += insert(arguments[i]) + raw[i];
|
|
186
|
+
return command(out);
|
|
187
|
+
}
|
|
188
|
+
throw new TypeError("$ takes a template or one string");
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// `lib` and `library`, when the caller gave a library: the saved programs run here, in this world, as one more
|
|
193
|
+
// way to run text; `library.save`, `remove`, `report`, `restore` and `read` are five more ways to make a tool call
|
|
194
|
+
// of the server "library". Nothing else is given to the program.
|
|
195
|
+
const IDENTIFIER = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;
|
|
196
|
+
const defineLibrary = (items) => {
|
|
197
|
+
const isPlain = (value) => {
|
|
198
|
+
if (typeof value !== "object" || value === null) return false;
|
|
199
|
+
const prototype = getPrototypeOf(value);
|
|
200
|
+
return prototype === ObjectPrototype || prototype === null;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// Each name of params is checked as a bare identifier before it is handed to the compiler, so that no text of
|
|
204
|
+
// params can end the parameter list; the compiler then refuses what the language refuses.
|
|
205
|
+
const compileItem = (params, code) => {
|
|
206
|
+
for (const param of params) {
|
|
207
|
+
if (!IDENTIFIER.test(param)) throw new SyntaxError("Invalid parameter name: " + param);
|
|
208
|
+
}
|
|
209
|
+
let fn = new AsyncFunction(...params, code);
|
|
210
|
+
for (const variant of parse(host.variants(code))) {
|
|
211
|
+
try {
|
|
212
|
+
fn = new AsyncFunction(...params, variant);
|
|
213
|
+
break;
|
|
214
|
+
} catch (_) {}
|
|
215
|
+
}
|
|
216
|
+
return fn;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const makeSaved = (name, params, code) => {
|
|
220
|
+
let compiled = null;
|
|
221
|
+
return async function (args) {
|
|
222
|
+
let ok = false;
|
|
223
|
+
try {
|
|
224
|
+
if (args === undefined) args = {};
|
|
225
|
+
else if (!isPlain(args)) throw new TypeError("the arguments of a saved program must be an object");
|
|
226
|
+
if (compiled === null) {
|
|
227
|
+
try {
|
|
228
|
+
compiled = { fn: compileItem(params, code) };
|
|
229
|
+
} catch (thrown) {
|
|
230
|
+
compiled = { thrown };
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if ("thrown" in compiled) throw compiled.thrown;
|
|
234
|
+
const values = [];
|
|
235
|
+
for (const param of params) values.push(args[param]);
|
|
236
|
+
const value = await compiled.fn(...values);
|
|
237
|
+
ok = true;
|
|
238
|
+
return value;
|
|
239
|
+
} finally {
|
|
240
|
+
host.use(name, ok);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const lib = {};
|
|
246
|
+
for (const { name, params, code } of items) {
|
|
247
|
+
Object.defineProperty(lib, name, { value: makeSaved(name, params, code), writable: true, enumerable: true, configurable: true });
|
|
248
|
+
}
|
|
249
|
+
define("lib", lib);
|
|
250
|
+
|
|
251
|
+
const callSave = makeTool("library", "save");
|
|
252
|
+
const callRemove = makeTool("library", "remove");
|
|
253
|
+
const library = {};
|
|
254
|
+
Object.defineProperty(library, "save", {
|
|
255
|
+
value: async function save(name, options) {
|
|
256
|
+
const given = typeof options === "object" && options !== null ? options : {};
|
|
257
|
+
return callSave({ name, about: given.about, params: given.params, code: given.code, replace: given.replace });
|
|
258
|
+
},
|
|
259
|
+
writable: true, enumerable: true, configurable: true,
|
|
260
|
+
});
|
|
261
|
+
Object.defineProperty(library, "remove", {
|
|
262
|
+
value: async function remove(name) {
|
|
263
|
+
return callRemove({ name });
|
|
264
|
+
},
|
|
265
|
+
writable: true, enumerable: true, configurable: true,
|
|
266
|
+
});
|
|
267
|
+
const callReport = makeTool("library", "report");
|
|
268
|
+
const callRestore = makeTool("library", "restore");
|
|
269
|
+
const callRead = makeTool("library", "read");
|
|
270
|
+
Object.defineProperty(library, "report", {
|
|
271
|
+
value: async function report() {
|
|
272
|
+
return callReport({});
|
|
273
|
+
},
|
|
274
|
+
writable: true, enumerable: true, configurable: true,
|
|
275
|
+
});
|
|
276
|
+
Object.defineProperty(library, "restore", {
|
|
277
|
+
value: async function restore(name) {
|
|
278
|
+
return callRestore({ name });
|
|
279
|
+
},
|
|
280
|
+
writable: true, enumerable: true, configurable: true,
|
|
281
|
+
});
|
|
282
|
+
Object.defineProperty(library, "read", {
|
|
283
|
+
value: async function read(name) {
|
|
284
|
+
return callRead({ name });
|
|
285
|
+
},
|
|
286
|
+
writable: true, enumerable: true, configurable: true,
|
|
287
|
+
});
|
|
288
|
+
define("library", library);
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
return {
|
|
292
|
+
init(toolsJson, stateJson, shell, posts, libraryJson) {
|
|
293
|
+
if (shell) defineShell();
|
|
294
|
+
if (posts) defineProgress();
|
|
295
|
+
if (stateJson !== null) {
|
|
296
|
+
kept = parse(stateJson);
|
|
297
|
+
Object.defineProperty(globalThis, "state", { value: kept, writable: false, configurable: false, enumerable: false });
|
|
298
|
+
}
|
|
299
|
+
const spec = parse(toolsJson);
|
|
300
|
+
const tools = {};
|
|
301
|
+
for (const server of Object.keys(spec)) {
|
|
302
|
+
let entry = {};
|
|
303
|
+
if (spec[server] === true) entry = everyName(server);
|
|
304
|
+
else {
|
|
305
|
+
for (const tool of spec[server]) {
|
|
306
|
+
Object.defineProperty(entry, tool, {
|
|
307
|
+
value: makeTool(server, tool), writable: true, enumerable: true, configurable: true,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
Object.defineProperty(tools, server, { value: entry, writable: true, enumerable: true, configurable: true });
|
|
312
|
+
}
|
|
313
|
+
define("tools", tools);
|
|
314
|
+
if (libraryJson !== null) defineLibrary(parse(libraryJson));
|
|
315
|
+
},
|
|
316
|
+
compile: (body) => new AsyncFunction(body),
|
|
317
|
+
fail: (thrown) => host.done("error", describe(thrown), readState()),
|
|
318
|
+
start(fn) {
|
|
319
|
+
(async () => {
|
|
320
|
+
let value;
|
|
321
|
+
try {
|
|
322
|
+
value = await fn();
|
|
323
|
+
} catch (thrown) {
|
|
324
|
+
host.done("error", describe(thrown), readState());
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
const state = readState();
|
|
328
|
+
let json;
|
|
329
|
+
try {
|
|
330
|
+
json = stringify(value);
|
|
331
|
+
} catch (_) {
|
|
332
|
+
host.done("error", "the value cannot be sent as JSON", state);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (json === undefined) host.done("undefined", "", state);
|
|
336
|
+
else host.done("value", json, state);
|
|
337
|
+
})();
|
|
338
|
+
},
|
|
339
|
+
fire(id) {
|
|
340
|
+
const timer = timers.get(id);
|
|
341
|
+
if (!timer) return;
|
|
342
|
+
timers.delete(id);
|
|
343
|
+
try {
|
|
344
|
+
timer[0](...timer[1]);
|
|
345
|
+
} catch (thrown) {
|
|
346
|
+
host.done("error", describe(thrown), readState());
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
deliver(id, status, answer) {
|
|
350
|
+
const call = pending.get(id);
|
|
351
|
+
if (!call) return;
|
|
352
|
+
pending.delete(id);
|
|
353
|
+
if (status === "ok") call[0](parse(answer));
|
|
354
|
+
else if (status === "undefined") call[0](undefined);
|
|
355
|
+
else call[1](new Error(answer));
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const send = (message) => process.stdout.write(JSON.stringify(message) + "\n");
|
|
361
|
+
// Whatever goes wrong here must not reach the program, nor end this process.
|
|
362
|
+
const quiet = (fn) => {
|
|
363
|
+
try {
|
|
364
|
+
fn();
|
|
365
|
+
} catch (_) {}
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
const timeouts = new Map();
|
|
369
|
+
let boot;
|
|
370
|
+
const host = {
|
|
371
|
+
log: (line) => quiet(() => send({ t: "log", s: String(line) })),
|
|
372
|
+
progress: (line) => quiet(() => send({ t: "progress", s: String(line) })),
|
|
373
|
+
use: (name, ok) => quiet(() => send({ t: "use", name: String(name), ok: ok === true })),
|
|
374
|
+
// the texts a saved program may be run as (see last-expression.mjs), as JSON text: only strings cross
|
|
375
|
+
variants: (code) => {
|
|
376
|
+
try {
|
|
377
|
+
return JSON.stringify([...withLastExpression(String(code))]);
|
|
378
|
+
} catch (_) {
|
|
379
|
+
return "[]";
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
call: (id, server, tool, args) => quiet(() => send({ t: "call", id, server, tool, args })),
|
|
383
|
+
// state: JSON text; null when it cannot be held; undefined (left out of the line) when none was given
|
|
384
|
+
done: (kind, answer, state) => quiet(() => send({ t: "done", kind, text: String(answer), state })),
|
|
385
|
+
timer: (id, delay) =>
|
|
386
|
+
quiet(() =>
|
|
387
|
+
timeouts.set(
|
|
388
|
+
id,
|
|
389
|
+
setTimeout(() => {
|
|
390
|
+
timeouts.delete(id);
|
|
391
|
+
quiet(() => boot.fire(id));
|
|
392
|
+
}, delay),
|
|
393
|
+
),
|
|
394
|
+
),
|
|
395
|
+
untimer: (id) =>
|
|
396
|
+
quiet(() => {
|
|
397
|
+
clearTimeout(timeouts.get(id));
|
|
398
|
+
timeouts.delete(id);
|
|
399
|
+
}),
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
const context = vm.createContext(Object.create(null));
|
|
403
|
+
boot = vm.runInContext("(" + bootstrap.toString() + ")", context)(host);
|
|
404
|
+
|
|
405
|
+
function run({ code, tools, state, shell, progress, library }) {
|
|
406
|
+
boot.init(JSON.stringify(tools), state, shell === true, progress === true, Array.isArray(library) ? JSON.stringify(library) : null);
|
|
407
|
+
let fn;
|
|
408
|
+
try {
|
|
409
|
+
fn = boot.compile(code);
|
|
410
|
+
} catch (thrown) {
|
|
411
|
+
boot.fail(thrown);
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
for (const text of withLastExpression(code)) {
|
|
415
|
+
try {
|
|
416
|
+
fn = boot.compile(text);
|
|
417
|
+
break;
|
|
418
|
+
} catch (_) {}
|
|
419
|
+
}
|
|
420
|
+
boot.start(fn);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
function onMessage(message) {
|
|
424
|
+
if (message.t === "init") run(message);
|
|
425
|
+
else if (message.t === "result") quiet(() => boot.deliver(message.id, message.status, message.text));
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// A caller that has gone, or has no more to say, leaves nothing to run for.
|
|
429
|
+
process.on("unhandledRejection", () => {});
|
|
430
|
+
process.stdin.setEncoding("utf8");
|
|
431
|
+
let buffer = "";
|
|
432
|
+
process.stdin.on("data", (chunk) => {
|
|
433
|
+
buffer += chunk;
|
|
434
|
+
let end;
|
|
435
|
+
while ((end = buffer.indexOf("\n")) >= 0) {
|
|
436
|
+
const line = buffer.slice(0, end);
|
|
437
|
+
buffer = buffer.slice(end + 1);
|
|
438
|
+
onMessage(JSON.parse(line));
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
process.stdin.on("end", () => process.exit(0));
|