@agent-api/cli 0.4.0 → 0.4.2
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/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +1 -1
- package/dist/tui/ink/app.js +31 -3
- package/dist/tui/ink/components.js +2 -1
- package/package.json +2 -2
package/dist/runtime.d.ts
CHANGED
package/dist/runtime.js
CHANGED
package/dist/tui/ink/app.js
CHANGED
|
@@ -107,6 +107,7 @@ function isAuthInputStatus(status) {
|
|
|
107
107
|
function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSwitchProfile, options, profileName, }) {
|
|
108
108
|
const app = useApp();
|
|
109
109
|
const { stdout } = useStdout();
|
|
110
|
+
const terminalSize = useTerminalSize(stdout);
|
|
110
111
|
const [draft, setDraft] = useState("");
|
|
111
112
|
const [cursor, setCursor] = useState(0);
|
|
112
113
|
const [spinnerFrame, setSpinnerFrame] = useState(0);
|
|
@@ -137,11 +138,11 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
|
|
|
137
138
|
state,
|
|
138
139
|
transcriptOffset,
|
|
139
140
|
viewport: {
|
|
140
|
-
rows:
|
|
141
|
-
columns:
|
|
141
|
+
rows: terminalSize.rows,
|
|
142
|
+
columns: terminalSize.columns,
|
|
142
143
|
},
|
|
143
144
|
workdirFallback: options.workdir || process.cwd(),
|
|
144
|
-
}), [cursor, draft, options.workdir, profileName, spinnerFrame, state,
|
|
145
|
+
}), [cursor, draft, options.workdir, profileName, spinnerFrame, state, terminalSize.columns, terminalSize.rows, transcriptOffset]);
|
|
145
146
|
useEffect(() => {
|
|
146
147
|
setTranscriptOffset((offset) => Math.min(offset, renderModel.transcript.maxOffset));
|
|
147
148
|
}, [renderModel.transcript.maxOffset]);
|
|
@@ -242,3 +243,30 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
|
|
|
242
243
|
}, [agentEngine]);
|
|
243
244
|
return _jsx(InkWorkbenchScreen, { renderModel: renderModel, spinnerFrame: spinnerFrame });
|
|
244
245
|
}
|
|
246
|
+
function useTerminalSize(stdout) {
|
|
247
|
+
const [size, setSize] = useState(() => ({
|
|
248
|
+
columns: stdout.columns || process.stdout.columns || 100,
|
|
249
|
+
rows: stdout.rows || process.stdout.rows || 32,
|
|
250
|
+
}));
|
|
251
|
+
useEffect(() => {
|
|
252
|
+
const update = () => {
|
|
253
|
+
setSize((current) => {
|
|
254
|
+
const next = {
|
|
255
|
+
columns: stdout.columns || process.stdout.columns || current.columns,
|
|
256
|
+
rows: stdout.rows || process.stdout.rows || current.rows,
|
|
257
|
+
};
|
|
258
|
+
return next.columns === current.columns && next.rows === current.rows ? current : next;
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
update();
|
|
262
|
+
stdout.on("resize", update);
|
|
263
|
+
if (stdout !== process.stdout)
|
|
264
|
+
process.stdout.on("resize", update);
|
|
265
|
+
return () => {
|
|
266
|
+
stdout.off("resize", update);
|
|
267
|
+
if (stdout !== process.stdout)
|
|
268
|
+
process.stdout.off("resize", update);
|
|
269
|
+
};
|
|
270
|
+
}, [stdout]);
|
|
271
|
+
return size;
|
|
272
|
+
}
|
|
@@ -3,7 +3,8 @@ import { Box, Text } from "ink";
|
|
|
3
3
|
import { activityColor, busySpinner, } from "@agent-api/app-engine/terminal";
|
|
4
4
|
import { authMethods, } from "@agent-api/app-engine/workbench";
|
|
5
5
|
export function InkWorkbenchScreen({ renderModel, spinnerFrame, }) {
|
|
6
|
-
|
|
6
|
+
const activity = (_jsxs(Box, { flexDirection: "column", width: renderModel.layout === "wide" ? "28%" : "100%", height: renderModel.activityHeight, borderStyle: "single", borderColor: "gray", paddingX: 1, children: [_jsx(Text, { bold: true, wrap: "truncate", children: "Activity" }), renderModel.visibleActivities.map((activity) => (_jsxs(Text, { color: activityColor(activity.level), wrap: "truncate", children: [new Date(activity.timestamp).toLocaleTimeString(), " ", activity.text] }, activity.id)))] }));
|
|
7
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, { contextEnabled: renderModel.header.contextEnabled, conversation: renderModel.header.conversation, conversationId: renderModel.header.conversationId, conversationPreviousResponseId: renderModel.header.conversationPreviousResponseId, conversationStatus: renderModel.header.conversationStatus, model: renderModel.header.model, accessMode: renderModel.header.accessMode, pendingLocalLabel: renderModel.header.pendingLocalLabel, preset: renderModel.header.preset, profile: renderModel.header.profile, renderMode: renderModel.header.renderMode, workdir: renderModel.header.workdir }), _jsxs(Box, { marginTop: 1, height: renderModel.viewportHeight, flexDirection: renderModel.layout === "wide" ? "row" : "column", children: [_jsxs(Box, { flexDirection: "column", width: renderModel.layout === "wide" ? "72%" : "100%", paddingRight: renderModel.layout === "wide" ? 1 : 0, children: [renderModel.transcript.visibleLines.map((line) => (_jsx(TranscriptText, { line: line }, line.id))), renderModel.transcript.visibleLines.length === 0 && _jsx(Text, { color: "gray", children: "No transcript lines." })] }), activity] }), _jsxs(Box, { borderStyle: "single", borderColor: renderModel.input.busy ? "yellow" : "green", paddingX: 1, children: [renderModel.input.fullAccess && (_jsx(Text, { color: "red", bold: true, inverse: true, children: "FULL ACCESS" })), renderModel.input.fullAccess && _jsx(Text, { children: " " }), _jsxs(Text, { color: renderModel.input.busy ? "yellow" : "green", children: [renderModel.input.label, " "] }), renderModel.input.busy ? (_jsxs(Text, { wrap: "truncate", children: [_jsx(Text, { color: "yellow", children: busySpinner(spinnerFrame) }), " ", renderModel.input.waitingText] })) : (_jsxs(Text, { wrap: "truncate", children: [renderModel.input.beforeCursor, _jsx(Cursor, { text: renderModel.input.cursorText, visible: true }), renderModel.input.afterCursor] }))] }), _jsx(Box, { paddingX: 1, children: _jsx(Text, { color: "gray", wrap: "truncate", children: renderModel.footerText }) })] }));
|
|
7
8
|
}
|
|
8
9
|
function TranscriptText({ line }) {
|
|
9
10
|
if (!line.spans || line.spans.length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-api/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "First-class command line interface for Agent API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/scalebox-dev/agent-tui#readme",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"test": "npm run sync-version && npm run build && npm run smoke -w @agent-api/app-engine && node --test test/*.test.mjs"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@agent-api/app-engine": "^0.1.
|
|
38
|
+
"@agent-api/app-engine": "^0.1.2",
|
|
39
39
|
"commander": "^14.0.3",
|
|
40
40
|
"ink": "^6.8.0",
|
|
41
41
|
"react": "^19.2.7"
|