pilotswarm-cli 0.1.12 → 0.1.13
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/tui.js +4 -279
- package/package.json +16 -12
- package/src/app.js +595 -0
- package/src/bootstrap-env.js +187 -0
- package/src/embedded-workers.js +65 -0
- package/src/index.js +152 -0
- package/src/node-sdk-transport.js +702 -0
- package/src/platform.js +899 -0
- package/tui-splash.txt +11 -0
- package/cli/context-usage.js +0 -80
- package/cli/tui.js +0 -8656
package/tui-splash.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{bold}{cyan-fg}
|
|
2
|
+
____ _ __ __ _____
|
|
3
|
+
/ __ \(_) /___ / /_/ ___/ ______ __________ ___
|
|
4
|
+
{/cyan-fg}{magenta-fg} / /_/ / / / __ \/ __/\__ \ | /| / / __ `/ ___/ __ `__ \
|
|
5
|
+
/ ____/ / / /_/ / /_ ___/ / |/ |/ / /_/ / / / / / / / /{/magenta-fg}
|
|
6
|
+
{yellow-fg}/_/ /_/_/\____/\__//____/|__/|__/\__,_/_/ /_/ /_/ /_/ {/yellow-fg}
|
|
7
|
+
{/bold}
|
|
8
|
+
|
|
9
|
+
{bold}{white-fg}Durable AI Agent Orchestration{/white-fg}{/bold}
|
|
10
|
+
{cyan-fg}Crash recovery{/cyan-fg} · {magenta-fg}Durable timers{/magenta-fg} · {yellow-fg}Sub-agents{/yellow-fg} · {green-fg}Multi-node scaling{/green-fg}
|
|
11
|
+
{gray-fg}Powered by duroxide + GitHub Copilot SDK{/gray-fg}
|
package/cli/context-usage.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
export function computeContextPercent(contextUsage) {
|
|
2
|
-
const utilization = typeof contextUsage?.utilization === "number"
|
|
3
|
-
? contextUsage.utilization
|
|
4
|
-
: (typeof contextUsage?.tokenLimit === "number" && contextUsage.tokenLimit > 0
|
|
5
|
-
&& typeof contextUsage?.currentTokens === "number"
|
|
6
|
-
? contextUsage.currentTokens / contextUsage.tokenLimit
|
|
7
|
-
: null);
|
|
8
|
-
if (typeof utilization !== "number" || !Number.isFinite(utilization)) return null;
|
|
9
|
-
return Math.max(0, Math.min(100, Math.round(utilization * 100)));
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function formatTokenCount(value) {
|
|
13
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) return "?";
|
|
14
|
-
if (value >= 1_000_000) {
|
|
15
|
-
const compact = value >= 10_000_000
|
|
16
|
-
? Math.round(value / 1_000_000)
|
|
17
|
-
: Math.round(value / 100_000) / 10;
|
|
18
|
-
return `${compact}`.replace(/\.0$/, "") + "m";
|
|
19
|
-
}
|
|
20
|
-
if (value >= 1_000) {
|
|
21
|
-
const compact = value >= 100_000
|
|
22
|
-
? Math.round(value / 1_000)
|
|
23
|
-
: Math.round(value / 100) / 10;
|
|
24
|
-
return `${compact}`.replace(/\.0$/, "") + "k";
|
|
25
|
-
}
|
|
26
|
-
return String(Math.round(value));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function getContextMeterColor(contextUsage) {
|
|
30
|
-
const percent = computeContextPercent(contextUsage);
|
|
31
|
-
if (percent == null) return "gray";
|
|
32
|
-
if (percent >= 85) return "red";
|
|
33
|
-
if (percent >= 70) return "yellow";
|
|
34
|
-
return "gray";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function formatContextHeaderBadge(contextUsage) {
|
|
38
|
-
if (!contextUsage) return "";
|
|
39
|
-
if (!(typeof contextUsage.tokenLimit === "number" && contextUsage.tokenLimit > 0
|
|
40
|
-
&& typeof contextUsage.currentTokens === "number" && contextUsage.currentTokens >= 0)) {
|
|
41
|
-
return "";
|
|
42
|
-
}
|
|
43
|
-
const percent = computeContextPercent(contextUsage);
|
|
44
|
-
if (percent == null) return "";
|
|
45
|
-
const color = getContextMeterColor(contextUsage);
|
|
46
|
-
return ` {${color}-fg}ctx ${formatTokenCount(contextUsage.currentTokens)}/${formatTokenCount(contextUsage.tokenLimit)} ${percent}%{/${color}-fg}`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function formatContextListBadge(contextUsage) {
|
|
50
|
-
if (!contextUsage) return "";
|
|
51
|
-
const compaction = contextUsage.compaction;
|
|
52
|
-
if (compaction?.state === "running") return " {magenta-fg}[compact]{/magenta-fg}";
|
|
53
|
-
if (compaction?.state === "failed") return " {red-fg}[compact !]{/red-fg}";
|
|
54
|
-
const percent = computeContextPercent(contextUsage);
|
|
55
|
-
if (percent == null || percent < 70) return "";
|
|
56
|
-
const color = percent >= 85 ? "red" : "yellow";
|
|
57
|
-
return ` {${color}-fg}[ctx ${percent}%]{/${color}-fg}`;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function formatContextCompactionBadge(contextUsage) {
|
|
61
|
-
const compaction = contextUsage?.compaction;
|
|
62
|
-
if (!compaction || typeof compaction !== "object") return "";
|
|
63
|
-
if (compaction.state === "running") return " {magenta-fg}[compacting]{/magenta-fg}";
|
|
64
|
-
if (compaction.state === "failed") return " {red-fg}[compact failed]{/red-fg}";
|
|
65
|
-
return "";
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function formatCompactionActivityMarkup(timestamp, eventType, data = {}) {
|
|
69
|
-
if (eventType === "session.compaction_start") {
|
|
70
|
-
return `{white-fg}[${timestamp}]{/white-fg} {magenta-fg}[compaction]{/magenta-fg} started`;
|
|
71
|
-
}
|
|
72
|
-
if (data.success === false) {
|
|
73
|
-
const reason = typeof data.error === "string" && data.error ? `: ${data.error}` : "";
|
|
74
|
-
return `{white-fg}[${timestamp}]{/white-fg} {red-fg}[compaction]{/red-fg} failed${reason}`;
|
|
75
|
-
}
|
|
76
|
-
const removed = typeof data.tokensRemoved === "number"
|
|
77
|
-
? ` freed ${formatTokenCount(data.tokensRemoved)}`
|
|
78
|
-
: "";
|
|
79
|
-
return `{white-fg}[${timestamp}]{/white-fg} {magenta-fg}[compaction]{/magenta-fg} complete${removed}`;
|
|
80
|
-
}
|