@runappsai/agent 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/dist/ui.cjs CHANGED
@@ -504,21 +504,25 @@ var VirtualList = class {
504
504
  const anchorDelta = this.offsets[anchor] - scrollTop;
505
505
  const first = this.indexAt(Math.max(0, scrollTop - this.overscan));
506
506
  const last = Math.min(n - 1, this.indexAt(Math.min(total - 1, scrollTop + view + this.overscan)));
507
+ this.top.style.height = `${this.offsets[first]}px`;
508
+ this.bottom.style.height = `${total - this.offsets[last + 1]}px`;
507
509
  if (first !== this.first || last !== this.last || this.win.childElementCount !== last - first + 1) {
508
510
  const keep = new Set(this.rows.slice(first, last + 1));
509
- for (const [row, w] of this.wrappers) if (!keep.has(row)) {
511
+ const leaving = [...this.wrappers].filter(([row]) => !keep.has(row));
512
+ let prev = null;
513
+ for (let i = first; i <= last; i++) {
514
+ const w = this.wrapper(this.rows[i]);
515
+ if (w.parentNode !== this.win) this.win.insertBefore(w, prev ? prev.nextSibling : this.win.firstChild);
516
+ prev = w;
517
+ }
518
+ for (const [row, w] of leaving) {
510
519
  this.ro?.unobserve(w);
511
520
  w.remove();
512
521
  this.wrappers.delete(row);
513
522
  }
514
- const kids = [];
515
- for (let i = first; i <= last; i++) kids.push(this.wrapper(this.rows[i]));
516
- this.win.replaceChildren(...kids);
517
523
  this.first = first;
518
524
  this.last = last;
519
525
  }
520
- this.top.style.height = `${this.offsets[first]}px`;
521
- this.bottom.style.height = `${total - this.offsets[last + 1]}px`;
522
526
  let changed = false;
523
527
  for (let i = first; i <= last; i++) {
524
528
  const row = this.rows[i];
package/dist/vlist.js CHANGED
@@ -240,24 +240,30 @@ export class VirtualList {
240
240
  const anchorDelta = this.offsets[anchor] - scrollTop;
241
241
  const first = this.indexAt(Math.max(0, scrollTop - this.overscan));
242
242
  const last = Math.min(n - 1, this.indexAt(Math.min(total - 1, scrollTop + view + this.overscan)));
243
- // Reconcile the window.
243
+ // The spacers first: a row that holds the focus forces a layout the moment it leaves (the browser clears
244
+ // the focus), and a scroller that is short then pulls scrollTop back to its new end.
245
+ this.top.style.height = `${this.offsets[first]}px`;
246
+ this.bottom.style.height = `${total - this.offsets[last + 1]}px`;
247
+ // Reconcile the window. Only the rows entering and leaving are touched: taking one out and putting it
248
+ // back would lose its focus, its selection and the scroll position of every code block inside it.
244
249
  if (first !== this.first || last !== this.last || this.win.childElementCount !== last - first + 1) {
245
250
  const keep = new Set(this.rows.slice(first, last + 1));
246
- for (const [row, w] of this.wrappers)
247
- if (!keep.has(row)) {
248
- this.ro?.unobserve(w);
249
- w.remove();
250
- this.wrappers.delete(row);
251
- }
252
- const kids = [];
253
- for (let i = first; i <= last; i++)
254
- kids.push(this.wrapper(this.rows[i]));
255
- this.win.replaceChildren(...kids);
251
+ const leaving = [...this.wrappers].filter(([row]) => !keep.has(row));
252
+ let prev = null;
253
+ for (let i = first; i <= last; i++) {
254
+ const w = this.wrapper(this.rows[i]);
255
+ if (w.parentNode !== this.win)
256
+ this.win.insertBefore(w, prev ? prev.nextSibling : this.win.firstChild);
257
+ prev = w;
258
+ }
259
+ for (const [row, w] of leaving) {
260
+ this.ro?.unobserve(w);
261
+ w.remove();
262
+ this.wrappers.delete(row);
263
+ }
256
264
  this.first = first;
257
265
  this.last = last;
258
266
  }
259
- this.top.style.height = `${this.offsets[first]}px`;
260
- this.bottom.style.height = `${total - this.offsets[last + 1]}px`;
261
267
  // Measure what is shown; a change means another pass with the new sizes.
262
268
  let changed = false;
263
269
  for (let i = first; i <= last; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runappsai/agent",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "description": "Agent harness: the model ↔ tool loop with a workspace, skills, sessions, compaction, a sandbox and a chat UI. Bring any OpenAI-compatible model provider (RunApps included); no runtime dependencies.",
6
6
  "license": "MIT",