larkway 0.3.30 → 0.3.32

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/main.js CHANGED
@@ -10379,769 +10379,6 @@ var require_proxy_from_env = __commonJS({
10379
10379
  }
10380
10380
  });
10381
10381
 
10382
- // node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js
10383
- var require_ms = __commonJS({
10384
- "node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports, module) {
10385
- var s = 1e3;
10386
- var m = s * 60;
10387
- var h = m * 60;
10388
- var d = h * 24;
10389
- var w = d * 7;
10390
- var y = d * 365.25;
10391
- module.exports = function(val, options) {
10392
- options = options || {};
10393
- var type2 = typeof val;
10394
- if (type2 === "string" && val.length > 0) {
10395
- return parse(val);
10396
- } else if (type2 === "number" && isFinite(val)) {
10397
- return options.long ? fmtLong(val) : fmtShort(val);
10398
- }
10399
- throw new Error(
10400
- "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
10401
- );
10402
- };
10403
- function parse(str2) {
10404
- str2 = String(str2);
10405
- if (str2.length > 100) {
10406
- return;
10407
- }
10408
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
10409
- str2
10410
- );
10411
- if (!match) {
10412
- return;
10413
- }
10414
- var n = parseFloat(match[1]);
10415
- var type2 = (match[2] || "ms").toLowerCase();
10416
- switch (type2) {
10417
- case "years":
10418
- case "year":
10419
- case "yrs":
10420
- case "yr":
10421
- case "y":
10422
- return n * y;
10423
- case "weeks":
10424
- case "week":
10425
- case "w":
10426
- return n * w;
10427
- case "days":
10428
- case "day":
10429
- case "d":
10430
- return n * d;
10431
- case "hours":
10432
- case "hour":
10433
- case "hrs":
10434
- case "hr":
10435
- case "h":
10436
- return n * h;
10437
- case "minutes":
10438
- case "minute":
10439
- case "mins":
10440
- case "min":
10441
- case "m":
10442
- return n * m;
10443
- case "seconds":
10444
- case "second":
10445
- case "secs":
10446
- case "sec":
10447
- case "s":
10448
- return n * s;
10449
- case "milliseconds":
10450
- case "millisecond":
10451
- case "msecs":
10452
- case "msec":
10453
- case "ms":
10454
- return n;
10455
- default:
10456
- return void 0;
10457
- }
10458
- }
10459
- function fmtShort(ms) {
10460
- var msAbs = Math.abs(ms);
10461
- if (msAbs >= d) {
10462
- return Math.round(ms / d) + "d";
10463
- }
10464
- if (msAbs >= h) {
10465
- return Math.round(ms / h) + "h";
10466
- }
10467
- if (msAbs >= m) {
10468
- return Math.round(ms / m) + "m";
10469
- }
10470
- if (msAbs >= s) {
10471
- return Math.round(ms / s) + "s";
10472
- }
10473
- return ms + "ms";
10474
- }
10475
- function fmtLong(ms) {
10476
- var msAbs = Math.abs(ms);
10477
- if (msAbs >= d) {
10478
- return plural(ms, msAbs, d, "day");
10479
- }
10480
- if (msAbs >= h) {
10481
- return plural(ms, msAbs, h, "hour");
10482
- }
10483
- if (msAbs >= m) {
10484
- return plural(ms, msAbs, m, "minute");
10485
- }
10486
- if (msAbs >= s) {
10487
- return plural(ms, msAbs, s, "second");
10488
- }
10489
- return ms + " ms";
10490
- }
10491
- function plural(ms, msAbs, n, name) {
10492
- var isPlural = msAbs >= n * 1.5;
10493
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
10494
- }
10495
- }
10496
- });
10497
-
10498
- // node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js
10499
- var require_common = __commonJS({
10500
- "node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js"(exports, module) {
10501
- function setup(env) {
10502
- createDebug.debug = createDebug;
10503
- createDebug.default = createDebug;
10504
- createDebug.coerce = coerce2;
10505
- createDebug.disable = disable;
10506
- createDebug.enable = enable;
10507
- createDebug.enabled = enabled;
10508
- createDebug.humanize = require_ms();
10509
- createDebug.destroy = destroy;
10510
- Object.keys(env).forEach((key) => {
10511
- createDebug[key] = env[key];
10512
- });
10513
- createDebug.names = [];
10514
- createDebug.skips = [];
10515
- createDebug.formatters = {};
10516
- function selectColor(namespace) {
10517
- let hash = 0;
10518
- for (let i = 0; i < namespace.length; i++) {
10519
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
10520
- hash |= 0;
10521
- }
10522
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
10523
- }
10524
- createDebug.selectColor = selectColor;
10525
- function createDebug(namespace) {
10526
- let prevTime;
10527
- let enableOverride = null;
10528
- let namespacesCache;
10529
- let enabledCache;
10530
- function debug(...args) {
10531
- if (!debug.enabled) {
10532
- return;
10533
- }
10534
- const self2 = debug;
10535
- const curr = Number(/* @__PURE__ */ new Date());
10536
- const ms = curr - (prevTime || curr);
10537
- self2.diff = ms;
10538
- self2.prev = prevTime;
10539
- self2.curr = curr;
10540
- prevTime = curr;
10541
- args[0] = createDebug.coerce(args[0]);
10542
- if (typeof args[0] !== "string") {
10543
- args.unshift("%O");
10544
- }
10545
- let index = 0;
10546
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
10547
- if (match === "%%") {
10548
- return "%";
10549
- }
10550
- index++;
10551
- const formatter = createDebug.formatters[format];
10552
- if (typeof formatter === "function") {
10553
- const val = args[index];
10554
- match = formatter.call(self2, val);
10555
- args.splice(index, 1);
10556
- index--;
10557
- }
10558
- return match;
10559
- });
10560
- createDebug.formatArgs.call(self2, args);
10561
- const logFn = self2.log || createDebug.log;
10562
- logFn.apply(self2, args);
10563
- }
10564
- debug.namespace = namespace;
10565
- debug.useColors = createDebug.useColors();
10566
- debug.color = createDebug.selectColor(namespace);
10567
- debug.extend = extend3;
10568
- debug.destroy = createDebug.destroy;
10569
- Object.defineProperty(debug, "enabled", {
10570
- enumerable: true,
10571
- configurable: false,
10572
- get: () => {
10573
- if (enableOverride !== null) {
10574
- return enableOverride;
10575
- }
10576
- if (namespacesCache !== createDebug.namespaces) {
10577
- namespacesCache = createDebug.namespaces;
10578
- enabledCache = createDebug.enabled(namespace);
10579
- }
10580
- return enabledCache;
10581
- },
10582
- set: (v) => {
10583
- enableOverride = v;
10584
- }
10585
- });
10586
- if (typeof createDebug.init === "function") {
10587
- createDebug.init(debug);
10588
- }
10589
- return debug;
10590
- }
10591
- function extend3(namespace, delimiter) {
10592
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
10593
- newDebug.log = this.log;
10594
- return newDebug;
10595
- }
10596
- function enable(namespaces) {
10597
- createDebug.save(namespaces);
10598
- createDebug.namespaces = namespaces;
10599
- createDebug.names = [];
10600
- createDebug.skips = [];
10601
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
10602
- for (const ns of split) {
10603
- if (ns[0] === "-") {
10604
- createDebug.skips.push(ns.slice(1));
10605
- } else {
10606
- createDebug.names.push(ns);
10607
- }
10608
- }
10609
- }
10610
- function matchesTemplate(search, template) {
10611
- let searchIndex = 0;
10612
- let templateIndex = 0;
10613
- let starIndex = -1;
10614
- let matchIndex = 0;
10615
- while (searchIndex < search.length) {
10616
- if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
10617
- if (template[templateIndex] === "*") {
10618
- starIndex = templateIndex;
10619
- matchIndex = searchIndex;
10620
- templateIndex++;
10621
- } else {
10622
- searchIndex++;
10623
- templateIndex++;
10624
- }
10625
- } else if (starIndex !== -1) {
10626
- templateIndex = starIndex + 1;
10627
- matchIndex++;
10628
- searchIndex = matchIndex;
10629
- } else {
10630
- return false;
10631
- }
10632
- }
10633
- while (templateIndex < template.length && template[templateIndex] === "*") {
10634
- templateIndex++;
10635
- }
10636
- return templateIndex === template.length;
10637
- }
10638
- function disable() {
10639
- const namespaces = [
10640
- ...createDebug.names,
10641
- ...createDebug.skips.map((namespace) => "-" + namespace)
10642
- ].join(",");
10643
- createDebug.enable("");
10644
- return namespaces;
10645
- }
10646
- function enabled(name) {
10647
- for (const skip of createDebug.skips) {
10648
- if (matchesTemplate(name, skip)) {
10649
- return false;
10650
- }
10651
- }
10652
- for (const ns of createDebug.names) {
10653
- if (matchesTemplate(name, ns)) {
10654
- return true;
10655
- }
10656
- }
10657
- return false;
10658
- }
10659
- function coerce2(val) {
10660
- if (val instanceof Error) {
10661
- return val.stack || val.message;
10662
- }
10663
- return val;
10664
- }
10665
- function destroy() {
10666
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
10667
- }
10668
- createDebug.enable(createDebug.load());
10669
- return createDebug;
10670
- }
10671
- module.exports = setup;
10672
- }
10673
- });
10674
-
10675
- // node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js
10676
- var require_browser = __commonJS({
10677
- "node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js"(exports, module) {
10678
- exports.formatArgs = formatArgs;
10679
- exports.save = save;
10680
- exports.load = load2;
10681
- exports.useColors = useColors;
10682
- exports.storage = localstorage();
10683
- exports.destroy = /* @__PURE__ */ (() => {
10684
- let warned = false;
10685
- return () => {
10686
- if (!warned) {
10687
- warned = true;
10688
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
10689
- }
10690
- };
10691
- })();
10692
- exports.colors = [
10693
- "#0000CC",
10694
- "#0000FF",
10695
- "#0033CC",
10696
- "#0033FF",
10697
- "#0066CC",
10698
- "#0066FF",
10699
- "#0099CC",
10700
- "#0099FF",
10701
- "#00CC00",
10702
- "#00CC33",
10703
- "#00CC66",
10704
- "#00CC99",
10705
- "#00CCCC",
10706
- "#00CCFF",
10707
- "#3300CC",
10708
- "#3300FF",
10709
- "#3333CC",
10710
- "#3333FF",
10711
- "#3366CC",
10712
- "#3366FF",
10713
- "#3399CC",
10714
- "#3399FF",
10715
- "#33CC00",
10716
- "#33CC33",
10717
- "#33CC66",
10718
- "#33CC99",
10719
- "#33CCCC",
10720
- "#33CCFF",
10721
- "#6600CC",
10722
- "#6600FF",
10723
- "#6633CC",
10724
- "#6633FF",
10725
- "#66CC00",
10726
- "#66CC33",
10727
- "#9900CC",
10728
- "#9900FF",
10729
- "#9933CC",
10730
- "#9933FF",
10731
- "#99CC00",
10732
- "#99CC33",
10733
- "#CC0000",
10734
- "#CC0033",
10735
- "#CC0066",
10736
- "#CC0099",
10737
- "#CC00CC",
10738
- "#CC00FF",
10739
- "#CC3300",
10740
- "#CC3333",
10741
- "#CC3366",
10742
- "#CC3399",
10743
- "#CC33CC",
10744
- "#CC33FF",
10745
- "#CC6600",
10746
- "#CC6633",
10747
- "#CC9900",
10748
- "#CC9933",
10749
- "#CCCC00",
10750
- "#CCCC33",
10751
- "#FF0000",
10752
- "#FF0033",
10753
- "#FF0066",
10754
- "#FF0099",
10755
- "#FF00CC",
10756
- "#FF00FF",
10757
- "#FF3300",
10758
- "#FF3333",
10759
- "#FF3366",
10760
- "#FF3399",
10761
- "#FF33CC",
10762
- "#FF33FF",
10763
- "#FF6600",
10764
- "#FF6633",
10765
- "#FF9900",
10766
- "#FF9933",
10767
- "#FFCC00",
10768
- "#FFCC33"
10769
- ];
10770
- function useColors() {
10771
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
10772
- return true;
10773
- }
10774
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
10775
- return false;
10776
- }
10777
- let m;
10778
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
10779
- typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
10780
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
10781
- typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
10782
- typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
10783
- }
10784
- function formatArgs(args) {
10785
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
10786
- if (!this.useColors) {
10787
- return;
10788
- }
10789
- const c = "color: " + this.color;
10790
- args.splice(1, 0, c, "color: inherit");
10791
- let index = 0;
10792
- let lastC = 0;
10793
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
10794
- if (match === "%%") {
10795
- return;
10796
- }
10797
- index++;
10798
- if (match === "%c") {
10799
- lastC = index;
10800
- }
10801
- });
10802
- args.splice(lastC, 0, c);
10803
- }
10804
- exports.log = console.debug || console.log || (() => {
10805
- });
10806
- function save(namespaces) {
10807
- try {
10808
- if (namespaces) {
10809
- exports.storage.setItem("debug", namespaces);
10810
- } else {
10811
- exports.storage.removeItem("debug");
10812
- }
10813
- } catch (error) {
10814
- }
10815
- }
10816
- function load2() {
10817
- let r;
10818
- try {
10819
- r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
10820
- } catch (error) {
10821
- }
10822
- if (!r && typeof process !== "undefined" && "env" in process) {
10823
- r = process.env.DEBUG;
10824
- }
10825
- return r;
10826
- }
10827
- function localstorage() {
10828
- try {
10829
- return localStorage;
10830
- } catch (error) {
10831
- }
10832
- }
10833
- module.exports = require_common()(exports);
10834
- var { formatters } = module.exports;
10835
- formatters.j = function(v) {
10836
- try {
10837
- return JSON.stringify(v);
10838
- } catch (error) {
10839
- return "[UnexpectedJSONParseError]: " + error.message;
10840
- }
10841
- };
10842
- }
10843
- });
10844
-
10845
- // node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js
10846
- var require_has_flag = __commonJS({
10847
- "node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module) {
10848
- "use strict";
10849
- module.exports = (flag, argv = process.argv) => {
10850
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
10851
- const position = argv.indexOf(prefix + flag);
10852
- const terminatorPosition = argv.indexOf("--");
10853
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
10854
- };
10855
- }
10856
- });
10857
-
10858
- // node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js
10859
- var require_supports_color = __commonJS({
10860
- "node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module) {
10861
- "use strict";
10862
- var os2 = __require("os");
10863
- var tty = __require("tty");
10864
- var hasFlag = require_has_flag();
10865
- var { env } = process;
10866
- var forceColor;
10867
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
10868
- forceColor = 0;
10869
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
10870
- forceColor = 1;
10871
- }
10872
- if ("FORCE_COLOR" in env) {
10873
- if (env.FORCE_COLOR === "true") {
10874
- forceColor = 1;
10875
- } else if (env.FORCE_COLOR === "false") {
10876
- forceColor = 0;
10877
- } else {
10878
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
10879
- }
10880
- }
10881
- function translateLevel(level) {
10882
- if (level === 0) {
10883
- return false;
10884
- }
10885
- return {
10886
- level,
10887
- hasBasic: true,
10888
- has256: level >= 2,
10889
- has16m: level >= 3
10890
- };
10891
- }
10892
- function supportsColor(haveStream, streamIsTTY) {
10893
- if (forceColor === 0) {
10894
- return 0;
10895
- }
10896
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
10897
- return 3;
10898
- }
10899
- if (hasFlag("color=256")) {
10900
- return 2;
10901
- }
10902
- if (haveStream && !streamIsTTY && forceColor === void 0) {
10903
- return 0;
10904
- }
10905
- const min = forceColor || 0;
10906
- if (env.TERM === "dumb") {
10907
- return min;
10908
- }
10909
- if (process.platform === "win32") {
10910
- const osRelease = os2.release().split(".");
10911
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
10912
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
10913
- }
10914
- return 1;
10915
- }
10916
- if ("CI" in env) {
10917
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
10918
- return 1;
10919
- }
10920
- return min;
10921
- }
10922
- if ("TEAMCITY_VERSION" in env) {
10923
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
10924
- }
10925
- if (env.COLORTERM === "truecolor") {
10926
- return 3;
10927
- }
10928
- if ("TERM_PROGRAM" in env) {
10929
- const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
10930
- switch (env.TERM_PROGRAM) {
10931
- case "iTerm.app":
10932
- return version >= 3 ? 3 : 2;
10933
- case "Apple_Terminal":
10934
- return 2;
10935
- }
10936
- }
10937
- if (/-256(color)?$/i.test(env.TERM)) {
10938
- return 2;
10939
- }
10940
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
10941
- return 1;
10942
- }
10943
- if ("COLORTERM" in env) {
10944
- return 1;
10945
- }
10946
- return min;
10947
- }
10948
- function getSupportLevel(stream) {
10949
- const level = supportsColor(stream, stream && stream.isTTY);
10950
- return translateLevel(level);
10951
- }
10952
- module.exports = {
10953
- supportsColor: getSupportLevel,
10954
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
10955
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
10956
- };
10957
- }
10958
- });
10959
-
10960
- // node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js
10961
- var require_node = __commonJS({
10962
- "node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js"(exports, module) {
10963
- var tty = __require("tty");
10964
- var util2 = __require("util");
10965
- exports.init = init;
10966
- exports.log = log;
10967
- exports.formatArgs = formatArgs;
10968
- exports.save = save;
10969
- exports.load = load2;
10970
- exports.useColors = useColors;
10971
- exports.destroy = util2.deprecate(
10972
- () => {
10973
- },
10974
- "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
10975
- );
10976
- exports.colors = [6, 2, 3, 4, 5, 1];
10977
- try {
10978
- const supportsColor = require_supports_color();
10979
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
10980
- exports.colors = [
10981
- 20,
10982
- 21,
10983
- 26,
10984
- 27,
10985
- 32,
10986
- 33,
10987
- 38,
10988
- 39,
10989
- 40,
10990
- 41,
10991
- 42,
10992
- 43,
10993
- 44,
10994
- 45,
10995
- 56,
10996
- 57,
10997
- 62,
10998
- 63,
10999
- 68,
11000
- 69,
11001
- 74,
11002
- 75,
11003
- 76,
11004
- 77,
11005
- 78,
11006
- 79,
11007
- 80,
11008
- 81,
11009
- 92,
11010
- 93,
11011
- 98,
11012
- 99,
11013
- 112,
11014
- 113,
11015
- 128,
11016
- 129,
11017
- 134,
11018
- 135,
11019
- 148,
11020
- 149,
11021
- 160,
11022
- 161,
11023
- 162,
11024
- 163,
11025
- 164,
11026
- 165,
11027
- 166,
11028
- 167,
11029
- 168,
11030
- 169,
11031
- 170,
11032
- 171,
11033
- 172,
11034
- 173,
11035
- 178,
11036
- 179,
11037
- 184,
11038
- 185,
11039
- 196,
11040
- 197,
11041
- 198,
11042
- 199,
11043
- 200,
11044
- 201,
11045
- 202,
11046
- 203,
11047
- 204,
11048
- 205,
11049
- 206,
11050
- 207,
11051
- 208,
11052
- 209,
11053
- 214,
11054
- 215,
11055
- 220,
11056
- 221
11057
- ];
11058
- }
11059
- } catch (error) {
11060
- }
11061
- exports.inspectOpts = Object.keys(process.env).filter((key) => {
11062
- return /^debug_/i.test(key);
11063
- }).reduce((obj, key) => {
11064
- const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
11065
- return k.toUpperCase();
11066
- });
11067
- let val = process.env[key];
11068
- if (/^(yes|on|true|enabled)$/i.test(val)) {
11069
- val = true;
11070
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
11071
- val = false;
11072
- } else if (val === "null") {
11073
- val = null;
11074
- } else {
11075
- val = Number(val);
11076
- }
11077
- obj[prop] = val;
11078
- return obj;
11079
- }, {});
11080
- function useColors() {
11081
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
11082
- }
11083
- function formatArgs(args) {
11084
- const { namespace: name, useColors: useColors2 } = this;
11085
- if (useColors2) {
11086
- const c = this.color;
11087
- const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
11088
- const prefix = ` ${colorCode};1m${name} \x1B[0m`;
11089
- args[0] = prefix + args[0].split("\n").join("\n" + prefix);
11090
- args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
11091
- } else {
11092
- args[0] = getDate() + name + " " + args[0];
11093
- }
11094
- }
11095
- function getDate() {
11096
- if (exports.inspectOpts.hideDate) {
11097
- return "";
11098
- }
11099
- return (/* @__PURE__ */ new Date()).toISOString() + " ";
11100
- }
11101
- function log(...args) {
11102
- return process.stderr.write(util2.formatWithOptions(exports.inspectOpts, ...args) + "\n");
11103
- }
11104
- function save(namespaces) {
11105
- if (namespaces) {
11106
- process.env.DEBUG = namespaces;
11107
- } else {
11108
- delete process.env.DEBUG;
11109
- }
11110
- }
11111
- function load2() {
11112
- return process.env.DEBUG;
11113
- }
11114
- function init(debug) {
11115
- debug.inspectOpts = {};
11116
- const keys = Object.keys(exports.inspectOpts);
11117
- for (let i = 0; i < keys.length; i++) {
11118
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
11119
- }
11120
- }
11121
- module.exports = require_common()(exports);
11122
- var { formatters } = module.exports;
11123
- formatters.o = function(v) {
11124
- this.inspectOpts.colors = this.useColors;
11125
- return util2.inspect(v, this.inspectOpts).split("\n").map((str2) => str2.trim()).join(" ");
11126
- };
11127
- formatters.O = function(v) {
11128
- this.inspectOpts.colors = this.useColors;
11129
- return util2.inspect(v, this.inspectOpts);
11130
- };
11131
- }
11132
- });
11133
-
11134
- // node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js
11135
- var require_src = __commonJS({
11136
- "node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js"(exports, module) {
11137
- if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
11138
- module.exports = require_browser();
11139
- } else {
11140
- module.exports = require_node();
11141
- }
11142
- }
11143
- });
11144
-
11145
10382
  // node_modules/.pnpm/follow-redirects@1.16.0/node_modules/follow-redirects/debug.js
