@openlucaskaka/kagent 0.1.7 → 0.1.8
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/npm/lib/App.js +14 -9
- package/npm/lib/transcript.js +17 -0
- package/npm/lib/ui-components.js +1 -1
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/src/kagent/__init__.py +1 -1
- package/src/kagent/service/contract.py +1 -1
package/npm/lib/App.js
CHANGED
|
@@ -144,6 +144,7 @@ function KagentInkApp({ React, Ink, runtimeSessionFactory = runtime_client_1.cre
|
|
|
144
144
|
const pagingLayout = (0, ui_components_1.createTerminalLayout)(terminalSize.columns, terminalSize.rows, {
|
|
145
145
|
approval: approval !== null,
|
|
146
146
|
commandMenu: status === "idle" && commandMenu ? commandMenu : false,
|
|
147
|
+
introVisible: transcript.entries.length === 0,
|
|
147
148
|
prompt: editor.value,
|
|
148
149
|
promptCursor: editor.cursor,
|
|
149
150
|
});
|
|
@@ -255,6 +256,7 @@ function KagentInkApp({ React, Ink, runtimeSessionFactory = runtime_client_1.cre
|
|
|
255
256
|
const promptLayout = (0, ui_components_1.createTerminalLayout)(terminalSize.columns, terminalSize.rows, {
|
|
256
257
|
approval: approval !== null,
|
|
257
258
|
commandMenu: false,
|
|
259
|
+
introVisible: transcript.entries.length === 0,
|
|
258
260
|
prompt: editor.value,
|
|
259
261
|
promptCursor: editor.cursor,
|
|
260
262
|
});
|
|
@@ -448,6 +450,7 @@ function KagentInkApp({ React, Ink, runtimeSessionFactory = runtime_client_1.cre
|
|
|
448
450
|
? { ...approval, showDetails: showApprovalDetails }
|
|
449
451
|
: false,
|
|
450
452
|
commandMenu: status === "idle" && commandMenu ? commandMenu : false,
|
|
453
|
+
introVisible: transcript.entries.length === 0,
|
|
451
454
|
prompt: editor.value,
|
|
452
455
|
promptCursor: editor.cursor,
|
|
453
456
|
});
|
|
@@ -459,15 +462,17 @@ function KagentInkApp({ React, Ink, runtimeSessionFactory = runtime_client_1.cre
|
|
|
459
462
|
rows: layout.rows,
|
|
460
463
|
reservedRows: layout.reservedRows + (transcriptOffset > 0 ? 1 : 0),
|
|
461
464
|
}, transcriptOffset);
|
|
462
|
-
return React.createElement(Box, { flexDirection: "column", paddingX: layout.horizontalPadding },
|
|
463
|
-
React,
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
465
|
+
return React.createElement(Box, { flexDirection: "column", paddingX: layout.horizontalPadding }, transcript.entries.length === 0
|
|
466
|
+
? React.createElement(ui_components_1.Header, {
|
|
467
|
+
React,
|
|
468
|
+
Box,
|
|
469
|
+
Text,
|
|
470
|
+
compact: layout.compact,
|
|
471
|
+
provider,
|
|
472
|
+
setup: false,
|
|
473
|
+
workspace: process.cwd(),
|
|
474
|
+
})
|
|
475
|
+
: null, React.createElement(ui_components_1.TranscriptPosition, {
|
|
471
476
|
React,
|
|
472
477
|
Text,
|
|
473
478
|
newerCount: transcriptOffset,
|
package/npm/lib/transcript.js
CHANGED
|
@@ -144,6 +144,7 @@ function selectTranscriptViewport(entries, viewport, offset = 0) {
|
|
|
144
144
|
usedRows += rows;
|
|
145
145
|
start = index;
|
|
146
146
|
}
|
|
147
|
+
start = avoidOrphanedLeadingAssistant(entries, start, end, usedRows, availableRows, viewport.columns);
|
|
147
148
|
return entries.slice(start, end);
|
|
148
149
|
}
|
|
149
150
|
function moveTranscriptViewport(entries, viewport, offset, direction) {
|
|
@@ -216,6 +217,22 @@ function retain(state) {
|
|
|
216
217
|
: null;
|
|
217
218
|
return { ...state, entries, activeAssistantId };
|
|
218
219
|
}
|
|
220
|
+
function avoidOrphanedLeadingAssistant(entries, start, end, usedRows, availableRows, columns) {
|
|
221
|
+
let nextStart = start;
|
|
222
|
+
let nextUsedRows = usedRows;
|
|
223
|
+
while (nextStart > 0 &&
|
|
224
|
+
nextStart < end - 1 &&
|
|
225
|
+
entries[nextStart].role === "assistant" &&
|
|
226
|
+
entries[nextStart - 1].role === "user") {
|
|
227
|
+
const userRows = estimateEntryRows(entries[nextStart - 1], columns);
|
|
228
|
+
if (nextUsedRows + userRows <= availableRows) {
|
|
229
|
+
return nextStart - 1;
|
|
230
|
+
}
|
|
231
|
+
nextUsedRows -= estimateEntryRows(entries[nextStart], columns);
|
|
232
|
+
nextStart += 1;
|
|
233
|
+
}
|
|
234
|
+
return nextStart;
|
|
235
|
+
}
|
|
219
236
|
function estimateEntryRows(entry, columns) {
|
|
220
237
|
const contentColumns = Math.max(4, columns - 4);
|
|
221
238
|
const titleRows = entry.title ? (0, terminal_width_1.estimateTextRows)(entry.title, contentColumns) : 0;
|
package/npm/lib/ui-components.js
CHANGED
|
@@ -24,7 +24,7 @@ function createTerminalLayout(columns, rows, overlays) {
|
|
|
24
24
|
const compact = safeColumns < 56;
|
|
25
25
|
const horizontalPadding = compact ? 0 : 1;
|
|
26
26
|
const defaultCommandLimit = compact ? 4 : 6;
|
|
27
|
-
const headerRows = compact ? 2 : 3;
|
|
27
|
+
const headerRows = overlays.introVisible === false ? 0 : compact ? 2 : 3;
|
|
28
28
|
const promptChromeRows = 1;
|
|
29
29
|
const fixedBaseRows = headerRows + promptChromeRows;
|
|
30
30
|
const approvalColumns = Math.max(4, safeColumns - horizontalPadding * 2 - (compact ? 0 : 2));
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
package/src/kagent/__init__.py
CHANGED