@nervur.org/installer-node 0.37.4 → 0.37.5
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/cargo/worker.js +11 -11
- package/organs/console/node/index.d.ts +1 -1
- package/organs/console/node/index.js +1 -1
- package/organs/console/node/line.d.ts +5 -1
- package/organs/console/node/line.js +14 -2
- package/package.json +3 -3
- package/src/command/mcp.d.ts +1 -0
- package/src/command/mcp.js +13 -2
- package/src/version/version.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { clearedSocket, dialable, pipeForListen, reachedByAnother, socketOf, socketTooLong } from './guard.js';
|
|
2
|
-
export { typeLine, watchConsole, type Heard, type Watch, type Watching } from './line.js';
|
|
2
|
+
export { typeLine, watchConsole, type Heard, type Watch, type Watching, type Whole } from './line.js';
|
|
3
3
|
export { listenConsole, type Listening, type Moved, type Typed } from './socket.js';
|
|
4
4
|
export { provingFirst, toldOf } from './proof.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: FSL-1.1-ALv2
|
|
2
2
|
export { clearedSocket, dialable, pipeForListen, reachedByAnother, socketOf, socketTooLong } from './guard.js';
|
|
3
|
-
export { typeLine, watchConsole,
|
|
3
|
+
export { typeLine, watchConsole, } from './line.js';
|
|
4
4
|
export { listenConsole, } from './socket.js';
|
|
5
5
|
export { provingFirst, toldOf } from './proof.js';
|
|
@@ -7,7 +7,11 @@ export type Heard = {
|
|
|
7
7
|
readonly answer: Answer;
|
|
8
8
|
readonly text: string;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type Whole = {
|
|
11
|
+
readonly ms: number;
|
|
12
|
+
readonly why: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const typeLine: (path: string, words: readonly string[], wait: number, within?: number, whole?: Whole) => Promise<Heard | Why>;
|
|
11
15
|
export type Watching = {
|
|
12
16
|
readonly close: () => void;
|
|
13
17
|
};
|
|
@@ -43,7 +43,7 @@ const reached = async (path , wait ) => {
|
|
|
43
43
|
return found ?? { why: `no console answers at ${path}` };
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const answerOver = (socket , within ) =>
|
|
46
|
+
const answerOver = (socket , within , whole ) =>
|
|
47
47
|
new Promise((done) => {
|
|
48
48
|
const held = [];
|
|
49
49
|
const silent = () => {
|
|
@@ -51,8 +51,17 @@ const answerOver = (socket , within ) =>
|
|
|
51
51
|
done({ why: `the console said nothing for ${within / 1000} s` });
|
|
52
52
|
};
|
|
53
53
|
let timer = setTimeout(silent, within);
|
|
54
|
+
const cut =
|
|
55
|
+
whole === undefined
|
|
56
|
+
? undefined
|
|
57
|
+
: setTimeout(() => {
|
|
58
|
+
clearTimeout(timer);
|
|
59
|
+
socket.destroy();
|
|
60
|
+
done({ why: whole.why });
|
|
61
|
+
}, whole.ms);
|
|
54
62
|
const finish = (heard ) => {
|
|
55
63
|
clearTimeout(timer);
|
|
64
|
+
clearTimeout(cut);
|
|
56
65
|
socket.destroy();
|
|
57
66
|
done(heard);
|
|
58
67
|
};
|
|
@@ -79,11 +88,14 @@ const answerOver = (socket , within ) =>
|
|
|
79
88
|
socket.on('error', (error) => finish({ why: `the console's socket failed: ${error.message}` }));
|
|
80
89
|
});
|
|
81
90
|
|
|
91
|
+
|
|
92
|
+
|
|
82
93
|
export const typeLine = async (
|
|
83
94
|
path ,
|
|
84
95
|
words ,
|
|
85
96
|
wait ,
|
|
86
97
|
within = LONGEST_WAIT,
|
|
98
|
+
whole ,
|
|
87
99
|
) => {
|
|
88
100
|
const why = reachedByAnother(dirname(path));
|
|
89
101
|
if (why !== null) return { why };
|
|
@@ -91,7 +103,7 @@ export const typeLine = async (
|
|
|
91
103
|
if (line.length > LONGEST) return { why: `a line holds at most ${LONGEST} bytes` };
|
|
92
104
|
const socket = await reached(path, wait);
|
|
93
105
|
if ('why' in socket) return socket;
|
|
94
|
-
const heard = answerOver(socket, within);
|
|
106
|
+
const heard = answerOver(socket, within, whole);
|
|
95
107
|
socket.write(line);
|
|
96
108
|
return heard;
|
|
97
109
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nervur.org/installer-node",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.5",
|
|
4
4
|
"description": "Nervur's installer for Node: the nervur command, the door, the host's organs (console, shell, disk, network) with their blueprints. 0.x, unstable.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@nervur.org/floor": "0.37.
|
|
40
|
-
"@nervur.org/genome": "0.37.
|
|
39
|
+
"@nervur.org/floor": "0.37.5",
|
|
40
|
+
"@nervur.org/genome": "0.37.5"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=22.23.5"
|
package/src/command/mcp.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Data } from '@nervur.org/genome/standard';
|
|
2
2
|
import { type Given, type Outcome } from './given.js';
|
|
3
|
+
export declare const CALL_SPAN: number;
|
|
3
4
|
export declare const serverAt: (organism: string, send: (message: Data) => void, note: (line: string) => void) => {
|
|
4
5
|
readonly answer: (message: Data) => Promise<Data | null>;
|
|
5
6
|
readonly settled: () => Promise<void>;
|
package/src/command/mcp.js
CHANGED
|
@@ -5,11 +5,22 @@ import { socketOf, typeLine, watchConsole } from '../../organs/console/node/inde
|
|
|
5
5
|
import { organismOf, } from './given.js';
|
|
6
6
|
import { serverOf } from './mcp/server.js';
|
|
7
7
|
import { runningOf } from './spawn.js';
|
|
8
|
-
import { LONGEST_TIMEOUT } from '../door/longest.js';
|
|
8
|
+
import { LONGEST_TIMEOUT, LONGEST_WAIT } from '../door/longest.js';
|
|
9
|
+
|
|
10
|
+
export const CALL_SPAN = LONGEST_TIMEOUT * 6;
|
|
11
|
+
|
|
12
|
+
const spanOf = (words ) => {
|
|
13
|
+
const [, placeholder = '', method] = words;
|
|
14
|
+
const node = method === undefined ? placeholder : `${placeholder}.${method}`;
|
|
15
|
+
return {
|
|
16
|
+
ms: CALL_SPAN,
|
|
17
|
+
why: `${node} answered not within ${CALL_SPAN / 1000} s: its node may be busy with other asks, which it answers one at a time; what was asked may still take effect, so read its node before asking it again`,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
9
20
|
|
|
10
21
|
export const serverAt = (organism , send , note ) =>
|
|
11
22
|
serverOf({
|
|
12
|
-
type: (words) => typeLine(socketOf(organism), words, LONGEST_TIMEOUT),
|
|
23
|
+
type: (words) => typeLine(socketOf(organism), words, LONGEST_TIMEOUT, LONGEST_WAIT, spanOf(words)),
|
|
13
24
|
now: Date.now,
|
|
14
25
|
watch: (changed, ended) => watchConsole(socketOf(organism), LONGEST_TIMEOUT, changed, ended),
|
|
15
26
|
send,
|
package/src/version/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// SPDX-License-Identifier: FSL-1.1-ALv2
|
|
2
|
-
export const INSTALLER_VERSION = '0.37.
|
|
2
|
+
export const INSTALLER_VERSION = '0.37.5';
|