@unbound-app/debugger 0.9.0 → 0.10.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.
Files changed (2) hide show
  1. package/dist/index.mjs +24 -27
  2. package/package.json +6 -5
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  import { stripEscapeSequences, terminal } from "terminal-kit";
3
3
  import { join } from "node:path";
4
- import { DEFAULT_EVAL_TIMEOUT_MS, MAX_EVAL_TIMEOUT_MS, parseMessage } from "@unbound-app/debugger-protocol";
4
+ import { CONTROLLER_ENDPOINT_MARKER, DEFAULT_BRIDGE_PORT, DEFAULT_EVAL_TIMEOUT_MS, MAX_EVAL_TIMEOUT_MS, parseMessage } from "@unbound-app/debugger-protocol";
5
5
  import os from "node:os";
6
6
  import { cli } from "cleye";
7
7
  // src/lib/history.ts
@@ -294,12 +294,15 @@ function getControllerDelivery(socket) {
294
294
  return deliver;
295
295
  }
296
296
  function sendDeviceStatus(socket, connected) {
297
- const device = connected ? state$2.deviceInfo ?? void 0 : void 0;
298
- socket.send(JSON.stringify({
297
+ const status = connected ? {
299
298
  type: "device-status",
300
299
  connected,
301
- device
302
- }));
300
+ device: state$2.deviceInfo ?? void 0
301
+ } : {
302
+ type: "device-status",
303
+ connected
304
+ };
305
+ socket.send(JSON.stringify(status));
303
306
  }
304
307
  function broadcastDeviceStatus(connected) {
305
308
  for (const socket of state$2.controllers) sendDeviceStatus(socket, connected);
@@ -453,27 +456,27 @@ function rowText(line) {
453
456
  function printBox(title, lines, inner) {
454
457
  const pad = " ".repeat(PADDING);
455
458
  const horizontal = "─".repeat(inner + 4);
456
- rgb(PINK, `╭${horizontal}╮\n`);
457
- rgb(PINK, `│${pad}`);
458
- boldRgb(PINK, center(title, inner));
459
- rgb(PINK, `${pad}│\n`);
460
- rgb(PINK, `├${horizontal}┤\n`);
459
+ terminal.colorRgbHex(PINK, `╭${horizontal}╮\n`);
460
+ terminal.colorRgbHex(PINK, `│${pad}`);
461
+ terminal.bold.colorRgbHex(PINK, center(title, inner));
462
+ terminal.colorRgbHex(PINK, `${pad}│\n`);
463
+ terminal.colorRgbHex(PINK, `├${horizontal}┤\n`);
461
464
  for (const line of lines) {
462
465
  const label = line.label.padEnd(8);
463
466
  const filler = " ".repeat(Math.max(inner - rowText(line).length, 0));
464
- rgb(PINK, `│${pad}`);
465
- boldRgb(PINK, label);
466
- rgb(GREY, line.value);
467
+ terminal.colorRgbHex(PINK, `│${pad}`);
468
+ terminal.bold.colorRgbHex(PINK, label);
469
+ terminal.colorRgbHex(GREY, line.value);
467
470
  terminal(filler);
468
- rgb(PINK, `${pad}│\n`);
471
+ terminal.colorRgbHex(PINK, `${pad}│\n`);
469
472
  }
470
- rgb(PINK, `╰${horizontal}╯\n`);
473
+ terminal.colorRgbHex(PINK, `╰${horizontal}╯\n`);
471
474
  }
472
475
  function printFallback(title, lines) {
473
- boldRgb(PINK, `✦ ${title}\n`);
476
+ terminal.bold.colorRgbHex(PINK, `✦ ${title}\n`);
474
477
  for (const line of lines) {
475
- rgb(PINK, ` ${line.label.padEnd(8)}`);
476
- rgb(GREY, `${line.value}\n`);
478
+ terminal.colorRgbHex(PINK, ` ${line.label.padEnd(8)}`);
479
+ terminal.colorRgbHex(GREY, `${line.value}\n`);
477
480
  }
478
481
  }
479
482
  /** The usable terminal width: terminal-kit's when it's a real TTY, else stdout's, else a default. */
@@ -489,19 +492,13 @@ function center(text, width) {
489
492
  const left = Math.floor(total / 2);
490
493
  return " ".repeat(left) + text + " ".repeat(total - left);
491
494
  }
492
- function rgb(hex, text) {
493
- terminal.colorRgbHex(hex, text);
494
- }
495
- function boldRgb(hex, text) {
496
- terminal.bold.colorRgbHex(hex, text);
497
- }
498
495
  // src/lib/cli.ts
499
496
  const argv = cli({
500
497
  name: "ub-debugger",
501
498
  flags: { port: {
502
499
  type: Number,
503
500
  description: "The port number to host the debugger on.",
504
- default: 9090
501
+ default: DEFAULT_BRIDGE_PORT
505
502
  } }
506
503
  });
507
504
  // src/lib/ws.ts
@@ -556,7 +553,7 @@ function setupWebSocket() {
556
553
  Bun.serve({
557
554
  port: argv.flags.port,
558
555
  fetch(request, server) {
559
- if (new URL(request.url).searchParams.has("mcp")) {
556
+ if (new URL(request.url).searchParams.has(CONTROLLER_ENDPOINT_MARKER)) {
560
557
  server.upgrade(request, { data: { role: "controller" } });
561
558
  return;
562
559
  }
@@ -624,7 +621,7 @@ function setupWebSocket() {
624
621
  system("pink", connected ? `MCP connected - ${count} ${plural} attached` : `MCP disconnected - ${count} ${plural} attached`);
625
622
  takeReplInput();
626
623
  });
627
- printBanner(`${getLocalAddress()}:${argv.flags.port}`, `ws://127.0.0.1:${argv.flags.port}?mcp`);
624
+ printBanner(`${getLocalAddress()}:${argv.flags.port}`, `ws://127.0.0.1:${argv.flags.port}?${CONTROLLER_ENDPOINT_MARKER}`);
628
625
  }
629
626
  function handleDeviceMessage(raw) {
630
627
  const message = parseMessage(raw);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unbound-app/debugger",
3
- "version": "0.9.0",
3
+ "version": "0.10.2",
4
4
  "description": "A REPL debugger for @unbound-app/client runtime instances.",
5
5
  "author": {
6
6
  "name": "Mario P.",
@@ -21,14 +21,15 @@
21
21
  "type": "module",
22
22
  "module": "./dist/index.mjs",
23
23
  "scripts": {
24
- "build": "tsdown"
24
+ "build": "tsdown",
25
+ "typecheck": "tsc --noEmit -p ."
25
26
  },
26
27
  "dependencies": {
27
- "@unbound-app/debugger-protocol": "0.9.0",
28
+ "@unbound-app/debugger-protocol": "0.11.1",
28
29
  "cleye": "^2.7.0",
29
- "terminal-kit": "^3.1.2"
30
+ "terminal-kit": "^3.1.4"
30
31
  },
31
32
  "peerDependencies": {
32
- "typescript": "^5.9.3"
33
+ "typescript": "^7.0.2"
33
34
  }
34
35
  }