agent-dbg 0.1.1 → 0.1.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/main.js +274 -570
  2. package/package.json +2 -2
package/dist/main.js CHANGED
@@ -1,22 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var __create = Object.create;
4
- var __getProtoOf = Object.getPrototypeOf;
5
3
  var __defProp = Object.defineProperty;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __toESM = (mod, isNodeMode, target) => {
9
- target = mod != null ? __create(__getProtoOf(mod)) : {};
10
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
- for (let key of __getOwnPropNames(mod))
12
- if (!__hasOwnProp.call(to, key))
13
- __defProp(to, key, {
14
- get: () => mod[key],
15
- enumerable: true
16
- });
17
- return to;
18
- };
19
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
20
4
  var __export = (target, all) => {
21
5
  for (var name in all)
22
6
  __defProp(target, name, {
@@ -781,9 +765,9 @@ function prettifyError(error) {
781
765
  const lines = [];
782
766
  const issues = [...error.issues].sort((a, b) => a.path.length - b.path.length);
783
767
  for (const issue2 of issues) {
784
- lines.push(`✖ ${issue2.message}`);
768
+ lines.push(`\u2716 ${issue2.message}`);
785
769
  if (issue2.path?.length)
786
- lines.push(` at ${toDotPath(issue2.path)}`);
770
+ lines.push(` \u2192 at ${toDotPath(issue2.path)}`);
787
771
  }
788
772
  return lines.join(`
789
773
  `);
@@ -6324,329 +6308,9 @@ var init_messages = __esm(() => {
6324
6308
  DaemonResponseSchema = exports_external.union([SuccessResponse, ErrorResponse]);
6325
6309
  });
6326
6310
 
6327
- // node:path
6328
- function assertPath(path) {
6329
- if (typeof path !== "string")
6330
- throw TypeError("Path must be a string. Received " + JSON.stringify(path));
6331
- }
6332
- function normalizeStringPosix(path, allowAboveRoot) {
6333
- var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code;
6334
- for (var i = 0;i <= path.length; ++i) {
6335
- if (i < path.length)
6336
- code = path.charCodeAt(i);
6337
- else if (code === 47)
6338
- break;
6339
- else
6340
- code = 47;
6341
- if (code === 47) {
6342
- if (lastSlash === i - 1 || dots === 1)
6343
- ;
6344
- else if (lastSlash !== i - 1 && dots === 2) {
6345
- if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {
6346
- if (res.length > 2) {
6347
- var lastSlashIndex = res.lastIndexOf("/");
6348
- if (lastSlashIndex !== res.length - 1) {
6349
- if (lastSlashIndex === -1)
6350
- res = "", lastSegmentLength = 0;
6351
- else
6352
- res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
6353
- lastSlash = i, dots = 0;
6354
- continue;
6355
- }
6356
- } else if (res.length === 2 || res.length === 1) {
6357
- res = "", lastSegmentLength = 0, lastSlash = i, dots = 0;
6358
- continue;
6359
- }
6360
- }
6361
- if (allowAboveRoot) {
6362
- if (res.length > 0)
6363
- res += "/..";
6364
- else
6365
- res = "..";
6366
- lastSegmentLength = 2;
6367
- }
6368
- } else {
6369
- if (res.length > 0)
6370
- res += "/" + path.slice(lastSlash + 1, i);
6371
- else
6372
- res = path.slice(lastSlash + 1, i);
6373
- lastSegmentLength = i - lastSlash - 1;
6374
- }
6375
- lastSlash = i, dots = 0;
6376
- } else if (code === 46 && dots !== -1)
6377
- ++dots;
6378
- else
6379
- dots = -1;
6380
- }
6381
- return res;
6382
- }
6383
- function _format(sep, pathObject) {
6384
- var dir = pathObject.dir || pathObject.root, base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
6385
- if (!dir)
6386
- return base;
6387
- if (dir === pathObject.root)
6388
- return dir + base;
6389
- return dir + sep + base;
6390
- }
6391
- function resolve() {
6392
- var resolvedPath = "", resolvedAbsolute = false, cwd;
6393
- for (var i = arguments.length - 1;i >= -1 && !resolvedAbsolute; i--) {
6394
- var path;
6395
- if (i >= 0)
6396
- path = arguments[i];
6397
- else {
6398
- if (cwd === undefined)
6399
- cwd = process.cwd();
6400
- path = cwd;
6401
- }
6402
- if (assertPath(path), path.length === 0)
6403
- continue;
6404
- resolvedPath = path + "/" + resolvedPath, resolvedAbsolute = path.charCodeAt(0) === 47;
6405
- }
6406
- if (resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute), resolvedAbsolute)
6407
- if (resolvedPath.length > 0)
6408
- return "/" + resolvedPath;
6409
- else
6410
- return "/";
6411
- else if (resolvedPath.length > 0)
6412
- return resolvedPath;
6413
- else
6414
- return ".";
6415
- }
6416
- function normalize(path) {
6417
- if (assertPath(path), path.length === 0)
6418
- return ".";
6419
- var isAbsolute = path.charCodeAt(0) === 47, trailingSeparator = path.charCodeAt(path.length - 1) === 47;
6420
- if (path = normalizeStringPosix(path, !isAbsolute), path.length === 0 && !isAbsolute)
6421
- path = ".";
6422
- if (path.length > 0 && trailingSeparator)
6423
- path += "/";
6424
- if (isAbsolute)
6425
- return "/" + path;
6426
- return path;
6427
- }
6428
- function isAbsolute(path) {
6429
- return assertPath(path), path.length > 0 && path.charCodeAt(0) === 47;
6430
- }
6431
- function join() {
6432
- if (arguments.length === 0)
6433
- return ".";
6434
- var joined;
6435
- for (var i = 0;i < arguments.length; ++i) {
6436
- var arg = arguments[i];
6437
- if (assertPath(arg), arg.length > 0)
6438
- if (joined === undefined)
6439
- joined = arg;
6440
- else
6441
- joined += "/" + arg;
6442
- }
6443
- if (joined === undefined)
6444
- return ".";
6445
- return normalize(joined);
6446
- }
6447
- function relative(from, to) {
6448
- if (assertPath(from), assertPath(to), from === to)
6449
- return "";
6450
- if (from = resolve(from), to = resolve(to), from === to)
6451
- return "";
6452
- var fromStart = 1;
6453
- for (;fromStart < from.length; ++fromStart)
6454
- if (from.charCodeAt(fromStart) !== 47)
6455
- break;
6456
- var fromEnd = from.length, fromLen = fromEnd - fromStart, toStart = 1;
6457
- for (;toStart < to.length; ++toStart)
6458
- if (to.charCodeAt(toStart) !== 47)
6459
- break;
6460
- var toEnd = to.length, toLen = toEnd - toStart, length = fromLen < toLen ? fromLen : toLen, lastCommonSep = -1, i = 0;
6461
- for (;i <= length; ++i) {
6462
- if (i === length) {
6463
- if (toLen > length) {
6464
- if (to.charCodeAt(toStart + i) === 47)
6465
- return to.slice(toStart + i + 1);
6466
- else if (i === 0)
6467
- return to.slice(toStart + i);
6468
- } else if (fromLen > length) {
6469
- if (from.charCodeAt(fromStart + i) === 47)
6470
- lastCommonSep = i;
6471
- else if (i === 0)
6472
- lastCommonSep = 0;
6473
- }
6474
- break;
6475
- }
6476
- var fromCode = from.charCodeAt(fromStart + i), toCode = to.charCodeAt(toStart + i);
6477
- if (fromCode !== toCode)
6478
- break;
6479
- else if (fromCode === 47)
6480
- lastCommonSep = i;
6481
- }
6482
- var out = "";
6483
- for (i = fromStart + lastCommonSep + 1;i <= fromEnd; ++i)
6484
- if (i === fromEnd || from.charCodeAt(i) === 47)
6485
- if (out.length === 0)
6486
- out += "..";
6487
- else
6488
- out += "/..";
6489
- if (out.length > 0)
6490
- return out + to.slice(toStart + lastCommonSep);
6491
- else {
6492
- if (toStart += lastCommonSep, to.charCodeAt(toStart) === 47)
6493
- ++toStart;
6494
- return to.slice(toStart);
6495
- }
6496
- }
6497
- function _makeLong(path) {
6498
- return path;
6499
- }
6500
- function dirname(path) {
6501
- if (assertPath(path), path.length === 0)
6502
- return ".";
6503
- var code = path.charCodeAt(0), hasRoot = code === 47, end = -1, matchedSlash = true;
6504
- for (var i = path.length - 1;i >= 1; --i)
6505
- if (code = path.charCodeAt(i), code === 47) {
6506
- if (!matchedSlash) {
6507
- end = i;
6508
- break;
6509
- }
6510
- } else
6511
- matchedSlash = false;
6512
- if (end === -1)
6513
- return hasRoot ? "/" : ".";
6514
- if (hasRoot && end === 1)
6515
- return "//";
6516
- return path.slice(0, end);
6517
- }
6518
- function basename(path, ext) {
6519
- if (ext !== undefined && typeof ext !== "string")
6520
- throw TypeError('"ext" argument must be a string');
6521
- assertPath(path);
6522
- var start = 0, end = -1, matchedSlash = true, i;
6523
- if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
6524
- if (ext.length === path.length && ext === path)
6525
- return "";
6526
- var extIdx = ext.length - 1, firstNonSlashEnd = -1;
6527
- for (i = path.length - 1;i >= 0; --i) {
6528
- var code = path.charCodeAt(i);
6529
- if (code === 47) {
6530
- if (!matchedSlash) {
6531
- start = i + 1;
6532
- break;
6533
- }
6534
- } else {
6535
- if (firstNonSlashEnd === -1)
6536
- matchedSlash = false, firstNonSlashEnd = i + 1;
6537
- if (extIdx >= 0)
6538
- if (code === ext.charCodeAt(extIdx)) {
6539
- if (--extIdx === -1)
6540
- end = i;
6541
- } else
6542
- extIdx = -1, end = firstNonSlashEnd;
6543
- }
6544
- }
6545
- if (start === end)
6546
- end = firstNonSlashEnd;
6547
- else if (end === -1)
6548
- end = path.length;
6549
- return path.slice(start, end);
6550
- } else {
6551
- for (i = path.length - 1;i >= 0; --i)
6552
- if (path.charCodeAt(i) === 47) {
6553
- if (!matchedSlash) {
6554
- start = i + 1;
6555
- break;
6556
- }
6557
- } else if (end === -1)
6558
- matchedSlash = false, end = i + 1;
6559
- if (end === -1)
6560
- return "";
6561
- return path.slice(start, end);
6562
- }
6563
- }
6564
- function extname(path) {
6565
- assertPath(path);
6566
- var startDot = -1, startPart = 0, end = -1, matchedSlash = true, preDotState = 0;
6567
- for (var i = path.length - 1;i >= 0; --i) {
6568
- var code = path.charCodeAt(i);
6569
- if (code === 47) {
6570
- if (!matchedSlash) {
6571
- startPart = i + 1;
6572
- break;
6573
- }
6574
- continue;
6575
- }
6576
- if (end === -1)
6577
- matchedSlash = false, end = i + 1;
6578
- if (code === 46) {
6579
- if (startDot === -1)
6580
- startDot = i;
6581
- else if (preDotState !== 1)
6582
- preDotState = 1;
6583
- } else if (startDot !== -1)
6584
- preDotState = -1;
6585
- }
6586
- if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)
6587
- return "";
6588
- return path.slice(startDot, end);
6589
- }
6590
- function format(pathObject) {
6591
- if (pathObject === null || typeof pathObject !== "object")
6592
- throw TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
6593
- return _format("/", pathObject);
6594
- }
6595
- function parse5(path) {
6596
- assertPath(path);
6597
- var ret = { root: "", dir: "", base: "", ext: "", name: "" };
6598
- if (path.length === 0)
6599
- return ret;
6600
- var code = path.charCodeAt(0), isAbsolute2 = code === 47, start;
6601
- if (isAbsolute2)
6602
- ret.root = "/", start = 1;
6603
- else
6604
- start = 0;
6605
- var startDot = -1, startPart = 0, end = -1, matchedSlash = true, i = path.length - 1, preDotState = 0;
6606
- for (;i >= start; --i) {
6607
- if (code = path.charCodeAt(i), code === 47) {
6608
- if (!matchedSlash) {
6609
- startPart = i + 1;
6610
- break;
6611
- }
6612
- continue;
6613
- }
6614
- if (end === -1)
6615
- matchedSlash = false, end = i + 1;
6616
- if (code === 46) {
6617
- if (startDot === -1)
6618
- startDot = i;
6619
- else if (preDotState !== 1)
6620
- preDotState = 1;
6621
- } else if (startDot !== -1)
6622
- preDotState = -1;
6623
- }
6624
- if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
6625
- if (end !== -1)
6626
- if (startPart === 0 && isAbsolute2)
6627
- ret.base = ret.name = path.slice(1, end);
6628
- else
6629
- ret.base = ret.name = path.slice(startPart, end);
6630
- } else {
6631
- if (startPart === 0 && isAbsolute2)
6632
- ret.name = path.slice(1, startDot), ret.base = path.slice(1, end);
6633
- else
6634
- ret.name = path.slice(startPart, startDot), ret.base = path.slice(startPart, end);
6635
- ret.ext = path.slice(startDot, end);
6636
- }
6637
- if (startPart > 0)
6638
- ret.dir = path.slice(0, startPart - 1);
6639
- else if (isAbsolute2)
6640
- ret.dir = "/";
6641
- return ret;
6642
- }
6643
- var sep = "/", delimiter = ":", posix;
6644
- var init_path = __esm(() => {
6645
- posix = ((p) => (p.posix = p, p))({ resolve, normalize, isAbsolute, join, relative, _makeLong, dirname, basename, extname, format, parse: parse5, sep, delimiter, win32: null, posix: null });
6646
- });
6647
-
6648
6311
  // src/daemon/paths.ts
