@ainecto/mcp 0.16.2 → 0.16.4

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/README.md CHANGED
@@ -208,6 +208,7 @@ the last point below.
208
208
 
209
209
  ```bash
210
210
  ainecto term new api --cwd ~/code/api -- claude # start a session (without a command: your login shell)
211
+ ainecto term new api --project <project-uuid> -- claude # file it under that AiNecto project in Terminal on the web
211
212
  ainecto term ls [--json]
212
213
  ainecto term send api "run the tests" # types the text, without Enter
213
214
  ainecto term key api enter # one key — see below
@@ -221,10 +222,14 @@ ainecto term restore # after a reboot: start again
221
222
 
222
223
  - Keys for `key`: `enter`, `tab`, `shift-tab`, `escape`, `backspace`, `delete`, `space`, `up`, `down`,
223
224
  `left`, `right`, `home`, `end`, `pageup`, `pagedown`, `ctrl-a` … `ctrl-z` (`ctrl+c`, `esc` and `return`
224
- are accepted too).
225
+ are accepted too). `wheel-up` and `wheel-down` scroll one step: a mouse wheel report when the app turned on
226
+ mouse tracking, otherwise the up/down key in a full-screen app (nothing in a plain shell).
225
227
  - `send --paste` sends the text as a bracketed paste when the app asked for one. To send text that starts
226
228
  with `-`, put it after `--`.
227
229
  - In `attach`, press `Ctrl-\` twice to send one `Ctrl-\` to the app.
230
+ - `--project` takes the project UUID from the project's web address (`…/projects/<uuid>`). Terminal on the web
231
+ lists the session under that project; without it, the session shows as outside any project. The tag stays
232
+ for the life of the session.
228
233
  - Inside a session, `AINECTO_TERM_SESSION` holds its name. A name does not change; renaming on the web
229
234
  changes only the name you see (`term ls` shows it as the label).
230
235
  - `restore` starts again each session that was running (name, folder, command) with the environment of the
@@ -271,7 +276,7 @@ This is the entry `setup --local` and `init --mcp --local` write — you normall
271
276
  "mcpServers": {
272
277
  "ainecto": {
273
278
  "command": "npx",
274
- "args": ["-y", "@ainecto/mcp@0.16.2"]
279
+ "args": ["-y", "@ainecto/mcp@0.16.4"]
275
280
  }
276
281
  }
277
282
  }
@@ -5699,8 +5699,8 @@ function legacyRoleInput(flag, envVars = process.env) {
5699
5699
 
5700
5700
  // src/core/version.ts
5701
5701
  var UNBUNDLED_VERSION = "dev";
5702
- var CLI_VERSION = true ? "0.16.2" : UNBUNDLED_VERSION;
5703
- var CLI_BUILD = true ? "3033982" : void 0;
5702
+ var CLI_VERSION = true ? "0.16.4" : UNBUNDLED_VERSION;
5703
+ var CLI_BUILD = true ? "ef54410" : void 0;
5704
5704
  function cliVersionLabel(version, build, release2) {
5705
5705
  return release2 || build === void 0 ? version : `${version}-dev+${build}`;
5706
5706
  }
@@ -11369,7 +11369,14 @@ function parseClientMessage(line) {
11369
11369
  case "key":
11370
11370
  return { id, op, name: stringField(record4, "name"), key: stringField(record4, "key"), ...optionalInstance(record4) };
11371
11371
  case "read":
11372
- return { id, op, name: stringField(record4, "name"), scrollback: record4.scrollback === true, lines: optionalSize(record4, "lines") };
11372
+ return {
11373
+ id,
11374
+ op,
11375
+ name: stringField(record4, "name"),
11376
+ scrollback: record4.scrollback === true,
11377
+ lines: optionalSize(record4, "lines"),
11378
+ ...record4.styles === true ? { styles: true } : {}
11379
+ };
11373
11380
  case "kill":
11374
11381
  return { id, op, name: stringField(record4, "name"), ...optionalInstance(record4) };
11375
11382
  case "watch":
@@ -11441,7 +11448,17 @@ function readModes(data) {
11441
11448
  const altScreen = "altScreen" in modes ? modes.altScreen : void 0;
11442
11449
  const appCursor = "appCursor" in modes ? modes.appCursor : void 0;
11443
11450
  const bracketedPaste = "bracketedPaste" in modes ? modes.bracketedPaste : void 0;
11444
- return typeof altScreen === "boolean" && typeof appCursor === "boolean" && typeof bracketedPaste === "boolean" ? { altScreen, appCursor, bracketedPaste } : void 0;
11451
+ const mouse = "mouse" in modes ? modes.mouse : void 0;
11452
+ return typeof altScreen === "boolean" && typeof appCursor === "boolean" && typeof bracketedPaste === "boolean" ? { altScreen, appCursor, bracketedPaste, ...typeof mouse === "boolean" ? { mouse } : {} } : void 0;
11453
+ }
11454
+ function readStyles(data, lineCount) {
11455
+ if (!data || typeof data !== "object" || !("styles" in data) || !("runs" in data)) return void 0;
11456
+ const { styles, runs } = data;
11457
+ if (!Array.isArray(styles) || !styles.every((style) => style && typeof style === "object" && !Array.isArray(style))) return void 0;
11458
+ if (!Array.isArray(runs) || runs.length !== lineCount || !runs.every((row) => Array.isArray(row) && row.length % 3 === 0 && row.every((value) => Number.isInteger(value) && value >= 0))) return void 0;
11459
+ const cursor = "cursor" in data ? data.cursor : void 0;
11460
+ const at = cursor && typeof cursor === "object" && "row" in cursor && "col" in cursor && Number.isInteger(cursor.row) && Number.isInteger(cursor.col) ? { row: cursor.row, col: cursor.col } : void 0;
11461
+ return { styles, runs, ...at ? { cursor: at } : {} };
11445
11462
  }
11446
11463
  function sessionInstance(data) {
11447
11464
  return data && typeof data === "object" && "instance" in data && typeof data.instance === "string" && data.instance !== "" ? data.instance : void 0;
@@ -11852,8 +11869,24 @@ var KEY_NAMES = [
11852
11869
  "ctrl-space",
11853
11870
  "ctrl-slash",
11854
11871
  "alt-<key>",
11855
- "ctrl-/shift-/alt- + up/down/left/right/home/end/pageup/pagedown/delete"
11872
+ "ctrl-/shift-/alt- + up/down/left/right/home/end/pageup/pagedown/delete",
11873
+ "wheel-up",
11874
+ "wheel-down"
11856
11875
  ];
11876
+ function wheelBytes(up, context) {
11877
+ const wheel = context.wheel;
11878
+ if (!wheel) return void 0;
11879
+ if (wheel.mouseTracking !== "none") {
11880
+ const button = up ? 64 : 65;
11881
+ const x = Math.max(1, Math.ceil(wheel.cols / 2));
11882
+ const y = Math.max(1, Math.ceil(wheel.rows / 2));
11883
+ return wheel.sgrMouse ? `\x1B[<${button};${x};${y}M` : `\x1B[M${String.fromCharCode(32 + button, 32 + Math.min(x, 223), 32 + Math.min(y, 223))}`;
11884
+ }
11885
+ if (wheel.altScreen) {
11886
+ return `${context.applicationCursorKeys ? "\x1BO" : "\x1B["}${up ? "A" : "B"}`;
11887
+ }
11888
+ return "";
11889
+ }
11857
11890
  function normalizeKeyName(raw) {
11858
11891
  const lower = raw.trim().toLowerCase().replace(/\+/g, "-");
11859
11892
  return ALIASES[lower] ?? lower;
@@ -11868,6 +11901,9 @@ function keyBytes(raw, context) {
11868
11901
  if (cursor !== void 0) {
11869
11902
  return `${context.applicationCursorKeys ? "\x1BO" : "\x1B["}${cursor}`;
11870
11903
  }
11904
+ if (name === "wheel-up" || name === "wheel-down") {
11905
+ return wheelBytes(name === "wheel-up", context);
11906
+ }
11871
11907
  return comboBytes(name);
11872
11908
  }
11873
11909
  function comboBytes(name) {
@@ -12255,16 +12291,108 @@ function oscWithoutQueries(payload) {
12255
12291
 
12256
12292
  // src/core/term/screen.ts
12257
12293
  function screenLines(buffer, rows, range) {
12294
+ return styledScreen(buffer, rows, range, false).lines;
12295
+ }
12296
+ function styledScreen(buffer, rows, range, cursorVisible) {
12258
12297
  const end = buffer.baseY + rows;
12259
12298
  const start = range.scrollback ? 0 : buffer.baseY;
12260
12299
  const lines = [];
12300
+ const runs = [];
12301
+ const styles = [];
12302
+ const styleIndex = /* @__PURE__ */ new Map();
12303
+ const cell = buffer.getNullCell();
12261
12304
  for (let index = start; index < end; index += 1) {
12262
- lines.push(buffer.getLine(index)?.translateToString(true) ?? "");
12263
- }
12264
- while (lines.length > 0 && lines[lines.length - 1] === "") {
12265
- lines.pop();
12305
+ const line = buffer.getLine(index);
12306
+ const text2 = line?.translateToString(true) ?? "";
12307
+ lines.push(text2);
12308
+ const row = [];
12309
+ let offset = 0;
12310
+ for (let column = 0; line && column < line.length && offset < text2.length; column += 1) {
12311
+ line.getCell(column, cell);
12312
+ if (cell.getWidth() === 0) continue;
12313
+ const length = (cell.getChars() || " ").length;
12314
+ const style = cellStyle(cell);
12315
+ if (style) {
12316
+ const key = JSON.stringify(style);
12317
+ let at = styleIndex.get(key);
12318
+ if (at === void 0) {
12319
+ at = styles.length;
12320
+ styles.push(style);
12321
+ styleIndex.set(key, at);
12322
+ }
12323
+ const stop = Math.min(offset + length, text2.length);
12324
+ if (row.length > 0 && row[row.length - 1] === at && row[row.length - 2] === offset) {
12325
+ row[row.length - 2] = stop;
12326
+ } else {
12327
+ row.push(offset, stop, at);
12328
+ }
12329
+ }
12330
+ offset += length;
12331
+ }
12332
+ runs.push(row);
12266
12333
  }
12267
- return range.lines === void 0 ? lines : lines.slice(Math.max(0, lines.length - range.lines));
12334
+ let kept = lines.length;
12335
+ while (kept > 0 && lines[kept - 1] === "") kept -= 1;
12336
+ const from = range.lines === void 0 ? 0 : Math.max(0, kept - range.lines);
12337
+ const cursorRow = buffer.baseY + buffer.cursorY - start - from;
12338
+ return {
12339
+ lines: lines.slice(from, kept),
12340
+ styles,
12341
+ runs: runs.slice(from, kept),
12342
+ ...cursorVisible && cursorRow >= 0 ? { cursor: { row: cursorRow, col: cursorColumn(buffer, cell) } } : {}
12343
+ };
12344
+ }
12345
+ function cursorColumn(buffer, cell) {
12346
+ const line = buffer.getLine(buffer.baseY + buffer.cursorY);
12347
+ let offset = 0;
12348
+ for (let column = 0; line && column < buffer.cursorX && column < line.length; column += 1) {
12349
+ line.getCell(column, cell);
12350
+ if (cell.getWidth() !== 0) offset += (cell.getChars() || " ").length;
12351
+ }
12352
+ return offset + Math.max(0, buffer.cursorX - (line?.length ?? 0));
12353
+ }
12354
+ function cellStyle(cell) {
12355
+ if (cell.isAttributeDefault()) return void 0;
12356
+ const style = {};
12357
+ const fg = cellColor(cell.isFgDefault(), cell.isFgRGB(), cell.getFgColor());
12358
+ const bg = cellColor(cell.isBgDefault(), cell.isBgRGB(), cell.getBgColor());
12359
+ if (fg !== void 0) style.fg = fg;
12360
+ if (bg !== void 0) style.bg = bg;
12361
+ if (cell.isBold()) style.bold = true;
12362
+ if (cell.isDim()) style.dim = true;
12363
+ if (cell.isItalic()) style.italic = true;
12364
+ if (cell.isUnderline()) style.underline = true;
12365
+ if (cell.isInverse()) style.inverse = true;
12366
+ if (cell.isInvisible()) style.invisible = true;
12367
+ if (cell.isStrikethrough()) style.strike = true;
12368
+ return Object.keys(style).length > 0 ? style : void 0;
12369
+ }
12370
+ function cellColor(isDefault, isRgb, value) {
12371
+ if (isDefault) return void 0;
12372
+ return isRgb ? `#${value.toString(16).padStart(6, "0")}` : value;
12373
+ }
12374
+ function trackScreenFlags(terminal) {
12375
+ const flags = { cursorVisible: true, sgrMouse: false };
12376
+ const privateMode = (on) => (params) => {
12377
+ for (const param of params) {
12378
+ if (param === 25) flags.cursorVisible = on;
12379
+ if (param === 1006) flags.sgrMouse = on;
12380
+ }
12381
+ return false;
12382
+ };
12383
+ terminal.parser.registerCsiHandler({ prefix: "?", final: "h" }, privateMode(true));
12384
+ terminal.parser.registerCsiHandler({ prefix: "?", final: "l" }, privateMode(false));
12385
+ const reset = () => {
12386
+ flags.cursorVisible = true;
12387
+ flags.sgrMouse = false;
12388
+ return false;
12389
+ };
12390
+ terminal.parser.registerEscHandler({ final: "c" }, reset);
12391
+ terminal.parser.registerCsiHandler({ intermediates: "!", final: "p" }, () => {
12392
+ flags.cursorVisible = true;
12393
+ return false;
12394
+ });
12395
+ return flags;
12268
12396
  }
12269
12397
  function terminalResetSequence(modes, alternateScreen) {
12270
12398
  let reset = "\x1B[0m";
@@ -12296,16 +12424,18 @@ var FULL_TERMINAL_RESET = terminalResetSequence(
12296
12424
  // src/core/term/session.ts
12297
12425
  var SESSION_ENV = "AINECTO_TERM_SESSION";
12298
12426
  var TermSession = class _TermSession {
12299
- constructor(spec, pty, screen, serializer) {
12427
+ constructor(spec, pty, screen, serializer, flags) {
12300
12428
  this.spec = spec;
12301
12429
  this.pty = pty;
12302
12430
  this.screen = screen;
12303
12431
  this.serializer = serializer;
12432
+ this.flags = flags;
12304
12433
  }
12305
12434
  spec;
12306
12435
  pty;
12307
12436
  screen;
12308
12437
  serializer;
12438
+ flags;
12309
12439
  attached = /* @__PURE__ */ new Map();
12310
12440
  /** watch 중인 쪽 → 다음 «바뀜» 알림을 보낼 차례인가. */
12311
12441
  watchers = /* @__PURE__ */ new Map();
@@ -12339,7 +12469,8 @@ var TermSession = class _TermSession {
12339
12469
  const screen = new import_headless.default.Terminal({ cols: pty.cols, rows: pty.rows, allowProposedApi: true });
12340
12470
  const serializer = new import_addon_serialize.default.SerializeAddon();
12341
12471
  screen.loadAddon(serializer);
12342
- const session = new _TermSession(spec, pty, screen, serializer);
12472
+ const flags = trackScreenFlags(screen);
12473
+ const session = new _TermSession(spec, pty, screen, serializer, flags);
12343
12474
  session.label = spec.label;
12344
12475
  screen.onData((answer) => session.answerQuery(answer));
12345
12476
  pty.onData((data) => session.handleOutput(data));
@@ -12374,7 +12505,8 @@ var TermSession = class _TermSession {
12374
12505
  return {
12375
12506
  altScreen: this.screen.buffer.active.type === "alternate",
12376
12507
  appCursor: this.screen.modes.applicationCursorKeysMode,
12377
- bracketedPaste: this.screen.modes.bracketedPasteMode
12508
+ bracketedPaste: this.screen.modes.bracketedPasteMode,
12509
+ mouse: this.screen.modes.mouseTrackingMode !== "none"
12378
12510
  };
12379
12511
  }
12380
12512
  async send(text2, paste) {
@@ -12383,7 +12515,16 @@ var TermSession = class _TermSession {
12383
12515
  }
12384
12516
  async key(name) {
12385
12517
  await this.settled();
12386
- const bytes = keyBytes(name, { applicationCursorKeys: this.screen.modes.applicationCursorKeysMode });
12518
+ const bytes = keyBytes(name, {
12519
+ applicationCursorKeys: this.screen.modes.applicationCursorKeysMode,
12520
+ wheel: {
12521
+ mouseTracking: this.screen.modes.mouseTrackingMode,
12522
+ sgrMouse: this.flags.sgrMouse,
12523
+ altScreen: this.screen.buffer.active.type === "alternate",
12524
+ cols: this.screen.cols,
12525
+ rows: this.screen.rows
12526
+ }
12527
+ });
12387
12528
  if (bytes === void 0) {
12388
12529
  throw new TermError("TERM_UNKNOWN_KEY", `Unknown key "${name}".`);
12389
12530
  }
@@ -12397,6 +12538,14 @@ var TermSession = class _TermSession {
12397
12538
  await this.settled();
12398
12539
  return screenLines(this.screen.buffer.active, this.screen.rows, range);
12399
12540
  }
12541
+ /** {@link read} 와 같은 줄에 글자 속성·커서까지(원격 웹 화면 — 색·흐림을 칠한다). */
12542
+ async readStyled(range, reader) {
12543
+ if (reader && this.watchers.has(reader)) {
12544
+ this.watchers.set(reader, true);
12545
+ }
12546
+ await this.settled();
12547
+ return styledScreen(this.screen.buffer.active, this.screen.rows, range, this.flags.cursorVisible);
12548
+ }
12400
12549
  /**
12401
12550
  * 붙는다 — ★첫 화면(직렬화)과 그 «뒤» 출력의 경계를 맞춘다: 붙는 순간부터 오는 출력은 모아 두고,
12402
12551
  * 그 앞까지 그린 화면을 직렬화해 보낸 다음 모은 출력을 흘린다(설계 2-3 «화면 세대 번호»와 같은 일).
@@ -12783,7 +12932,12 @@ var TermDaemon = class {
12783
12932
  }
12784
12933
  case "read": {
12785
12934
  const session = this.session(request.name);
12786
- const lines = await session.read({ scrollback: request.scrollback, lines: request.lines }, connection);
12935
+ const range = { scrollback: request.scrollback, lines: request.lines };
12936
+ if (request.styles) {
12937
+ const screen = await session.readStyled(range, connection);
12938
+ return { data: { name: request.name, instance: session.instance, ...screen, modes: await session.modes() } };
12939
+ }
12940
+ const lines = await session.read(range, connection);
12787
12941
  return { data: { name: request.name, instance: session.instance, lines, modes: await session.modes() } };
12788
12942
  }
12789
12943
  case "kill": {
@@ -13120,7 +13274,7 @@ async function waitForMatch(paths, name, pattern, range, timeoutMs) {
13120
13274
 
13121
13275
  // src/adapters/cli/termCommand.ts
13122
13276
  var TERM_HELP_LINES = [
13123
- " ainecto term new <name> [--cwd DIR] [-- command args\u2026] start a session (default: your login shell); AINECTO_TERM_SESSION=<name> inside",
13277
+ " ainecto term new <name> [--cwd DIR] [--project UUID] [-- command args\u2026] start a session (default: your login shell); AINECTO_TERM_SESSION=<name> inside; --project files it under that AiNecto project on the web",
13124
13278
  " ainecto term ls [--json] list sessions",
13125
13279
  " ainecto term send <name> [--paste] [--] <text> type text (no Enter; --paste wraps it as a bracketed paste when the app asked for it)",
13126
13280
  ` ainecto term key <name> <key> press one key: ${KEY_NAMES.join(", ")}`,
@@ -13190,8 +13344,9 @@ async function executeTermCommand(input) {
13190
13344
  }
13191
13345
  }
13192
13346
  async function newSession(paths, argv, input) {
13193
- const args = parseArgs(argv, { cwd: "string" });
13194
- const name = singleName(args.positionals, "term new <name> [--cwd DIR] [-- command args\u2026]");
13347
+ const args = parseArgs(argv, { cwd: "string", project: "string" });
13348
+ const name = singleName(args.positionals, "term new <name> [--cwd DIR] [--project UUID] [-- command args\u2026]");
13349
+ const project = typeof args.flags.project === "string" ? projectFlag(args.flags.project) : void 0;
13195
13350
  const tty = input.io.stdout.isTTY ? { cols: input.io.stdout.columns, rows: input.io.stdout.rows } : {};
13196
13351
  const result = await termRequest(paths, {
13197
13352
  op: "new",
@@ -13199,10 +13354,21 @@ async function newSession(paths, argv, input) {
13199
13354
  cwd: resolve3(typeof args.flags.cwd === "string" ? args.flags.cwd : process.cwd()),
13200
13355
  command: args.afterDashes.length > 0 ? args.afterDashes : null,
13201
13356
  env: stringEnv(),
13202
- ...tty
13357
+ ...tty,
13358
+ ...project ? { project } : {}
13203
13359
  }, { start: true });
13204
13360
  const data = result.daemon ? result.data : void 0;
13205
- return print(input, data, `Started ${name}. Attach with: ainecto term attach ${name}`);
13361
+ const dropped = project !== void 0 && keptProject(data) !== project;
13362
+ const started = `Started ${name}. Attach with: ainecto term attach ${name}`;
13363
+ return print(input, data, dropped ? `${started}
13364
+ The running term background process is older and did not keep --project; the session has no project. Run \`ainecto term kill-server\` when no session needs it, then start the session again.` : started);
13365
+ }
13366
+ function projectFlag(value) {
13367
+ const uuid = value.trim().toLowerCase();
13368
+ if (!isUuid(uuid)) {
13369
+ throw new TermError("TERM_USAGE", `--project needs an AiNecto project UUID (the part after projects/ in its web address), not "${value}".`);
13370
+ }
13371
+ return uuid;
13206
13372
  }
13207
13373
  async function listSessions(paths, argv, input) {
13208
13374
  parseArgs(argv, {});
@@ -13421,6 +13587,9 @@ function linesField(data) {
13421
13587
  }
13422
13588
  return [];
13423
13589
  }
13590
+ function keptProject(data) {
13591
+ return data && typeof data === "object" && "project" in data && typeof data.project === "string" ? data.project : void 0;
13592
+ }
13424
13593
  function resetField(data) {
13425
13594
  return data && typeof data === "object" && "reset" in data && typeof data.reset === "string" ? data.reset : void 0;
13426
13595
  }
@@ -15680,21 +15849,34 @@ function sessionsKey(sessions) {
15680
15849
 
15681
15850
  // src/core/term/remoteFrame.ts
15682
15851
  import { createHash as createHash7 } from "crypto";
15683
- function screenFrame(lines, maxD) {
15852
+ function screenFrame(lines, maxD, attributes) {
15684
15853
  const sizes = lines.map((line) => Buffer.byteLength(line, "utf8"));
15854
+ const runs = attributes?.runs.length === lines.length ? attributes.runs : void 0;
15855
+ const runSizes = runs ? runs.map((row) => JSON.stringify(row).length + 1) : [];
15685
15856
  let start = 0;
15686
15857
  let bytes = sizes.reduce((sum, size) => sum + size, 0) + Math.max(0, lines.length - 1) * 2;
15687
- while (start < lines.length && base64Length(bytes) > maxD) {
15858
+ const fixed = runs ? 10 + CURSOR_BYTES : 0;
15859
+ let runBytes = runSizes.reduce((sum, size) => sum + size, 0);
15860
+ while (start < lines.length && base64Length(bytes) + fixed + runBytes > maxD) {
15688
15861
  bytes -= (sizes[start] ?? 0) + (start < lines.length - 1 ? 2 : 0);
15862
+ runBytes -= runSizes[start] ?? 0;
15689
15863
  start += 1;
15690
15864
  }
15691
15865
  const text2 = lines.slice(start).join("\r\n");
15866
+ const kept = runs?.slice(start);
15867
+ const cursorRow = attributes?.cursor ? attributes.cursor.row - start : -1;
15868
+ const cursor = attributes?.cursor && cursorRow >= 0 ? { row: cursorRow, col: attributes.cursor.col } : void 0;
15869
+ const hash = createHash7("sha256").update(text2, "utf8");
15870
+ if (kept) hash.update(JSON.stringify([attributes?.styles, kept, cursor ?? null]), "utf8");
15692
15871
  return {
15693
15872
  d: Buffer.from(text2, "utf8").toString("base64"),
15694
- hash: createHash7("sha256").update(text2, "utf8").digest("hex"),
15873
+ ...kept ? { runs: kept } : {},
15874
+ ...cursor ? { cursor } : {},
15875
+ hash: hash.digest("hex"),
15695
15876
  dropped: start
15696
15877
  };
15697
15878
  }
15879
+ var CURSOR_BYTES = Buffer.byteLength(JSON.stringify({ cursor: { row: 2 ** 32 - 1, col: 2 ** 32 - 1 } }), "utf8");
15698
15880
  var GCM_TAG_BYTES = 16;
15699
15881
  var MAX_COUNTER = 2 ** 32 - 1;
15700
15882
  function frameBudget(frameMaxBytes, outer, sealed) {
@@ -15807,7 +15989,7 @@ var RemoteViewer = class {
15807
15989
  }
15808
15990
  let data;
15809
15991
  try {
15810
- data = await client.request({ op: "read", name, scrollback: true, lines: FRAME_SCROLLBACK_LINES + rows });
15992
+ data = await client.request({ op: "read", name, scrollback: true, lines: FRAME_SCROLLBACK_LINES + rows, styles: true });
15811
15993
  } catch (error) {
15812
15994
  this.daemonFailed("read", error);
15813
15995
  return;
@@ -15821,9 +16003,11 @@ var RemoteViewer = class {
15821
16003
  return;
15822
16004
  }
15823
16005
  const modes = readModes(data);
16006
+ const lines = readLines(data);
16007
+ const attributes = readStyles(data, lines.length);
15824
16008
  const outer = { linkId: target.linkId, channelId: this.deps.channelId, session: name, cols, rows };
15825
- const sealed = { ...modes ? { modes } : {}, instance };
15826
- const frame = screenFrame(readLines(data), frameBudget(target.frameMaxBytes, outer, sealed));
16009
+ const sealed = { ...modes ? { modes } : {}, ...attributes ? { styles: attributes.styles } : {}, instance };
16010
+ const frame = screenFrame(lines, frameBudget(target.frameMaxBytes, outer, sealed), attributes);
15827
16011
  if (frame.dropped !== dropped) {
15828
16012
  dropped = frame.dropped;
15829
16013
  this.deps.log.write({ event: "remote_frame_trimmed", channelId: this.deps.channelId, session: name, dropped });
@@ -15832,7 +16016,13 @@ var RemoteViewer = class {
15832
16016
  if (key === sentKey) continue;
15833
16017
  let box;
15834
16018
  try {
15835
- box = await this.deps.seal({ d: frame.d, ...sealed, executedThrough });
16019
+ box = await this.deps.seal({
16020
+ d: frame.d,
16021
+ ...sealed,
16022
+ ...frame.runs ? { runs: frame.runs } : {},
16023
+ ...frame.cursor ? { cursor: frame.cursor } : {},
16024
+ executedThrough
16025
+ });
15836
16026
  } catch (error) {
15837
16027
  this.stop();
15838
16028
  this.deps.onChannelEnded(error instanceof ChannelSealError ? error.reason : "CHANNEL_GONE");