henergyqueai 0.9.1 → 0.9.3
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/bin/henergyqueai.js +1 -1
- package/package.json +1 -1
- package/src/butterfly.js +55 -80
- package/src/connexion.js +14 -7
package/bin/henergyqueai.js
CHANGED
|
@@ -36,7 +36,7 @@ import { expandReferences } from "../src/references.js";
|
|
|
36
36
|
import { stopAll } from "../src/background.js";
|
|
37
37
|
import { loadHooks } from "../src/hooks.js";
|
|
38
38
|
|
|
39
|
-
const VERSION = "0.9.
|
|
39
|
+
const VERSION = "0.9.3";
|
|
40
40
|
// Le papillon, une ligne vide, le trait, l'aide et une ligne vide.
|
|
41
41
|
const HEADER_HEIGHT = LOGO_HEIGHT + 4;
|
|
42
42
|
const BODY_ROW = HEADER_HEIGHT + 1;
|
package/package.json
CHANGED
package/src/butterfly.js
CHANGED
|
@@ -22,94 +22,69 @@ const bg = (hex) => {
|
|
|
22
22
|
return `48;2;${(v >> 16) & 255};${(v >> 8) & 255};${v & 255}`;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
// Le papillon choisi par le sondage (n°
|
|
26
|
-
//
|
|
27
|
-
//
|
|
25
|
+
// Le papillon choisi par le sondage (n° 5, « Profil · deux ailes ») : posé,
|
|
26
|
+
// vu de côté, l'aile du fond dépasse derrière la première. Ses ailes
|
|
27
|
+
// respirent doucement. Le même que dans VS Code, à la taille du terminal.
|
|
28
28
|
export const FRAMES = [
|
|
29
29
|
[
|
|
30
|
-
"..
|
|
31
|
-
"
|
|
32
|
-
"....
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"...obcco..f..occbo...",
|
|
41
|
-
"..obcwdco.f.ocdwcbo..",
|
|
42
|
-
"..obccddo.e.oddccbo..",
|
|
43
|
-
"...occdo..e..odcco...",
|
|
44
|
-
"....ooo.......ooo....",
|
|
30
|
+
"......ooooeo..c",
|
|
31
|
+
".....ofwacoo.c.",
|
|
32
|
+
"....owaabcooo..",
|
|
33
|
+
"...ofabbbcooo..",
|
|
34
|
+
"...owbbccdooo..",
|
|
35
|
+
"..ofboccddoooo.",
|
|
36
|
+
"..owbboddoeewo.",
|
|
37
|
+
"...ofwfwoeeeeo.",
|
|
38
|
+
"..oeefeefeeoo..",
|
|
39
|
+
"...ooooooooo.o.",
|
|
45
40
|
],
|
|
46
41
|
[
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"...
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"...
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
".....obco.f.ocbo.....",
|
|
58
|
-
"....obcdc.f.cdcbo....",
|
|
59
|
-
"....obcdd.e.ddcbo....",
|
|
60
|
-
".....ocdo.e.odco.....",
|
|
61
|
-
"......oo.....oo......",
|
|
42
|
+
"........ooo...c",
|
|
43
|
+
"......ooooeo.c.",
|
|
44
|
+
"....oofwacooo..",
|
|
45
|
+
"...ofabbbcooo..",
|
|
46
|
+
"...owbbccdooo..",
|
|
47
|
+
"..ofboccddoooo.",
|
|
48
|
+
"..owbboddoeewo.",
|
|
49
|
+
"...ofwfwoeeeeo.",
|
|
50
|
+
"..oeefeefeeoo..",
|
|
51
|
+
"...ooooooooo.o.",
|
|
62
52
|
],
|
|
63
53
|
[
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
".......oc.f.co.......",
|
|
75
|
-
".......bwofowb.......",
|
|
76
|
-
".......bcoeocb.......",
|
|
77
|
-
".......oc.e.co.......",
|
|
78
|
-
"........o...o........",
|
|
54
|
+
"........ooo...c",
|
|
55
|
+
"......ooooeo.c.",
|
|
56
|
+
".....ofwacooo..",
|
|
57
|
+
"....owaabcooo..",
|
|
58
|
+
"...ofabbbcooo..",
|
|
59
|
+
"..ofboccddoooo.",
|
|
60
|
+
"..owbboddoeewo.",
|
|
61
|
+
"...ofwfwoeeeeo.",
|
|
62
|
+
"..oeefeefeeoo..",
|
|
63
|
+
"...ooooooooo.o.",
|
|
79
64
|
],
|
|
80
65
|
[
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"...
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"...
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
".....obco.f.ocbo.....",
|
|
92
|
-
"....obcdc.f.cdcbo....",
|
|
93
|
-
"....obcdd.e.ddcbo....",
|
|
94
|
-
".....ocdo.e.odco.....",
|
|
95
|
-
"......oo.....oo......",
|
|
66
|
+
"........ooo...c",
|
|
67
|
+
"......ooooeo.c.",
|
|
68
|
+
"....oofwacooo..",
|
|
69
|
+
"...ofabbbcooo..",
|
|
70
|
+
"...owbbccdooo..",
|
|
71
|
+
"..ofboccddoooo.",
|
|
72
|
+
"..owbboddoeewo.",
|
|
73
|
+
"...ofwfwoeeeeo.",
|
|
74
|
+
"..oeefeefeeoo..",
|
|
75
|
+
"...ooooooooo.o.",
|
|
96
76
|
],
|
|
97
77
|
[
|
|
98
|
-
"..
|
|
99
|
-
"
|
|
100
|
-
"....
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"...obcco..f..occbo...",
|
|
109
|
-
"..obcwdco.f.ocdwcbo..",
|
|
110
|
-
"..obccddo.e.oddccbo..",
|
|
111
|
-
"...occdo..e..odcco...",
|
|
112
|
-
"....ooo.......ooo....",
|
|
78
|
+
"......ooooeo..c",
|
|
79
|
+
".....ofwacoo.c.",
|
|
80
|
+
"....owaabcooo..",
|
|
81
|
+
"...ofabbbcooo..",
|
|
82
|
+
"...owbbccdooo..",
|
|
83
|
+
"..ofboccddoooo.",
|
|
84
|
+
"..owbboddoeewo.",
|
|
85
|
+
"...ofwfwoeeeeo.",
|
|
86
|
+
"..oeefeefeeoo..",
|
|
87
|
+
"...ooooooooo.o.",
|
|
113
88
|
],
|
|
114
89
|
];
|
|
115
90
|
|
|
@@ -247,8 +222,8 @@ const CREATURES = {
|
|
|
247
222
|
oryne: { frames: ORYNE, ink: ORYNE_INK },
|
|
248
223
|
};
|
|
249
224
|
|
|
250
|
-
export const WIDTH =
|
|
251
|
-
export const HEIGHT =
|
|
225
|
+
export const WIDTH = 15;
|
|
226
|
+
export const HEIGHT = 5;
|
|
252
227
|
const fit = (grid) => {
|
|
253
228
|
if (grid.length >= HEIGHT * 2 - 1) return grid;
|
|
254
229
|
const side = ".".repeat(Math.floor((WIDTH - grid[0].length) / 2));
|
package/src/connexion.js
CHANGED
|
@@ -3,15 +3,22 @@ import { createHash, randomBytes } from "node:crypto";
|
|
|
3
3
|
import { hostname } from "node:os";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
5
|
|
|
6
|
+
// On Windows the address must not go through cmd: it reads each « & » of the
|
|
7
|
+
// query string as a new command, so the browser got a truncated address and
|
|
8
|
+
// « code=… » launched VS Code.
|
|
9
|
+
export const browserCommand = (url, platform = process.platform) =>
|
|
10
|
+
platform === "win32"
|
|
11
|
+
? ["rundll32.exe", ["url.dll,FileProtocolHandler", url]]
|
|
12
|
+
: platform === "darwin"
|
|
13
|
+
? ["open", [url]]
|
|
14
|
+
: ["xdg-open", [url]];
|
|
15
|
+
|
|
6
16
|
const openBrowser = (url) => {
|
|
7
|
-
const [command, args] =
|
|
8
|
-
process.platform === "win32"
|
|
9
|
-
? ["cmd", ["/c", "start", "", url]]
|
|
10
|
-
: process.platform === "darwin"
|
|
11
|
-
? ["open", [url]]
|
|
12
|
-
: ["xdg-open", [url]];
|
|
17
|
+
const [command, args] = browserCommand(url);
|
|
13
18
|
try {
|
|
14
|
-
spawn(command, args, { detached: true, stdio: "ignore" })
|
|
19
|
+
const child = spawn(command, args, { detached: true, stdio: "ignore", windowsHide: true });
|
|
20
|
+
child.on("error", () => {});
|
|
21
|
+
child.unref();
|
|
15
22
|
return true;
|
|
16
23
|
} catch {
|
|
17
24
|
return false;
|