@volter-ai-dev/supercode-ui 0.1.4 → 0.1.5
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/controller.mjs +21 -1
- package/package.json +4 -3
package/controller.mjs
CHANGED
|
@@ -178,12 +178,32 @@ function projectConversation(conversation, options) {
|
|
|
178
178
|
// Start at the tail and stop as soon as the bounded render window is full. Hidden harness
|
|
179
179
|
// context never consumes a slot. The independent scan cap prevents a corrupt/all-context
|
|
180
180
|
// transcript from turning this display projection back into an unbounded whole-history walk.
|
|
181
|
-
|
|
181
|
+
let index = conversation.length - 1;
|
|
182
|
+
let scanned = 0;
|
|
183
|
+
for (;
|
|
182
184
|
index >= 0 && rows.length < maxEntries && scanned < maxScanEntries;
|
|
183
185
|
index -= 1, scanned += 1) {
|
|
184
186
|
const row = projectConversationEntry(conversation[index], maxEntryChars);
|
|
185
187
|
if (row) rows.push(row);
|
|
186
188
|
}
|
|
189
|
+
|
|
190
|
+
// A messenger tail needs a conversational anchor. If the hard entry boundary landed inside a
|
|
191
|
+
// long assistant/tool run, use the remaining scan budget to find its nearest preceding human
|
|
192
|
+
// prompt and spend one existing render slot on it. When a prompt is already present, discard
|
|
193
|
+
// older orphaned activity so the visible slice begins on that turn boundary. Both the render
|
|
194
|
+
// count and native-history scan remain strictly bounded.
|
|
195
|
+
const oldestVisibleUser = rows.findLastIndex((row) => row.role === 'user');
|
|
196
|
+
if (oldestVisibleUser >= 0) {
|
|
197
|
+
rows.length = oldestVisibleUser + 1;
|
|
198
|
+
} else {
|
|
199
|
+
for (; index >= 0 && scanned < maxScanEntries; index -= 1, scanned += 1) {
|
|
200
|
+
const row = projectConversationEntry(conversation[index], maxEntryChars);
|
|
201
|
+
if (row?.role !== 'user') continue;
|
|
202
|
+
if (rows.length === maxEntries) rows[rows.length - 1] = row;
|
|
203
|
+
else rows.push(row);
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
187
207
|
rows.reverse();
|
|
188
208
|
return rows;
|
|
189
209
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter-ai-dev/supercode-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Composable default UI kit for Supercode-powered coding-agent experiences",
|
|
6
6
|
"exports": {
|
|
@@ -77,15 +77,16 @@
|
|
|
77
77
|
"storybook": "npm run build && storybook dev -p 6006",
|
|
78
78
|
"build:storybook": "npm run build && storybook build",
|
|
79
79
|
"test:storybook": "npm run build && vitest --run",
|
|
80
|
+
"test:headless": "npm run build && npm run typecheck && npm test",
|
|
80
81
|
"typecheck": "tsc -p tsconfig.json && tsc -p test/tsconfig.json",
|
|
81
82
|
"test": "node --test test/*.test.mjs",
|
|
82
|
-
"prepack": "npm run
|
|
83
|
+
"prepack": "npm run test:headless"
|
|
83
84
|
},
|
|
84
85
|
"dependencies": {
|
|
85
86
|
"markdown-it": "^14.1.0"
|
|
86
87
|
},
|
|
87
88
|
"peerDependencies": {
|
|
88
|
-
"@volter-ai-dev/supercode-client": ">=0.3.
|
|
89
|
+
"@volter-ai-dev/supercode-client": ">=0.3.10 <0.4.0",
|
|
89
90
|
"preact": ">=10.19.0 <11"
|
|
90
91
|
},
|
|
91
92
|
"peerDependenciesMeta": {
|