larkway 0.3.29 → 0.3.31

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") {
@@ -118687,7 +117924,7 @@ function renderStateContract(stateFilePath) {
118687
117924
  "- card_title/card_color: \u517C\u5BB9\u5B57\u6BB5; \u9ED8\u8BA4 CardKit \u4E0D\u6E32\u67D3\u9876\u90E8\u6807\u9898\u8272\u6761,legacy/fallback \u5361\u7247\u8DEF\u5F84\u53EF\u80FD\u4F7F\u7528",
118688
117925
  "- image_blocks: \u53EF\u9009\u56FE\u7247\u9884\u89C8\u5757\u6570\u7EC4,\u6700\u591A 4 \u4E2A\u3002\u6BCF\u9879 `{img_key, alt?, title?, mode?, preview?}`; `img_key` \u5FC5\u987B\u662F\u5DF2\u4E0A\u4F20/\u53EF\u7528\u4E8E\u5361\u7247\u7684 Feishu \u56FE\u7247 key,`alt` \u7701\u7565\u65F6 bridge \u9ED8\u8BA4\u201C\u56FE\u7247\u9884\u89C8\u201D,`mode` \u53EA\u5141\u8BB8 `crop_center`/`fit_horizontal` \u5E76\u6620\u5C04\u5230 Card JSON 2.0 `scale_type`,`preview` \u9ED8\u8BA4 true\u3002bridge \u4E0D\u8D1F\u8D23\u4E0B\u8F7D/\u4E0A\u4F20/\u9009\u62E9\u56FE\u7247;\u8FD9\u4E9B\u7531\u4F60\u7528 lark-cli \u7B49\u5DE5\u5177\u5148\u5B8C\u6210\u3002",
118689
117926
  '- content_blocks: \u53EF\u9009\u6709\u5E8F\u6B63\u6587\u5757\u6570\u7EC4,\u6700\u591A 12 \u4E2A block\u3001\u6700\u591A 4 \u4E2A image block\u3002\u53EA\u652F\u6301\u7A84 union:`{type:"markdown", content}` \u548C `{type:"image", img_key, alt?, title?, mode?, preview?}`;\u4E0D\u652F\u6301 raw card JSON\u3002\u7528\u4E8E\u6B63\u6587\u4E0E\u56FE\u7247\u4EA4\u9519\u6392\u7248,\u4F8B\u5982 markdown -> image -> markdown -> image\u3002\u82E5 `content_blocks` \u975E\u7A7A,bridge \u4EE5\u5B83\u4F5C\u4E3A\u4E3B\u6B63\u6587\u5E76\u5FFD\u7565 `last_message` + `image_blocks` \u7684\u6B63\u6587\u6E32\u67D3,\u907F\u514D\u91CD\u590D;\u82E5\u7701\u7565\u5219\u4FDD\u6301\u65E7 `last_message` + `image_blocks` \u884C\u4E3A\u3002',
118690
- "- response_surface: \u53EF\u9009\u8986\u76D6\u5B57\u6BB5,\u4E3B\u8981\u7528\u4E8E `{post:{mentions:[{user_id,label?}]}}` late peer @\u3002\u9ED8\u8BA4\u53EF\u4E0D\u5199;bridge \u6309 CardKit \u6D41\u5F0F\u5361\u7247\u5904\u7406,\u6700\u7EC8\u6536\u6210\u5E72\u51C0\u603B\u7ED3\u5361\u3002\u65E7 `mode`/`primary` \u4EC5\u517C\u5BB9\u89E3\u6790,\u4E0D\u518D\u9009\u62E9 post-only/hybrid \u4E3B\u54CD\u5E94\u9762\u3002\u9700\u8981\u771F\u5B9E @ \u65F6\u628A\u76EE\u6807\u5199\u5165 `post.mentions`;\u4E0D\u8981\u5199 raw Feishu post/card JSON\u3002",
117927
+ "- response_surface: \u53EF\u9009\u8986\u76D6\u5B57\u6BB5,\u4E3B\u8981\u7528\u4E8E `{post:{mentions:[{user_id,label?}]}}` late peer @\u3002\u9ED8\u8BA4\u53EF\u4E0D\u5199;bridge \u6309 CardKit \u6D41\u5F0F\u5361\u7247\u5904\u7406,\u6700\u7EC8\u6536\u6210\u5E72\u51C0\u603B\u7ED3\u5361\u3002\u65E7 `mode`/`primary` \u4EC5\u517C\u5BB9\u89E3\u6790,\u4E0D\u518D\u9009\u62E9 post-only/hybrid \u4E3B\u54CD\u5E94\u9762\u3002\u8FD9\u91CC\u7684 late @ \u53EA\u662F\u6700\u7EC8\u5361\u7247\u91CC\u7684\u89C6\u89C9\u63D0\u793A;\u9700\u8981 peer bot \u6D88\u8D39\u6B63\u6587\u7684 handoff \u5FC5\u987B\u7531 Agent/\u56E2\u961F\u5DE5\u4F5C\u6D41\u53D1\u9001\u771F\u5B9E Feishu post + at \u6807\u7B7E\u3002\u4E0D\u8981\u5199 raw Feishu post/card JSON\u3002",
118691
117928
  "- scheduled reply / daily social ops review card \u7B49\u9700\u8981\u201C\u5E73\u53F0\u6B63\u6587 + \u5339\u914D\u56FE\u7247\u201D\u540C\u6BB5\u76F8\u90BB\u5C55\u793A\u7684\u573A\u666F,\u5E94\u5148\u53D6\u5F97\u5404\u56FE\u7247 `img_key`,\u518D\u5199 `content_blocks` \u4E3A `\u5E73\u53F0 markdown -> \u5BF9\u5E94 image -> \u4E0B\u4E2A\u5E73\u53F0 markdown -> \u5BF9\u5E94 image`;\u4E0D\u8981\u7528\u5355\u72EC\u8BDD\u9898\u56FE\u7247\u6D88\u606F\u6216\u5C3E\u90E8 `image_blocks` \u4EE3\u66FF\u9A8C\u6536\u9762\u3002",
118692
117929
  "- dev_url / mr_url / \u5176\u4F59\u4E1A\u52A1\u5B57\u6BB5:\u81EA\u7531\u5199\u5165,bridge \u4E0D\u611F\u77E5\u5176\u4E1A\u52A1\u542B\u4E49;\u8981\u8BA9\u8FD0\u8425\u770B\u5230,\u8BF7\u5199\u8FDB last_message",
118693
117930
  "- updated_at: ISO 8601 timestamp",
@@ -118738,6 +117975,9 @@ function renderPeersBlock(peers) {
118738
117975
  "- \u4E0D\u8981\u628A\u540C\u4E00\u4EFB\u52A1\u540C\u65F6\u8F6C\u53D1\u7ED9\u591A\u4E2A peer",
118739
117976
  '- @ peer \u5FC5\u987B\u7528 **post \u6D88\u606F** + at \u6807\u7B7E `{"tag":"at","user_id":"ou_xxx"}`(\u7528\u4E0A\u9762\u7684 open_id),',
118740
117977
  " **\u4E25\u7981\u7528\u7EAF text \u7684 @xxx**(\u7EAF\u6587\u672C @ \u4E0D\u4F1A\u771F\u6B63\u89E6\u8FBE\u5BF9\u65B9 bot)",
117978
+ "- \u53D1\u8D77 peer handoff \u540E,\u5728\u4F60\u7684\u534F\u8C03\u5C42/\u5DE5\u4F5C\u533A\u53F0\u8D26\u8BB0\u5F55 task_id\u3001assignee\u3001\u6765\u6E90\u3001\u671F\u671B\u4EA7\u51FA\u3001deadline \u548C\u5347\u7EA7\u4EBA;\u6CA1\u6709\u4E13\u7528 skill \u65F6\u81F3\u5C11\u5199\u5165\u672C session summary\u3002",
117979
+ "- \u6536\u5230 peer handoff \u540E,\u5148\u7528\u771F\u5B9E post \u8F7B\u91CF ack(\u6536\u5230/\u5F00\u59CB)\u518D\u505A\u957F\u4EFB\u52A1;\u5B8C\u6210\u3001\u5931\u8D25\u6216\u963B\u585E\u65F6\u5FC5\u987B\u7528\u771F\u5B9E post \u56DE\u62A5\u7EC8\u6001,\u4E0D\u8981\u8BA9\u94FE\u8DEF\u9759\u9ED8\u505C\u5728\u4F60\u8FD9\u91CC\u3002",
117980
+ "- \u9ED8\u8BA4 deadline \u53EF\u6309\u56E2\u961F\u5DE5\u4F5C\u6D41\u8BBE\u7F6E(\u5E38\u89C1\u9ED8\u8BA4 15 \u5206\u949F);\u8D85\u65F6\u68C0\u6D4B\u3001\u91CD\u8BD5/\u91CD\u6D3E/\u5347\u7EA7\u5C5E\u4E8E\u534F\u8C03\u5C42 skill/workspace \u903B\u8F91,\u4E0D\u8981\u671F\u5F85 bridge \u66FF\u4F60\u7F16\u6392\u3002",
118741
117981
  "</peer-bots>"
118742
117982
  ];
118743
117983
  }
