@osfactory/har 0.43.0 → 0.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +627 -550
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -30573,6 +30573,548 @@ var init_cloud_executor = __esm({
30573
30573
  }
30574
30574
  });
30575
30575
 
30576
+ // node_modules/chalk/source/vendor/ansi-styles/index.js
30577
+ function assembleStyles() {
30578
+ const codes = /* @__PURE__ */ new Map();
30579
+ for (const [groupName, group] of Object.entries(styles)) {
30580
+ for (const [styleName, style] of Object.entries(group)) {
30581
+ styles[styleName] = {
30582
+ open: `\x1B[${style[0]}m`,
30583
+ close: `\x1B[${style[1]}m`
30584
+ };
30585
+ group[styleName] = styles[styleName];
30586
+ codes.set(style[0], style[1]);
30587
+ }
30588
+ Object.defineProperty(styles, groupName, {
30589
+ value: group,
30590
+ enumerable: false
30591
+ });
30592
+ }
30593
+ Object.defineProperty(styles, "codes", {
30594
+ value: codes,
30595
+ enumerable: false
30596
+ });
30597
+ styles.color.close = "\x1B[39m";
30598
+ styles.bgColor.close = "\x1B[49m";
30599
+ styles.color.ansi = wrapAnsi16();
30600
+ styles.color.ansi256 = wrapAnsi256();
30601
+ styles.color.ansi16m = wrapAnsi16m();
30602
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
30603
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
30604
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
30605
+ Object.defineProperties(styles, {
30606
+ rgbToAnsi256: {
30607
+ value(red, green, blue) {
30608
+ if (red === green && green === blue) {
30609
+ if (red < 8) {
30610
+ return 16;
30611
+ }
30612
+ if (red > 248) {
30613
+ return 231;
30614
+ }
30615
+ return Math.round((red - 8) / 247 * 24) + 232;
30616
+ }
30617
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
30618
+ },
30619
+ enumerable: false
30620
+ },
30621
+ hexToRgb: {
30622
+ value(hex) {
30623
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
30624
+ if (!matches) {
30625
+ return [0, 0, 0];
30626
+ }
30627
+ let [colorString] = matches;
30628
+ if (colorString.length === 3) {
30629
+ colorString = [...colorString].map((character) => character + character).join("");
30630
+ }
30631
+ const integer2 = Number.parseInt(colorString, 16);
30632
+ return [
30633
+ /* eslint-disable no-bitwise */
30634
+ integer2 >> 16 & 255,
30635
+ integer2 >> 8 & 255,
30636
+ integer2 & 255
30637
+ /* eslint-enable no-bitwise */
30638
+ ];
30639
+ },
30640
+ enumerable: false
30641
+ },
30642
+ hexToAnsi256: {
30643
+ value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
30644
+ enumerable: false
30645
+ },
30646
+ ansi256ToAnsi: {
30647
+ value(code) {
30648
+ if (code < 8) {
30649
+ return 30 + code;
30650
+ }
30651
+ if (code < 16) {
30652
+ return 90 + (code - 8);
30653
+ }
30654
+ let red;
30655
+ let green;
30656
+ let blue;
30657
+ if (code >= 232) {
30658
+ red = ((code - 232) * 10 + 8) / 255;
30659
+ green = red;
30660
+ blue = red;
30661
+ } else {
30662
+ code -= 16;
30663
+ const remainder = code % 36;
30664
+ red = Math.floor(code / 36) / 5;
30665
+ green = Math.floor(remainder / 6) / 5;
30666
+ blue = remainder % 6 / 5;
30667
+ }
30668
+ const value = Math.max(red, green, blue) * 2;
30669
+ if (value === 0) {
30670
+ return 30;
30671
+ }
30672
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
30673
+ if (value === 2) {
30674
+ result += 60;
30675
+ }
30676
+ return result;
30677
+ },
30678
+ enumerable: false
30679
+ },
30680
+ rgbToAnsi: {
30681
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
30682
+ enumerable: false
30683
+ },
30684
+ hexToAnsi: {
30685
+ value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
30686
+ enumerable: false
30687
+ }
30688
+ });
30689
+ return styles;
30690
+ }
30691
+ var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
30692
+ var init_ansi_styles = __esm({
30693
+ "node_modules/chalk/source/vendor/ansi-styles/index.js"() {
30694
+ ANSI_BACKGROUND_OFFSET = 10;
30695
+ wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
30696
+ wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
30697
+ wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
30698
+ styles = {
30699
+ modifier: {
30700
+ reset: [0, 0],
30701
+ // 21 isn't widely supported and 22 does the same thing
30702
+ bold: [1, 22],
30703
+ dim: [2, 22],
30704
+ italic: [3, 23],
30705
+ underline: [4, 24],
30706
+ overline: [53, 55],
30707
+ inverse: [7, 27],
30708
+ hidden: [8, 28],
30709
+ strikethrough: [9, 29]
30710
+ },
30711
+ color: {
30712
+ black: [30, 39],
30713
+ red: [31, 39],
30714
+ green: [32, 39],
30715
+ yellow: [33, 39],
30716
+ blue: [34, 39],
30717
+ magenta: [35, 39],
30718
+ cyan: [36, 39],
30719
+ white: [37, 39],
30720
+ // Bright color
30721
+ blackBright: [90, 39],
30722
+ gray: [90, 39],
30723
+ // Alias of `blackBright`
30724
+ grey: [90, 39],
30725
+ // Alias of `blackBright`
30726
+ redBright: [91, 39],
30727
+ greenBright: [92, 39],
30728
+ yellowBright: [93, 39],
30729
+ blueBright: [94, 39],
30730
+ magentaBright: [95, 39],
30731
+ cyanBright: [96, 39],
30732
+ whiteBright: [97, 39]
30733
+ },
30734
+ bgColor: {
30735
+ bgBlack: [40, 49],
30736
+ bgRed: [41, 49],
30737
+ bgGreen: [42, 49],
30738
+ bgYellow: [43, 49],
30739
+ bgBlue: [44, 49],
30740
+ bgMagenta: [45, 49],
30741
+ bgCyan: [46, 49],
30742
+ bgWhite: [47, 49],
30743
+ // Bright color
30744
+ bgBlackBright: [100, 49],
30745
+ bgGray: [100, 49],
30746
+ // Alias of `bgBlackBright`
30747
+ bgGrey: [100, 49],
30748
+ // Alias of `bgBlackBright`
30749
+ bgRedBright: [101, 49],
30750
+ bgGreenBright: [102, 49],
30751
+ bgYellowBright: [103, 49],
30752
+ bgBlueBright: [104, 49],
30753
+ bgMagentaBright: [105, 49],
30754
+ bgCyanBright: [106, 49],
30755
+ bgWhiteBright: [107, 49]
30756
+ }
30757
+ };
30758
+ modifierNames = Object.keys(styles.modifier);
30759
+ foregroundColorNames = Object.keys(styles.color);
30760
+ backgroundColorNames = Object.keys(styles.bgColor);
30761
+ colorNames = [...foregroundColorNames, ...backgroundColorNames];
30762
+ ansiStyles = assembleStyles();
30763
+ ansi_styles_default = ansiStyles;
30764
+ }
30765
+ });
30766
+
30767
+ // node_modules/chalk/source/vendor/supports-color/index.js
30768
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
30769
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
30770
+ const position = argv.indexOf(prefix + flag);
30771
+ const terminatorPosition = argv.indexOf("--");
30772
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
30773
+ }
30774
+ function envForceColor() {
30775
+ if ("FORCE_COLOR" in env2) {
30776
+ if (env2.FORCE_COLOR === "true") {
30777
+ return 1;
30778
+ }
30779
+ if (env2.FORCE_COLOR === "false") {
30780
+ return 0;
30781
+ }
30782
+ return env2.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
30783
+ }
30784
+ }
30785
+ function translateLevel(level) {
30786
+ if (level === 0) {
30787
+ return false;
30788
+ }
30789
+ return {
30790
+ level,
30791
+ hasBasic: true,
30792
+ has256: level >= 2,
30793
+ has16m: level >= 3
30794
+ };
30795
+ }
30796
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
30797
+ const noFlagForceColor = envForceColor();
30798
+ if (noFlagForceColor !== void 0) {
30799
+ flagForceColor = noFlagForceColor;
30800
+ }
30801
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
30802
+ if (forceColor === 0) {
30803
+ return 0;
30804
+ }
30805
+ if (sniffFlags) {
30806
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
30807
+ return 3;
30808
+ }
30809
+ if (hasFlag("color=256")) {
30810
+ return 2;
30811
+ }
30812
+ }
30813
+ if ("TF_BUILD" in env2 && "AGENT_NAME" in env2) {
30814
+ return 1;
30815
+ }
30816
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
30817
+ return 0;
30818
+ }
30819
+ const min = forceColor || 0;
30820
+ if (env2.TERM === "dumb") {
30821
+ return min;
30822
+ }
30823
+ if (import_node_process.default.platform === "win32") {
30824
+ const osRelease = import_node_os.default.release().split(".");
30825
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
30826
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
30827
+ }
30828
+ return 1;
30829
+ }
30830
+ if ("CI" in env2) {
30831
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env2)) {
30832
+ return 3;
30833
+ }
30834
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
30835
+ return 1;
30836
+ }
30837
+ return min;
30838
+ }
30839
+ if ("TEAMCITY_VERSION" in env2) {
30840
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
30841
+ }
30842
+ if (env2.COLORTERM === "truecolor") {
30843
+ return 3;
30844
+ }
30845
+ if (env2.TERM === "xterm-kitty") {
30846
+ return 3;
30847
+ }
30848
+ if (env2.TERM === "xterm-ghostty") {
30849
+ return 3;
30850
+ }
30851
+ if (env2.TERM === "wezterm") {
30852
+ return 3;
30853
+ }
30854
+ if ("TERM_PROGRAM" in env2) {
30855
+ const version2 = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
30856
+ switch (env2.TERM_PROGRAM) {
30857
+ case "iTerm.app": {
30858
+ return version2 >= 3 ? 3 : 2;
30859
+ }
30860
+ case "Apple_Terminal": {
30861
+ return 2;
30862
+ }
30863
+ }
30864
+ }
30865
+ if (/-256(color)?$/i.test(env2.TERM)) {
30866
+ return 2;
30867
+ }
30868
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
30869
+ return 1;
30870
+ }
30871
+ if ("COLORTERM" in env2) {
30872
+ return 1;
30873
+ }
30874
+ return min;
30875
+ }
30876
+ function createSupportsColor(stream, options = {}) {
30877
+ const level = _supportsColor(stream, {
30878
+ streamIsTTY: stream && stream.isTTY,
30879
+ ...options
30880
+ });
30881
+ return translateLevel(level);
30882
+ }
30883
+ var import_node_process, import_node_os, import_node_tty, env2, flagForceColor, supportsColor, supports_color_default;
30884
+ var init_supports_color = __esm({
30885
+ "node_modules/chalk/source/vendor/supports-color/index.js"() {
30886
+ import_node_process = __toESM(require("node:process"), 1);
30887
+ import_node_os = __toESM(require("node:os"), 1);
30888
+ import_node_tty = __toESM(require("node:tty"), 1);
30889
+ ({ env: env2 } = import_node_process.default);
30890
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
30891
+ flagForceColor = 0;
30892
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
30893
+ flagForceColor = 1;
30894
+ }
30895
+ supportsColor = {
30896
+ stdout: createSupportsColor({ isTTY: import_node_tty.default.isatty(1) }),
30897
+ stderr: createSupportsColor({ isTTY: import_node_tty.default.isatty(2) })
30898
+ };
30899
+ supports_color_default = supportsColor;
30900
+ }
30901
+ });
30902
+
30903
+ // node_modules/chalk/source/utilities.js
30904
+ function stringReplaceAll(string3, substring, replacer) {
30905
+ let index = string3.indexOf(substring);
30906
+ if (index === -1) {
30907
+ return string3;
30908
+ }
30909
+ const substringLength = substring.length;
30910
+ let endIndex = 0;
30911
+ let returnValue = "";
30912
+ do {
30913
+ returnValue += string3.slice(endIndex, index) + substring + replacer;
30914
+ endIndex = index + substringLength;
30915
+ index = string3.indexOf(substring, endIndex);
30916
+ } while (index !== -1);
30917
+ returnValue += string3.slice(endIndex);
30918
+ return returnValue;
30919
+ }
30920
+ function stringEncaseCRLFWithFirstIndex(string3, prefix, postfix, index) {
30921
+ let endIndex = 0;
30922
+ let returnValue = "";
30923
+ do {
30924
+ const gotCR = string3[index - 1] === "\r";
30925
+ returnValue += string3.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
30926
+ endIndex = index + 1;
30927
+ index = string3.indexOf("\n", endIndex);
30928
+ } while (index !== -1);
30929
+ returnValue += string3.slice(endIndex);
30930
+ return returnValue;
30931
+ }
30932
+ var init_utilities = __esm({
30933
+ "node_modules/chalk/source/utilities.js"() {
30934
+ }
30935
+ });
30936
+
30937
+ // node_modules/chalk/source/index.js
30938
+ function createChalk(options) {
30939
+ return chalkFactory(options);
30940
+ }
30941
+ var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
30942
+ var init_source = __esm({
30943
+ "node_modules/chalk/source/index.js"() {
30944
+ init_ansi_styles();
30945
+ init_supports_color();
30946
+ init_utilities();
30947
+ ({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
30948
+ GENERATOR = Symbol("GENERATOR");
30949
+ STYLER = Symbol("STYLER");
30950
+ IS_EMPTY = Symbol("IS_EMPTY");
30951
+ levelMapping = [
30952
+ "ansi",
30953
+ "ansi",
30954
+ "ansi256",
30955
+ "ansi16m"
30956
+ ];
30957
+ styles2 = /* @__PURE__ */ Object.create(null);
30958
+ applyOptions = (object3, options = {}) => {
30959
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
30960
+ throw new Error("The `level` option should be an integer from 0 to 3");
30961
+ }
30962
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
30963
+ object3.level = options.level === void 0 ? colorLevel : options.level;
30964
+ };
30965
+ chalkFactory = (options) => {
30966
+ const chalk2 = (...strings) => strings.join(" ");
30967
+ applyOptions(chalk2, options);
30968
+ Object.setPrototypeOf(chalk2, createChalk.prototype);
30969
+ return chalk2;
30970
+ };
30971
+ Object.setPrototypeOf(createChalk.prototype, Function.prototype);
30972
+ for (const [styleName, style] of Object.entries(ansi_styles_default)) {
30973
+ styles2[styleName] = {
30974
+ get() {
30975
+ const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
30976
+ Object.defineProperty(this, styleName, { value: builder });
30977
+ return builder;
30978
+ }
30979
+ };
30980
+ }
30981
+ styles2.visible = {
30982
+ get() {
30983
+ const builder = createBuilder(this, this[STYLER], true);
30984
+ Object.defineProperty(this, "visible", { value: builder });
30985
+ return builder;
30986
+ }
30987
+ };
30988
+ getModelAnsi = (model, level, type, ...arguments_) => {
30989
+ if (model === "rgb") {
30990
+ if (level === "ansi16m") {
30991
+ return ansi_styles_default[type].ansi16m(...arguments_);
30992
+ }
30993
+ if (level === "ansi256") {
30994
+ return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
30995
+ }
30996
+ return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
30997
+ }
30998
+ if (model === "hex") {
30999
+ return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
31000
+ }
31001
+ return ansi_styles_default[type][model](...arguments_);
31002
+ };
31003
+ usedModels = ["rgb", "hex", "ansi256"];
31004
+ for (const model of usedModels) {
31005
+ styles2[model] = {
31006
+ get() {
31007
+ const { level } = this;
31008
+ return function(...arguments_) {
31009
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
31010
+ return createBuilder(this, styler, this[IS_EMPTY]);
31011
+ };
31012
+ }
31013
+ };
31014
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
31015
+ styles2[bgModel] = {
31016
+ get() {
31017
+ const { level } = this;
31018
+ return function(...arguments_) {
31019
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
31020
+ return createBuilder(this, styler, this[IS_EMPTY]);
31021
+ };
31022
+ }
31023
+ };
31024
+ }
31025
+ proto = Object.defineProperties(() => {
31026
+ }, {
31027
+ ...styles2,
31028
+ level: {
31029
+ enumerable: true,
31030
+ get() {
31031
+ return this[GENERATOR].level;
31032
+ },
31033
+ set(level) {
31034
+ this[GENERATOR].level = level;
31035
+ }
31036
+ }
31037
+ });
31038
+ createStyler = (open, close, parent) => {
31039
+ let openAll;
31040
+ let closeAll;
31041
+ if (parent === void 0) {
31042
+ openAll = open;
31043
+ closeAll = close;
31044
+ } else {
31045
+ openAll = parent.openAll + open;
31046
+ closeAll = close + parent.closeAll;
31047
+ }
31048
+ return {
31049
+ open,
31050
+ close,
31051
+ openAll,
31052
+ closeAll,
31053
+ parent
31054
+ };
31055
+ };
31056
+ createBuilder = (self, _styler, _isEmpty) => {
31057
+ const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
31058
+ Object.setPrototypeOf(builder, proto);
31059
+ builder[GENERATOR] = self;
31060
+ builder[STYLER] = _styler;
31061
+ builder[IS_EMPTY] = _isEmpty;
31062
+ return builder;
31063
+ };
31064
+ applyStyle = (self, string3) => {
31065
+ if (self.level <= 0 || !string3) {
31066
+ return self[IS_EMPTY] ? "" : string3;
31067
+ }
31068
+ let styler = self[STYLER];
31069
+ if (styler === void 0) {
31070
+ return string3;
31071
+ }
31072
+ const { openAll, closeAll } = styler;
31073
+ if (string3.includes("\x1B")) {
31074
+ while (styler !== void 0) {
31075
+ string3 = stringReplaceAll(string3, styler.close, styler.open);
31076
+ styler = styler.parent;
31077
+ }
31078
+ }
31079
+ const lfIndex = string3.indexOf("\n");
31080
+ if (lfIndex !== -1) {
31081
+ string3 = stringEncaseCRLFWithFirstIndex(string3, closeAll, openAll, lfIndex);
31082
+ }
31083
+ return openAll + string3 + closeAll;
31084
+ };
31085
+ Object.defineProperties(createChalk.prototype, styles2);
31086
+ chalk = createChalk();
31087
+ chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
31088
+ source_default = chalk;
31089
+ }
31090
+ });
31091
+
31092
+ // src/utils/logging.ts
31093
+ function info(msg) {
31094
+ console.error(source_default.blue("==>") + " " + msg);
31095
+ }
31096
+ function success(msg) {
31097
+ console.error(source_default.green("\u2713") + " " + msg);
31098
+ }
31099
+ function warn(msg) {
31100
+ console.error(source_default.yellow("\u26A0") + " " + msg);
31101
+ }
31102
+ function error(msg) {
31103
+ console.error(source_default.red("\u2717") + " " + msg);
31104
+ }
31105
+ function header(msg) {
31106
+ console.error("\n" + source_default.bold(msg));
31107
+ }
31108
+ function divider() {
31109
+ console.error(source_default.dim("\u2500".repeat(60)));
31110
+ }
31111
+ var init_logging = __esm({
31112
+ "src/utils/logging.ts"() {
31113
+ "use strict";
31114
+ init_source();
31115
+ }
31116
+ });
31117
+
30576
31118
  // src/core/telemetry-env.ts
30577
31119
  function escapeAttrValue(value) {
30578
31120
  return value.replace(/[,=]/g, "_");
@@ -30667,7 +31209,7 @@ var init_workspace_path_match = __esm({
30667
31209
 
30668
31210
  // src/core/usage-harvest/claude.ts
30669
31211
  function claudeProjectsRoot() {
30670
- return process.env.HAR_CLAUDE_PROJECTS_DIR ? path23.resolve(process.env.HAR_CLAUDE_PROJECTS_DIR) : path23.join(os8.homedir(), ".claude", "projects");
31212
+ return process.env.HAR_CLAUDE_PROJECTS_DIR ? path23.resolve(process.env.HAR_CLAUDE_PROJECTS_DIR) : path23.join(os9.homedir(), ".claude", "projects");
30671
31213
  }
30672
31214
  function encodeClaudeProjectDir(cwd) {
30673
31215
  return cwd.replace(/[^a-zA-Z0-9]/g, "-");
@@ -30735,34 +31277,46 @@ function extractClaudeUsageFromRecords(records) {
30735
31277
  return { tokensInput, tokensOutput, tokensCacheRead, tokensCacheCreation, costUsd, modelBreakdown };
30736
31278
  }
30737
31279
  function findMatchingClaudeTranscripts(slot) {
30738
- const targets = [slot.workDir, slot.worktreePath].filter(Boolean);
30739
- if (targets.length === 0) return [];
31280
+ const primaryTargets = [slot.workDir, slot.worktreePath].filter(Boolean);
31281
+ const fallbackTargets = slot.includeRepoPathFallback && slot.repoPath && !primaryTargets.includes(slot.repoPath) ? [slot.repoPath] : [];
31282
+ if (primaryTargets.length === 0 && fallbackTargets.length === 0) return [];
30740
31283
  const root = claudeProjectsRoot();
30741
31284
  if (!fs21.existsSync(root)) return [];
30742
- const matches = [];
31285
+ const primary = [];
31286
+ const fallback = [];
30743
31287
  for (const entry of fs21.readdirSync(root, { withFileTypes: true })) {
30744
31288
  if (!entry.isDirectory()) continue;
30745
31289
  const projectDir = path23.join(root, entry.name);
30746
- const encodedHit = targets.some((t2) => entry.name === encodeClaudeProjectDir(t2));
31290
+ const primaryEncoded = primaryTargets.some((t2) => entry.name === encodeClaudeProjectDir(t2));
31291
+ const fallbackEncoded = fallbackTargets.some((t2) => entry.name === encodeClaudeProjectDir(t2));
30747
31292
  for (const file of fs21.readdirSync(projectDir)) {
30748
31293
  if (!file.endsWith(".jsonl")) continue;
30749
31294
  const filePath = path23.join(projectDir, file);
30750
31295
  const stat = fs21.statSync(filePath);
30751
31296
  const records = readJsonlRecords(filePath);
30752
- let cwdHit = encodedHit;
30753
- for (const record2 of records) {
30754
- if (!record2 || typeof record2 !== "object") continue;
30755
- const cwd = String(record2.cwd ?? "");
30756
- if (cwd && workspaceMatchesTarget(cwd, targets)) {
30757
- cwdHit = true;
30758
- break;
31297
+ let primaryHit = primaryEncoded;
31298
+ let fallbackHit = fallbackEncoded;
31299
+ if (!primaryHit) {
31300
+ for (const record2 of records) {
31301
+ if (!record2 || typeof record2 !== "object") continue;
31302
+ const cwd = String(record2.cwd ?? "");
31303
+ if (!cwd) continue;
31304
+ if (workspaceMatchesTarget(cwd, primaryTargets)) {
31305
+ primaryHit = true;
31306
+ break;
31307
+ }
31308
+ if (!fallbackHit && workspaceMatchesTarget(cwd, fallbackTargets)) {
31309
+ fallbackHit = true;
31310
+ }
30759
31311
  }
30760
31312
  }
30761
- if (!cwdHit) continue;
30762
- matches.push({ filePath, records, mtimeMs: stat.mtimeMs });
31313
+ if (primaryHit) primary.push({ filePath, records, mtimeMs: stat.mtimeMs });
31314
+ else if (fallbackHit) fallback.push({ filePath, records, mtimeMs: stat.mtimeMs });
30763
31315
  }
30764
31316
  }
30765
- return matches.sort((a2, b3) => b3.mtimeMs - a2.mtimeMs);
31317
+ primary.sort((a2, b3) => b3.mtimeMs - a2.mtimeMs);
31318
+ fallback.sort((a2, b3) => b3.mtimeMs - a2.mtimeMs);
31319
+ return [...primary, ...fallback];
30766
31320
  }
30767
31321
  function extractPromptEvents(records, sessionKey, slot) {
30768
31322
  const events = [];
@@ -30857,12 +31411,12 @@ function harvestClaudeEvents(slot) {
30857
31411
  });
30858
31412
  return extractPromptEvents(matches[0].records, sessionKey, slot).slice(-40);
30859
31413
  }
30860
- var fs21, os8, path23;
31414
+ var fs21, os9, path23;
30861
31415
  var init_claude = __esm({
30862
31416
  "src/core/usage-harvest/claude.ts"() {
30863
31417
  "use strict";
30864
31418
  fs21 = __toESM(require("fs"));
30865
- os8 = __toESM(require("os"));
31419
+ os9 = __toESM(require("os"));
30866
31420
  path23 = __toESM(require("path"));
30867
31421
  init_telemetry_config();
30868
31422
  init_telemetry_env();
@@ -30872,7 +31426,7 @@ var init_claude = __esm({
30872
31426
 
30873
31427
  // src/core/usage-harvest/codex.ts
30874
31428
  function codexSessionsRoot() {
30875
- return process.env.HAR_CODEX_SESSIONS_DIR ? path24.resolve(process.env.HAR_CODEX_SESSIONS_DIR) : path24.join(os9.homedir(), ".codex", "sessions");
31429
+ return process.env.HAR_CODEX_SESSIONS_DIR ? path24.resolve(process.env.HAR_CODEX_SESSIONS_DIR) : path24.join(os10.homedir(), ".codex", "sessions");
30876
31430
  }
30877
31431
  function walkJsonlFiles(dir, out = []) {
30878
31432
  if (!fs22.existsSync(dir)) return out;
@@ -30930,8 +31484,9 @@ function extractCodexTokens(records) {
30930
31484
  return { tokensInput, tokensOutput, tokensCacheRead, cwd };
30931
31485
  }
30932
31486
  function harvestCodexUsage(slot) {
30933
- const targets = [slot.workDir, slot.worktreePath].filter(Boolean);
30934
- if (targets.length === 0) return null;
31487
+ const primaryTargets = [slot.workDir, slot.worktreePath].filter(Boolean);
31488
+ const fallbackTargets = slot.includeRepoPathFallback && slot.repoPath && !primaryTargets.includes(slot.repoPath) ? [slot.repoPath] : [];
31489
+ if (primaryTargets.length === 0 && fallbackTargets.length === 0) return null;
30935
31490
  const root = codexSessionsRoot();
30936
31491
  const files = walkJsonlFiles(root);
30937
31492
  if (files.length === 0) return null;
@@ -30941,19 +31496,29 @@ function harvestCodexUsage(slot) {
30941
31496
  suffix: slot.suffix,
30942
31497
  createdAt: slot.sessionCreatedAt
30943
31498
  });
30944
- let best = null;
30945
- let bestMtime = 0;
31499
+ let bestPrimary = null;
31500
+ let bestPrimaryMtime = 0;
31501
+ let bestFallback = null;
31502
+ let bestFallbackMtime = 0;
30946
31503
  for (const file of files) {
30947
31504
  const records = readJsonl(file);
30948
31505
  const extracted = extractCodexTokens(records);
30949
- if (!extracted.cwd || !workspaceMatchesTarget(extracted.cwd, targets)) continue;
31506
+ if (!extracted.cwd) continue;
30950
31507
  if (extracted.tokensInput + extracted.tokensOutput + extracted.tokensCacheRead === 0) continue;
30951
31508
  const mtime = fs22.statSync(file).mtimeMs;
30952
- if (mtime >= bestMtime) {
30953
- bestMtime = mtime;
30954
- best = extracted;
31509
+ if (workspaceMatchesTarget(extracted.cwd, primaryTargets)) {
31510
+ if (mtime >= bestPrimaryMtime) {
31511
+ bestPrimaryMtime = mtime;
31512
+ bestPrimary = extracted;
31513
+ }
31514
+ } else if (workspaceMatchesTarget(extracted.cwd, fallbackTargets)) {
31515
+ if (mtime >= bestFallbackMtime) {
31516
+ bestFallbackMtime = mtime;
31517
+ bestFallback = extracted;
31518
+ }
30955
31519
  }
30956
31520
  }
31521
+ const best = bestPrimary ?? bestFallback;
30957
31522
  if (!best) return null;
30958
31523
  const now = (/* @__PURE__ */ new Date()).toISOString();
30959
31524
  const tokensTotal = best.tokensInput + best.tokensOutput + best.tokensCacheRead;
@@ -30975,12 +31540,12 @@ function harvestCodexUsage(slot) {
30975
31540
  lastSeenAt: now
30976
31541
  };
30977
31542
  }
30978
- var fs22, os9, path24;
31543
+ var fs22, os10, path24;
30979
31544
  var init_codex = __esm({
30980
31545
  "src/core/usage-harvest/codex.ts"() {
30981
31546
  "use strict";
30982
31547
  fs22 = __toESM(require("fs"));
30983
- os9 = __toESM(require("os"));
31548
+ os10 = __toESM(require("os"));
30984
31549
  path24 = __toESM(require("path"));
30985
31550
  init_telemetry_env();
30986
31551
  init_workspace_path_match();
@@ -31031,7 +31596,7 @@ function getStatePath() {
31031
31596
  if (process.env.HAR_PORTAL_SYNC_STATE_PATH) {
31032
31597
  return path25.resolve(process.env.HAR_PORTAL_SYNC_STATE_PATH);
31033
31598
  }
31034
- return path25.join(os10.homedir(), ".har", "portal-sync-state.json");
31599
+ return path25.join(os11.homedir(), ".har", "portal-sync-state.json");
31035
31600
  }
31036
31601
  function readState() {
31037
31602
  const statePath = getStatePath();
@@ -31100,12 +31665,12 @@ function selectSince(rows, since, getTimestamp) {
31100
31665
  }
31101
31666
  return { selected, maxSyncedAt };
31102
31667
  }
31103
- var fs23, os10, path25;
31668
+ var fs23, os11, path25;
31104
31669
  var init_portal_watermark = __esm({
31105
31670
  "src/core/portal-watermark.ts"() {
31106
31671
  "use strict";
31107
31672
  fs23 = __toESM(require("fs"));
31108
- os10 = __toESM(require("os"));
31673
+ os11 = __toESM(require("os"));
31109
31674
  path25 = __toESM(require("path"));
31110
31675
  init_control_repo_path();
31111
31676
  }
@@ -31453,6 +32018,7 @@ async function collectPortalTelemetry(repoPath, slots, controlApiUrl, since) {
31453
32018
  if (!isTelemetryEnabled()) return { usage: [], events: [], maxSyncedAt: null };
31454
32019
  try {
31455
32020
  const userEmail = resolvePortalUserEmail();
32021
+ const fallbackAgentId = slots.length > 0 ? Math.min(...slots.map((slot) => slot.agentId)) : null;
31456
32022
  const liveUsage = slots.flatMap(
31457
32023
  (slot) => harvestUsageForSlot({
31458
32024
  agentId: slot.agentId,
@@ -31461,7 +32027,8 @@ async function collectPortalTelemetry(repoPath, slots, controlApiUrl, since) {
31461
32027
  branch: slot.branch,
31462
32028
  suffix: slot.suffix,
31463
32029
  sessionCreatedAt: slot.sessionCreatedAt,
31464
- repoPath
32030
+ repoPath,
32031
+ includeRepoPathFallback: slot.agentId === fallbackAgentId
31465
32032
  }).map((row) => ({
31466
32033
  ...row,
31467
32034
  workUnitId: slot.workUnitId ?? row.workUnitId,
@@ -31482,7 +32049,8 @@ async function collectPortalTelemetry(repoPath, slots, controlApiUrl, since) {
31482
32049
  branch: slot.branch,
31483
32050
  suffix: slot.suffix,
31484
32051
  sessionCreatedAt: slot.sessionCreatedAt,
31485
- repoPath
32052
+ repoPath,
32053
+ includeRepoPathFallback: slot.agentId === fallbackAgentId
31486
32054
  }).map((event) => ({
31487
32055
  ...event,
31488
32056
  workUnitId: slot.workUnitId ?? event.workUnitId,
@@ -31511,7 +32079,7 @@ async function collectPortalTelemetry(repoPath, slots, controlApiUrl, since) {
31511
32079
  return { usage: [], events: [], maxSyncedAt: null };
31512
32080
  }
31513
32081
  }
31514
- async function buildPortalPayload(repoPath, controlApiUrl, since) {
32082
+ async function buildPortalPayload(repoPath, controlApiUrl, since, full = false) {
31515
32083
  const runs = listRuns(repoPath);
31516
32084
  const status = collectEnvironmentStatus(repoPath);
31517
32085
  const manifest = readManifest(repoPath);
@@ -31527,6 +32095,11 @@ async function buildPortalPayload(repoPath, controlApiUrl, since) {
31527
32095
  controlApiUrl,
31528
32096
  since
31529
32097
  );
32098
+ if (full && isTelemetryEnabled() && usage2.length === 0 && runs.some((r2) => r2.agentId != null)) {
32099
+ warn(
32100
+ `${path27.basename(repoPath)}: agent runs found but no usage harvested \u2014 attribution will be missing. This happens when agent sessions ran outside the har worktree slot (e.g. in the main checkout). Run agents inside \`har env launch\`.`
32101
+ );
32102
+ }
31530
32103
  const syncBody = {
31531
32104
  path: repoPath,
31532
32105
  ...manifest ? { manifest } : {},
@@ -31669,7 +32242,8 @@ async function syncRepoWithPortal(options, controlApiUrl) {
31669
32242
  const { syncBody, runs, events, maxSyncedAt } = await buildPortalPayload(
31670
32243
  repoPath,
31671
32244
  controlApiUrl,
31672
- since
32245
+ since,
32246
+ full
31673
32247
  );
31674
32248
  const { selected: newRuns } = selectSince(runs, runsSince, runTimestamp);
31675
32249
  let repoId;
@@ -31906,6 +32480,7 @@ var init_control_sync = __esm({
31906
32480
  init_work_units();
31907
32481
  init_cloud_executor();
31908
32482
  init_telemetry_config();
32483
+ init_logging();
31909
32484
  init_usage_harvest();
31910
32485
  init_telemetry_env();
31911
32486
  init_control_persisted_usage();
@@ -71310,521 +71885,7 @@ var os12 = __toESM(require("os"));
71310
71885
  var path30 = __toESM(require("path"));
71311
71886
  var readline = __toESM(require("readline"));
71312
71887
  init_file_ops();
71313
-
71314
- // node_modules/chalk/source/vendor/ansi-styles/index.js
71315
- var ANSI_BACKGROUND_OFFSET = 10;
71316
- var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
71317
- var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
71318
- var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
71319
- var styles = {
71320
- modifier: {
71321
- reset: [0, 0],
71322
- // 21 isn't widely supported and 22 does the same thing
71323
- bold: [1, 22],
71324
- dim: [2, 22],
71325
- italic: [3, 23],
71326
- underline: [4, 24],
71327
- overline: [53, 55],
71328
- inverse: [7, 27],
71329
- hidden: [8, 28],
71330
- strikethrough: [9, 29]
71331
- },
71332
- color: {
71333
- black: [30, 39],
71334
- red: [31, 39],
71335
- green: [32, 39],
71336
- yellow: [33, 39],
71337
- blue: [34, 39],
71338
- magenta: [35, 39],
71339
- cyan: [36, 39],
71340
- white: [37, 39],
71341
- // Bright color
71342
- blackBright: [90, 39],
71343
- gray: [90, 39],
71344
- // Alias of `blackBright`
71345
- grey: [90, 39],
71346
- // Alias of `blackBright`
71347
- redBright: [91, 39],
71348
- greenBright: [92, 39],
71349
- yellowBright: [93, 39],
71350
- blueBright: [94, 39],
71351
- magentaBright: [95, 39],
71352
- cyanBright: [96, 39],
71353
- whiteBright: [97, 39]
71354
- },
71355
- bgColor: {
71356
- bgBlack: [40, 49],
71357
- bgRed: [41, 49],
71358
- bgGreen: [42, 49],
71359
- bgYellow: [43, 49],
71360
- bgBlue: [44, 49],
71361
- bgMagenta: [45, 49],
71362
- bgCyan: [46, 49],
71363
- bgWhite: [47, 49],
71364
- // Bright color
71365
- bgBlackBright: [100, 49],
71366
- bgGray: [100, 49],
71367
- // Alias of `bgBlackBright`
71368
- bgGrey: [100, 49],
71369
- // Alias of `bgBlackBright`
71370
- bgRedBright: [101, 49],
71371
- bgGreenBright: [102, 49],
71372
- bgYellowBright: [103, 49],
71373
- bgBlueBright: [104, 49],
71374
- bgMagentaBright: [105, 49],
71375
- bgCyanBright: [106, 49],
71376
- bgWhiteBright: [107, 49]
71377
- }
71378
- };
71379
- var modifierNames = Object.keys(styles.modifier);
71380
- var foregroundColorNames = Object.keys(styles.color);
71381
- var backgroundColorNames = Object.keys(styles.bgColor);
71382
- var colorNames = [...foregroundColorNames, ...backgroundColorNames];
71383
- function assembleStyles() {
71384
- const codes = /* @__PURE__ */ new Map();
71385
- for (const [groupName, group] of Object.entries(styles)) {
71386
- for (const [styleName, style] of Object.entries(group)) {
71387
- styles[styleName] = {
71388
- open: `\x1B[${style[0]}m`,
71389
- close: `\x1B[${style[1]}m`
71390
- };
71391
- group[styleName] = styles[styleName];
71392
- codes.set(style[0], style[1]);
71393
- }
71394
- Object.defineProperty(styles, groupName, {
71395
- value: group,
71396
- enumerable: false
71397
- });
71398
- }
71399
- Object.defineProperty(styles, "codes", {
71400
- value: codes,
71401
- enumerable: false
71402
- });
71403
- styles.color.close = "\x1B[39m";
71404
- styles.bgColor.close = "\x1B[49m";
71405
- styles.color.ansi = wrapAnsi16();
71406
- styles.color.ansi256 = wrapAnsi256();
71407
- styles.color.ansi16m = wrapAnsi16m();
71408
- styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
71409
- styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
71410
- styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
71411
- Object.defineProperties(styles, {
71412
- rgbToAnsi256: {
71413
- value(red, green, blue) {
71414
- if (red === green && green === blue) {
71415
- if (red < 8) {
71416
- return 16;
71417
- }
71418
- if (red > 248) {
71419
- return 231;
71420
- }
71421
- return Math.round((red - 8) / 247 * 24) + 232;
71422
- }
71423
- return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
71424
- },
71425
- enumerable: false
71426
- },
71427
- hexToRgb: {
71428
- value(hex) {
71429
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
71430
- if (!matches) {
71431
- return [0, 0, 0];
71432
- }
71433
- let [colorString] = matches;
71434
- if (colorString.length === 3) {
71435
- colorString = [...colorString].map((character) => character + character).join("");
71436
- }
71437
- const integer2 = Number.parseInt(colorString, 16);
71438
- return [
71439
- /* eslint-disable no-bitwise */
71440
- integer2 >> 16 & 255,
71441
- integer2 >> 8 & 255,
71442
- integer2 & 255
71443
- /* eslint-enable no-bitwise */
71444
- ];
71445
- },
71446
- enumerable: false
71447
- },
71448
- hexToAnsi256: {
71449
- value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
71450
- enumerable: false
71451
- },
71452
- ansi256ToAnsi: {
71453
- value(code) {
71454
- if (code < 8) {
71455
- return 30 + code;
71456
- }
71457
- if (code < 16) {
71458
- return 90 + (code - 8);
71459
- }
71460
- let red;
71461
- let green;
71462
- let blue;
71463
- if (code >= 232) {
71464
- red = ((code - 232) * 10 + 8) / 255;
71465
- green = red;
71466
- blue = red;
71467
- } else {
71468
- code -= 16;
71469
- const remainder = code % 36;
71470
- red = Math.floor(code / 36) / 5;
71471
- green = Math.floor(remainder / 6) / 5;
71472
- blue = remainder % 6 / 5;
71473
- }
71474
- const value = Math.max(red, green, blue) * 2;
71475
- if (value === 0) {
71476
- return 30;
71477
- }
71478
- let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
71479
- if (value === 2) {
71480
- result += 60;
71481
- }
71482
- return result;
71483
- },
71484
- enumerable: false
71485
- },
71486
- rgbToAnsi: {
71487
- value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
71488
- enumerable: false
71489
- },
71490
- hexToAnsi: {
71491
- value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
71492
- enumerable: false
71493
- }
71494
- });
71495
- return styles;
71496
- }
71497
- var ansiStyles = assembleStyles();
71498
- var ansi_styles_default = ansiStyles;
71499
-
71500
- // node_modules/chalk/source/vendor/supports-color/index.js
71501
- var import_node_process = __toESM(require("node:process"), 1);
71502
- var import_node_os = __toESM(require("node:os"), 1);
71503
- var import_node_tty = __toESM(require("node:tty"), 1);
71504
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
71505
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
71506
- const position = argv.indexOf(prefix + flag);
71507
- const terminatorPosition = argv.indexOf("--");
71508
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
71509
- }
71510
- var { env: env2 } = import_node_process.default;
71511
- var flagForceColor;
71512
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
71513
- flagForceColor = 0;
71514
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
71515
- flagForceColor = 1;
71516
- }
71517
- function envForceColor() {
71518
- if ("FORCE_COLOR" in env2) {
71519
- if (env2.FORCE_COLOR === "true") {
71520
- return 1;
71521
- }
71522
- if (env2.FORCE_COLOR === "false") {
71523
- return 0;
71524
- }
71525
- return env2.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
71526
- }
71527
- }
71528
- function translateLevel(level) {
71529
- if (level === 0) {
71530
- return false;
71531
- }
71532
- return {
71533
- level,
71534
- hasBasic: true,
71535
- has256: level >= 2,
71536
- has16m: level >= 3
71537
- };
71538
- }
71539
- function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
71540
- const noFlagForceColor = envForceColor();
71541
- if (noFlagForceColor !== void 0) {
71542
- flagForceColor = noFlagForceColor;
71543
- }
71544
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
71545
- if (forceColor === 0) {
71546
- return 0;
71547
- }
71548
- if (sniffFlags) {
71549
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
71550
- return 3;
71551
- }
71552
- if (hasFlag("color=256")) {
71553
- return 2;
71554
- }
71555
- }
71556
- if ("TF_BUILD" in env2 && "AGENT_NAME" in env2) {
71557
- return 1;
71558
- }
71559
- if (haveStream && !streamIsTTY && forceColor === void 0) {
71560
- return 0;
71561
- }
71562
- const min = forceColor || 0;
71563
- if (env2.TERM === "dumb") {
71564
- return min;
71565
- }
71566
- if (import_node_process.default.platform === "win32") {
71567
- const osRelease = import_node_os.default.release().split(".");
71568
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
71569
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
71570
- }
71571
- return 1;
71572
- }
71573
- if ("CI" in env2) {
71574
- if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env2)) {
71575
- return 3;
71576
- }
71577
- if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
71578
- return 1;
71579
- }
71580
- return min;
71581
- }
71582
- if ("TEAMCITY_VERSION" in env2) {
71583
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
71584
- }
71585
- if (env2.COLORTERM === "truecolor") {
71586
- return 3;
71587
- }
71588
- if (env2.TERM === "xterm-kitty") {
71589
- return 3;
71590
- }
71591
- if (env2.TERM === "xterm-ghostty") {
71592
- return 3;
71593
- }
71594
- if (env2.TERM === "wezterm") {
71595
- return 3;
71596
- }
71597
- if ("TERM_PROGRAM" in env2) {
71598
- const version2 = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
71599
- switch (env2.TERM_PROGRAM) {
71600
- case "iTerm.app": {
71601
- return version2 >= 3 ? 3 : 2;
71602
- }
71603
- case "Apple_Terminal": {
71604
- return 2;
71605
- }
71606
- }
71607
- }
71608
- if (/-256(color)?$/i.test(env2.TERM)) {
71609
- return 2;
71610
- }
71611
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
71612
- return 1;
71613
- }
71614
- if ("COLORTERM" in env2) {
71615
- return 1;
71616
- }
71617
- return min;
71618
- }
71619
- function createSupportsColor(stream, options = {}) {
71620
- const level = _supportsColor(stream, {
71621
- streamIsTTY: stream && stream.isTTY,
71622
- ...options
71623
- });
71624
- return translateLevel(level);
71625
- }
71626
- var supportsColor = {
71627
- stdout: createSupportsColor({ isTTY: import_node_tty.default.isatty(1) }),
71628
- stderr: createSupportsColor({ isTTY: import_node_tty.default.isatty(2) })
71629
- };
71630
- var supports_color_default = supportsColor;
71631
-
71632
- // node_modules/chalk/source/utilities.js
71633
- function stringReplaceAll(string3, substring, replacer) {
71634
- let index = string3.indexOf(substring);
71635
- if (index === -1) {
71636
- return string3;
71637
- }
71638
- const substringLength = substring.length;
71639
- let endIndex = 0;
71640
- let returnValue = "";
71641
- do {
71642
- returnValue += string3.slice(endIndex, index) + substring + replacer;
71643
- endIndex = index + substringLength;
71644
- index = string3.indexOf(substring, endIndex);
71645
- } while (index !== -1);
71646
- returnValue += string3.slice(endIndex);
71647
- return returnValue;
71648
- }
71649
- function stringEncaseCRLFWithFirstIndex(string3, prefix, postfix, index) {
71650
- let endIndex = 0;
71651
- let returnValue = "";
71652
- do {
71653
- const gotCR = string3[index - 1] === "\r";
71654
- returnValue += string3.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
71655
- endIndex = index + 1;
71656
- index = string3.indexOf("\n", endIndex);
71657
- } while (index !== -1);
71658
- returnValue += string3.slice(endIndex);
71659
- return returnValue;
71660
- }
71661
-
71662
- // node_modules/chalk/source/index.js
71663
- var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
71664
- var GENERATOR = Symbol("GENERATOR");
71665
- var STYLER = Symbol("STYLER");
71666
- var IS_EMPTY = Symbol("IS_EMPTY");
71667
- var levelMapping = [
71668
- "ansi",
71669
- "ansi",
71670
- "ansi256",
71671
- "ansi16m"
71672
- ];
71673
- var styles2 = /* @__PURE__ */ Object.create(null);
71674
- var applyOptions = (object3, options = {}) => {
71675
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
71676
- throw new Error("The `level` option should be an integer from 0 to 3");
71677
- }
71678
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
71679
- object3.level = options.level === void 0 ? colorLevel : options.level;
71680
- };
71681
- var chalkFactory = (options) => {
71682
- const chalk2 = (...strings) => strings.join(" ");
71683
- applyOptions(chalk2, options);
71684
- Object.setPrototypeOf(chalk2, createChalk.prototype);
71685
- return chalk2;
71686
- };
71687
- function createChalk(options) {
71688
- return chalkFactory(options);
71689
- }
71690
- Object.setPrototypeOf(createChalk.prototype, Function.prototype);
71691
- for (const [styleName, style] of Object.entries(ansi_styles_default)) {
71692
- styles2[styleName] = {
71693
- get() {
71694
- const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
71695
- Object.defineProperty(this, styleName, { value: builder });
71696
- return builder;
71697
- }
71698
- };
71699
- }
71700
- styles2.visible = {
71701
- get() {
71702
- const builder = createBuilder(this, this[STYLER], true);
71703
- Object.defineProperty(this, "visible", { value: builder });
71704
- return builder;
71705
- }
71706
- };
71707
- var getModelAnsi = (model, level, type, ...arguments_) => {
71708
- if (model === "rgb") {
71709
- if (level === "ansi16m") {
71710
- return ansi_styles_default[type].ansi16m(...arguments_);
71711
- }
71712
- if (level === "ansi256") {
71713
- return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
71714
- }
71715
- return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
71716
- }
71717
- if (model === "hex") {
71718
- return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
71719
- }
71720
- return ansi_styles_default[type][model](...arguments_);
71721
- };
71722
- var usedModels = ["rgb", "hex", "ansi256"];
71723
- for (const model of usedModels) {
71724
- styles2[model] = {
71725
- get() {
71726
- const { level } = this;
71727
- return function(...arguments_) {
71728
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
71729
- return createBuilder(this, styler, this[IS_EMPTY]);
71730
- };
71731
- }
71732
- };
71733
- const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
71734
- styles2[bgModel] = {
71735
- get() {
71736
- const { level } = this;
71737
- return function(...arguments_) {
71738
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
71739
- return createBuilder(this, styler, this[IS_EMPTY]);
71740
- };
71741
- }
71742
- };
71743
- }
71744
- var proto = Object.defineProperties(() => {
71745
- }, {
71746
- ...styles2,
71747
- level: {
71748
- enumerable: true,
71749
- get() {
71750
- return this[GENERATOR].level;
71751
- },
71752
- set(level) {
71753
- this[GENERATOR].level = level;
71754
- }
71755
- }
71756
- });
71757
- var createStyler = (open, close, parent) => {
71758
- let openAll;
71759
- let closeAll;
71760
- if (parent === void 0) {
71761
- openAll = open;
71762
- closeAll = close;
71763
- } else {
71764
- openAll = parent.openAll + open;
71765
- closeAll = close + parent.closeAll;
71766
- }
71767
- return {
71768
- open,
71769
- close,
71770
- openAll,
71771
- closeAll,
71772
- parent
71773
- };
71774
- };
71775
- var createBuilder = (self, _styler, _isEmpty) => {
71776
- const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
71777
- Object.setPrototypeOf(builder, proto);
71778
- builder[GENERATOR] = self;
71779
- builder[STYLER] = _styler;
71780
- builder[IS_EMPTY] = _isEmpty;
71781
- return builder;
71782
- };
71783
- var applyStyle = (self, string3) => {
71784
- if (self.level <= 0 || !string3) {
71785
- return self[IS_EMPTY] ? "" : string3;
71786
- }
71787
- let styler = self[STYLER];
71788
- if (styler === void 0) {
71789
- return string3;
71790
- }
71791
- const { openAll, closeAll } = styler;
71792
- if (string3.includes("\x1B")) {
71793
- while (styler !== void 0) {
71794
- string3 = stringReplaceAll(string3, styler.close, styler.open);
71795
- styler = styler.parent;
71796
- }
71797
- }
71798
- const lfIndex = string3.indexOf("\n");
71799
- if (lfIndex !== -1) {
71800
- string3 = stringEncaseCRLFWithFirstIndex(string3, closeAll, openAll, lfIndex);
71801
- }
71802
- return openAll + string3 + closeAll;
71803
- };
71804
- Object.defineProperties(createChalk.prototype, styles2);
71805
- var chalk = createChalk();
71806
- var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
71807
- var source_default = chalk;
71808
-
71809
- // src/utils/logging.ts
71810
- function info(msg) {
71811
- console.error(source_default.blue("==>") + " " + msg);
71812
- }
71813
- function success(msg) {
71814
- console.error(source_default.green("\u2713") + " " + msg);
71815
- }
71816
- function warn(msg) {
71817
- console.error(source_default.yellow("\u26A0") + " " + msg);
71818
- }
71819
- function error(msg) {
71820
- console.error(source_default.red("\u2717") + " " + msg);
71821
- }
71822
- function header(msg) {
71823
- console.error("\n" + source_default.bold(msg));
71824
- }
71825
- function divider() {
71826
- console.error(source_default.dim("\u2500".repeat(60)));
71827
- }
71888
+ init_logging();
71828
71889
 
71829
71890
  // src/utils/paths.ts
71830
71891
  var fs24 = __toESM(require("fs"));
@@ -72067,6 +72128,7 @@ async function askYesNo(question) {
72067
72128
  }
72068
72129
 
72069
72130
  // src/cli/commands/agents.ts
72131
+ init_logging();
72070
72132
  var targetsOption = (y2) => y2.option("repo", { type: "string", default: ".", describe: "Path to the repository" }).option("claude", { type: "boolean", default: false, describe: "Target Claude Code (.claude/skills/)" }).option("cursor", { type: "boolean", default: false, describe: "Target Cursor (.cursor/commands/)" }).option("codex", { type: "boolean", default: false, describe: "Target Codex CLI (~/.codex/prompts/, global)" }).option("agents", {
72071
72133
  type: "string",
72072
72134
  describe: `Comma-separated targets (${AGENT_SKILL_TARGETS.join(",")}); alternative to the per-agent flags`
@@ -72157,6 +72219,7 @@ var path43 = __toESM(require("path"));
72157
72219
  var fs28 = __toESM(require("fs"));
72158
72220
  var path34 = __toESM(require("path"));
72159
72221
  init_file_ops();
72222
+ init_logging();
72160
72223
 
72161
72224
  // src/core/gitignore.ts
72162
72225
  var fs26 = __toESM(require("fs"));
@@ -75268,12 +75331,14 @@ var fs31 = __toESM(require("fs"));
75268
75331
  var path36 = __toESM(require("path"));
75269
75332
  var readline3 = __toESM(require("readline"));
75270
75333
  init_file_ops();
75334
+ init_logging();
75271
75335
 
75272
75336
  // src/harness/agent-md.ts
75273
75337
  var fs30 = __toESM(require("fs"));
75274
75338
  var path35 = __toESM(require("path"));
75275
75339
  var readline2 = __toESM(require("readline"));
75276
75340
  init_file_ops();
75341
+ init_logging();
75277
75342
  init_manifest();
75278
75343
  var AGENT_MD_PROPOSAL = "AGENT.md.proposed";
75279
75344
  var AGENT_MD_PROPOSAL_META = "AGENT.md.proposed.meta.json";
@@ -75609,6 +75674,7 @@ async function askUser(question, options) {
75609
75674
  }
75610
75675
 
75611
75676
  // src/llm/authoring-agent.ts
75677
+ init_logging();
75612
75678
  init_manifest();
75613
75679
  async function authorHarness(repoPath, apiKey, options = {}) {
75614
75680
  const client = new sdk_default({ apiKey });
@@ -76040,6 +76106,7 @@ init_manifest();
76040
76106
  var fs36 = __toESM(require("fs"));
76041
76107
  var path40 = __toESM(require("path"));
76042
76108
  init_zod();
76109
+ init_logging();
76043
76110
 
76044
76111
  // src/harness/parser.ts
76045
76112
  var fs35 = __toESM(require("fs"));
@@ -77111,6 +77178,7 @@ function copyTextToClipboard(text) {
77111
77178
 
77112
77179
  // src/harness/adaptation-prompt.ts
77113
77180
  init_file_ops();
77181
+ init_logging();
77114
77182
  init_manifest();
77115
77183
  var ADAPTATION_PROMPT_FILE = "ADAPT-PROMPT.md";
77116
77184
  var PROFILE_HINTS = {
@@ -77204,6 +77272,7 @@ var fs42 = __toESM(require("fs"));
77204
77272
  var path46 = __toESM(require("path"));
77205
77273
  var readline5 = __toESM(require("readline"));
77206
77274
  init_file_ops();
77275
+ init_logging();
77207
77276
  var CURSOR_RULE_RELATIVE_PATH = ".cursor/rules/har-workflow.mdc";
77208
77277
  function getCursorRulePath(repoPath) {
77209
77278
  return path46.join(repoPath, CURSOR_RULE_RELATIVE_PATH);
@@ -78259,6 +78328,7 @@ async function recordCommitAssociation(cwd) {
78259
78328
 
78260
78329
  // src/core/commit-gate-onboarding.ts
78261
78330
  init_stages();
78331
+ init_logging();
78262
78332
  function askYesNo5(question) {
78263
78333
  const rl = readline6.createInterface({ input: process.stdin, output: process.stderr });
78264
78334
  return new Promise((resolve47) => {
@@ -78357,6 +78427,7 @@ function writeOnboardingPreferences(overrides) {
78357
78427
  init_schema2();
78358
78428
  init_file_ops();
78359
78429
  init_validation();
78430
+ init_logging();
78360
78431
 
78361
78432
  // src/cli/help-text.ts
78362
78433
  var HAR_ROOT_EPILOG = `First time in a repo:
@@ -81988,6 +82059,7 @@ async function resetMissionControlFromCli(options = {}) {
81988
82059
  }
81989
82060
 
81990
82061
  // src/cli/commands/control.ts
82062
+ init_logging();
81991
82063
  init_control_registry();
81992
82064
  var controlCommand = {
81993
82065
  command: "control <subcommand>",
@@ -82502,6 +82574,7 @@ function claudeGuardInstalled(repoPath) {
82502
82574
  }
82503
82575
 
82504
82576
  // src/cli/commands/hooks.ts
82577
+ init_logging();
82505
82578
  function repoOption(y2) {
82506
82579
  return y2.option("repo", { type: "string", default: ".", describe: "Path to the repository" });
82507
82580
  }
@@ -90345,6 +90418,7 @@ init_control_sync();
90345
90418
  init_otel_hooks();
90346
90419
  init_telemetry_config();
90347
90420
  init_stages();
90421
+ init_logging();
90348
90422
  var ONBOARDING_GUIDE_STEPS = [
90349
90423
  {
90350
90424
  title: "What HAR is",
@@ -90588,6 +90662,7 @@ async function finalizeOnboardingAdaptation(options) {
90588
90662
  }
90589
90663
 
90590
90664
  // src/cli/commands/onboard.ts
90665
+ init_logging();
90591
90666
  function parsePluginsFlag(raw) {
90592
90667
  if (raw === void 0) return void 0;
90593
90668
  if (raw === false) return [];
@@ -90898,6 +90973,7 @@ var onboardCommand = {
90898
90973
  };
90899
90974
 
90900
90975
  // src/cli/commands/preferences.ts
90976
+ init_logging();
90901
90977
  function parseAgents(raw) {
90902
90978
  if (raw === "auto") return "auto";
90903
90979
  if (raw === "none") return [];
@@ -91021,6 +91097,7 @@ init_otel_hooks();
91021
91097
  init_slot_registry();
91022
91098
  init_telemetry_config();
91023
91099
  init_telemetry_env();
91100
+ init_logging();
91024
91101
  function printSignals() {
91025
91102
  info("Collected when enabled (local Mission Control only):");
91026
91103
  for (const signal of TELEMETRY_SIGNALS) {