11146
10383
  var require_debug = __commonJS({
11147
10384
  "node_modules/.pnpm/follow-redirects@1.16.0/node_modules/follow-redirects/debug.js"(exports, module) {
@@ -11149,7 +10386,7 @@ var require_debug = __commonJS({
11149
10386
  module.exports = function() {
11150
10387
  if (!debug) {
11151
10388
  try {
11152
- debug = require_src()("follow-redirects");
10389
+ debug = __require("debug")("follow-redirects");
11153
10390
  } catch (error) {
11154
10391
  }
11155
10392
  if (typeof debug !== "function") {
@@ -119069,6 +118306,84 @@ function renderPrompt(input) {
119069
118306
  ].join("\n");
119070
118307
  }
119071
118308
 
118309
+ // src/lark/rosterResolver.ts
118310
+ import { execFile as execFile2 } from "node:child_process";
118311
+ function parseBotRoster(stdout) {
118312
+ const roster = /* @__PURE__ */ new Map();
118313
+ let json2;
118314
+ try {
118315
+ json2 = JSON.parse(stdout);
118316
+ } catch {
118317
+ return roster;
118318
+ }
118319
+ const items = json2?.data?.items;
118320
+ if (!Array.isArray(items)) return roster;
118321
+ for (const item of items) {
118322
+ if (typeof item !== "object" || item === null) continue;
118323
+ const record = item;
118324
+ const name = record["bot_name"];
118325
+ const id = record["bot_id"];
118326
+ if (typeof name === "string" && name && typeof id === "string" && id) {
118327
+ roster.set(name, id);
118328
+ }
118329
+ }
118330
+ return roster;
118331
+ }
118332
+ function remapPeersToLiveRoster(peers, liveRoster) {
118333
+ const remapped = [];
118334
+ const unresolved = [];
118335
+ const out = peers.map((peer) => {
118336
+ const liveId = liveRoster.get(peer.name);
118337
+ if (!liveId) {
118338
+ unresolved.push(peer.name);
118339
+ return peer;
118340
+ }
118341
+ if (liveId !== peer.id) {
118342
+ remapped.push(peer.name);
118343
+ return { ...peer, id: liveId };
118344
+ }
118345
+ return peer;
118346
+ });
118347
+ return { peers: out, remapped, unresolved };
118348
+ }
118349
+ async function resolveChatBotRoster(chatId, opts = {}) {
118350
+ const cli = opts.larkCliPath ?? "lark-cli";
118351
+ const args = ["im", "chat.members", "bots", "--chat-id", chatId, "--as", "bot"];
118352
+ if (opts.profile) args.push("--profile", opts.profile);
118353
+ const exec = opts.exec ?? defaultExec(opts.timeoutMs ?? 1e4);
118354
+ try {
118355
+ const stdout = await exec(cli, args);
118356
+ const roster = parseBotRoster(stdout);
118357
+ return roster.size > 0 ? roster : null;
118358
+ } catch {
118359
+ return null;
118360
+ }
118361
+ }
118362
+ function defaultExec(timeoutMs) {
118363
+ return (cmd, args) => new Promise((resolve2, reject) => {
118364
+ execFile2(cmd, args, { timeout: timeoutMs, maxBuffer: 1024 * 1024 }, (err, stdout) => {
118365
+ if (err) reject(err);
118366
+ else resolve2(stdout);
118367
+ });
118368
+ });
118369
+ }
118370
+ function createCachedRosterResolver(opts) {
118371
+ const ttlMs = opts.ttlMs ?? 5 * 60 * 1e3;
118372
+ const now = opts.now ?? (() => Date.now());
118373
+ const cache = /* @__PURE__ */ new Map();
118374
+ return async (chatId) => {
118375
+ const hit = cache.get(chatId);
118376
+ if (hit && now() - hit.at < ttlMs) return hit.roster;
118377
+ const roster = await resolveChatBotRoster(chatId, {
118378
+ profile: opts.profile,
118379
+ larkCliPath: opts.larkCliPath,
118380
+ exec: opts.exec
118381
+ });
118382
+ cache.set(chatId, { roster, at: now() });
118383
+ return roster;
118384
+ };
118385
+ }
118386
+
119072
118387
  // src/agent/runner.ts
119073
118388
  var _registry = /* @__PURE__ */ new Map();
119074
118389
  function registerRunner(backend, factory) {
@@ -120723,6 +120038,7 @@ function derivePostIdempotencyKey(input) {
120723
120038
 
120724
120039
  // src/bridge/handler.ts
120725
120040
  var DEFAULT_CARDKIT_RESPONSE_SURFACE_TIMEOUT_MS = 20 * 60 * 1e3;
120041
+ var DEFAULT_CARDKIT_IDLE_TIMEOUT_MS = 3 * 60 * 1e3;
120726
120042
  function summarizeMentionPolicyRules(rules) {
120727
120043
  const counts = /* @__PURE__ */ new Map();
120728
120044
  for (const rule of rules) {
@@ -120894,7 +120210,7 @@ async function ensureNodeModules(worktreePath) {
120894
120210
  if (await pathExists(modulesMarker)) return;
120895
120211
  const start = Date.now();
120896
120212
  try {
120897
- await execFile2(
120213
+ await execFile3(
120898
120214
  "pnpm",
120899
120215
  ["install", "--offline", "--frozen-lockfile"],
120900
120216
  { cwd: monorepDir, timeoutMs: 18e4 }
@@ -120908,7 +120224,7 @@ async function ensureNodeModules(worktreePath) {
120908
120224
  `[bridge.handler] --offline install failed (will fall back to network): ${offlineErr.message.slice(0, 200)}`
120909
120225
  );
120910
120226
  }
120911
- await execFile2(
120227
+ await execFile3(
120912
120228
  "pnpm",
120913
120229
  ["install", "--frozen-lockfile"],
120914
120230
  { cwd: monorepDir, timeoutMs: 6e5 }
@@ -120917,7 +120233,7 @@ async function ensureNodeModules(worktreePath) {
120917
120233
  `[bridge.handler] pnpm install (network) ok (${((Date.now() - start) / 1e3).toFixed(1)}s) in ${monorepDir}`
120918
120234
  );
120919
120235
  }
120920
- function execFile2(cmd, args, opts) {
120236
+ function execFile3(cmd, args, opts) {
120921
120237
  return new Promise((resolve2, reject) => {
120922
120238
  const child = child_process.spawn(cmd, args, {
120923
120239
  cwd: opts.cwd,
@@ -120985,9 +120301,30 @@ async function createOnlyPostFallback(opts) {
120985
120301
  var BridgeHandler = class {
120986
120302
  deps;
120987
120303
  closed = false;
120304
+ /**
120305
+ * In-flight per-turn completion promises. run() dispatches handleOne
120306
+ * fire-and-forget (thread-serialized), so run() returning does NOT mean the
120307
+ * turn finished. Each entry resolves only when its handleOne AND all trailing
120308
+ * work (terminal render + ledger writes, incl. the failure-path fallback that
120309
+ * runs after the early settle) have completed. {@link whenAllTurnsSettled}
120310
+ * awaits these — the real turn boundary tests must sync assertions/cleanup on.
120311
+ */
120312
+ inFlightTurns = /* @__PURE__ */ new Set();
120988
120313
  constructor(deps) {
120989
120314
  this.deps = deps;
120990
120315
  }
120316
+ /**
120317
+ * Resolves when every dispatched turn has fully completed (handleOne returned
120318
+ * and its trailing render/ledger I/O drained). Test-facing sync point; a bridge
120319
+ * that keeps receiving events would keep finding work, so callers use this
120320
+ * after the event source is exhausted (e.g. right after `await run()` in a
120321
+ * single-message test).
120322
+ */
120323
+ async whenAllTurnsSettled() {
120324
+ while (this.inFlightTurns.size > 0) {
120325
+ await Promise.all([...this.inFlightTurns]);
120326
+ }
120327
+ }
120991
120328
  runtimeWarnings() {
120992
120329
  return (this.deps.runtimeRequirements ?? []).filter(
120993
120330
  (req) => !req.ok && (req.severity === "required" || req.kind === "secret")
@@ -121038,7 +120375,9 @@ var BridgeHandler = class {
121038
120375
  }).finally(() => {
121039
120376
  release();
121040
120377
  if (threadQueues.get(key) === next) threadQueues.delete(key);
120378
+ this.inFlightTurns.delete(next);
121041
120379
  });
120380
+ this.inFlightTurns.add(next);
121042
120381
  threadQueues.set(key, next);
121043
120382
  }
121044
120383
  }
@@ -121421,6 +120760,34 @@ var BridgeHandler = class {
121421
120760
  while (true) {
121422
120761
  attempt++;
121423
120762
  const currentIsNewThread = currentExisting === void 0;
120763
+ let effectivePeers = this.deps.peers;
120764
+ if (effectivePeers?.length && this.deps.resolveLiveRoster) {
120765
+ try {
120766
+ const liveRoster = await this.deps.resolveLiveRoster(parsed.chatId);
120767
+ if (liveRoster) {
120768
+ const { peers: remappedPeers, remapped, unresolved } = remapPeersToLiveRoster(
120769
+ effectivePeers,
120770
+ liveRoster
120771
+ );
120772
+ effectivePeers = remappedPeers;
120773
+ if (remapped.length > 0 || unresolved.length > 0) {
120774
+ await recordEvent({
120775
+ status: "running",
120776
+ appendPath: "peer roster",
120777
+ reason: `live-roster resolve: remapped [${remapped.join(", ") || "none"}] to same-app-scope open_id; unresolved (kept static config id, may not be deliverable) [${unresolved.join(", ") || "none"}].`
120778
+ });
120779
+ }
120780
+ } else {
120781
+ await recordEvent({
120782
+ status: "running",
120783
+ appendPath: "peer roster",
120784
+ reason: "live-roster resolve returned nothing; kept static <peer-bots> open_ids (may be cross-app-scope / undeliverable)."
120785
+ });
120786
+ }
120787
+ } catch (err) {
120788
+ console.warn("[bridge.handler] live-roster resolve failed (using static peers):", err);
120789
+ }
120790
+ }
121424
120791
  const prompt = renderPrompt({
121425
120792
  parsed,
121426
120793
  isNewThread: currentIsNewThread,
@@ -121442,7 +120809,7 @@ var BridgeHandler = class {
121442
120809
  readOnly: conventions.readOnly,
121443
120810
  gitlabTokenEnvName: conventions.gitlabTokenEnvName
121444
120811
  },
121445
- peers: this.deps.peers,
120812
+ peers: effectivePeers,
121446
120813
  turn_taking_limit: this.deps.botConfig?.turn_taking_limit,
121447
120814
  botName: this.deps.botConfig?.name,
121448
120815
  backend: this.deps.botConfig?.backend,
@@ -121453,10 +120820,8 @@ var BridgeHandler = class {
121453
120820
  const backend = this.deps.botConfig?.backend ?? "claude";
121454
120821
  const permissionMode = this.deps.permissionMode ?? "bypassPermissions";
121455
120822
  const baseTimeoutMs = this.deps.subprocessTimeoutMs ?? 60 * 60 * 1e3;
121456
- const timeoutMs = cardKitProgress ? Math.min(
121457
- baseTimeoutMs,
121458
- this.deps.responseSurfaceTimeoutMs ?? DEFAULT_CARDKIT_RESPONSE_SURFACE_TIMEOUT_MS
121459
- ) : baseTimeoutMs;
120823
+ const timeoutMs = baseTimeoutMs;
120824
+ const idleTimeoutMs = this.deps.responseSurfaceIdleTimeoutMs ?? DEFAULT_CARDKIT_IDLE_TIMEOUT_MS;
121460
120825
  const runnerStartedAt = Date.now();
121461
120826
  const handle = createRunner(backend).run({
121462
120827
  prompt,
@@ -121468,6 +120833,24 @@ var BridgeHandler = class {
121468
120833
  botGitIdentity: this.deps.botConfig?.git_identity,
121469
120834
  gitlabToken: this.deps.gitlabToken
121470
120835
  });
120836
+ let lastActivityAt = Date.now();
120837
+ let interruptedByIdle = false;
120838
+ let idleWatchdog;
120839
+ if (cardKitProgress) {
120840
+ const cadenceMs = Math.max(50, Math.min(Math.floor(idleTimeoutMs / 4), 15e3));
120841
+ idleWatchdog = setInterval(() => {
120842
+ if (Date.now() - lastActivityAt >= idleTimeoutMs) {
120843
+ interruptedByIdle = true;
120844
+ if (idleWatchdog) clearInterval(idleWatchdog);
120845
+ idleWatchdog = void 0;
120846
+ try {
120847
+ handle.kill();
120848
+ } catch {
120849
+ }
120850
+ }
120851
+ }, cadenceMs);
120852
+ idleWatchdog.unref?.();
120853
+ }
121471
120854
  if (isAgentWorkspace && handle.pid != null) {
121472
120855
  const sessionPidFile = path9.join(worktreePath, ".larkway", "runner.pid");
121473
120856
  void fs6.mkdir(path9.dirname(sessionPidFile), { recursive: true }).then(
@@ -121479,6 +120862,7 @@ var BridgeHandler = class {
121479
120862
  let trustedAnswerText = "";
121480
120863
  try {
121481
120864
  for await (const ev of handle.events) {
120865
+ lastActivityAt = Date.now();
121482
120866
  if (cardKitProgress) cardKitProgress.handle(ev);
121483
120867
  else if (card) card.handle(ev);
121484
120868
  if (ev.type === "system_init") {
@@ -121491,7 +120875,11 @@ var BridgeHandler = class {
121491
120875
  }
121492
120876
  }
121493
120877
  const result = await handle.done;
121494
- const cardKitTurnTimedOut = cardKitProgress != null && result.exitCode !== 0 && Date.now() - runnerStartedAt >= timeoutMs;
120878
+ if (idleWatchdog) {
120879
+ clearInterval(idleWatchdog);
120880
+ idleWatchdog = void 0;
120881
+ }
120882
+ const cardKitTurnTimedOut = cardKitProgress != null && interruptedByIdle;
121495
120883
  const reportedStateRead = await readStateFileDetailed(worktreePath);
121496
120884
  const rawReportedState = reportedStateRead.state;
121497
120885
  const reportedState = rawReportedState?.updated_at != null && rawReportedState.updated_at !== preRunUpdatedAt ? rawReportedState : null;
@@ -121546,10 +120934,10 @@ var BridgeHandler = class {
121546
120934
  success = true;
121547
120935
  } else if (cardKitTimeoutFailure) {
121548
120936
  success = false;
121549
- failureReason = `agent turn timed out after ${timeoutMs}ms; CardKit running card was finalized as interrupted`;
120937
+ failureReason = `agent turn idle for ${idleTimeoutMs}ms with no activity (treated as stuck); run interrupted`;
121550
120938
  await recordEvent({
121551
120939
  status: "running",
121552
- appendPath: "Agent \u8D85\u65F6",
120940
+ appendPath: "Agent \u5361\u6B7B\u4E2D\u65AD",
121553
120941
  reason: failureReason
121554
120942
  });
121555
120943
  } else if (result.exitCode === 0) {
@@ -121564,7 +120952,7 @@ var BridgeHandler = class {
121564
120952
  });
121565
120953
  }
121566
120954
  const fallbackAnswer = trustedAnswerText.trim() || cardKitProgress?.answerText.trim() || "";
121567
- const cardBody = cardKitTimeoutFailure ? "\u26A0\uFE0F \u672C\u8F6E\u5904\u7406\u8D85\u65F6\uFF0C\u5DF2\u4E2D\u65AD\u3002\u8BF7\u518D @ \u6211\u4E00\u6B21\u91CD\u8BD5\u3002" : reportedState?.last_message ?? (fallbackAnswer ? fallbackAnswer : "\u26A0\uFE0F \u672C\u8F6E\u6CA1\u6709\u62FF\u5230 agent \u7684\u65B0\u56DE\u590D(\u53EF\u80FD\u88AB\u4E2D\u65AD\u6216\u672A\u66F4\u65B0\u72B6\u6001),\u518D @ \u6211\u4E00\u6B21\u91CD\u8BD5\u3002");
120955
+ const cardBody = cardKitTimeoutFailure ? "\u26A0\uFE0F \u672C\u8F6E\u88AB\u4E2D\u65AD\uFF08\u957F\u65F6\u95F4\u65E0\u6D3B\u6027\uFF0C\u5224\u5B9A\u5361\u6B7B\uFF09\uFF0C\u672A\u5B8C\u6210\u3002\u8BF7\u91CD\u8BD5\u3002" : reportedState?.last_message ?? (fallbackAnswer ? fallbackAnswer : "\u26A0\uFE0F \u672C\u8F6E\u6CA1\u6709\u62FF\u5230 agent \u7684\u65B0\u56DE\u590D(\u53EF\u80FD\u88AB\u4E2D\u65AD\u6216\u672A\u66F4\u65B0\u72B6\u6001),\u518D @ \u6211\u4E00\u6B21\u91CD\u8BD5\u3002");
121568
120956
  const noReportThisTurn = reportedState === null;
121569
120957
  const neutralTitle = noReportThisTurn && success && !failureReason ? "\u{1F4AC} \u5DF2\u56DE\u590D" : void 0;
121570
120958
  const baseCardPayload = {
@@ -125423,17 +124811,18 @@ function selectOrphanCards(entries, opts) {
125423
124811
  }
125424
124812
  return out;
125425
124813
  }
124814
+ var INTERRUPTED_TURN_TEXT = "\u26A0\uFE0F \u672C\u8F6E\u5728\u5904\u7406\u4E2D\u88AB bridge \u91CD\u542F\u4E2D\u65AD\uFF0C\u672A\u5B8C\u6210\u3002\u8BF7\u91CD\u8BD5(\u91CD\u65B0\u53D1\u8D77\u672C\u8F6E)\u3002";
125426
124815
  function mapFinalizeArgs(state, success, stateFresh = true) {
125427
124816
  if (!stateFresh) {
125428
124817
  return {
125429
- finalText: "\u26A0\uFE0F \u672C\u8F6E\u5728\u5904\u7406\u4E2D\u88AB bridge \u91CD\u542F\u4E2D\u65AD\uFF0C\u672A\u62FF\u5230 agent \u7684\u65B0\u56DE\u590D\u3002\u8BF7\u518D @ \u6211\u4E00\u6B21\u7EE7\u7EED\u3002",
124818
+ finalText: INTERRUPTED_TURN_TEXT,
125430
124819
  success: false,
125431
124820
  failureReason: "bridge \u91CD\u542F\u540E\u53D1\u73B0\u65E7 state.json \u65E9\u4E8E\u672C\u8F6E\u5361\u7247\uFF0C\u5DF2\u963B\u6B62\u65E7\u56DE\u590D\u8986\u76D6\u65B0\u95EE\u9898",
125432
124821
  titleOverride: "\u26A0\uFE0F \u672C\u8F6E\u88AB\u4E2D\u65AD",
125433
124822
  colorOverride: "failure"
125434
124823
  };
125435
124824
  }
125436
- const finalText = state.last_message ?? "\u26A0\uFE0F \u672C\u8F6E\u5728\u5904\u7406\u4E2D\u88AB\u4E2D\u65AD(bridge \u91CD\u542F),\u72B6\u6001\u5DF2\u636E state.json \u6536\u5C3E\u3002\u518D @ \u6211\u4E00\u6B21\u53EF\u7EE7\u7EED\u3002";
124825
+ const finalText = state.last_message ?? INTERRUPTED_TURN_TEXT;
125437
124826
  const failureReason = success ? void 0 : state.error ?? "bridge \u91CD\u542F\u65F6\u8BE5\u8F6E\u672A\u6B63\u5E38\u6536\u5C3E(reconcile \u515C\u5E95)";
125438
124827
  return {
125439
124828
  finalText,
@@ -125450,7 +124839,7 @@ function mapFinalizeArgs(state, success, stateFresh = true) {
125450
124839
  function mapCardKitFinalizeArgs(state, success, stateFresh = true) {
125451
124840
  const args = mapFinalizeArgs(state, success, stateFresh);
125452
124841
  return {
125453
- finalText: args.finalText ?? "\u26A0\uFE0F \u672C\u8F6E\u5728\u5904\u7406\u4E2D\u88AB bridge \u91CD\u542F\u4E2D\u65AD\uFF0C\u672A\u62FF\u5230 agent \u7684\u65B0\u56DE\u590D\u3002",
124842
+ finalText: args.finalText ?? INTERRUPTED_TURN_TEXT,
125454
124843
  ...args.titleOverride !== void 0 ? { title: args.titleOverride } : {},
125455
124844
  ...args.choices !== void 0 ? { choices: args.choices } : {},
125456
124845
  ...args.choicePrompt !== void 0 ? { choicePrompt: args.choicePrompt } : {},
@@ -127037,6 +126426,9 @@ async function runV2Mode({
127037
126426
  gitlabToken: effectiveGitlabToken,
127038
126427
  agentMemory: bot.agent_memory,
127039
126428
  larkCliProfile,
126429
+ // PRB-6/§11.3: resolve peer @ targets to same-app-scope open_ids from the
126430
+ // live chat roster (per-chat cached), only when this bot actually has peers.
126431
+ resolveLiveRoster: resolvedPeers.length > 0 ? createCachedRosterResolver({ profile: larkCliProfile }) : void 0,
127040
126432
  runtimeRequirements: runtimeRequirementsForBots([bot]),
127041
126433
  recordRuntimeEvent: async (patch) => {
127042
126434
  await upsertRuntimeEvent(larkwayHome(), bot.id, patch);