6649
- var {existsSync, mkdirSync} = (() => ({}));
6312
+ import { existsSync, mkdirSync } from "fs";
6313
+ import { join } from "path";
6650
6314
  function getSocketDir() {
6651
6315
  const xdgRuntime = process.env.XDG_RUNTIME_DIR;
6652
6316
  if (xdgRuntime) {
@@ -6670,12 +6334,10 @@ function ensureSocketDir() {
6670
6334
  mkdirSync(dir, { recursive: true });
6671
6335
  }
6672
6336
  }
6673
- var init_paths = __esm(() => {
6674
- init_path();
6675
- });
6337
+ var init_paths = () => {};
6676
6338
 
6677
6339
  // src/daemon/server.ts
6678
- var {existsSync: existsSync2, unlinkSync, writeFileSync} = (() => ({}));
6340
+ import { existsSync as existsSync2, unlinkSync, writeFileSync } from "fs";
6679
6341
 
6680
6342
  class DaemonServer {
6681
6343
  session;
@@ -6845,12 +6507,12 @@ class CdpClient {
6845
6507
  this.setupHandlers();
6846
6508
  }
6847
6509
  static async connect(wsUrl, logger) {
6848
- return new Promise((resolve2, reject) => {
6510
+ return new Promise((resolve, reject) => {
6849
6511
  const ws = new WebSocket(wsUrl);
6850
6512
  const onOpen = () => {
6851
6513
  ws.removeEventListener("error", onError);
6852
6514
  const client = new CdpClient(ws, logger);
6853
- resolve2(client);
6515
+ resolve(client);
6854
6516
  };
6855
6517
  const onError = (event) => {
6856
6518
  ws.removeEventListener("open", onOpen);
@@ -6873,13 +6535,13 @@ class CdpClient {
6873
6535
  }
6874
6536
  this.sentMethods.set(id, method);
6875
6537
  this.logger?.logSend(id, method, params);
6876
- return new Promise((resolve2, reject) => {
6538
+ return new Promise((resolve, reject) => {
6877
6539
  const timer = setTimeout(() => {
6878
6540
  this.pending.delete(id);
6879
6541
  this.sentMethods.delete(id);
6880
6542
  reject(new Error(`CDP request timed out: ${method} (id=${id})`));
6881
6543
  }, DEFAULT_TIMEOUT_MS);
6882
- this.pending.set(id, { resolve: resolve2, reject, timer });
6544
+ this.pending.set(id, { resolve, reject, timer });
6883
6545
  this.ws.send(JSON.stringify(request));
6884
6546
  });
6885
6547
  }
@@ -6985,7 +6647,7 @@ class CdpClient {
6985
6647
  var DEFAULT_TIMEOUT_MS = 30000;
6986
6648
 
6987
6649
  // src/cdp/logger.ts
6988
- var {appendFileSync, writeFileSync: writeFileSync2} = (() => ({}));
6650
+ import { appendFileSync, writeFileSync as writeFileSync2 } from "fs";
6989
6651
 
6990
6652
  class CdpLogger {
6991
6653
  logPath;
@@ -7335,7 +6997,7 @@ var init_ref_table = __esm(() => {
7335
6997
  });
7336
6998
 
7337
6999
  // node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
7338
- function decodeInteger(reader, relative2) {
7000
+ function decodeInteger(reader, relative) {
7339
7001
  let value = 0;
7340
7002
  let shift = 0;
7341
7003
  let integer2 = 0;
@@ -7350,7 +7012,7 @@ function decodeInteger(reader, relative2) {
7350
7012
  if (shouldNegate) {
7351
7013
  value = -2147483648 | -value;
7352
7014
  }
7353
- return relative2 + value;
7015
+ return relative + value;
7354
7016
  }
7355
7017
  function hasMoreVlq(reader, max) {
7356
7018
  if (reader.pos >= max)
@@ -7435,174 +7097,170 @@ var init_sourcemap_codec = __esm(() => {
7435
7097
  bufLength = 1024 * 16;
7436
7098
  });
7437
7099
 
7438
- // node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js
7439
- var require_resolve_uri_umd = __commonJS((exports, module) => {
7440
- (function(global, factory) {
7441
- typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.resolveURI = factory());
7442
- })(exports, function() {
7443
- const schemeRegex = /^[\w+.-]+:\/\//;
7444
- const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
7445
- const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
7446
- function isAbsoluteUrl(input) {
7447
- return schemeRegex.test(input);
7448
- }
7449
- function isSchemeRelativeUrl(input) {
7450
- return input.startsWith("//");
7451
- }
7452
- function isAbsolutePath(input) {
7453
- return input.startsWith("/");
7454
- }
7455
- function isFileUrl(input) {
7456
- return input.startsWith("file:");
7457
- }
7458
- function isRelative(input) {
7459
- return /^[.?#]/.test(input);
7460
- }
7461
- function parseAbsoluteUrl(input) {
7462
- const match = urlRegex.exec(input);
7463
- return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
7464
- }
7465
- function parseFileUrl(input) {
7466
- const match = fileRegex.exec(input);
7467
- const path = match[2];
7468
- return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
7469
- }
7470
- function makeUrl(scheme, user, host, port, path, query, hash) {
7471
- return {
7472
- scheme,
7473
- user,
7474
- host,
7475
- port,
7476
- path,
7477
- query,
7478
- hash,
7479
- type: 7
7480
- };
7100
+ // node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
7101
+ function isAbsoluteUrl(input) {
7102
+ return schemeRegex.test(input);
7103
+ }
7104
+ function isSchemeRelativeUrl(input) {
7105
+ return input.startsWith("//");
7106
+ }
7107
+ function isAbsolutePath(input) {
7108
+ return input.startsWith("/");
7109
+ }
7110
+ function isFileUrl(input) {
7111
+ return input.startsWith("file:");
7112
+ }
7113
+ function isRelative(input) {
7114
+ return /^[.?#]/.test(input);
7115
+ }
7116
+ function parseAbsoluteUrl(input) {
7117
+ const match = urlRegex.exec(input);
7118
+ return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
7119
+ }
7120
+ function parseFileUrl(input) {
7121
+ const match = fileRegex.exec(input);
7122
+ const path = match[2];
7123
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
7124
+ }
7125
+ function makeUrl(scheme, user, host, port, path, query, hash) {
7126
+ return {
7127
+ scheme,
7128
+ user,
7129
+ host,
7130
+ port,
7131
+ path,
7132
+ query,
7133
+ hash,
7134
+ type: 7
7135
+ };
7136
+ }
7137
+ function parseUrl(input) {
7138
+ if (isSchemeRelativeUrl(input)) {
7139
+ const url3 = parseAbsoluteUrl("http:" + input);
7140
+ url3.scheme = "";
7141
+ url3.type = 6;
7142
+ return url3;
7143
+ }
7144
+ if (isAbsolutePath(input)) {
7145
+ const url3 = parseAbsoluteUrl("http://foo.com" + input);
7146
+ url3.scheme = "";
7147
+ url3.host = "";
7148
+ url3.type = 5;
7149
+ return url3;
7150
+ }
7151
+ if (isFileUrl(input))
7152
+ return parseFileUrl(input);
7153
+ if (isAbsoluteUrl(input))
7154
+ return parseAbsoluteUrl(input);
7155
+ const url2 = parseAbsoluteUrl("http://foo.com/" + input);
7156
+ url2.scheme = "";
7157
+ url2.host = "";
7158
+ url2.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
7159
+ return url2;
7160
+ }
7161
+ function stripPathFilename(path) {
7162
+ if (path.endsWith("/.."))
7163
+ return path;
7164
+ const index = path.lastIndexOf("/");
7165
+ return path.slice(0, index + 1);
7166
+ }
7167
+ function mergePaths(url2, base) {
7168
+ normalizePath(base, base.type);
7169
+ if (url2.path === "/") {
7170
+ url2.path = base.path;
7171
+ } else {
7172
+ url2.path = stripPathFilename(base.path) + url2.path;
7173
+ }
7174
+ }
7175
+ function normalizePath(url2, type) {
7176
+ const rel = type <= 4;
7177
+ const pieces = url2.path.split("/");
7178
+ let pointer = 1;
7179
+ let positive = 0;
7180
+ let addTrailingSlash = false;
7181
+ for (let i = 1;i < pieces.length; i++) {
7182
+ const piece = pieces[i];
7183
+ if (!piece) {
7184
+ addTrailingSlash = true;
7185
+ continue;
7481
7186
  }
7482
- function parseUrl(input) {
7483
- if (isSchemeRelativeUrl(input)) {
7484
- const url3 = parseAbsoluteUrl("http:" + input);
7485
- url3.scheme = "";
7486
- url3.type = 6;
7487
- return url3;
7488
- }
7489
- if (isAbsolutePath(input)) {
7490
- const url3 = parseAbsoluteUrl("http://foo.com" + input);
7491
- url3.scheme = "";
7492
- url3.host = "";
7493
- url3.type = 5;
7494
- return url3;
7495
- }
7496
- if (isFileUrl(input))
7497
- return parseFileUrl(input);
7498
- if (isAbsoluteUrl(input))
7499
- return parseAbsoluteUrl(input);
7500
- const url2 = parseAbsoluteUrl("http://foo.com/" + input);
7501
- url2.scheme = "";
7502
- url2.host = "";
7503
- url2.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
7504
- return url2;
7505
- }
7506
- function stripPathFilename(path) {
7507
- if (path.endsWith("/.."))
7508
- return path;
7509
- const index = path.lastIndexOf("/");
7510
- return path.slice(0, index + 1);
7511
- }
7512
- function mergePaths(url2, base) {
7513
- normalizePath(base, base.type);
7514
- if (url2.path === "/") {
7515
- url2.path = base.path;
7516
- } else {
7517
- url2.path = stripPathFilename(base.path) + url2.path;
7518
- }
7519
- }
7520
- function normalizePath(url2, type) {
7521
- const rel = type <= 4;
7522
- const pieces = url2.path.split("/");
7523
- let pointer = 1;
7524
- let positive = 0;
7525
- let addTrailingSlash = false;
7526
- for (let i = 1;i < pieces.length; i++) {
7527
- const piece = pieces[i];
7528
- if (!piece) {
7529
- addTrailingSlash = true;
7530
- continue;
7531
- }
7532
- addTrailingSlash = false;
7533
- if (piece === ".")
7534
- continue;
7535
- if (piece === "..") {
7536
- if (positive) {
7537
- addTrailingSlash = true;
7538
- positive--;
7539
- pointer--;
7540
- } else if (rel) {
7541
- pieces[pointer++] = piece;
7542
- }
7543
- continue;
7544
- }
7187
+ addTrailingSlash = false;
7188
+ if (piece === ".")
7189
+ continue;
7190
+ if (piece === "..") {
7191
+ if (positive) {
7192
+ addTrailingSlash = true;
7193
+ positive--;
7194
+ pointer--;
7195
+ } else if (rel) {
7545
7196
  pieces[pointer++] = piece;
7546
- positive++;
7547
- }
7548
- let path = "";
7549
- for (let i = 1;i < pointer; i++) {
7550
- path += "/" + pieces[i];
7551
- }
7552
- if (!path || addTrailingSlash && !path.endsWith("/..")) {
7553
- path += "/";
7554
- }
7555
- url2.path = path;
7556
- }
7557
- function resolve2(input, base) {
7558
- if (!input && !base)
7559
- return "";
7560
- const url2 = parseUrl(input);
7561
- let inputType = url2.type;
7562
- if (base && inputType !== 7) {
7563
- const baseUrl = parseUrl(base);
7564
- const baseType = baseUrl.type;
7565
- switch (inputType) {
7566
- case 1:
7567
- url2.hash = baseUrl.hash;
7568
- case 2:
7569
- url2.query = baseUrl.query;
7570
- case 3:
7571
- case 4:
7572
- mergePaths(url2, baseUrl);
7573
- case 5:
7574
- url2.user = baseUrl.user;
7575
- url2.host = baseUrl.host;
7576
- url2.port = baseUrl.port;
7577
- case 6:
7578
- url2.scheme = baseUrl.scheme;
7579
- }
7580
- if (baseType > inputType)
7581
- inputType = baseType;
7582
- }
7583
- normalizePath(url2, inputType);
7584
- const queryHash = url2.query + url2.hash;
7585
- switch (inputType) {
7586
- case 2:
7587
- case 3:
7588
- return queryHash;
7589
- case 4: {
7590
- const path = url2.path.slice(1);
7591
- if (!path)
7592
- return queryHash || ".";
7593
- if (isRelative(base || input) && !isRelative(path)) {
7594
- return "./" + path + queryHash;
7595
- }
7596
- return path + queryHash;
7597
- }
7598
- case 5:
7599
- return url2.path + queryHash;
7600
- default:
7601
- return url2.scheme + "//" + url2.user + url2.host + url2.port + url2.path + queryHash;
7602
7197
  }
7198
+ continue;
7603
7199
  }
7604
- return resolve2;
7605
- });
7200
+ pieces[pointer++] = piece;
7201
+ positive++;
7202
+ }
7203
+ let path = "";
7204
+ for (let i = 1;i < pointer; i++) {
7205
+ path += "/" + pieces[i];
7206
+ }
7207
+ if (!path || addTrailingSlash && !path.endsWith("/..")) {
7208
+ path += "/";
7209
+ }
7210
+ url2.path = path;
7211
+ }
7212
+ function resolve(input, base) {
7213
+ if (!input && !base)
7214
+ return "";
7215
+ const url2 = parseUrl(input);
7216
+ let inputType = url2.type;
7217
+ if (base && inputType !== 7) {
7218
+ const baseUrl = parseUrl(base);
7219
+ const baseType = baseUrl.type;
7220
+ switch (inputType) {
7221
+ case 1:
7222
+ url2.hash = baseUrl.hash;
7223
+ case 2:
7224
+ url2.query = baseUrl.query;
7225
+ case 3:
7226
+ case 4:
7227
+ mergePaths(url2, baseUrl);
7228
+ case 5:
7229
+ url2.user = baseUrl.user;
7230
+ url2.host = baseUrl.host;
7231
+ url2.port = baseUrl.port;
7232
+ case 6:
7233
+ url2.scheme = baseUrl.scheme;
7234
+ }
7235
+ if (baseType > inputType)
7236
+ inputType = baseType;
7237
+ }
7238
+ normalizePath(url2, inputType);
7239
+ const queryHash = url2.query + url2.hash;
7240
+ switch (inputType) {
7241
+ case 2:
7242
+ case 3:
7243
+ return queryHash;
7244
+ case 4: {
7245
+ const path = url2.path.slice(1);
7246
+ if (!path)
7247
+ return queryHash || ".";
7248
+ if (isRelative(base || input) && !isRelative(path)) {
7249
+ return "./" + path + queryHash;
7250
+ }
7251
+ return path + queryHash;
7252
+ }
7253
+ case 5:
7254
+ return url2.path + queryHash;
7255
+ default:
7256
+ return url2.scheme + "//" + url2.user + url2.host + url2.port + url2.path + queryHash;
7257
+ }
7258
+ }
7259
+ var schemeRegex, urlRegex, fileRegex;
7260
+ var init_resolve_uri = __esm(() => {
7261
+ schemeRegex = /^[\w+.-]+:\/\//;
7262
+ urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
7263
+ fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
7606
7264
  });
7607
7265
 
7608
7266
  // node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
@@ -7615,7 +7273,7 @@ function stripFilename(path) {
7615
7273
  function resolver(mapUrl, sourceRoot) {
7616
7274
  const from = stripFilename(mapUrl);
7617
7275
  const prefix = sourceRoot ? sourceRoot + "/" : "";
7618
- return (source) => import_resolve_uri.default(prefix + (source || ""), from);
7276
+ return (source) => resolve(prefix + (source || ""), from);
7619
7277
  }
7620
7278
  function maybeSort(mappings, owned) {
7621
7279
  const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
@@ -7734,7 +7392,7 @@ function memoizedBinarySearch(haystack, needle, state, key) {
7734
7392
  state.lastNeedle = needle;
7735
7393
  return state.lastIndex = binarySearch(haystack, needle, low, high);
7736
7394
  }
7737
- function parse6(map2) {
7395
+ function parse5(map2) {
7738
7396
  return typeof map2 === "string" ? JSON.parse(map2) : map2;
7739
7397
  }
7740
7398
  function cast(map2) {
@@ -7828,12 +7486,12 @@ function generatedPosition(map2, source, line, column, bias, all) {
7828
7486
  const segment = segments[index];
7829
7487
  return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);
7830
7488
  }
7831
- var import_resolve_uri, COLUMN = 0, SOURCES_INDEX = 1, SOURCE_LINE = 2, SOURCE_COLUMN = 3, NAMES_INDEX = 4, REV_GENERATED_LINE = 1, REV_GENERATED_COLUMN = 2, found = false, LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)", COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)", LEAST_UPPER_BOUND = -1, GREATEST_LOWER_BOUND = 1, TraceMap = class {
7489
+ var COLUMN = 0, SOURCES_INDEX = 1, SOURCE_LINE = 2, SOURCE_COLUMN = 3, NAMES_INDEX = 4, REV_GENERATED_LINE = 1, REV_GENERATED_COLUMN = 2, found = false, LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)", COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)", LEAST_UPPER_BOUND = -1, GREATEST_LOWER_BOUND = 1, TraceMap = class {
7832
7490
  constructor(map2, mapUrl) {
7833
7491
  const isString = typeof map2 === "string";
7834
7492
  if (!isString && map2._decodedMemo)
7835
7493
  return map2;
7836
- const parsed = parse6(map2);
7494
+ const parsed = parse5(map2);
7837
7495
  const { version, file: file2, names, sourceRoot, sources, sourcesContent } = parsed;
7838
7496
  this.version = version;
7839
7497
  this.file = file2;
@@ -7863,10 +7521,12 @@ var import_resolve_uri, COLUMN = 0, SOURCES_INDEX = 1, SOURCE_LINE = 2, SOURCE_C
7863
7521
  };
7864
7522
  var init_trace_mapping = __esm(() => {
7865
7523
  init_sourcemap_codec();
7866
- import_resolve_uri = __toESM(require_resolve_uri_umd(), 1);
7524
+ init_resolve_uri();
7867
7525
  });
7868
7526
 
7869
7527
  // src/sourcemap/resolver.ts
7528
+ import { dirname, resolve as resolve2 } from "path";
7529
+
7870
7530
  class SourceMapResolver {
7871
7531
  maps = new Map;
7872
7532
  sourceIndex = new Map;
@@ -7893,7 +7553,7 @@ class SourceMapResolver {
7893
7553
  if (sourceMapURL.startsWith("/")) {
7894
7554
  mapPath = sourceMapURL;
7895
7555
  } else {
7896
- mapPath = resolve(dirname(scriptPath2), sourceMapURL);
7556
+ mapPath = resolve2(dirname(scriptPath2), sourceMapURL);
7897
7557
  }
7898
7558
  const file2 = Bun.file(mapPath);
7899
7559
  if (!await file2.exists())
@@ -7908,7 +7568,7 @@ class SourceMapResolver {
7908
7568
  const resolvedSources = sources.map((s) => {
7909
7569
  if (s.startsWith("/"))
7910
7570
  return s;
7911
- return resolve(scriptDir, s);
7571
+ return resolve2(scriptDir, s);
7912
7572
  });
7913
7573
  const entry = {
7914
7574
  traceMap,
@@ -8089,7 +7749,6 @@ class SourceMapResolver {
8089
7749
  }
8090
7750
  }
8091
7751
  var init_resolver = __esm(() => {
8092
- init_path();
8093
7752
  init_trace_mapping();
8094
7753
  });
8095
7754
 
@@ -8351,13 +8010,13 @@ async function reEnableBreakpoint(session, ref, entry) {
8351
8010
  const url2 = meta.url;
8352
8011
  const condition = meta.condition;
8353
8012
  const hitCount = meta.hitCount;
8354
- const urlRegex = meta.urlRegex;
8013
+ const urlRegex2 = meta.urlRegex;
8355
8014
  const builtCondition = session.buildBreakpointCondition(condition, hitCount);
8356
8015
  const bpParams = {
8357
8016
  lineNumber: line - 1
8358
8017
  };
8359
- if (urlRegex) {
8360
- bpParams.urlRegex = urlRegex;
8018
+ if (urlRegex2) {
8019
+ bpParams.urlRegex = urlRegex2;
8361
8020
  } else if (url2) {
8362
8021
  bpParams.url = url2;
8363
8022
  }
@@ -9650,7 +9309,7 @@ class DebugSession {
9650
9309
  return null;
9651
9310
  }
9652
9311
  createPauseWaiter(timeoutMs = 30000) {
9653
- return new Promise((resolve2) => {
9312
+ return new Promise((resolve3) => {
9654
9313
  let settled = false;
9655
9314
  const settle = () => {
9656
9315
  if (settled)
@@ -9660,7 +9319,7 @@ class DebugSession {
9660
9319
  clearInterval(pollTimer);
9661
9320
  this.cdp?.off("Debugger.paused", handler);
9662
9321
  this.onProcessExit = null;
9663
- resolve2();
9322
+ resolve3();
9664
9323
  };
9665
9324
  const timer = setTimeout(() => {
9666
9325
  settle();
@@ -9973,11 +9632,11 @@ var init_entry = __esm(async () => {
9973
9632
  return { ok: true, data: stateAfter };
9974
9633
  }
9975
9634
  case "break": {
9976
- const { file: file2, line, condition, hitCount, urlRegex, column } = req.args;
9635
+ const { file: file2, line, condition, hitCount, urlRegex: urlRegex2, column } = req.args;
9977
9636
  const bpResult = await debugSession.setBreakpoint(file2, line, {
9978
9637
  condition,
9979
9638
  hitCount,
9980
- urlRegex,
9639
+ urlRegex: urlRegex2,
9981
9640
  column
9982
9641
  });
9983
9642
  return { ok: true, data: bpResult };
@@ -10131,7 +9790,7 @@ var init_registry = __esm(() => {
10131
9790
  });
10132
9791
 
10133
9792
  // src/daemon/client.ts
10134
- var {existsSync: existsSync3, readdirSync} = (() => ({}));
9793
+ import { existsSync as existsSync3, readdirSync } from "fs";
10135
9794
 
10136
9795
  class DaemonClient {
10137
9796
  session;
@@ -10145,7 +9804,7 @@ class DaemonClient {
10145
9804
  `;
10146
9805
  const sessionName = this.session;
10147
9806
  const socketPath = this.socketPath;
10148
- return new Promise((resolve2, reject) => {
9807
+ return new Promise((resolve3, reject) => {
10149
9808
  let buffer = "";
10150
9809
  let settled = false;
10151
9810
  const timer = setTimeout(() => {
@@ -10174,7 +9833,7 @@ class DaemonClient {
10174
9833
  if (!parsed.success) {
10175
9834
  reject(new Error("Invalid response from daemon"));
10176
9835
  } else {
10177
- resolve2(parsed.data);
9836
+ resolve3(parsed.data);
10178
9837
  }
10179
9838
  } catch {
10180
9839
  reject(new Error("Invalid JSON response from daemon"));
@@ -10192,7 +9851,7 @@ class DaemonClient {
10192
9851
  if (!parsed.success) {
10193
9852
  reject(new Error("Invalid response from daemon"));
10194
9853
  } else {
10195
- resolve2(parsed.data);
9854
+ resolve3(parsed.data);
10196
9855
  }
10197
9856
  } catch {
10198
9857
  reject(new Error("Invalid JSON response from daemon"));
@@ -10266,7 +9925,7 @@ var init_client = __esm(() => {
10266
9925
  });
10267
9926
 
10268
9927
  // src/daemon/spawn.ts
10269
- var {existsSync: existsSync4} = (() => ({}));
9928
+ import { existsSync as existsSync4 } from "fs";
10270
9929
  async function spawnDaemon(session2, options = {}) {
10271
9930
  const socketPath = getSocketPath(session2);
10272
9931
  const spawnArgs = [];
@@ -10302,12 +9961,35 @@ var init_spawn = __esm(() => {
10302
9961
  init_paths();
10303
9962
  });
10304
9963
 
9964
+ // src/formatter/path.ts
9965
+ import { relative } from "path";
9966
+ function shortPath(path) {
9967
+ if (path.startsWith("file://")) {
9968
+ path = path.slice(7);
9969
+ }
9970
+ if (path.includes("://") || path.startsWith("node:")) {
9971
+ return path;
9972
+ }
9973
+ if (path.startsWith("/")) {
9974
+ const rel = relative(cwd, path);
9975
+ if (!rel.startsWith("../../..") && rel.length < path.length) {
9976
+ return rel.startsWith("..") ? rel : `./${rel}`;
9977
+ }
9978
+ }
9979
+ return path;
9980
+ }
9981
+ var cwd;
9982
+ var init_path = __esm(() => {
9983
+ cwd = process.cwd();
9984
+ });
9985
+
10305
9986
  // src/commands/launch.ts
10306
9987
  var exports_launch = {};
10307
9988
  var init_launch = __esm(() => {
10308
9989
  init_registry();
10309
9990
  init_client();
10310
9991
  init_spawn();
9992
+ init_path();
10311
9993
  registerCommand("launch", async (args) => {
10312
9994
  const session2 = args.global.session;
10313
9995
  const brk = args.flags.brk === true;
@@ -10337,7 +10019,7 @@ var init_launch = __esm(() => {
10337
10019
  console.log(`Session "${session2}" started (pid ${data.pid})`);
10338
10020
  if (data.paused && data.pauseInfo) {
10339
10021
  const col = data.pauseInfo.column !== undefined ? `:${data.pauseInfo.column + 1}` : "";
10340
- const loc = data.pauseInfo.url ? `${data.pauseInfo.url}:${data.pauseInfo.line}${col}` : "unknown";
10022
+ const loc = data.pauseInfo.url ? `${shortPath(data.pauseInfo.url)}:${data.pauseInfo.line}${col}` : "unknown";
10341
10023
  console.log(`Paused at ${loc}`);
10342
10024
  } else {
10343
10025
  console.log("Running");
@@ -10418,6 +10100,7 @@ var exports_restart = {};
10418
10100
  var init_restart = __esm(() => {
10419
10101
  init_registry();
10420
10102
  init_client();
10103
+ init_path();
10421
10104
  registerCommand("restart", async (args) => {
10422
10105
  const session2 = args.global.session;
10423
10106
  if (!DaemonClient.isRunning(session2)) {
@@ -10440,7 +10123,7 @@ var init_restart = __esm(() => {
10440
10123
  console.log(`Session "${session2}" restarted (pid ${data.pid})`);
10441
10124
  if (data.paused && data.pauseInfo) {
10442
10125
  const col = data.pauseInfo.column !== undefined ? `:${data.pauseInfo.column + 1}` : "";
10443
- const loc = data.pauseInfo.url ? `${data.pauseInfo.url}:${data.pauseInfo.line}${col}` : "unknown";
10126
+ const loc = data.pauseInfo.url ? `${shortPath(data.pauseInfo.url)}:${data.pauseInfo.line}${col}` : "unknown";
10444
10127
  console.log(`Paused at ${loc}`);
10445
10128
  } else {
10446
10129
  console.log("Running");
@@ -10520,6 +10203,7 @@ var exports_status = {};
10520
10203
  var init_status = __esm(() => {
10521
10204
  init_registry();
10522
10205
  init_client();
10206
+ init_path();
10523
10207
  registerCommand("status", async (args) => {
10524
10208
  const session2 = args.global.session;
10525
10209
  if (!DaemonClient.isRunning(session2)) {
@@ -10538,7 +10222,7 @@ var init_status = __esm(() => {
10538
10222
  console.log(JSON.stringify(data, null, 2));
10539
10223
  } else {
10540
10224
  const stateIcon = data.state === "paused" ? "Paused" : data.state === "running" ? "Running" : "Idle";
10541
- console.log(`${stateIcon} Session "${data.session}" ${data.state}`);
10225
+ console.log(`${stateIcon} \u2014 Session "${data.session}" \u2014 ${data.state}`);
10542
10226
  if (data.pid)
10543
10227
  console.log(` PID: ${data.pid}`);
10544
10228
  if (data.wsUrl)
@@ -10546,7 +10230,7 @@ var init_status = __esm(() => {
10546
10230
  console.log(` Uptime: ${Math.round(data.uptime)}s`);
10547
10231
  console.log(` Scripts loaded: ${data.scriptCount}`);
10548
10232
  if (data.pauseInfo) {
10549
- const loc = data.pauseInfo.url ? `${data.pauseInfo.url}:${data.pauseInfo.line}${data.pauseInfo.column !== undefined ? `:${data.pauseInfo.column}` : ""}` : "unknown";
10233
+ const loc = data.pauseInfo.url ? `${shortPath(data.pauseInfo.url)}:${data.pauseInfo.line}${data.pauseInfo.column !== undefined ? `:${data.pauseInfo.column}` : ""}` : "unknown";
10550
10234
  console.log(` Paused: ${data.pauseInfo.reason} at ${loc}`);
10551
10235
  }
10552
10236
  }
@@ -10576,8 +10260,8 @@ function trimLine(content, column) {
10576
10260
  }
10577
10261
  const hasPrefix = start > 0;
10578
10262
  const hasSuffix = end < content.length;
10579
- const prefix = hasPrefix ? "" : "";
10580
- const suffix = hasSuffix ? "" : "";
10263
+ const prefix = hasPrefix ? "\u2026" : "";
10264
+ const suffix = hasSuffix ? "\u2026" : "";
10581
10265
  const adjustedCaret = col !== undefined ? col - start + (hasPrefix ? 1 : 0) : undefined;
10582
10266
  return { text: `${prefix}${content.slice(start, end)}${suffix}`, caretOffset: adjustedCaret };
10583
10267
  }
@@ -10591,14 +10275,14 @@ function formatSource(lines) {
10591
10275
  const num = String(line.lineNumber).padStart(numWidth);
10592
10276
  let marker = " ";
10593
10277
  if (line.isCurrent && line.hasBreakpoint) {
10594
- marker = "→●";
10278
+ marker = "\u2192\u25CF";
10595
10279
  } else if (line.isCurrent) {
10596
- marker = " ";
10280
+ marker = " \u2192";
10597
10281
  } else if (line.hasBreakpoint) {
10598
- marker = " ";
10282
+ marker = " \u25CF";
10599
10283
  }
10600
10284
  const trimmed = line.isCurrent ? trimLine(line.content, line.currentColumn) : trimLine(line.content);
10601
- result.push(`${marker} ${num}│${trimmed.text}`);
10285
+ result.push(`${marker} ${num}\u2502${trimmed.text}`);
10602
10286
  if (line.isCurrent && trimmed.caretOffset !== undefined && trimmed.caretOffset >= 0) {
10603
10287
  const gutterWidth = numWidth + 4;
10604
10288
  result.push(`${" ".repeat(gutterWidth)}${" ".repeat(trimmed.caretOffset)}^`);
@@ -10640,22 +10324,26 @@ function formatStack(frames) {
10640
10324
  }
10641
10325
  for (const seg of segments) {
10642
10326
  if ("blackboxedCount" in seg) {
10643
- const label = seg.blackboxedCount === 1 ? " ... 1 framework frame (blackboxed)" : `┊ ... ${seg.blackboxedCount} framework frames (blackboxed)`;
10327
+ const label = seg.blackboxedCount === 1 ? "\u250A ... 1 framework frame (blackboxed)" : `\u250A ... ${seg.blackboxedCount} framework frames (blackboxed)`;
10644
10328
  outputLines.push(label);
10645
10329
  continue;
10646
10330
  }
10647
10331
  const frame = seg;
10648
10332
  if (frame.isAsync) {
10649
- outputLines.push(" async gap");
10333
+ outputLines.push("\u250A async gap");
10650
10334
  }
10651
10335
  const ref = frame.ref.padEnd(maxRefLen);
10652
10336
  const name = frame.functionName.padEnd(maxNameLen);
10653
- const loc = frame.column !== undefined ? `${frame.file}:${frame.line}:${frame.column}` : `${frame.file}:${frame.line}`;
10337
+ const file2 = shortPath(frame.file);
10338
+ const loc = frame.column !== undefined ? `${file2}:${frame.line}:${frame.column}` : `${file2}:${frame.line}`;
10654
10339
  outputLines.push(`${ref} ${name} ${loc}`);
10655
10340
  }
10656
10341
  return outputLines.join(`
10657
10342
  `);
10658
10343
  }
10344
+ var init_stack = __esm(() => {
10345
+ init_path();
10346
+ });
10659
10347
 
10660
10348
  // src/formatter/variables.ts
10661
10349
  function formatGroup(vars) {
@@ -10719,13 +10407,13 @@ var init_variables = __esm(() => {
10719
10407
  // src/commands/print-state.ts
10720
10408
  function printState(data) {
10721
10409
  if (data.status !== "paused") {
10722
- const icon = data.status === "running" ? "" : "";
10410
+ const icon = data.status === "running" ? "\u25B6" : "\u25CB";
10723
10411
  console.log(`${icon} ${data.status === "running" ? "Running" : "Idle"}`);
10724
10412
  return;
10725
10413
  }
10726
- const loc = data.location ? `${data.location.url}:${data.location.line}${data.location.column !== undefined ? `:${data.location.column}` : ""}` : "unknown";
10414
+ const loc = data.location ? `${shortPath(data.location.url)}:${data.location.line}${data.location.column !== undefined ? `:${data.location.column}` : ""}` : "unknown";
10727
10415
  const reason = data.reason ?? "unknown";
10728
- console.log(`⏸ Paused at ${loc} (${reason})`);
10416
+ console.log(`\u23F8 Paused at ${loc} (${reason})`);
10729
10417
  if (data.source?.lines) {
10730
10418
  console.log("");
10731
10419
  console.log("Source:");
@@ -10776,6 +10464,8 @@ function printState(data) {
10776
10464
  }
10777
10465
  }
10778
10466
  var init_print_state = __esm(() => {
10467
+ init_path();
10468
+ init_stack();
10779
10469
  init_variables();
10780
10470
  });
10781
10471
 
@@ -11007,6 +10697,7 @@ function parseFileLineColumn(target) {
11007
10697
  var init_break = __esm(() => {
11008
10698
  init_registry();
11009
10699
  init_client();
10700
+ init_path();
11010
10701
  registerCommand("break", async (args) => {
11011
10702
  const session2 = args.global.session;
11012
10703
  if (!DaemonClient.isRunning(session2)) {
@@ -11070,7 +10761,7 @@ var init_break = __esm(() => {
11070
10761
  if (args.global.json) {
11071
10762
  console.log(JSON.stringify(data2, null, 2));
11072
10763
  } else {
11073
- const loc = `${data2.location.url}:${data2.location.line}`;
10764
+ const loc = `${shortPath(data2.location.url)}:${data2.location.line}`;
11074
10765
  console.log(`${data2.ref} set at ${loc} (log: ${logTemplate})`);
11075
10766
  }
11076
10767
  return 0;
@@ -11096,7 +10787,7 @@ var init_break = __esm(() => {
11096
10787
  if (args.global.json) {
11097
10788
  console.log(JSON.stringify(data, null, 2));
11098
10789
  } else {
11099
- const loc = `${data.location.url}:${data.location.line}`;
10790
+ const loc = `${shortPath(data.location.url)}:${data.location.line}`;
11100
10791
  let msg = `${data.ref} set at ${loc}`;
11101
10792
  if (condition) {
11102
10793
  msg += ` (condition: ${condition})`;
@@ -11164,6 +10855,7 @@ var exports_break_ls = {};
11164
10855
  var init_break_ls = __esm(() => {
11165
10856
  init_registry();
11166
10857
  init_client();
10858
+ init_path();
11167
10859
  registerCommand("break-ls", async (args) => {
11168
10860
  const session2 = args.global.session;
11169
10861
  if (!DaemonClient.isRunning(session2)) {
@@ -11187,7 +10879,7 @@ var init_break_ls = __esm(() => {
11187
10879
  console.log("No breakpoints or logpoints set");
11188
10880
  } else {
11189
10881
  for (const bp of data) {
11190
- const loc = `${bp.url}:${bp.line}`;
10882
+ const loc = `${shortPath(bp.url)}:${bp.line}`;
11191
10883
  let line = `${bp.ref} ${loc}`;
11192
10884
  if (bp.type === "LP" && bp.template) {
11193
10885
  line += ` (log: ${bp.template})`;
@@ -11211,6 +10903,7 @@ var exports_logpoint = {};
11211
10903
  var init_logpoint = __esm(() => {
11212
10904
  init_registry();
11213
10905
  init_client();
10906
+ init_path();
11214
10907
  registerCommand("logpoint", async (args) => {
11215
10908
  const session2 = args.global.session;
11216
10909
  if (!DaemonClient.isRunning(session2)) {
@@ -11263,7 +10956,7 @@ var init_logpoint = __esm(() => {
11263
10956
  if (args.global.json) {
11264
10957
  console.log(JSON.stringify(data, null, 2));
11265
10958
  } else {
11266
- const loc = `${data.location.url}:${data.location.line}`;
10959
+ const loc = `${shortPath(data.location.url)}:${data.location.line}`;
11267
10960
  console.log(`${data.ref} set at ${loc} (log: ${template})`);
11268
10961
  }
11269
10962
  return 0;
@@ -11312,6 +11005,7 @@ var exports_source = {};
11312
11005
  var init_source = __esm(() => {
11313
11006
  init_registry();
11314
11007
  init_client();
11008
+ init_path();
11315
11009
  registerCommand("source", async (args) => {
11316
11010
  const session2 = args.global.session;
11317
11011
  if (!DaemonClient.isRunning(session2)) {
@@ -11345,7 +11039,7 @@ var init_source = __esm(() => {
11345
11039
  console.log(JSON.stringify(data, null, 2));
11346
11040
  return 0;
11347
11041
  }
11348
- console.log(`Source: ${data.url}`);
11042
+ console.log(`Source: ${shortPath(data.url)}`);
11349
11043
  const sourceLines = data.lines.map((l) => ({
11350
11044
  lineNumber: l.line,
11351
11045
  content: l.text,
@@ -11404,9 +11098,10 @@ var init_scripts = __esm(() => {
11404
11098
 
11405
11099
  // src/commands/stack.ts
11406
11100
  var exports_stack = {};
11407
- var init_stack = __esm(() => {
11101
+ var init_stack2 = __esm(() => {
11408
11102
  init_registry();
11409
11103
  init_client();
11104
+ init_stack();
11410
11105
  registerCommand("stack", async (args) => {
11411
11106
  const session2 = args.global.session;
11412
11107
  if (!DaemonClient.isRunning(session2)) {
@@ -11456,6 +11151,7 @@ var exports_search = {};
11456
11151
  var init_search = __esm(() => {
11457
11152
  init_registry();
11458
11153
  init_client();
11154
+ init_path();
11459
11155
  registerCommand("search", async (args) => {
11460
11156
  const session2 = args.global.session;
11461
11157
  if (!DaemonClient.isRunning(session2)) {
@@ -11504,7 +11200,7 @@ var init_search = __esm(() => {
11504
11200
  return 0;
11505
11201
  }
11506
11202
  for (const match of data) {
11507
- console.log(`${match.url}:${match.line}: ${match.content}`);
11203
+ console.log(`${shortPath(match.url)}:${match.line}: ${match.content}`);
11508
11204
  }
11509
11205
  return 0;
11510
11206
  });
@@ -12371,7 +12067,15 @@ var init_logs = __esm(() => {
12371
12067
 
12372
12068
  // src/commands/logs.ts
12373
12069
  var exports_logs = {};
12374
- var {closeSync, existsSync: existsSync5, openSync, readFileSync, readSync, watch, writeFileSync: writeFileSync3} = (() => ({}));
12070
+ import {
12071
+ closeSync,
12072
+ existsSync as existsSync5,
12073
+ openSync,
12074
+ readFileSync,
12075
+ readSync,
12076
+ watch,
12077
+ writeFileSync as writeFileSync3
12078
+ } from "fs";
12375
12079
  function parseEntries(text) {
12376
12080
  const entries = [];
12377
12081
  for (const line of text.split(`
@@ -12450,10 +12154,10 @@ var init_logs2 = __esm(() => {
12450
12154
  watcher = watch(logPath, () => {
12451
12155
  readNew();
12452
12156
  });
12453
- await new Promise((resolve2) => {
12157
+ await new Promise((resolve3) => {
12454
12158
  process.on("SIGINT", () => {
12455
12159
  watcher?.close();
12456
- resolve2();
12160
+ resolve3();
12457
12161
  });
12458
12162
  });
12459
12163
  return 0;
@@ -12559,20 +12263,20 @@ async function run(args) {
12559
12263
  }
12560
12264
  const handler = registry2.get(args.command);
12561
12265
  if (!handler) {
12562
- console.error(`✗ Unknown command: ${args.command}`);
12563
- console.error(" Try: agent-dbg --help");
12266
+ console.error(`\u2717 Unknown command: ${args.command}`);
12267
+ console.error(" \u2192 Try: agent-dbg --help");
12564
12268
  return 1;
12565
12269
  }
12566
12270
  try {
12567
12271
  return await handler(args);
12568
12272
  } catch (err) {
12569
12273
  const message = err instanceof Error ? err.message : String(err);
12570
- console.error(`✗ ${message}`);
12274
+ console.error(`\u2717 ${message}`);
12571
12275
  return 1;
12572
12276
  }
12573
12277
  }
12574
12278
  function printHelp() {
12575
- console.log(`agent-dbg Node.js debugger CLI for AI agents
12279
+ console.log(`agent-dbg \u2014 Node.js debugger CLI for AI agents
12576
12280
 
12577
12281
  Usage: agent-dbg <command> [options]
12578
12282
 
@@ -12647,12 +12351,12 @@ Global flags:
12647
12351
  --help Show this help`);
12648
12352
  }
12649
12353
  function printHelpAgent() {
12650
- console.log(`agent-dbg Node.js debugger CLI for AI agents
12354
+ console.log(`agent-dbg \u2014 Node.js debugger CLI for AI agents
12651
12355
 
12652
12356
  CORE LOOP:
12653
- 1. agent-dbg launch --brk "node app.js" pauses at first line, returns state
12654
- 2. agent-dbg break src/file.ts:42 set breakpoint
12655
- 3. agent-dbg continue run to breakpoint, returns state
12357
+ 1. agent-dbg launch --brk "node app.js" \u2192 pauses at first line, returns state
12358
+ 2. agent-dbg break src/file.ts:42 \u2192 set breakpoint
12359
+ 3. agent-dbg continue \u2192 run to breakpoint, returns state
12656
12360
  4. Inspect: agent-dbg vars, agent-dbg eval, agent-dbg props @v1
12657
12361
  5. Mutate/fix: agent-dbg set @v1 value, agent-dbg hotpatch src/file.ts
12658
12362
  6. Repeat from 3
@@ -12771,7 +12475,7 @@ if (process.argv.includes("--daemon")) {
12771
12475
  await Promise.resolve().then(() => (init_catch(), exports_catch));
12772
12476
  await Promise.resolve().then(() => (init_source(), exports_source));
12773
12477
  await Promise.resolve().then(() => (init_scripts(), exports_scripts));
12774
- await Promise.resolve().then(() => (init_stack(), exports_stack));
12478
+ await Promise.resolve().then(() => (init_stack2(), exports_stack));
12775
12479
  await Promise.resolve().then(() => (init_search(), exports_search));
12776
12480
  await Promise.resolve().then(() => (init_console(), exports_console));
12777
12481
  await Promise.resolve().then(() => (init_exceptions(), exports_exceptions));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-dbg",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Node.js Debugger CLI for AI Agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "scripts": {
10
10
  "dev": "bun run src/main.ts",
11
- "build": "bun build src/main.ts --outdir dist",
11
+ "build": "bun build src/main.ts --outdir dist --target=bun",
12
12
  "test": "bun test",
13
13
  "lint": "biome check .",
14
14
  "format": "biome check --write .",