@@ -119494,6 +118734,9 @@ import path6 from "node:path";
119494
118734
 
119495
118735
  // src/responseSurface.ts
119496
118736
  var NonEmptyString = external_exports.string().trim().min(1);
118737
+ var CardKitMentionUserIdSchema = NonEmptyString.max(128).regex(/^[A-Za-z0-9_:-]+$/, {
118738
+ message: "mention user_id must contain only letters, numbers, underscore, colon, or hyphen"
118739
+ });
119497
118740
  function defaultResponseSurfacePrototypeConfig() {
119498
118741
  return {
119499
118742
  enabled: true,
@@ -119503,6 +118746,7 @@ function defaultResponseSurfacePrototypeConfig() {
119503
118746
  post_outbound_enabled: true,
119504
118747
  cardkit_streaming_enabled: true,
119505
118748
  allow_agent_mentions: true,
118749
+ denied_mention_open_ids: [],
119506
118750
  allowed_mention_open_ids: []
119507
118751
  };
119508
118752
  }
@@ -119515,6 +118759,7 @@ var responseSurfacePrototypeConfigDefaults = () => ({
119515
118759
  post_outbound_enabled: true,
119516
118760
  cardkit_streaming_enabled: true,
119517
118761
  allow_agent_mentions: true,
118762
+ denied_mention_open_ids: [],
119518
118763
  allowed_mention_open_ids: []
119519
118764
  });
119520
118765
  var ResponseSurfaceModeSchema = external_exports.enum(["card", "post", "hybrid"]);
@@ -119527,7 +118772,7 @@ var ResponseSurfaceCapabilitySchema = external_exports.enum([
119527
118772
  "audit"
119528
118773
  ]);
119529
118774
  var MentionTargetSchema = external_exports.object({
119530
- user_id: NonEmptyString.max(128),
118775
+ user_id: CardKitMentionUserIdSchema,
119531
118776
  label: external_exports.string().trim().min(1).max(80).optional()
119532
118777
  });
119533
118778
  var ResponseSurfacePostSchema = external_exports.object({
@@ -119538,7 +118783,7 @@ var ResponseSurfaceCardSchema = external_exports.object({
119538
118783
  capabilities: external_exports.array(ResponseSurfaceCapabilitySchema).max(8).default([])
119539
118784
  });
119540
118785
  var StrictResponseSurfaceStateSchema = external_exports.object({
119541
- mode: ResponseSurfaceModeSchema,
118786
+ mode: ResponseSurfaceModeSchema.optional().default("card"),
119542
118787
  primary: ResponseSurfacePrimarySchema.optional(),
119543
118788
  post: ResponseSurfacePostSchema.optional(),
119544
118789
  card: ResponseSurfaceCardSchema.optional()
@@ -119553,9 +118798,18 @@ var StrictResponseSurfaceStateSchema = external_exports.object({
119553
118798
  });
119554
118799
  var ResponseSurfaceStateSchema = external_exports.preprocess((value) => {
119555
118800
  if (value === void 0) return void 0;
119556
- const result = StrictResponseSurfaceStateSchema.safeParse(value);
119557
- return result.success ? result.data : void 0;
118801
+ return parseResponseSurfaceState(value).state;
119558
118802
  }, StrictResponseSurfaceStateSchema.optional());
118803
+ function parseResponseSurfaceState(value) {
118804
+ const result = StrictResponseSurfaceStateSchema.safeParse(value);
118805
+ if (result.success) return { state: result.data, diagnostics: [] };
118806
+ return {
118807
+ diagnostics: result.error.issues.map((issue) => {
118808
+ const path16 = issue.path.length > 0 ? issue.path.join(".") : "<root>";
118809
+ return `${path16}: ${issue.message}`;
118810
+ })
118811
+ };
118812
+ }
119559
118813
  var ResponseSurfacePrototypeConfigSchema = external_exports.object({
119560
118814
  /**
119561
118815
  * Master gate. Default true makes response surfaces available unless the
@@ -119596,10 +118850,16 @@ var ResponseSurfacePrototypeConfigSchema = external_exports.object({
119596
118850
  */
119597
118851
  allow_agent_mentions: external_exports.boolean().default(true),
119598
118852
  /**
119599
- * Optional target allowlist for real post @ mentions. Empty means the Agent
119600
- * may choose mention targets; non-empty narrows mentions to this exact set.
118853
+ * Optional deny-list for Agent-authored @ mentions. Empty means the Agent
118854
+ * may choose mention targets, except broadcast aliases such as @all.
119601
118855
  * Keep real IDs in private bot config, never in public docs/tests.
119602
118856
  */
118857
+ denied_mention_open_ids: external_exports.array(external_exports.string().min(1)).default([]),
118858
+ /**
118859
+ * Deprecated compatibility field. It is still parsed so older private
118860
+ * configs do not fail, but mention policy is deny-list/default-allow.
118861
+ * Use denied_mention_open_ids for new restrictions.
118862
+ */
119603
118863
  allowed_mention_open_ids: external_exports.array(external_exports.string().min(1)).default([])
119604
118864
  }).default(responseSurfacePrototypeConfigDefaults);
119605
118865
  function isResponseSurfacePrototypeAllowlisted(config, facts) {
@@ -119611,12 +118871,30 @@ function isResponseSurfacePrototypeAllowlisted(config, facts) {
119611
118871
  const threadAllowed = config.allowed_threads.length > 0 && config.allowed_threads.includes(facts.threadId);
119612
118872
  return chatAllowed || threadAllowed;
119613
118873
  }
119614
- function isResponseSurfaceMentionAllowed(config, userId) {
119615
- if (!config?.allow_agent_mentions) return false;
118874
+ function evaluateResponseSurfaceMentionPolicy(config, userId) {
118875
+ if (!config?.allow_agent_mentions) {
118876
+ return {
118877
+ allowed: false,
118878
+ rule: "agent_mentions_disabled",
118879
+ reason: "Agent-authored mentions are disabled by allow_agent_mentions=false."
118880
+ };
118881
+ }
119616
118882
  const normalized = userId.trim().toLowerCase();
119617
- if (normalized === "all" || normalized === "@all") return false;
119618
- if (config.allowed_mention_open_ids.length === 0) return true;
119619
- return config.allowed_mention_open_ids.includes(userId);
118883
+ if (normalized === "all" || normalized === "@all") {
118884
+ return {
118885
+ allowed: false,
118886
+ rule: "broadcast_blocked",
118887
+ reason: "Broadcast mentions such as @all are blocked."
118888
+ };
118889
+ }
118890
+ if (config.denied_mention_open_ids.includes(userId)) {
118891
+ return {
118892
+ allowed: false,
118893
+ rule: "denied_target",
118894
+ reason: "Mention target is denied by denied_mention_open_ids."
118895
+ };
118896
+ }
118897
+ return { allowed: true, rule: "allowed" };
119620
118898
  }
119621
118899
  function shouldProvideResponseSurfacePostClient(config) {
119622
118900
  return !!(config?.enabled && !config.kill_switch && config.post_outbound_enabled);
@@ -119801,14 +119079,19 @@ async function ensureStateFile(worktreePath) {
119801
119079
  await fs3.writeFile(file, JSON.stringify(initial, null, 2), "utf8");
119802
119080
  }
119803
119081
  async function readStateFile(worktreePath) {
119082
+ return (await readStateFileDetailed(worktreePath)).state;
119083
+ }
119084
+ async function readStateFileDetailed(worktreePath) {
119804
119085
  const file = stateFilePathOf(worktreePath);
119805
119086
  let raw;
119806
119087
  try {
119807
119088
  raw = await fs3.readFile(file, "utf8");
119808
119089
  } catch (err) {
119809
- if (err.code === "ENOENT") return null;
119090
+ if (err.code === "ENOENT") {
119091
+ return { state: null, diagnostics: [] };
119092
+ }
119810
119093
  console.warn(`[stateFile] read ${file} failed:`, err);
119811
- return null;
119094
+ return { state: null, diagnostics: [] };
119812
119095
  }
119813
119096
  let parsed;
119814
119097
  try {
@@ -119826,11 +119109,11 @@ async function readStateFile(worktreePath) {
119826
119109
  `[stateFile] ${file} not valid JSON (repair also failed):`,
119827
119110
  err2
119828
119111
  );
119829
- return null;
119112
+ return { state: null, diagnostics: [] };
119830
119113
  }
119831
119114
  } else {
119832
119115
  console.warn(`[stateFile] ${file} not valid JSON:`, err);
119833
- return null;
119116
+ return { state: null, diagnostics: [] };
119834
119117
  }
119835
119118
  }
119836
119119
  const result = StateFileSchema.safeParse(parsed);
@@ -119839,9 +119122,22 @@ async function readStateFile(worktreePath) {
119839
119122
  `[stateFile] ${file} failed schema validation:`,
119840
119123
  result.error.issues
119841
119124
  );
119842
- return null;
119125
+ return { state: null, diagnostics: [] };
119843
119126
  }
119844
- return result.data;
119127
+ const diagnostics = diagnoseStateFile(parsed, result.data);
119128
+ for (const diagnostic of diagnostics) {
119129
+ console.warn(`[stateFile] ${file}: ${diagnostic}`);
119130
+ }
119131
+ return { state: result.data, diagnostics };
119132
+ }
119133
+ function diagnoseStateFile(parsed, state) {
119134
+ if (parsed === null || typeof parsed !== "object") return [];
119135
+ if (!Object.prototype.hasOwnProperty.call(parsed, "response_surface")) return [];
119136
+ const rawSurface = parsed.response_surface;
119137
+ if (rawSurface === void 0 || state.response_surface !== void 0) return [];
119138
+ const parsedSurface = parseResponseSurfaceState(rawSurface);
119139
+ const details = parsedSurface.diagnostics.length > 0 ? parsedSurface.diagnostics.join("; ") : "unknown parse failure";
119140
+ return [`response_surface ignored: ${details}`];
119845
119141
  }
119846
119142
  function tryRepairBareQuotesInLastMessage(raw) {
119847
119143
  const startRe = /"last_message"\s*:\s*"/;
@@ -120664,6 +119960,14 @@ function derivePostIdempotencyKey(input) {
120664
119960
 
120665
119961
  // src/bridge/handler.ts
120666
119962
  var DEFAULT_CARDKIT_RESPONSE_SURFACE_TIMEOUT_MS = 20 * 60 * 1e3;
119963
+ var DEFAULT_CARDKIT_IDLE_TIMEOUT_MS = 3 * 60 * 1e3;
119964
+ function summarizeMentionPolicyRules(rules) {
119965
+ const counts = /* @__PURE__ */ new Map();
119966
+ for (const rule of rules) {
119967
+ counts.set(rule, (counts.get(rule) ?? 0) + 1);
119968
+ }
119969
+ return Array.from(counts.entries()).map(([rule, count]) => `${rule}=${count}`).join(", ");
119970
+ }
120667
119971
  function execGit(cwd, args) {
120668
119972
  return new Promise((resolve2, reject) => {
120669
119973
  const child = child_process.spawn("git", args, {
@@ -121387,10 +120691,8 @@ var BridgeHandler = class {
121387
120691
  const backend = this.deps.botConfig?.backend ?? "claude";
121388
120692
  const permissionMode = this.deps.permissionMode ?? "bypassPermissions";
121389
120693
  const baseTimeoutMs = this.deps.subprocessTimeoutMs ?? 60 * 60 * 1e3;
121390
- const timeoutMs = cardKitProgress ? Math.min(
121391
- baseTimeoutMs,
121392
- this.deps.responseSurfaceTimeoutMs ?? DEFAULT_CARDKIT_RESPONSE_SURFACE_TIMEOUT_MS
121393
- ) : baseTimeoutMs;
120694
+ const timeoutMs = baseTimeoutMs;
120695
+ const idleTimeoutMs = this.deps.responseSurfaceIdleTimeoutMs ?? DEFAULT_CARDKIT_IDLE_TIMEOUT_MS;
121394
120696
  const runnerStartedAt = Date.now();
121395
120697
  const handle = createRunner(backend).run({
121396
120698
  prompt,
@@ -121402,6 +120704,24 @@ var BridgeHandler = class {
121402
120704
  botGitIdentity: this.deps.botConfig?.git_identity,
121403
120705
  gitlabToken: this.deps.gitlabToken
121404
120706
  });
120707
+ let lastActivityAt = Date.now();
120708
+ let interruptedByIdle = false;
120709
+ let idleWatchdog;
120710
+ if (cardKitProgress) {
120711
+ const cadenceMs = Math.max(50, Math.min(Math.floor(idleTimeoutMs / 4), 15e3));
120712
+ idleWatchdog = setInterval(() => {
120713
+ if (Date.now() - lastActivityAt >= idleTimeoutMs) {
120714
+ interruptedByIdle = true;
120715
+ if (idleWatchdog) clearInterval(idleWatchdog);
120716
+ idleWatchdog = void 0;
120717
+ try {
120718
+ handle.kill();
120719
+ } catch {
120720
+ }
120721
+ }
120722
+ }, cadenceMs);
120723
+ idleWatchdog.unref?.();
120724
+ }
121405
120725
  if (isAgentWorkspace && handle.pid != null) {
121406
120726
  const sessionPidFile = path9.join(worktreePath, ".larkway", "runner.pid");
121407
120727
  void fs6.mkdir(path9.dirname(sessionPidFile), { recursive: true }).then(
@@ -121413,6 +120733,7 @@ var BridgeHandler = class {
121413
120733
  let trustedAnswerText = "";
121414
120734
  try {
121415
120735
  for await (const ev of handle.events) {
120736
+ lastActivityAt = Date.now();
121416
120737
  if (cardKitProgress) cardKitProgress.handle(ev);
121417
120738
  else if (card) card.handle(ev);
121418
120739
  if (ev.type === "system_init") {
@@ -121425,9 +120746,28 @@ var BridgeHandler = class {
121425
120746
  }
121426
120747
  }
121427
120748
  const result = await handle.done;
121428
- const cardKitTurnTimedOut = cardKitProgress != null && result.exitCode !== 0 && Date.now() - runnerStartedAt >= timeoutMs;
121429
- const rawReportedState = await readStateFile(worktreePath);
120749
+ if (idleWatchdog) {
120750
+ clearInterval(idleWatchdog);
120751
+ idleWatchdog = void 0;
120752
+ }
120753
+ const cardKitTurnTimedOut = cardKitProgress != null && interruptedByIdle;
120754
+ const reportedStateRead = await readStateFileDetailed(worktreePath);
120755
+ const rawReportedState = reportedStateRead.state;
121430
120756
  const reportedState = rawReportedState?.updated_at != null && rawReportedState.updated_at !== preRunUpdatedAt ? rawReportedState : null;
120757
+ if (reportedStateRead.diagnostics.length > 0 && reportedState !== null) {
120758
+ await recordEvent({
120759
+ status: "running",
120760
+ appendPath: "state \u8BCA\u65AD",
120761
+ reason: reportedStateRead.diagnostics.join("; ")
120762
+ });
120763
+ }
120764
+ if (reportedState === null) {
120765
+ await recordEvent({
120766
+ status: "running",
120767
+ appendPath: "\u672A\u66F4\u65B0 state.json",
120768
+ reason: rawReportedState === null ? "\u672C\u8F6E\u7ED3\u675F\u65F6\u672A\u8BFB\u53D6\u5230 state.json\u3002" : "\u672C\u8F6E state.json \u6CA1\u6709 fresh updated_at\uFF0C\u5DF2\u5FFD\u7565\u65E7\u72B6\u6001\u3002"
120769
+ });
120770
+ }
121431
120771
  const now = Date.now();
121432
120772
  if (sessionId !== void 0 && currentExisting === void 0) {
121433
120773
  await this.deps.sessionStore.put({
@@ -121465,15 +120805,25 @@ var BridgeHandler = class {
121465
120805
  success = true;
121466
120806
  } else if (cardKitTimeoutFailure) {
121467
120807
  success = false;
121468
- failureReason = `agent turn timed out after ${timeoutMs}ms; CardKit running card was finalized as interrupted`;
120808
+ failureReason = `agent turn idle for ${idleTimeoutMs}ms with no activity (treated as stuck); run interrupted`;
120809
+ await recordEvent({
120810
+ status: "running",
120811
+ appendPath: "Agent \u5361\u6B7B\u4E2D\u65AD",
120812
+ reason: failureReason
120813
+ });
121469
120814
  } else if (result.exitCode === 0) {
121470
120815
  success = true;
121471
120816
  } else {
121472
120817
  success = false;
121473
120818
  failureReason = `claude exited ${result.exitCode} \u4E14 bot \u672A\u66F4\u65B0 state.json status \u2014 \u53EF\u80FD\u5D29\u6E83`;
120819
+ await recordEvent({
120820
+ status: "running",
120821
+ appendPath: "Agent \u5F02\u5E38\u9000\u51FA",
120822
+ reason: failureReason
120823
+ });
121474
120824
  }
121475
120825
  const fallbackAnswer = trustedAnswerText.trim() || cardKitProgress?.answerText.trim() || "";
121476
- 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");
120826
+ 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");
121477
120827
  const noReportThisTurn = reportedState === null;
121478
120828
  const neutralTitle = noReportThisTurn && success && !failureReason ? "\u{1F4AC} \u5DF2\u56DE\u590D" : void 0;
121479
120829
  const baseCardPayload = {
@@ -121491,9 +120841,31 @@ var BridgeHandler = class {
121491
120841
  contentBlocks: reportedState?.content_blocks
121492
120842
  };
121493
120843
  if (cardKitProgress) {
121494
- const mentions = (reportedState?.response_surface?.post?.mentions ?? []).filter(
121495
- (mention) => isResponseSurfaceMentionAllowed(prototypeConfig, mention.user_id)
121496
- );
120844
+ const declaredMentions = reportedState?.response_surface?.post?.mentions ?? [];
120845
+ const responseSurfacePostDeclared = reportedState?.response_surface?.post !== void 0;
120846
+ const mentionPolicyResults = declaredMentions.map((mention) => ({
120847
+ mention,
120848
+ policy: evaluateResponseSurfaceMentionPolicy(prototypeConfig, mention.user_id)
120849
+ }));
120850
+ const mentions = mentionPolicyResults.filter(({ policy }) => policy.allowed).map(({ mention }) => mention);
120851
+ const blockedMentionRules = mentionPolicyResults.filter(({ policy }) => !policy.allowed).map(({ policy }) => policy.rule);
120852
+ if (responseSurfacePostDeclared && declaredMentions.length === 0) {
120853
+ const reason = "response_surface.post was declared with an empty mentions array.";
120854
+ console.warn("[bridge.handler] response_surface post has no mentions");
120855
+ await recordEvent({
120856
+ status: "running",
120857
+ appendPath: "mention \u8BCA\u65AD",
120858
+ reason
120859
+ });
120860
+ } else if (declaredMentions.length > mentions.length) {
120861
+ const reason = `response_surface mentions filtered by policy: ${mentions.length}/${declaredMentions.length} allowed; blocked rules: ${summarizeMentionPolicyRules(blockedMentionRules)}.`;
120862
+ console.warn("[bridge.handler] response_surface mention policy filtered targets");
120863
+ await recordEvent({
120864
+ status: "running",
120865
+ appendPath: "mention \u8BCA\u65AD",
120866
+ reason
120867
+ });
120868
+ }
121497
120869
  try {
121498
120870
  await cardKitProgress.finalize({
121499
120871
  title: baseCardPayload.titleOverride,
@@ -125310,17 +124682,18 @@ function selectOrphanCards(entries, opts) {
125310
124682
  }
125311
124683
  return out;
125312
124684
  }
124685
+ 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";
125313
124686
  function mapFinalizeArgs(state, success, stateFresh = true) {
125314
124687
  if (!stateFresh) {
125315
124688
  return {
125316
- 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",
124689
+ finalText: INTERRUPTED_TURN_TEXT,
125317
124690
  success: false,
125318
124691
  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",
125319
124692
  titleOverride: "\u26A0\uFE0F \u672C\u8F6E\u88AB\u4E2D\u65AD",
125320
124693
  colorOverride: "failure"
125321
124694
  };
125322
124695
  }
125323
- 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";
124696
+ const finalText = state.last_message ?? INTERRUPTED_TURN_TEXT;
125324
124697
  const failureReason = success ? void 0 : state.error ?? "bridge \u91CD\u542F\u65F6\u8BE5\u8F6E\u672A\u6B63\u5E38\u6536\u5C3E(reconcile \u515C\u5E95)";
125325
124698
  return {
125326
124699
  finalText,
@@ -125337,7 +124710,7 @@ function mapFinalizeArgs(state, success, stateFresh = true) {
125337
124710
  function mapCardKitFinalizeArgs(state, success, stateFresh = true) {
125338
124711
  const args = mapFinalizeArgs(state, success, stateFresh);
125339
124712
  return {
125340
- 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",
124713
+ finalText: args.finalText ?? INTERRUPTED_TURN_TEXT,
125341
124714
  ...args.titleOverride !== void 0 ? { title: args.titleOverride } : {},
125342
124715
  ...args.choices !== void 0 ? { choices: args.choices } : {},
125343
124716
  ...args.choicePrompt !== void 0 ? { choicePrompt: args.choicePrompt } : {},