toolcraft 0.0.236 → 0.0.237
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/composition.json +2 -2
- package/dist/composition.json +2 -2
- package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
- package/node_modules/toolcraft-design/dist/dashboard/components/footer.d.ts +2 -2
- package/node_modules/toolcraft-design/dist/dashboard/components/footer.js +20 -3
- package/node_modules/toolcraft-design/dist/dashboard/dashboard.js +4 -3
- package/node_modules/toolcraft-design/dist/dashboard/types.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/escape-terminal-text.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/escape-terminal-text.js +20 -0
- package/node_modules/toolcraft-design/package.json +4 -0
- package/node_modules/toolcraft-schema/package.json +1 -1
- package/package.json +2 -2
package/composition.json
CHANGED
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.237",
|
|
117
117
|
"license": "MIT"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "toolcraft-schema",
|
|
126
|
-
"version": "0.0.
|
|
126
|
+
"version": "0.0.237",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
package/dist/composition.json
CHANGED
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.237",
|
|
117
117
|
"license": "MIT"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "toolcraft-schema",
|
|
126
|
-
"version": "0.0.
|
|
126
|
+
"version": "0.0.237",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ScreenBuffer } from "../buffer.js";
|
|
2
|
-
import type { Rect } from "../types.js";
|
|
2
|
+
import type { DashboardStats, Rect } from "../types.js";
|
|
3
3
|
export type FooterHint = {
|
|
4
4
|
key: string;
|
|
5
5
|
label: string;
|
|
6
6
|
};
|
|
7
|
-
export declare function renderFooter(buffer: ScreenBuffer, rect: Rect, hints: FooterHint[]): void;
|
|
7
|
+
export declare function renderFooter(buffer: ScreenBuffer, rect: Rect, hints: FooterHint[], session?: DashboardStats["session"]): void;
|
|
8
8
|
export declare function defaultHints(): FooterHint[];
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { getTheme } from "../../internal/theme-detect.js";
|
|
2
2
|
import { displayWidth, graphemes, graphemeWidth, truncateToWidth } from "../terminal-width.js";
|
|
3
3
|
import { plainTerminalText } from "../ansi.js";
|
|
4
|
-
export function renderFooter(buffer, rect, hints) {
|
|
4
|
+
export function renderFooter(buffer, rect, hints, session) {
|
|
5
5
|
buffer.clearRect(rect);
|
|
6
|
-
if (rect.width <= 0 || rect.height <= 0
|
|
6
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
7
|
+
return;
|
|
8
|
+
if (session) {
|
|
9
|
+
const directory = plainTerminalText(session.cwd);
|
|
10
|
+
const agentModel = plainTerminalText(`${session.agent} · ${session.model ?? "default model"}`);
|
|
11
|
+
const gap = Math.min(2, rect.width);
|
|
12
|
+
const available = Math.max(0, rect.width - gap);
|
|
13
|
+
const agentWidth = Math.min(displayWidth(agentModel), Math.ceil(available / 2));
|
|
14
|
+
const directoryWidth = Math.max(0, available - agentWidth);
|
|
15
|
+
const style = getTheme().styles.muted;
|
|
16
|
+
const y = rect.y + rect.height - 1;
|
|
17
|
+
buffer.put(rect.x, y, truncateToWidth(directory, directoryWidth || rect.width), style);
|
|
18
|
+
if (agentWidth > 0) {
|
|
19
|
+
const text = truncateToWidth(agentModel, agentWidth);
|
|
20
|
+
buffer.put(rect.x + rect.width - displayWidth(text), y, text, style);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (hints.length === 0 || (session && rect.height === 1)) {
|
|
7
24
|
return;
|
|
8
25
|
}
|
|
9
26
|
const fitted = [];
|
|
@@ -23,7 +40,7 @@ export function renderFooter(buffer, rect, hints) {
|
|
|
23
40
|
}
|
|
24
41
|
const cells = hintsToCells(fitted);
|
|
25
42
|
let x = rect.x + Math.floor((rect.width - width) / 2);
|
|
26
|
-
const y = rect.y + Math.floor(rect.height / 2);
|
|
43
|
+
const y = session ? rect.y : rect.y + Math.floor(rect.height / 2);
|
|
27
44
|
cells.forEach((cell) => {
|
|
28
45
|
buffer.put(x, y, cell.ch, cell.style);
|
|
29
46
|
x += graphemeWidth(cell.ch);
|
|
@@ -175,13 +175,14 @@ export function createDashboard(opts = {}) {
|
|
|
175
175
|
}
|
|
176
176
|
const startedAt = performanceMonitor.begin();
|
|
177
177
|
const { cols, rows } = driver.getSize();
|
|
178
|
+
const state = getStore().getState();
|
|
178
179
|
const layout = computeDashboardLayout({
|
|
179
180
|
totalWidth: cols,
|
|
180
181
|
totalHeight: rows,
|
|
181
|
-
rightPaneWidth
|
|
182
|
+
rightPaneWidth,
|
|
183
|
+
footerHeight: state.stats.session ? 2 : 1
|
|
182
184
|
});
|
|
183
185
|
const nextBuffer = new ScreenBuffer(cols, rows);
|
|
184
|
-
const state = getStore().getState();
|
|
185
186
|
renderBorder(nextBuffer, layout, {
|
|
186
187
|
leftTitle: title,
|
|
187
188
|
rightTitle: statsTitle,
|
|
@@ -215,7 +216,7 @@ export function createDashboard(opts = {}) {
|
|
|
215
216
|
renderStatsPane(nextBuffer, layout.rightPane, state.stats);
|
|
216
217
|
if (layout.summary)
|
|
217
218
|
renderCompactStatsPane(nextBuffer, layout.summary, state.stats);
|
|
218
|
-
renderFooter(nextBuffer, layout.footer, footerHints);
|
|
219
|
+
renderFooter(nextBuffer, layout.footer, footerHints, state.stats.session);
|
|
219
220
|
if (showPerformance && layout.leftPane.height > 0) {
|
|
220
221
|
nextBuffer.putInRect(layout.leftPane, layout.leftPane.height - 1, formatRenderPerformance(performanceMonitor.snapshot(), layout.leftPane.width), { dim: true });
|
|
221
222
|
}
|
|
@@ -16,6 +16,11 @@ export type DashboardStats = {
|
|
|
16
16
|
tokensOut: number;
|
|
17
17
|
elapsedMs: number;
|
|
18
18
|
currentAction?: string;
|
|
19
|
+
session?: {
|
|
20
|
+
cwd: string;
|
|
21
|
+
agent: string;
|
|
22
|
+
model?: string;
|
|
23
|
+
};
|
|
19
24
|
};
|
|
20
25
|
export type Command = "quit" | "forceQuit" | "edit" | "pause" | "retry" | "view-log" | "scroll-up" | "scroll-down" | "page-up" | "page-down" | "follow" | "render-stats";
|
|
21
26
|
export type DashboardState = {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Makes untrusted text safe to embed in a human-readable terminal field. */
|
|
2
|
+
export function escapeTerminalText(text) {
|
|
3
|
+
let result = "";
|
|
4
|
+
for (const character of text) {
|
|
5
|
+
const code = character.codePointAt(0);
|
|
6
|
+
if (code <= 0x1f ||
|
|
7
|
+
(code >= 0x7f && code <= 0x9f) ||
|
|
8
|
+
code === 0x061c ||
|
|
9
|
+
code === 0x200e ||
|
|
10
|
+
code === 0x200f ||
|
|
11
|
+
(code >= 0x202a && code <= 0x202e) ||
|
|
12
|
+
(code >= 0x2066 && code <= 0x2069)) {
|
|
13
|
+
result += `\\u${code.toString(16).padStart(4, "0")}`;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
result += character;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.237",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"yaml"
|
|
159
159
|
],
|
|
160
160
|
"optionalDependencies": {
|
|
161
|
-
"toolcraft-schema": "0.0.
|
|
161
|
+
"toolcraft-schema": "0.0.237",
|
|
162
162
|
"toolcraft-design": "*",
|
|
163
163
|
"@poe-code/frontmatter": "*",
|
|
164
164
|
"@poe-code/agent-mcp-config": "*",
|