swarmlancer-cli 0.5.2 → 0.5.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Container, Text, Spacer, SelectList, matchesKey, Key,
|
|
1
|
+
import { Container, Text, Spacer, SelectList, matchesKey, Key, } from "@mariozechner/pi-tui";
|
|
2
2
|
import { colors, theme } from "../theme.js";
|
|
3
3
|
import { BannerComponent } from "./banner.js";
|
|
4
4
|
export class AgentConfigScreen {
|
|
@@ -9,11 +9,7 @@ export class AgentConfigScreen {
|
|
|
9
9
|
constructor(tui, agent, initialIndex = 0) {
|
|
10
10
|
this.tui = tui;
|
|
11
11
|
this.container = new Container();
|
|
12
|
-
|
|
13
|
-
this.container.addChild(new BannerComponent());
|
|
14
|
-
this.container.addChild(new Text(theme.title(` Agent: ${agent.name}`), 1, 0));
|
|
15
|
-
this.container.addChild(new Text(truncateToWidth(theme.border("─".repeat(60)), 60), 0, 0));
|
|
16
|
-
this.container.addChild(new Spacer(1));
|
|
12
|
+
this.container.addChild(new BannerComponent(`Agent: ${agent.name}`));
|
|
17
13
|
// Status summary
|
|
18
14
|
const modelStr = agent.modelPattern || "(auto — cheapest)";
|
|
19
15
|
const instrStr = agent.instructions.length > 0
|
|
@@ -26,8 +22,6 @@ export class AgentConfigScreen {
|
|
|
26
22
|
this.container.addChild(new Text(` ${colors.gray("Discovery:")} ${discoveryStr}`, 0, 0));
|
|
27
23
|
this.container.addChild(new Text(` ${colors.gray("Limits:")} ${limitsStr}`, 0, 0));
|
|
28
24
|
this.container.addChild(new Spacer(1));
|
|
29
|
-
this.container.addChild(new Text(truncateToWidth(theme.border("─".repeat(60)), 60), 0, 0));
|
|
30
|
-
this.container.addChild(new Spacer(1));
|
|
31
25
|
const items = [
|
|
32
26
|
{ value: "edit-name", label: "Rename", description: agent.name },
|
|
33
27
|
{ value: "edit-instructions", label: "Instructions", description: "How your agent behaves" },
|
|
@@ -43,9 +37,8 @@ export class AgentConfigScreen {
|
|
|
43
37
|
scrollInfo: (t) => colors.gray(t),
|
|
44
38
|
noMatch: (t) => colors.gray(t),
|
|
45
39
|
});
|
|
46
|
-
if (initialIndex > 0)
|
|
40
|
+
if (initialIndex > 0)
|
|
47
41
|
this.selectList.setSelectedIndex(initialIndex);
|
|
48
|
-
}
|
|
49
42
|
this.selectList.onSelect = (item) => {
|
|
50
43
|
const idx = items.findIndex((i) => i.value === item.value);
|
|
51
44
|
this.onAction?.(item.value, idx);
|
|
@@ -68,10 +61,6 @@ export class AgentConfigScreen {
|
|
|
68
61
|
this.selectList.handleInput(data);
|
|
69
62
|
this.tui.requestRender();
|
|
70
63
|
}
|
|
71
|
-
render(width) {
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
invalidate() {
|
|
75
|
-
this.container.invalidate();
|
|
76
|
-
}
|
|
64
|
+
render(width) { return this.container.render(width); }
|
|
65
|
+
invalidate() { this.container.invalidate(); }
|
|
77
66
|
}
|
package/dist/screens/banner.d.ts
CHANGED
package/dist/screens/banner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Container, Text, Spacer } from "@mariozechner/pi-tui";
|
|
2
|
-
import { colors } from "../theme.js";
|
|
2
|
+
import { colors, theme } from "../theme.js";
|
|
3
3
|
const BANNER_ART = [
|
|
4
4
|
` █████████ ███`,
|
|
5
5
|
`███ ███ ███`,
|
|
@@ -9,9 +9,12 @@ const BANNER_ART = [
|
|
|
9
9
|
`███ ███ ███`,
|
|
10
10
|
` █████████ ███`,
|
|
11
11
|
];
|
|
12
|
+
const LINE = "─────────────────────";
|
|
12
13
|
export class BannerComponent extends Container {
|
|
13
|
-
|
|
14
|
+
headline;
|
|
15
|
+
constructor(headline = "Let the swarm begin!") {
|
|
14
16
|
super();
|
|
17
|
+
this.headline = headline;
|
|
15
18
|
this.rebuild();
|
|
16
19
|
}
|
|
17
20
|
rebuild() {
|
|
@@ -20,8 +23,10 @@ export class BannerComponent extends Container {
|
|
|
20
23
|
for (const line of BANNER_ART) {
|
|
21
24
|
this.addChild(new Text(colors.limeBold(` ${line}`), 1, 0));
|
|
22
25
|
}
|
|
23
|
-
this.addChild(new Spacer(
|
|
24
|
-
this.addChild(new Text(
|
|
26
|
+
this.addChild(new Spacer(1));
|
|
27
|
+
this.addChild(new Text(theme.border(` ${LINE}`), 0, 0));
|
|
28
|
+
this.addChild(new Text(colors.bold(` ${this.headline}`), 1, 0));
|
|
29
|
+
this.addChild(new Text(theme.border(` ${LINE}`), 0, 0));
|
|
25
30
|
this.addChild(new Spacer(1));
|
|
26
31
|
}
|
|
27
32
|
invalidate() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Container,
|
|
1
|
+
import { Container, Spacer, Text, SelectList, matchesKey, Key, } from "@mariozechner/pi-tui";
|
|
2
2
|
import { colors, theme } from "../theme.js";
|
|
3
3
|
import { BannerComponent } from "./banner.js";
|
|
4
4
|
const MENU_ITEMS = [
|
|
@@ -14,7 +14,7 @@ export class DashboardScreen {
|
|
|
14
14
|
constructor(tui, initialIndex = 0) {
|
|
15
15
|
this.tui = tui;
|
|
16
16
|
this.container = new Container();
|
|
17
|
-
this.container.addChild(new BannerComponent());
|
|
17
|
+
this.container.addChild(new BannerComponent("Let the swarm begin!"));
|
|
18
18
|
this.selectList = new SelectList(MENU_ITEMS, MENU_ITEMS.length, {
|
|
19
19
|
selectedPrefix: (t) => theme.accent(t),
|
|
20
20
|
selectedText: (t) => theme.accent(t),
|
|
@@ -22,9 +22,8 @@ export class DashboardScreen {
|
|
|
22
22
|
scrollInfo: (t) => colors.gray(t),
|
|
23
23
|
noMatch: (t) => colors.gray(t),
|
|
24
24
|
});
|
|
25
|
-
if (initialIndex > 0)
|
|
25
|
+
if (initialIndex > 0)
|
|
26
26
|
this.selectList.setSelectedIndex(initialIndex);
|
|
27
|
-
}
|
|
28
27
|
this.selectList.onSelect = (item) => {
|
|
29
28
|
const idx = MENU_ITEMS.findIndex((i) => i.value === item.value);
|
|
30
29
|
this.onAction?.(item.value, idx);
|
|
@@ -46,10 +45,6 @@ export class DashboardScreen {
|
|
|
46
45
|
this.selectList.handleInput(data);
|
|
47
46
|
this.tui.requestRender();
|
|
48
47
|
}
|
|
49
|
-
render(width) {
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
invalidate() {
|
|
53
|
-
this.container.invalidate();
|
|
54
|
-
}
|
|
48
|
+
render(width) { return this.container.render(width); }
|
|
49
|
+
invalidate() { this.container.invalidate(); }
|
|
55
50
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { type SelectItem, type Component } from "@mariozechner/pi-tui";
|
|
2
2
|
import type { TUI } from "@mariozechner/pi-tui";
|
|
3
|
-
/**
|
|
4
|
-
* Reusable menu screen with banner, title, items, and left/right/enter/esc navigation.
|
|
5
|
-
* Enter or Right = select, Left or Esc = back.
|
|
6
|
-
*/
|
|
7
3
|
export declare class MenuScreen implements Component {
|
|
8
4
|
private container;
|
|
9
5
|
private selectList;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { Container,
|
|
1
|
+
import { Container, Spacer, Text, SelectList, matchesKey, Key, } from "@mariozechner/pi-tui";
|
|
2
2
|
import { colors, theme } from "../theme.js";
|
|
3
3
|
import { BannerComponent } from "./banner.js";
|
|
4
|
-
/**
|
|
5
|
-
* Reusable menu screen with banner, title, items, and left/right/enter/esc navigation.
|
|
6
|
-
* Enter or Right = select, Left or Esc = back.
|
|
7
|
-
*/
|
|
8
4
|
export class MenuScreen {
|
|
9
5
|
container;
|
|
10
6
|
selectList;
|
|
@@ -16,11 +12,7 @@ export class MenuScreen {
|
|
|
16
12
|
this.tui = tui;
|
|
17
13
|
this.items = items;
|
|
18
14
|
this.container = new Container();
|
|
19
|
-
|
|
20
|
-
this.container.addChild(new BannerComponent());
|
|
21
|
-
this.container.addChild(new Text(theme.title(` ${title}`), 1, 0));
|
|
22
|
-
this.container.addChild(new Text(truncateToWidth(theme.border("─".repeat(60)), 60), 0, 0));
|
|
23
|
-
this.container.addChild(new Spacer(1));
|
|
15
|
+
this.container.addChild(new BannerComponent(title));
|
|
24
16
|
this.selectList = new SelectList(items, Math.min(items.length, 15), {
|
|
25
17
|
selectedPrefix: (t) => theme.accent(t),
|
|
26
18
|
selectedText: (t) => theme.accent(t),
|
|
@@ -28,9 +20,8 @@ export class MenuScreen {
|
|
|
28
20
|
scrollInfo: (t) => colors.gray(t),
|
|
29
21
|
noMatch: (t) => colors.gray(t),
|
|
30
22
|
});
|
|
31
|
-
if (initialIndex > 0)
|
|
23
|
+
if (initialIndex > 0)
|
|
32
24
|
this.selectList.setSelectedIndex(initialIndex);
|
|
33
|
-
}
|
|
34
25
|
this.selectList.onSelect = (item) => {
|
|
35
26
|
const idx = this.items.findIndex((i) => i.value === item.value);
|
|
36
27
|
this.onSelect?.(item.value, idx);
|
|
@@ -53,10 +44,6 @@ export class MenuScreen {
|
|
|
53
44
|
this.selectList.handleInput(data);
|
|
54
45
|
this.tui.requestRender();
|
|
55
46
|
}
|
|
56
|
-
render(width) {
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
invalidate() {
|
|
60
|
-
this.container.invalidate();
|
|
61
|
-
}
|
|
47
|
+
render(width) { return this.container.render(width); }
|
|
48
|
+
invalidate() { this.container.invalidate(); }
|
|
62
49
|
}
|