henergyqueai 0.9.0 → 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/bin/henergyqueai.js +4 -3
- package/package.json +1 -1
- package/src/butterfly.js +103 -59
- package/src/terminal-app.js +3 -3
package/bin/henergyqueai.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
waiting,
|
|
19
19
|
write,
|
|
20
20
|
} from "../src/ui.js";
|
|
21
|
-
import { brand, flutter, still } from "../src/butterfly.js";
|
|
21
|
+
import { HEIGHT as LOGO_HEIGHT, brand, flutter, still } from "../src/butterfly.js";
|
|
22
22
|
import { choose, clearScreen } from "../src/confiance.js";
|
|
23
23
|
import {
|
|
24
24
|
MODES,
|
|
@@ -36,8 +36,9 @@ 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.
|
|
40
|
-
|
|
39
|
+
const VERSION = "0.9.1";
|
|
40
|
+
// Le papillon, une ligne vide, le trait, l'aide et une ligne vide.
|
|
41
|
+
const HEADER_HEIGHT = LOGO_HEIGHT + 4;
|
|
41
42
|
const BODY_ROW = HEADER_HEIGHT + 1;
|
|
42
43
|
const CONFIG = path.join(homedir(), ".henergyqueai", "config.json");
|
|
43
44
|
const DEFAULT_BASE = process.env.HENERGYQUEAI_URL || "https://henergyqueai.fr";
|
package/package.json
CHANGED
package/src/butterfly.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// left half of the wings is written down and then mirrored, so the drawing can
|
|
4
|
-
// never drift out of symmetry.
|
|
1
|
+
// Les créatures sont en pixel art : chaque caractère porte deux pixels, celui
|
|
2
|
+
// du haut en couleur de « ▀ » et celui du bas en fond.
|
|
5
3
|
const plain = !process.stdout.isTTY || process.env.NO_COLOR;
|
|
6
4
|
|
|
7
5
|
const INK = {
|
|
@@ -11,6 +9,8 @@ const INK = {
|
|
|
11
9
|
d: "#95503f",
|
|
12
10
|
e: "#784e3e",
|
|
13
11
|
f: "#5d3b2f",
|
|
12
|
+
o: "#3f261e",
|
|
13
|
+
w: "#fff1e4",
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const fg = (hex) => {
|
|
@@ -22,59 +22,95 @@ const bg = (hex) => {
|
|
|
22
22
|
return `48;2;${(v >> 16) & 255};${(v >> 8) & 255};${v & 255}`;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
face: ["..b.........b..", "...b.......b..."],
|
|
29
|
-
droite: ["..b..........b·", "...b........b.."],
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const mirror = (rows) =>
|
|
33
|
-
rows.map(([half, body]) => half + body + [...half].reverse().join(""));
|
|
34
|
-
|
|
35
|
-
const OUVERT = mirror([
|
|
36
|
-
[".bbbb..", "e"],
|
|
37
|
-
["bbaabb.", "e"],
|
|
38
|
-
["bbaabbe", "f"],
|
|
39
|
-
[".bbbcce", "f"],
|
|
40
|
-
["..cccc.", "f"],
|
|
41
|
-
["..cddc.", "f"],
|
|
42
|
-
["...dd..", "e"],
|
|
43
|
-
[".......", "e"],
|
|
44
|
-
]);
|
|
45
|
-
|
|
46
|
-
const MI = mirror([
|
|
47
|
-
["...bbb.", "e"],
|
|
48
|
-
["..bbaab", "e"],
|
|
49
|
-
["..bbaab", "f"],
|
|
50
|
-
["...bbcc", "f"],
|
|
51
|
-
["...cccc", "f"],
|
|
52
|
-
["...cddc", "f"],
|
|
53
|
-
["....dd.", "e"],
|
|
54
|
-
[".......", "e"],
|
|
55
|
-
]);
|
|
56
|
-
|
|
57
|
-
const FERME = mirror([
|
|
58
|
-
["....bb.", "e"],
|
|
59
|
-
["....baa", "e"],
|
|
60
|
-
["....bba", "f"],
|
|
61
|
-
["....bbc", "f"],
|
|
62
|
-
[".....cc", "f"],
|
|
63
|
-
[".....cd", "f"],
|
|
64
|
-
["......d", "e"],
|
|
65
|
-
[".......", "e"],
|
|
66
|
-
]);
|
|
67
|
-
|
|
68
|
-
// One full wingbeat, with the head glancing left then right between beats.
|
|
25
|
+
// Le papillon choisi par le sondage (n° 2, « Face · détaillé ») : contours
|
|
26
|
+
// sombres, taches claires et ocelles. Un battement complet, les ailes se
|
|
27
|
+
// resserrent vers le corps puis se rouvrent.
|
|
69
28
|
export const FRAMES = [
|
|
70
|
-
[
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
29
|
+
[
|
|
30
|
+
"..o...............o..",
|
|
31
|
+
"...o.............o...",
|
|
32
|
+
"....o...........o....",
|
|
33
|
+
".oooo.o.......o.oooo.",
|
|
34
|
+
"oaaabo.o..o..o.obaaao",
|
|
35
|
+
"oaawabboo.f.oobbawaao",
|
|
36
|
+
"oaaabbbcoofoocbbbaaao",
|
|
37
|
+
"obbbbcccdoeodcccbbbbo",
|
|
38
|
+
".obbcccddoeoddcccbbo.",
|
|
39
|
+
"..oocdddooeoodddcoo..",
|
|
40
|
+
"...obcco..f..occbo...",
|
|
41
|
+
"..obcwdco.f.ocdwcbo..",
|
|
42
|
+
"..obccddo.e.oddccbo..",
|
|
43
|
+
"...occdo..e..odcco...",
|
|
44
|
+
"....ooo.......ooo....",
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"....o...........o....",
|
|
48
|
+
".....o.........o.....",
|
|
49
|
+
"......o.......o......",
|
|
50
|
+
"....oooo.....oooo....",
|
|
51
|
+
"...oaab.o.o.o.baao...",
|
|
52
|
+
"...oawabo.f.obawao...",
|
|
53
|
+
"...oaabbcofocbbaao...",
|
|
54
|
+
"...obbbccoeoccbbbo...",
|
|
55
|
+
"....bbccdoeodccbb....",
|
|
56
|
+
"....oocddoeoddcoo....",
|
|
57
|
+
".....obco.f.ocbo.....",
|
|
58
|
+
"....obcdc.f.cdcbo....",
|
|
59
|
+
"....obcdd.e.ddcbo....",
|
|
60
|
+
".....ocdo.e.odco.....",
|
|
61
|
+
"......oo.....oo......",
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
".....................",
|
|
65
|
+
".......o.....o.......",
|
|
66
|
+
".....................",
|
|
67
|
+
".......o.....o.......",
|
|
68
|
+
"......oao.o.oao......",
|
|
69
|
+
"......owbofobwo......",
|
|
70
|
+
"......oabofobao......",
|
|
71
|
+
"......obcdedcbo......",
|
|
72
|
+
".......bcdedcb.......",
|
|
73
|
+
".......odoeodo.......",
|
|
74
|
+
".......oc.f.co.......",
|
|
75
|
+
".......bwofowb.......",
|
|
76
|
+
".......bcoeocb.......",
|
|
77
|
+
".......oc.e.co.......",
|
|
78
|
+
"........o...o........",
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
"....o...........o....",
|
|
82
|
+
".....o.........o.....",
|
|
83
|
+
"......o.......o......",
|
|
84
|
+
"....oooo.....oooo....",
|
|
85
|
+
"...oaab.o.o.o.baao...",
|
|
86
|
+
"...oawabo.f.obawao...",
|
|
87
|
+
"...oaabbcofocbbaao...",
|
|
88
|
+
"...obbbccoeoccbbbo...",
|
|
89
|
+
"....bbccdoeodccbb....",
|
|
90
|
+
"....oocddoeoddcoo....",
|
|
91
|
+
".....obco.f.ocbo.....",
|
|
92
|
+
"....obcdc.f.cdcbo....",
|
|
93
|
+
"....obcdd.e.ddcbo....",
|
|
94
|
+
".....ocdo.e.odco.....",
|
|
95
|
+
"......oo.....oo......",
|
|
96
|
+
],
|
|
97
|
+
[
|
|
98
|
+
"..o...............o..",
|
|
99
|
+
"...o.............o...",
|
|
100
|
+
"....o...........o....",
|
|
101
|
+
".oooo.o.......o.oooo.",
|
|
102
|
+
"oaaabo.o..o..o.obaaao",
|
|
103
|
+
"oaawabboo.f.oobbawaao",
|
|
104
|
+
"oaaabbbcoofoocbbbaaao",
|
|
105
|
+
"obbbbcccdoeodcccbbbbo",
|
|
106
|
+
".obbcccddoeoddcccbbo.",
|
|
107
|
+
"..oocdddooeoodddcoo..",
|
|
108
|
+
"...obcco..f..occbo...",
|
|
109
|
+
"..obcwdco.f.ocdwcbo..",
|
|
110
|
+
"..obccddo.e.oddccbo..",
|
|
111
|
+
"...occdo..e..odcco...",
|
|
112
|
+
"....ooo.......ooo....",
|
|
113
|
+
],
|
|
78
114
|
];
|
|
79
115
|
|
|
80
116
|
// Les deux autres créatures du jardin, à la même taille que le papillon :
|
|
@@ -211,8 +247,16 @@ const CREATURES = {
|
|
|
211
247
|
oryne: { frames: ORYNE, ink: ORYNE_INK },
|
|
212
248
|
};
|
|
213
249
|
|
|
214
|
-
export const WIDTH =
|
|
215
|
-
export const HEIGHT =
|
|
250
|
+
export const WIDTH = 21;
|
|
251
|
+
export const HEIGHT = 8;
|
|
252
|
+
const fit = (grid) => {
|
|
253
|
+
if (grid.length >= HEIGHT * 2 - 1) return grid;
|
|
254
|
+
const side = ".".repeat(Math.floor((WIDTH - grid[0].length) / 2));
|
|
255
|
+
const empty = ".".repeat(WIDTH);
|
|
256
|
+
const rows = [empty, empty, ...grid.map((row) => (side + row).padEnd(WIDTH, "."))];
|
|
257
|
+
while (rows.length < HEIGHT * 2) rows.push(empty);
|
|
258
|
+
return rows;
|
|
259
|
+
};
|
|
216
260
|
|
|
217
261
|
// Turns a pixel grid into five printable lines.
|
|
218
262
|
export function paint(grid, ink = INK) {
|
|
@@ -242,7 +286,7 @@ export const still = () => paint(FRAMES[0]);
|
|
|
242
286
|
// l'abeille pour Oryne, le papillon pour Aelyr.
|
|
243
287
|
export function creature(model, frame = 0) {
|
|
244
288
|
const { frames, ink } = CREATURES[model] || CREATURES.aelyr;
|
|
245
|
-
return paint(frames[frame % frames.length], ink);
|
|
289
|
+
return paint(fit(frames[frame % frames.length]), ink);
|
|
246
290
|
}
|
|
247
291
|
|
|
248
292
|
export const brand = (text) =>
|
package/src/terminal-app.js
CHANGED
|
@@ -10,7 +10,7 @@ import path from "node:path";
|
|
|
10
10
|
import { execute } from "./tools.js";
|
|
11
11
|
import { MODES, saveUserSetting } from "./reglages.js";
|
|
12
12
|
import { listSessions, saveSession } from "./sessions.js";
|
|
13
|
-
import { creature } from "./butterfly.js";
|
|
13
|
+
import { HEIGHT as LOGO_HEIGHT, WIDTH as LOGO_WIDTH, creature } from "./butterfly.js";
|
|
14
14
|
import { interactiveDefinitions, runAgentTurn } from "./agent-loop.js";
|
|
15
15
|
import { compactHistory, historySize } from "./compact.js";
|
|
16
16
|
import { listTasks, manageTasks } from "./tasks.js";
|
|
@@ -111,7 +111,7 @@ const EXAMPLES = [
|
|
|
111
111
|
const pick = (list) => list[Math.floor(Math.random() * list.length)];
|
|
112
112
|
const SHELL_MARKER = "\n\n--- Commandes lancées par l’utilisateur ---\n";
|
|
113
113
|
const NOTE_MARKER = "\n\n--- Consignes ajoutées au projet ---\n";
|
|
114
|
-
const HEADER_HEIGHT =
|
|
114
|
+
const HEADER_HEIGHT = LOGO_HEIGHT + 2;
|
|
115
115
|
const LONG_TURN = 30000;
|
|
116
116
|
const INIT_PROMPT =
|
|
117
117
|
"Analyse ce projet : structure, commandes d’installation, de build, de test et de lancement, architecture d’ensemble et conventions qui ne se devinent pas en lisant un seul fichier. Crée ensuite à la racine un fichier HENERGYQUEAI.md concis, destiné à un assistant de code qui découvre le projet. S’il existe déjà, améliore-le sans perdre ce qu’il contient. N’invente rien, ne liste pas chaque fichier et reste court.";
|
|
@@ -639,7 +639,7 @@ function Header({ palette, model, mode, root, frame, busy, status }) {
|
|
|
639
639
|
},
|
|
640
640
|
h(
|
|
641
641
|
Box,
|
|
642
|
-
{ flexDirection: "column", width:
|
|
642
|
+
{ flexDirection: "column", width: LOGO_WIDTH, marginRight: 3, flexShrink: 0 },
|
|
643
643
|
...logo.map((line, index) => h(Text, { key: index }, line)),
|
|
644
644
|
),
|
|
645
645
|
h(
|