ccstatusline 2.2.1 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/dist/ccstatusline.js +1126 -12
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -46,13 +46,14 @@
|
|
|
46
46
|
|
|
47
47
|
## 🆕 Recent Updates
|
|
48
48
|
|
|
49
|
-
### v2.2.0 - v2.2.
|
|
49
|
+
### v2.2.0 - v2.2.2 - Token Speed + Skills widget updates
|
|
50
50
|
|
|
51
51
|
- **🚀 New Token Speed widgets** - Added three widgets: **Input Speed**, **Output Speed**, and **Total Speed**.
|
|
52
52
|
- Each speed widget supports a configurable window of `0-120` seconds in the widget editor (`w` key).
|
|
53
53
|
- `0` disables window mode and uses a full-session average speed.
|
|
54
54
|
- `1-120` calculates recent speed over the selected rolling window.
|
|
55
55
|
- **🧩 New Skills widget controls (v2.2.1)** - Added configurable Skills modes (last/count/list), optional hide-when-empty behavior, and list-size limiting with most-recent-first ordering.
|
|
56
|
+
- **🌐 Usage API proxy support (v2.2.2)** - Usage widgets honor the uppercase `HTTPS_PROXY` environment variable for their direct API call to Anthropic.
|
|
56
57
|
- **🤝 Better subagent-aware speed reporting** - Token speed calculations continue to include referenced subagent activity so displayed speeds better reflect actual concurrent work.
|
|
57
58
|
|
|
58
59
|
### v2.1.0 - v2.1.10 - Usage widgets, links, new git insertions / deletions widgets, and reliability fixes
|
|
@@ -203,6 +204,8 @@ The interactive configuration tool provides a terminal UI where you can:
|
|
|
203
204
|
> $env:CLAUDE_CONFIG_DIR="C:\custom\path\.claude"
|
|
204
205
|
> ```
|
|
205
206
|
|
|
207
|
+
> 🌐 **Usage API proxy:** Usage widgets honor the uppercase `HTTPS_PROXY` environment variable for their direct API call to Anthropic.
|
|
208
|
+
|
|
206
209
|
### Claude Code settings.json format
|
|
207
210
|
|
|
208
211
|
When you install from the TUI, ccstatusline writes a `statusLine` command object to your Claude Code settings:
|
|
@@ -673,9 +676,12 @@ bun run example
|
|
|
673
676
|
# Run tests
|
|
674
677
|
bun test
|
|
675
678
|
|
|
676
|
-
# Run typecheck + eslint
|
|
679
|
+
# Run typecheck + eslint checks without modifying files
|
|
677
680
|
bun run lint
|
|
678
681
|
|
|
682
|
+
# Apply ESLint auto-fixes intentionally
|
|
683
|
+
bun run lint:fix
|
|
684
|
+
|
|
679
685
|
# Build for distribution
|
|
680
686
|
bun run build
|
|
681
687
|
|
package/dist/ccstatusline.js
CHANGED
|
@@ -56103,7 +56103,7 @@ function getTerminalWidth() {
|
|
|
56103
56103
|
function canDetectTerminalWidth() {
|
|
56104
56104
|
return probeTerminalWidth() !== null;
|
|
56105
56105
|
}
|
|
56106
|
-
var __dirname = "/Users/sirmalloc/Projects/Personal/ccstatusline/src/utils", PACKAGE_VERSION = "2.2.
|
|
56106
|
+
var __dirname = "/Users/sirmalloc/Projects/Personal/ccstatusline/src/utils", PACKAGE_VERSION = "2.2.2";
|
|
56107
56107
|
var init_terminal = () => {};
|
|
56108
56108
|
|
|
56109
56109
|
// src/utils/renderer.ts
|
|
@@ -57841,6 +57841,1098 @@ var init_CustomCommand = __esm(async () => {
|
|
|
57841
57841
|
jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
|
|
57842
57842
|
});
|
|
57843
57843
|
|
|
57844
|
+
// node_modules/ms/index.js
|
|
57845
|
+
var require_ms = __commonJS((exports, module) => {
|
|
57846
|
+
var s = 1000;
|
|
57847
|
+
var m = s * 60;
|
|
57848
|
+
var h = m * 60;
|
|
57849
|
+
var d = h * 24;
|
|
57850
|
+
var w = d * 7;
|
|
57851
|
+
var y = d * 365.25;
|
|
57852
|
+
module.exports = function(val, options) {
|
|
57853
|
+
options = options || {};
|
|
57854
|
+
var type = typeof val;
|
|
57855
|
+
if (type === "string" && val.length > 0) {
|
|
57856
|
+
return parse5(val);
|
|
57857
|
+
} else if (type === "number" && isFinite(val)) {
|
|
57858
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
57859
|
+
}
|
|
57860
|
+
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
|
|
57861
|
+
};
|
|
57862
|
+
function parse5(str) {
|
|
57863
|
+
str = String(str);
|
|
57864
|
+
if (str.length > 100) {
|
|
57865
|
+
return;
|
|
57866
|
+
}
|
|
57867
|
+
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(str);
|
|
57868
|
+
if (!match) {
|
|
57869
|
+
return;
|
|
57870
|
+
}
|
|
57871
|
+
var n = parseFloat(match[1]);
|
|
57872
|
+
var type = (match[2] || "ms").toLowerCase();
|
|
57873
|
+
switch (type) {
|
|
57874
|
+
case "years":
|
|
57875
|
+
case "year":
|
|
57876
|
+
case "yrs":
|
|
57877
|
+
case "yr":
|
|
57878
|
+
case "y":
|
|
57879
|
+
return n * y;
|
|
57880
|
+
case "weeks":
|
|
57881
|
+
case "week":
|
|
57882
|
+
case "w":
|
|
57883
|
+
return n * w;
|
|
57884
|
+
case "days":
|
|
57885
|
+
case "day":
|
|
57886
|
+
case "d":
|
|
57887
|
+
return n * d;
|
|
57888
|
+
case "hours":
|
|
57889
|
+
case "hour":
|
|
57890
|
+
case "hrs":
|
|
57891
|
+
case "hr":
|
|
57892
|
+
case "h":
|
|
57893
|
+
return n * h;
|
|
57894
|
+
case "minutes":
|
|
57895
|
+
case "minute":
|
|
57896
|
+
case "mins":
|
|
57897
|
+
case "min":
|
|
57898
|
+
case "m":
|
|
57899
|
+
return n * m;
|
|
57900
|
+
case "seconds":
|
|
57901
|
+
case "second":
|
|
57902
|
+
case "secs":
|
|
57903
|
+
case "sec":
|
|
57904
|
+
case "s":
|
|
57905
|
+
return n * s;
|
|
57906
|
+
case "milliseconds":
|
|
57907
|
+
case "millisecond":
|
|
57908
|
+
case "msecs":
|
|
57909
|
+
case "msec":
|
|
57910
|
+
case "ms":
|
|
57911
|
+
return n;
|
|
57912
|
+
default:
|
|
57913
|
+
return;
|
|
57914
|
+
}
|
|
57915
|
+
}
|
|
57916
|
+
function fmtShort(ms) {
|
|
57917
|
+
var msAbs = Math.abs(ms);
|
|
57918
|
+
if (msAbs >= d) {
|
|
57919
|
+
return Math.round(ms / d) + "d";
|
|
57920
|
+
}
|
|
57921
|
+
if (msAbs >= h) {
|
|
57922
|
+
return Math.round(ms / h) + "h";
|
|
57923
|
+
}
|
|
57924
|
+
if (msAbs >= m) {
|
|
57925
|
+
return Math.round(ms / m) + "m";
|
|
57926
|
+
}
|
|
57927
|
+
if (msAbs >= s) {
|
|
57928
|
+
return Math.round(ms / s) + "s";
|
|
57929
|
+
}
|
|
57930
|
+
return ms + "ms";
|
|
57931
|
+
}
|
|
57932
|
+
function fmtLong(ms) {
|
|
57933
|
+
var msAbs = Math.abs(ms);
|
|
57934
|
+
if (msAbs >= d) {
|
|
57935
|
+
return plural(ms, msAbs, d, "day");
|
|
57936
|
+
}
|
|
57937
|
+
if (msAbs >= h) {
|
|
57938
|
+
return plural(ms, msAbs, h, "hour");
|
|
57939
|
+
}
|
|
57940
|
+
if (msAbs >= m) {
|
|
57941
|
+
return plural(ms, msAbs, m, "minute");
|
|
57942
|
+
}
|
|
57943
|
+
if (msAbs >= s) {
|
|
57944
|
+
return plural(ms, msAbs, s, "second");
|
|
57945
|
+
}
|
|
57946
|
+
return ms + " ms";
|
|
57947
|
+
}
|
|
57948
|
+
function plural(ms, msAbs, n, name) {
|
|
57949
|
+
var isPlural = msAbs >= n * 1.5;
|
|
57950
|
+
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
57951
|
+
}
|
|
57952
|
+
});
|
|
57953
|
+
|
|
57954
|
+
// node_modules/https-proxy-agent/node_modules/debug/src/common.js
|
|
57955
|
+
var require_common = __commonJS((exports, module) => {
|
|
57956
|
+
function setup(env3) {
|
|
57957
|
+
createDebug.debug = createDebug;
|
|
57958
|
+
createDebug.default = createDebug;
|
|
57959
|
+
createDebug.coerce = coerce;
|
|
57960
|
+
createDebug.disable = disable;
|
|
57961
|
+
createDebug.enable = enable;
|
|
57962
|
+
createDebug.enabled = enabled;
|
|
57963
|
+
createDebug.humanize = require_ms();
|
|
57964
|
+
createDebug.destroy = destroy;
|
|
57965
|
+
Object.keys(env3).forEach((key) => {
|
|
57966
|
+
createDebug[key] = env3[key];
|
|
57967
|
+
});
|
|
57968
|
+
createDebug.names = [];
|
|
57969
|
+
createDebug.skips = [];
|
|
57970
|
+
createDebug.formatters = {};
|
|
57971
|
+
function selectColor(namespace) {
|
|
57972
|
+
let hash2 = 0;
|
|
57973
|
+
for (let i = 0;i < namespace.length; i++) {
|
|
57974
|
+
hash2 = (hash2 << 5) - hash2 + namespace.charCodeAt(i);
|
|
57975
|
+
hash2 |= 0;
|
|
57976
|
+
}
|
|
57977
|
+
return createDebug.colors[Math.abs(hash2) % createDebug.colors.length];
|
|
57978
|
+
}
|
|
57979
|
+
createDebug.selectColor = selectColor;
|
|
57980
|
+
function createDebug(namespace) {
|
|
57981
|
+
let prevTime;
|
|
57982
|
+
let enableOverride = null;
|
|
57983
|
+
let namespacesCache;
|
|
57984
|
+
let enabledCache;
|
|
57985
|
+
function debug(...args) {
|
|
57986
|
+
if (!debug.enabled) {
|
|
57987
|
+
return;
|
|
57988
|
+
}
|
|
57989
|
+
const self2 = debug;
|
|
57990
|
+
const curr = Number(new Date);
|
|
57991
|
+
const ms = curr - (prevTime || curr);
|
|
57992
|
+
self2.diff = ms;
|
|
57993
|
+
self2.prev = prevTime;
|
|
57994
|
+
self2.curr = curr;
|
|
57995
|
+
prevTime = curr;
|
|
57996
|
+
args[0] = createDebug.coerce(args[0]);
|
|
57997
|
+
if (typeof args[0] !== "string") {
|
|
57998
|
+
args.unshift("%O");
|
|
57999
|
+
}
|
|
58000
|
+
let index = 0;
|
|
58001
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
58002
|
+
if (match === "%%") {
|
|
58003
|
+
return "%";
|
|
58004
|
+
}
|
|
58005
|
+
index++;
|
|
58006
|
+
const formatter = createDebug.formatters[format];
|
|
58007
|
+
if (typeof formatter === "function") {
|
|
58008
|
+
const val = args[index];
|
|
58009
|
+
match = formatter.call(self2, val);
|
|
58010
|
+
args.splice(index, 1);
|
|
58011
|
+
index--;
|
|
58012
|
+
}
|
|
58013
|
+
return match;
|
|
58014
|
+
});
|
|
58015
|
+
createDebug.formatArgs.call(self2, args);
|
|
58016
|
+
const logFn = self2.log || createDebug.log;
|
|
58017
|
+
logFn.apply(self2, args);
|
|
58018
|
+
}
|
|
58019
|
+
debug.namespace = namespace;
|
|
58020
|
+
debug.useColors = createDebug.useColors();
|
|
58021
|
+
debug.color = createDebug.selectColor(namespace);
|
|
58022
|
+
debug.extend = extend2;
|
|
58023
|
+
debug.destroy = createDebug.destroy;
|
|
58024
|
+
Object.defineProperty(debug, "enabled", {
|
|
58025
|
+
enumerable: true,
|
|
58026
|
+
configurable: false,
|
|
58027
|
+
get: () => {
|
|
58028
|
+
if (enableOverride !== null) {
|
|
58029
|
+
return enableOverride;
|
|
58030
|
+
}
|
|
58031
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
58032
|
+
namespacesCache = createDebug.namespaces;
|
|
58033
|
+
enabledCache = createDebug.enabled(namespace);
|
|
58034
|
+
}
|
|
58035
|
+
return enabledCache;
|
|
58036
|
+
},
|
|
58037
|
+
set: (v) => {
|
|
58038
|
+
enableOverride = v;
|
|
58039
|
+
}
|
|
58040
|
+
});
|
|
58041
|
+
if (typeof createDebug.init === "function") {
|
|
58042
|
+
createDebug.init(debug);
|
|
58043
|
+
}
|
|
58044
|
+
return debug;
|
|
58045
|
+
}
|
|
58046
|
+
function extend2(namespace, delimiter) {
|
|
58047
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
58048
|
+
newDebug.log = this.log;
|
|
58049
|
+
return newDebug;
|
|
58050
|
+
}
|
|
58051
|
+
function enable(namespaces) {
|
|
58052
|
+
createDebug.save(namespaces);
|
|
58053
|
+
createDebug.namespaces = namespaces;
|
|
58054
|
+
createDebug.names = [];
|
|
58055
|
+
createDebug.skips = [];
|
|
58056
|
+
const split2 = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
58057
|
+
for (const ns of split2) {
|
|
58058
|
+
if (ns[0] === "-") {
|
|
58059
|
+
createDebug.skips.push(ns.slice(1));
|
|
58060
|
+
} else {
|
|
58061
|
+
createDebug.names.push(ns);
|
|
58062
|
+
}
|
|
58063
|
+
}
|
|
58064
|
+
}
|
|
58065
|
+
function matchesTemplate(search, template2) {
|
|
58066
|
+
let searchIndex = 0;
|
|
58067
|
+
let templateIndex = 0;
|
|
58068
|
+
let starIndex = -1;
|
|
58069
|
+
let matchIndex = 0;
|
|
58070
|
+
while (searchIndex < search.length) {
|
|
58071
|
+
if (templateIndex < template2.length && (template2[templateIndex] === search[searchIndex] || template2[templateIndex] === "*")) {
|
|
58072
|
+
if (template2[templateIndex] === "*") {
|
|
58073
|
+
starIndex = templateIndex;
|
|
58074
|
+
matchIndex = searchIndex;
|
|
58075
|
+
templateIndex++;
|
|
58076
|
+
} else {
|
|
58077
|
+
searchIndex++;
|
|
58078
|
+
templateIndex++;
|
|
58079
|
+
}
|
|
58080
|
+
} else if (starIndex !== -1) {
|
|
58081
|
+
templateIndex = starIndex + 1;
|
|
58082
|
+
matchIndex++;
|
|
58083
|
+
searchIndex = matchIndex;
|
|
58084
|
+
} else {
|
|
58085
|
+
return false;
|
|
58086
|
+
}
|
|
58087
|
+
}
|
|
58088
|
+
while (templateIndex < template2.length && template2[templateIndex] === "*") {
|
|
58089
|
+
templateIndex++;
|
|
58090
|
+
}
|
|
58091
|
+
return templateIndex === template2.length;
|
|
58092
|
+
}
|
|
58093
|
+
function disable() {
|
|
58094
|
+
const namespaces = [
|
|
58095
|
+
...createDebug.names,
|
|
58096
|
+
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
58097
|
+
].join(",");
|
|
58098
|
+
createDebug.enable("");
|
|
58099
|
+
return namespaces;
|
|
58100
|
+
}
|
|
58101
|
+
function enabled(name) {
|
|
58102
|
+
for (const skip of createDebug.skips) {
|
|
58103
|
+
if (matchesTemplate(name, skip)) {
|
|
58104
|
+
return false;
|
|
58105
|
+
}
|
|
58106
|
+
}
|
|
58107
|
+
for (const ns of createDebug.names) {
|
|
58108
|
+
if (matchesTemplate(name, ns)) {
|
|
58109
|
+
return true;
|
|
58110
|
+
}
|
|
58111
|
+
}
|
|
58112
|
+
return false;
|
|
58113
|
+
}
|
|
58114
|
+
function coerce(val) {
|
|
58115
|
+
if (val instanceof Error) {
|
|
58116
|
+
return val.stack || val.message;
|
|
58117
|
+
}
|
|
58118
|
+
return val;
|
|
58119
|
+
}
|
|
58120
|
+
function destroy() {
|
|
58121
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
58122
|
+
}
|
|
58123
|
+
createDebug.enable(createDebug.load());
|
|
58124
|
+
return createDebug;
|
|
58125
|
+
}
|
|
58126
|
+
module.exports = setup;
|
|
58127
|
+
});
|
|
58128
|
+
|
|
58129
|
+
// node_modules/https-proxy-agent/node_modules/debug/src/browser.js
|
|
58130
|
+
var require_browser = __commonJS((exports, module) => {
|
|
58131
|
+
exports.formatArgs = formatArgs;
|
|
58132
|
+
exports.save = save;
|
|
58133
|
+
exports.load = load;
|
|
58134
|
+
exports.useColors = useColors;
|
|
58135
|
+
exports.storage = localstorage();
|
|
58136
|
+
exports.destroy = (() => {
|
|
58137
|
+
let warned = false;
|
|
58138
|
+
return () => {
|
|
58139
|
+
if (!warned) {
|
|
58140
|
+
warned = true;
|
|
58141
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
58142
|
+
}
|
|
58143
|
+
};
|
|
58144
|
+
})();
|
|
58145
|
+
exports.colors = [
|
|
58146
|
+
"#0000CC",
|
|
58147
|
+
"#0000FF",
|
|
58148
|
+
"#0033CC",
|
|
58149
|
+
"#0033FF",
|
|
58150
|
+
"#0066CC",
|
|
58151
|
+
"#0066FF",
|
|
58152
|
+
"#0099CC",
|
|
58153
|
+
"#0099FF",
|
|
58154
|
+
"#00CC00",
|
|
58155
|
+
"#00CC33",
|
|
58156
|
+
"#00CC66",
|
|
58157
|
+
"#00CC99",
|
|
58158
|
+
"#00CCCC",
|
|
58159
|
+
"#00CCFF",
|
|
58160
|
+
"#3300CC",
|
|
58161
|
+
"#3300FF",
|
|
58162
|
+
"#3333CC",
|
|
58163
|
+
"#3333FF",
|
|
58164
|
+
"#3366CC",
|
|
58165
|
+
"#3366FF",
|
|
58166
|
+
"#3399CC",
|
|
58167
|
+
"#3399FF",
|
|
58168
|
+
"#33CC00",
|
|
58169
|
+
"#33CC33",
|
|
58170
|
+
"#33CC66",
|
|
58171
|
+
"#33CC99",
|
|
58172
|
+
"#33CCCC",
|
|
58173
|
+
"#33CCFF",
|
|
58174
|
+
"#6600CC",
|
|
58175
|
+
"#6600FF",
|
|
58176
|
+
"#6633CC",
|
|
58177
|
+
"#6633FF",
|
|
58178
|
+
"#66CC00",
|
|
58179
|
+
"#66CC33",
|
|
58180
|
+
"#9900CC",
|
|
58181
|
+
"#9900FF",
|
|
58182
|
+
"#9933CC",
|
|
58183
|
+
"#9933FF",
|
|
58184
|
+
"#99CC00",
|
|
58185
|
+
"#99CC33",
|
|
58186
|
+
"#CC0000",
|
|
58187
|
+
"#CC0033",
|
|
58188
|
+
"#CC0066",
|
|
58189
|
+
"#CC0099",
|
|
58190
|
+
"#CC00CC",
|
|
58191
|
+
"#CC00FF",
|
|
58192
|
+
"#CC3300",
|
|
58193
|
+
"#CC3333",
|
|
58194
|
+
"#CC3366",
|
|
58195
|
+
"#CC3399",
|
|
58196
|
+
"#CC33CC",
|
|
58197
|
+
"#CC33FF",
|
|
58198
|
+
"#CC6600",
|
|
58199
|
+
"#CC6633",
|
|
58200
|
+
"#CC9900",
|
|
58201
|
+
"#CC9933",
|
|
58202
|
+
"#CCCC00",
|
|
58203
|
+
"#CCCC33",
|
|
58204
|
+
"#FF0000",
|
|
58205
|
+
"#FF0033",
|
|
58206
|
+
"#FF0066",
|
|
58207
|
+
"#FF0099",
|
|
58208
|
+
"#FF00CC",
|
|
58209
|
+
"#FF00FF",
|
|
58210
|
+
"#FF3300",
|
|
58211
|
+
"#FF3333",
|
|
58212
|
+
"#FF3366",
|
|
58213
|
+
"#FF3399",
|
|
58214
|
+
"#FF33CC",
|
|
58215
|
+
"#FF33FF",
|
|
58216
|
+
"#FF6600",
|
|
58217
|
+
"#FF6633",
|
|
58218
|
+
"#FF9900",
|
|
58219
|
+
"#FF9933",
|
|
58220
|
+
"#FFCC00",
|
|
58221
|
+
"#FFCC33"
|
|
58222
|
+
];
|
|
58223
|
+
function useColors() {
|
|
58224
|
+
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
58225
|
+
return true;
|
|
58226
|
+
}
|
|
58227
|
+
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
58228
|
+
return false;
|
|
58229
|
+
}
|
|
58230
|
+
let m;
|
|
58231
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
58232
|
+
}
|
|
58233
|
+
function formatArgs(args) {
|
|
58234
|
+
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
58235
|
+
if (!this.useColors) {
|
|
58236
|
+
return;
|
|
58237
|
+
}
|
|
58238
|
+
const c = "color: " + this.color;
|
|
58239
|
+
args.splice(1, 0, c, "color: inherit");
|
|
58240
|
+
let index = 0;
|
|
58241
|
+
let lastC = 0;
|
|
58242
|
+
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
58243
|
+
if (match === "%%") {
|
|
58244
|
+
return;
|
|
58245
|
+
}
|
|
58246
|
+
index++;
|
|
58247
|
+
if (match === "%c") {
|
|
58248
|
+
lastC = index;
|
|
58249
|
+
}
|
|
58250
|
+
});
|
|
58251
|
+
args.splice(lastC, 0, c);
|
|
58252
|
+
}
|
|
58253
|
+
exports.log = console.debug || console.log || (() => {});
|
|
58254
|
+
function save(namespaces) {
|
|
58255
|
+
try {
|
|
58256
|
+
if (namespaces) {
|
|
58257
|
+
exports.storage.setItem("debug", namespaces);
|
|
58258
|
+
} else {
|
|
58259
|
+
exports.storage.removeItem("debug");
|
|
58260
|
+
}
|
|
58261
|
+
} catch (error48) {}
|
|
58262
|
+
}
|
|
58263
|
+
function load() {
|
|
58264
|
+
let r;
|
|
58265
|
+
try {
|
|
58266
|
+
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
58267
|
+
} catch (error48) {}
|
|
58268
|
+
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
58269
|
+
r = process.env.DEBUG;
|
|
58270
|
+
}
|
|
58271
|
+
return r;
|
|
58272
|
+
}
|
|
58273
|
+
function localstorage() {
|
|
58274
|
+
try {
|
|
58275
|
+
return localStorage;
|
|
58276
|
+
} catch (error48) {}
|
|
58277
|
+
}
|
|
58278
|
+
module.exports = require_common()(exports);
|
|
58279
|
+
var { formatters } = module.exports;
|
|
58280
|
+
formatters.j = function(v) {
|
|
58281
|
+
try {
|
|
58282
|
+
return JSON.stringify(v);
|
|
58283
|
+
} catch (error48) {
|
|
58284
|
+
return "[UnexpectedJSONParseError]: " + error48.message;
|
|
58285
|
+
}
|
|
58286
|
+
};
|
|
58287
|
+
});
|
|
58288
|
+
|
|
58289
|
+
// node_modules/https-proxy-agent/node_modules/debug/src/node.js
|
|
58290
|
+
var require_node = __commonJS((exports, module) => {
|
|
58291
|
+
var tty2 = __require("tty");
|
|
58292
|
+
var util = __require("util");
|
|
58293
|
+
exports.init = init;
|
|
58294
|
+
exports.log = log;
|
|
58295
|
+
exports.formatArgs = formatArgs;
|
|
58296
|
+
exports.save = save;
|
|
58297
|
+
exports.load = load;
|
|
58298
|
+
exports.useColors = useColors;
|
|
58299
|
+
exports.destroy = util.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
58300
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
58301
|
+
try {
|
|
58302
|
+
const supportsColor2 = require_supports_color();
|
|
58303
|
+
if (supportsColor2 && (supportsColor2.stderr || supportsColor2).level >= 2) {
|
|
58304
|
+
exports.colors = [
|
|
58305
|
+
20,
|
|
58306
|
+
21,
|
|
58307
|
+
26,
|
|
58308
|
+
27,
|
|
58309
|
+
32,
|
|
58310
|
+
33,
|
|
58311
|
+
38,
|
|
58312
|
+
39,
|
|
58313
|
+
40,
|
|
58314
|
+
41,
|
|
58315
|
+
42,
|
|
58316
|
+
43,
|
|
58317
|
+
44,
|
|
58318
|
+
45,
|
|
58319
|
+
56,
|
|
58320
|
+
57,
|
|
58321
|
+
62,
|
|
58322
|
+
63,
|
|
58323
|
+
68,
|
|
58324
|
+
69,
|
|
58325
|
+
74,
|
|
58326
|
+
75,
|
|
58327
|
+
76,
|
|
58328
|
+
77,
|
|
58329
|
+
78,
|
|
58330
|
+
79,
|
|
58331
|
+
80,
|
|
58332
|
+
81,
|
|
58333
|
+
92,
|
|
58334
|
+
93,
|
|
58335
|
+
98,
|
|
58336
|
+
99,
|
|
58337
|
+
112,
|
|
58338
|
+
113,
|
|
58339
|
+
128,
|
|
58340
|
+
129,
|
|
58341
|
+
134,
|
|
58342
|
+
135,
|
|
58343
|
+
148,
|
|
58344
|
+
149,
|
|
58345
|
+
160,
|
|
58346
|
+
161,
|
|
58347
|
+
162,
|
|
58348
|
+
163,
|
|
58349
|
+
164,
|
|
58350
|
+
165,
|
|
58351
|
+
166,
|
|
58352
|
+
167,
|
|
58353
|
+
168,
|
|
58354
|
+
169,
|
|
58355
|
+
170,
|
|
58356
|
+
171,
|
|
58357
|
+
172,
|
|
58358
|
+
173,
|
|
58359
|
+
178,
|
|
58360
|
+
179,
|
|
58361
|
+
184,
|
|
58362
|
+
185,
|
|
58363
|
+
196,
|
|
58364
|
+
197,
|
|
58365
|
+
198,
|
|
58366
|
+
199,
|
|
58367
|
+
200,
|
|
58368
|
+
201,
|
|
58369
|
+
202,
|
|
58370
|
+
203,
|
|
58371
|
+
204,
|
|
58372
|
+
205,
|
|
58373
|
+
206,
|
|
58374
|
+
207,
|
|
58375
|
+
208,
|
|
58376
|
+
209,
|
|
58377
|
+
214,
|
|
58378
|
+
215,
|
|
58379
|
+
220,
|
|
58380
|
+
221
|
|
58381
|
+
];
|
|
58382
|
+
}
|
|
58383
|
+
} catch (error48) {}
|
|
58384
|
+
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
58385
|
+
return /^debug_/i.test(key);
|
|
58386
|
+
}).reduce((obj, key) => {
|
|
58387
|
+
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
58388
|
+
return k.toUpperCase();
|
|
58389
|
+
});
|
|
58390
|
+
let val = process.env[key];
|
|
58391
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
58392
|
+
val = true;
|
|
58393
|
+
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
58394
|
+
val = false;
|
|
58395
|
+
} else if (val === "null") {
|
|
58396
|
+
val = null;
|
|
58397
|
+
} else {
|
|
58398
|
+
val = Number(val);
|
|
58399
|
+
}
|
|
58400
|
+
obj[prop] = val;
|
|
58401
|
+
return obj;
|
|
58402
|
+
}, {});
|
|
58403
|
+
function useColors() {
|
|
58404
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty2.isatty(process.stderr.fd);
|
|
58405
|
+
}
|
|
58406
|
+
function formatArgs(args) {
|
|
58407
|
+
const { namespace: name, useColors: useColors2 } = this;
|
|
58408
|
+
if (useColors2) {
|
|
58409
|
+
const c = this.color;
|
|
58410
|
+
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
58411
|
+
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
58412
|
+
args[0] = prefix + args[0].split(`
|
|
58413
|
+
`).join(`
|
|
58414
|
+
` + prefix);
|
|
58415
|
+
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
58416
|
+
} else {
|
|
58417
|
+
args[0] = getDate() + name + " " + args[0];
|
|
58418
|
+
}
|
|
58419
|
+
}
|
|
58420
|
+
function getDate() {
|
|
58421
|
+
if (exports.inspectOpts.hideDate) {
|
|
58422
|
+
return "";
|
|
58423
|
+
}
|
|
58424
|
+
return new Date().toISOString() + " ";
|
|
58425
|
+
}
|
|
58426
|
+
function log(...args) {
|
|
58427
|
+
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + `
|
|
58428
|
+
`);
|
|
58429
|
+
}
|
|
58430
|
+
function save(namespaces) {
|
|
58431
|
+
if (namespaces) {
|
|
58432
|
+
process.env.DEBUG = namespaces;
|
|
58433
|
+
} else {
|
|
58434
|
+
delete process.env.DEBUG;
|
|
58435
|
+
}
|
|
58436
|
+
}
|
|
58437
|
+
function load() {
|
|
58438
|
+
return process.env.DEBUG;
|
|
58439
|
+
}
|
|
58440
|
+
function init(debug) {
|
|
58441
|
+
debug.inspectOpts = {};
|
|
58442
|
+
const keys2 = Object.keys(exports.inspectOpts);
|
|
58443
|
+
for (let i = 0;i < keys2.length; i++) {
|
|
58444
|
+
debug.inspectOpts[keys2[i]] = exports.inspectOpts[keys2[i]];
|
|
58445
|
+
}
|
|
58446
|
+
}
|
|
58447
|
+
module.exports = require_common()(exports);
|
|
58448
|
+
var { formatters } = module.exports;
|
|
58449
|
+
formatters.o = function(v) {
|
|
58450
|
+
this.inspectOpts.colors = this.useColors;
|
|
58451
|
+
return util.inspect(v, this.inspectOpts).split(`
|
|
58452
|
+
`).map((str) => str.trim()).join(" ");
|
|
58453
|
+
};
|
|
58454
|
+
formatters.O = function(v) {
|
|
58455
|
+
this.inspectOpts.colors = this.useColors;
|
|
58456
|
+
return util.inspect(v, this.inspectOpts);
|
|
58457
|
+
};
|
|
58458
|
+
});
|
|
58459
|
+
|
|
58460
|
+
// node_modules/https-proxy-agent/node_modules/debug/src/index.js
|
|
58461
|
+
var require_src = __commonJS((exports, module) => {
|
|
58462
|
+
if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
|
|
58463
|
+
module.exports = require_browser();
|
|
58464
|
+
} else {
|
|
58465
|
+
module.exports = require_node();
|
|
58466
|
+
}
|
|
58467
|
+
});
|
|
58468
|
+
|
|
58469
|
+
// node_modules/agent-base/dist/helpers.js
|
|
58470
|
+
var require_helpers = __commonJS((exports) => {
|
|
58471
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
58472
|
+
if (k2 === undefined)
|
|
58473
|
+
k2 = k;
|
|
58474
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
58475
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
58476
|
+
desc = { enumerable: true, get: function() {
|
|
58477
|
+
return m[k];
|
|
58478
|
+
} };
|
|
58479
|
+
}
|
|
58480
|
+
Object.defineProperty(o, k2, desc);
|
|
58481
|
+
} : function(o, m, k, k2) {
|
|
58482
|
+
if (k2 === undefined)
|
|
58483
|
+
k2 = k;
|
|
58484
|
+
o[k2] = m[k];
|
|
58485
|
+
});
|
|
58486
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
58487
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
58488
|
+
} : function(o, v) {
|
|
58489
|
+
o["default"] = v;
|
|
58490
|
+
});
|
|
58491
|
+
var __importStar = exports && exports.__importStar || function(mod) {
|
|
58492
|
+
if (mod && mod.__esModule)
|
|
58493
|
+
return mod;
|
|
58494
|
+
var result2 = {};
|
|
58495
|
+
if (mod != null) {
|
|
58496
|
+
for (var k in mod)
|
|
58497
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
58498
|
+
__createBinding(result2, mod, k);
|
|
58499
|
+
}
|
|
58500
|
+
__setModuleDefault(result2, mod);
|
|
58501
|
+
return result2;
|
|
58502
|
+
};
|
|
58503
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58504
|
+
exports.req = exports.json = exports.toBuffer = undefined;
|
|
58505
|
+
var http = __importStar(__require("http"));
|
|
58506
|
+
var https = __importStar(__require("https"));
|
|
58507
|
+
async function toBuffer(stream) {
|
|
58508
|
+
let length = 0;
|
|
58509
|
+
const chunks = [];
|
|
58510
|
+
for await (const chunk2 of stream) {
|
|
58511
|
+
length += chunk2.length;
|
|
58512
|
+
chunks.push(chunk2);
|
|
58513
|
+
}
|
|
58514
|
+
return Buffer.concat(chunks, length);
|
|
58515
|
+
}
|
|
58516
|
+
exports.toBuffer = toBuffer;
|
|
58517
|
+
async function json2(stream) {
|
|
58518
|
+
const buf = await toBuffer(stream);
|
|
58519
|
+
const str = buf.toString("utf8");
|
|
58520
|
+
try {
|
|
58521
|
+
return JSON.parse(str);
|
|
58522
|
+
} catch (_err) {
|
|
58523
|
+
const err = _err;
|
|
58524
|
+
err.message += ` (input: ${str})`;
|
|
58525
|
+
throw err;
|
|
58526
|
+
}
|
|
58527
|
+
}
|
|
58528
|
+
exports.json = json2;
|
|
58529
|
+
function req(url2, opts = {}) {
|
|
58530
|
+
const href = typeof url2 === "string" ? url2 : url2.href;
|
|
58531
|
+
const req2 = (href.startsWith("https:") ? https : http).request(url2, opts);
|
|
58532
|
+
const promise2 = new Promise((resolve, reject2) => {
|
|
58533
|
+
req2.once("response", resolve).once("error", reject2).end();
|
|
58534
|
+
});
|
|
58535
|
+
req2.then = promise2.then.bind(promise2);
|
|
58536
|
+
return req2;
|
|
58537
|
+
}
|
|
58538
|
+
exports.req = req;
|
|
58539
|
+
});
|
|
58540
|
+
|
|
58541
|
+
// node_modules/agent-base/dist/index.js
|
|
58542
|
+
var require_dist = __commonJS((exports) => {
|
|
58543
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
58544
|
+
if (k2 === undefined)
|
|
58545
|
+
k2 = k;
|
|
58546
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
58547
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
58548
|
+
desc = { enumerable: true, get: function() {
|
|
58549
|
+
return m[k];
|
|
58550
|
+
} };
|
|
58551
|
+
}
|
|
58552
|
+
Object.defineProperty(o, k2, desc);
|
|
58553
|
+
} : function(o, m, k, k2) {
|
|
58554
|
+
if (k2 === undefined)
|
|
58555
|
+
k2 = k;
|
|
58556
|
+
o[k2] = m[k];
|
|
58557
|
+
});
|
|
58558
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
58559
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
58560
|
+
} : function(o, v) {
|
|
58561
|
+
o["default"] = v;
|
|
58562
|
+
});
|
|
58563
|
+
var __importStar = exports && exports.__importStar || function(mod) {
|
|
58564
|
+
if (mod && mod.__esModule)
|
|
58565
|
+
return mod;
|
|
58566
|
+
var result2 = {};
|
|
58567
|
+
if (mod != null) {
|
|
58568
|
+
for (var k in mod)
|
|
58569
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
58570
|
+
__createBinding(result2, mod, k);
|
|
58571
|
+
}
|
|
58572
|
+
__setModuleDefault(result2, mod);
|
|
58573
|
+
return result2;
|
|
58574
|
+
};
|
|
58575
|
+
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
58576
|
+
for (var p in m)
|
|
58577
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
58578
|
+
__createBinding(exports2, m, p);
|
|
58579
|
+
};
|
|
58580
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58581
|
+
exports.Agent = undefined;
|
|
58582
|
+
var net = __importStar(__require("net"));
|
|
58583
|
+
var http = __importStar(__require("http"));
|
|
58584
|
+
var https_1 = __require("https");
|
|
58585
|
+
__exportStar(require_helpers(), exports);
|
|
58586
|
+
var INTERNAL = Symbol("AgentBaseInternalState");
|
|
58587
|
+
|
|
58588
|
+
class Agent extends http.Agent {
|
|
58589
|
+
constructor(opts) {
|
|
58590
|
+
super(opts);
|
|
58591
|
+
this[INTERNAL] = {};
|
|
58592
|
+
}
|
|
58593
|
+
isSecureEndpoint(options) {
|
|
58594
|
+
if (options) {
|
|
58595
|
+
if (typeof options.secureEndpoint === "boolean") {
|
|
58596
|
+
return options.secureEndpoint;
|
|
58597
|
+
}
|
|
58598
|
+
if (typeof options.protocol === "string") {
|
|
58599
|
+
return options.protocol === "https:";
|
|
58600
|
+
}
|
|
58601
|
+
}
|
|
58602
|
+
const { stack } = new Error;
|
|
58603
|
+
if (typeof stack !== "string")
|
|
58604
|
+
return false;
|
|
58605
|
+
return stack.split(`
|
|
58606
|
+
`).some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
|
|
58607
|
+
}
|
|
58608
|
+
incrementSockets(name) {
|
|
58609
|
+
if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
|
|
58610
|
+
return null;
|
|
58611
|
+
}
|
|
58612
|
+
if (!this.sockets[name]) {
|
|
58613
|
+
this.sockets[name] = [];
|
|
58614
|
+
}
|
|
58615
|
+
const fakeSocket = new net.Socket({ writable: false });
|
|
58616
|
+
this.sockets[name].push(fakeSocket);
|
|
58617
|
+
this.totalSocketCount++;
|
|
58618
|
+
return fakeSocket;
|
|
58619
|
+
}
|
|
58620
|
+
decrementSockets(name, socket) {
|
|
58621
|
+
if (!this.sockets[name] || socket === null) {
|
|
58622
|
+
return;
|
|
58623
|
+
}
|
|
58624
|
+
const sockets = this.sockets[name];
|
|
58625
|
+
const index = sockets.indexOf(socket);
|
|
58626
|
+
if (index !== -1) {
|
|
58627
|
+
sockets.splice(index, 1);
|
|
58628
|
+
this.totalSocketCount--;
|
|
58629
|
+
if (sockets.length === 0) {
|
|
58630
|
+
delete this.sockets[name];
|
|
58631
|
+
}
|
|
58632
|
+
}
|
|
58633
|
+
}
|
|
58634
|
+
getName(options) {
|
|
58635
|
+
const secureEndpoint = this.isSecureEndpoint(options);
|
|
58636
|
+
if (secureEndpoint) {
|
|
58637
|
+
return https_1.Agent.prototype.getName.call(this, options);
|
|
58638
|
+
}
|
|
58639
|
+
return super.getName(options);
|
|
58640
|
+
}
|
|
58641
|
+
createSocket(req, options, cb) {
|
|
58642
|
+
const connectOpts = {
|
|
58643
|
+
...options,
|
|
58644
|
+
secureEndpoint: this.isSecureEndpoint(options)
|
|
58645
|
+
};
|
|
58646
|
+
const name = this.getName(connectOpts);
|
|
58647
|
+
const fakeSocket = this.incrementSockets(name);
|
|
58648
|
+
Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
|
|
58649
|
+
this.decrementSockets(name, fakeSocket);
|
|
58650
|
+
if (socket instanceof http.Agent) {
|
|
58651
|
+
try {
|
|
58652
|
+
return socket.addRequest(req, connectOpts);
|
|
58653
|
+
} catch (err) {
|
|
58654
|
+
return cb(err);
|
|
58655
|
+
}
|
|
58656
|
+
}
|
|
58657
|
+
this[INTERNAL].currentSocket = socket;
|
|
58658
|
+
super.createSocket(req, options, cb);
|
|
58659
|
+
}, (err) => {
|
|
58660
|
+
this.decrementSockets(name, fakeSocket);
|
|
58661
|
+
cb(err);
|
|
58662
|
+
});
|
|
58663
|
+
}
|
|
58664
|
+
createConnection() {
|
|
58665
|
+
const socket = this[INTERNAL].currentSocket;
|
|
58666
|
+
this[INTERNAL].currentSocket = undefined;
|
|
58667
|
+
if (!socket) {
|
|
58668
|
+
throw new Error("No socket was returned in the `connect()` function");
|
|
58669
|
+
}
|
|
58670
|
+
return socket;
|
|
58671
|
+
}
|
|
58672
|
+
get defaultPort() {
|
|
58673
|
+
return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
|
|
58674
|
+
}
|
|
58675
|
+
set defaultPort(v) {
|
|
58676
|
+
if (this[INTERNAL]) {
|
|
58677
|
+
this[INTERNAL].defaultPort = v;
|
|
58678
|
+
}
|
|
58679
|
+
}
|
|
58680
|
+
get protocol() {
|
|
58681
|
+
return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
|
|
58682
|
+
}
|
|
58683
|
+
set protocol(v) {
|
|
58684
|
+
if (this[INTERNAL]) {
|
|
58685
|
+
this[INTERNAL].protocol = v;
|
|
58686
|
+
}
|
|
58687
|
+
}
|
|
58688
|
+
}
|
|
58689
|
+
exports.Agent = Agent;
|
|
58690
|
+
});
|
|
58691
|
+
|
|
58692
|
+
// node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
58693
|
+
var require_parse_proxy_response = __commonJS((exports) => {
|
|
58694
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
58695
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
58696
|
+
};
|
|
58697
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58698
|
+
exports.parseProxyResponse = undefined;
|
|
58699
|
+
var debug_1 = __importDefault(require_src());
|
|
58700
|
+
var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
58701
|
+
function parseProxyResponse(socket) {
|
|
58702
|
+
return new Promise((resolve, reject2) => {
|
|
58703
|
+
let buffersLength = 0;
|
|
58704
|
+
const buffers = [];
|
|
58705
|
+
function read() {
|
|
58706
|
+
const b = socket.read();
|
|
58707
|
+
if (b)
|
|
58708
|
+
ondata(b);
|
|
58709
|
+
else
|
|
58710
|
+
socket.once("readable", read);
|
|
58711
|
+
}
|
|
58712
|
+
function cleanup() {
|
|
58713
|
+
socket.removeListener("end", onend);
|
|
58714
|
+
socket.removeListener("error", onerror);
|
|
58715
|
+
socket.removeListener("readable", read);
|
|
58716
|
+
}
|
|
58717
|
+
function onend() {
|
|
58718
|
+
cleanup();
|
|
58719
|
+
debug("onend");
|
|
58720
|
+
reject2(new Error("Proxy connection ended before receiving CONNECT response"));
|
|
58721
|
+
}
|
|
58722
|
+
function onerror(err) {
|
|
58723
|
+
cleanup();
|
|
58724
|
+
debug("onerror %o", err);
|
|
58725
|
+
reject2(err);
|
|
58726
|
+
}
|
|
58727
|
+
function ondata(b) {
|
|
58728
|
+
buffers.push(b);
|
|
58729
|
+
buffersLength += b.length;
|
|
58730
|
+
const buffered = Buffer.concat(buffers, buffersLength);
|
|
58731
|
+
const endOfHeaders = buffered.indexOf(`\r
|
|
58732
|
+
\r
|
|
58733
|
+
`);
|
|
58734
|
+
if (endOfHeaders === -1) {
|
|
58735
|
+
debug("have not received end of HTTP headers yet...");
|
|
58736
|
+
read();
|
|
58737
|
+
return;
|
|
58738
|
+
}
|
|
58739
|
+
const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split(`\r
|
|
58740
|
+
`);
|
|
58741
|
+
const firstLine = headerParts.shift();
|
|
58742
|
+
if (!firstLine) {
|
|
58743
|
+
socket.destroy();
|
|
58744
|
+
return reject2(new Error("No header received from proxy CONNECT response"));
|
|
58745
|
+
}
|
|
58746
|
+
const firstLineParts = firstLine.split(" ");
|
|
58747
|
+
const statusCode = +firstLineParts[1];
|
|
58748
|
+
const statusText = firstLineParts.slice(2).join(" ");
|
|
58749
|
+
const headers = {};
|
|
58750
|
+
for (const header of headerParts) {
|
|
58751
|
+
if (!header)
|
|
58752
|
+
continue;
|
|
58753
|
+
const firstColon = header.indexOf(":");
|
|
58754
|
+
if (firstColon === -1) {
|
|
58755
|
+
socket.destroy();
|
|
58756
|
+
return reject2(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
|
|
58757
|
+
}
|
|
58758
|
+
const key = header.slice(0, firstColon).toLowerCase();
|
|
58759
|
+
const value = header.slice(firstColon + 1).trimStart();
|
|
58760
|
+
const current = headers[key];
|
|
58761
|
+
if (typeof current === "string") {
|
|
58762
|
+
headers[key] = [current, value];
|
|
58763
|
+
} else if (Array.isArray(current)) {
|
|
58764
|
+
current.push(value);
|
|
58765
|
+
} else {
|
|
58766
|
+
headers[key] = value;
|
|
58767
|
+
}
|
|
58768
|
+
}
|
|
58769
|
+
debug("got proxy server response: %o %o", firstLine, headers);
|
|
58770
|
+
cleanup();
|
|
58771
|
+
resolve({
|
|
58772
|
+
connect: {
|
|
58773
|
+
statusCode,
|
|
58774
|
+
statusText,
|
|
58775
|
+
headers
|
|
58776
|
+
},
|
|
58777
|
+
buffered
|
|
58778
|
+
});
|
|
58779
|
+
}
|
|
58780
|
+
socket.on("error", onerror);
|
|
58781
|
+
socket.on("end", onend);
|
|
58782
|
+
read();
|
|
58783
|
+
});
|
|
58784
|
+
}
|
|
58785
|
+
exports.parseProxyResponse = parseProxyResponse;
|
|
58786
|
+
});
|
|
58787
|
+
|
|
58788
|
+
// node_modules/https-proxy-agent/dist/index.js
|
|
58789
|
+
var require_dist2 = __commonJS((exports) => {
|
|
58790
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
58791
|
+
if (k2 === undefined)
|
|
58792
|
+
k2 = k;
|
|
58793
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
58794
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
58795
|
+
desc = { enumerable: true, get: function() {
|
|
58796
|
+
return m[k];
|
|
58797
|
+
} };
|
|
58798
|
+
}
|
|
58799
|
+
Object.defineProperty(o, k2, desc);
|
|
58800
|
+
} : function(o, m, k, k2) {
|
|
58801
|
+
if (k2 === undefined)
|
|
58802
|
+
k2 = k;
|
|
58803
|
+
o[k2] = m[k];
|
|
58804
|
+
});
|
|
58805
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
58806
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
58807
|
+
} : function(o, v) {
|
|
58808
|
+
o["default"] = v;
|
|
58809
|
+
});
|
|
58810
|
+
var __importStar = exports && exports.__importStar || function(mod) {
|
|
58811
|
+
if (mod && mod.__esModule)
|
|
58812
|
+
return mod;
|
|
58813
|
+
var result2 = {};
|
|
58814
|
+
if (mod != null) {
|
|
58815
|
+
for (var k in mod)
|
|
58816
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
58817
|
+
__createBinding(result2, mod, k);
|
|
58818
|
+
}
|
|
58819
|
+
__setModuleDefault(result2, mod);
|
|
58820
|
+
return result2;
|
|
58821
|
+
};
|
|
58822
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
58823
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
58824
|
+
};
|
|
58825
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58826
|
+
exports.HttpsProxyAgent = undefined;
|
|
58827
|
+
var net = __importStar(__require("net"));
|
|
58828
|
+
var tls = __importStar(__require("tls"));
|
|
58829
|
+
var assert_1 = __importDefault(__require("assert"));
|
|
58830
|
+
var debug_1 = __importDefault(require_src());
|
|
58831
|
+
var agent_base_1 = require_dist();
|
|
58832
|
+
var url_1 = __require("url");
|
|
58833
|
+
var parse_proxy_response_1 = require_parse_proxy_response();
|
|
58834
|
+
var debug = (0, debug_1.default)("https-proxy-agent");
|
|
58835
|
+
var setServernameFromNonIpHost = (options) => {
|
|
58836
|
+
if (options.servername === undefined && options.host && !net.isIP(options.host)) {
|
|
58837
|
+
return {
|
|
58838
|
+
...options,
|
|
58839
|
+
servername: options.host
|
|
58840
|
+
};
|
|
58841
|
+
}
|
|
58842
|
+
return options;
|
|
58843
|
+
};
|
|
58844
|
+
|
|
58845
|
+
class HttpsProxyAgent extends agent_base_1.Agent {
|
|
58846
|
+
constructor(proxy, opts) {
|
|
58847
|
+
super(opts);
|
|
58848
|
+
this.options = { path: undefined };
|
|
58849
|
+
this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
|
|
58850
|
+
this.proxyHeaders = opts?.headers ?? {};
|
|
58851
|
+
debug("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
|
|
58852
|
+
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
|
|
58853
|
+
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
|
|
58854
|
+
this.connectOpts = {
|
|
58855
|
+
ALPNProtocols: ["http/1.1"],
|
|
58856
|
+
...opts ? omit3(opts, "headers") : null,
|
|
58857
|
+
host,
|
|
58858
|
+
port
|
|
58859
|
+
};
|
|
58860
|
+
}
|
|
58861
|
+
async connect(req, opts) {
|
|
58862
|
+
const { proxy } = this;
|
|
58863
|
+
if (!opts.host) {
|
|
58864
|
+
throw new TypeError('No "host" provided');
|
|
58865
|
+
}
|
|
58866
|
+
let socket;
|
|
58867
|
+
if (proxy.protocol === "https:") {
|
|
58868
|
+
debug("Creating `tls.Socket`: %o", this.connectOpts);
|
|
58869
|
+
socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
|
|
58870
|
+
} else {
|
|
58871
|
+
debug("Creating `net.Socket`: %o", this.connectOpts);
|
|
58872
|
+
socket = net.connect(this.connectOpts);
|
|
58873
|
+
}
|
|
58874
|
+
const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
|
|
58875
|
+
const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
|
|
58876
|
+
let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
|
|
58877
|
+
`;
|
|
58878
|
+
if (proxy.username || proxy.password) {
|
|
58879
|
+
const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
|
|
58880
|
+
headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
|
|
58881
|
+
}
|
|
58882
|
+
headers.Host = `${host}:${opts.port}`;
|
|
58883
|
+
if (!headers["Proxy-Connection"]) {
|
|
58884
|
+
headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
|
|
58885
|
+
}
|
|
58886
|
+
for (const name of Object.keys(headers)) {
|
|
58887
|
+
payload += `${name}: ${headers[name]}\r
|
|
58888
|
+
`;
|
|
58889
|
+
}
|
|
58890
|
+
const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
|
|
58891
|
+
socket.write(`${payload}\r
|
|
58892
|
+
`);
|
|
58893
|
+
const { connect, buffered } = await proxyResponsePromise;
|
|
58894
|
+
req.emit("proxyConnect", connect);
|
|
58895
|
+
this.emit("proxyConnect", connect, req);
|
|
58896
|
+
if (connect.statusCode === 200) {
|
|
58897
|
+
req.once("socket", resume);
|
|
58898
|
+
if (opts.secureEndpoint) {
|
|
58899
|
+
debug("Upgrading socket connection to TLS");
|
|
58900
|
+
return tls.connect({
|
|
58901
|
+
...omit3(setServernameFromNonIpHost(opts), "host", "path", "port"),
|
|
58902
|
+
socket
|
|
58903
|
+
});
|
|
58904
|
+
}
|
|
58905
|
+
return socket;
|
|
58906
|
+
}
|
|
58907
|
+
socket.destroy();
|
|
58908
|
+
const fakeSocket = new net.Socket({ writable: false });
|
|
58909
|
+
fakeSocket.readable = true;
|
|
58910
|
+
req.once("socket", (s) => {
|
|
58911
|
+
debug("Replaying proxy buffer for failed request");
|
|
58912
|
+
(0, assert_1.default)(s.listenerCount("data") > 0);
|
|
58913
|
+
s.push(buffered);
|
|
58914
|
+
s.push(null);
|
|
58915
|
+
});
|
|
58916
|
+
return fakeSocket;
|
|
58917
|
+
}
|
|
58918
|
+
}
|
|
58919
|
+
HttpsProxyAgent.protocols = ["http", "https"];
|
|
58920
|
+
exports.HttpsProxyAgent = HttpsProxyAgent;
|
|
58921
|
+
function resume(socket) {
|
|
58922
|
+
socket.resume();
|
|
58923
|
+
}
|
|
58924
|
+
function omit3(obj, ...keys2) {
|
|
58925
|
+
const ret = {};
|
|
58926
|
+
let key;
|
|
58927
|
+
for (key in obj) {
|
|
58928
|
+
if (!keys2.includes(key)) {
|
|
58929
|
+
ret[key] = obj[key];
|
|
58930
|
+
}
|
|
58931
|
+
}
|
|
58932
|
+
return ret;
|
|
58933
|
+
}
|
|
58934
|
+
});
|
|
58935
|
+
|
|
57844
58936
|
// src/utils/usage-types.ts
|
|
57845
58937
|
var FIVE_HOUR_BLOCK_MS, SEVEN_DAY_WINDOW_MS, UsageErrorSchema;
|
|
57846
58938
|
var init_usage_types = __esm(() => {
|
|
@@ -57951,6 +59043,31 @@ function readStaleUsageCache() {
|
|
|
57951
59043
|
return null;
|
|
57952
59044
|
}
|
|
57953
59045
|
}
|
|
59046
|
+
function getUsageApiProxyUrl() {
|
|
59047
|
+
const proxyUrl = process.env.HTTPS_PROXY?.trim();
|
|
59048
|
+
if (proxyUrl === "") {
|
|
59049
|
+
return null;
|
|
59050
|
+
}
|
|
59051
|
+
return proxyUrl ?? null;
|
|
59052
|
+
}
|
|
59053
|
+
function getUsageApiRequestOptions(token) {
|
|
59054
|
+
const proxyUrl = getUsageApiProxyUrl();
|
|
59055
|
+
try {
|
|
59056
|
+
return {
|
|
59057
|
+
hostname: USAGE_API_HOST,
|
|
59058
|
+
path: USAGE_API_PATH,
|
|
59059
|
+
method: "GET",
|
|
59060
|
+
headers: {
|
|
59061
|
+
Authorization: `Bearer ${token}`,
|
|
59062
|
+
"anthropic-beta": "oauth-2025-04-20"
|
|
59063
|
+
},
|
|
59064
|
+
timeout: USAGE_API_TIMEOUT_MS,
|
|
59065
|
+
...proxyUrl ? { agent: new import_https_proxy_agent.HttpsProxyAgent(proxyUrl) } : {}
|
|
59066
|
+
};
|
|
59067
|
+
} catch {
|
|
59068
|
+
return null;
|
|
59069
|
+
}
|
|
59070
|
+
}
|
|
57954
59071
|
async function fetchFromUsageApi(token) {
|
|
57955
59072
|
return new Promise((resolve) => {
|
|
57956
59073
|
let settled = false;
|
|
@@ -57961,16 +59078,12 @@ async function fetchFromUsageApi(token) {
|
|
|
57961
59078
|
settled = true;
|
|
57962
59079
|
resolve(value);
|
|
57963
59080
|
};
|
|
57964
|
-
const
|
|
57965
|
-
|
|
57966
|
-
|
|
57967
|
-
|
|
57968
|
-
|
|
57969
|
-
|
|
57970
|
-
"anthropic-beta": "oauth-2025-04-20"
|
|
57971
|
-
},
|
|
57972
|
-
timeout: 5000
|
|
57973
|
-
}, (response) => {
|
|
59081
|
+
const requestOptions = getUsageApiRequestOptions(token);
|
|
59082
|
+
if (!requestOptions) {
|
|
59083
|
+
finish(null);
|
|
59084
|
+
return;
|
|
59085
|
+
}
|
|
59086
|
+
const request2 = https.request(requestOptions, (response) => {
|
|
57974
59087
|
let data = "";
|
|
57975
59088
|
response.setEncoding("utf8");
|
|
57976
59089
|
response.on("data", (chunk2) => {
|
|
@@ -58063,11 +59176,12 @@ async function fetchUsageData() {
|
|
|
58063
59176
|
return getStaleUsageOrError("parse-error", now2);
|
|
58064
59177
|
}
|
|
58065
59178
|
}
|
|
58066
|
-
var CACHE_DIR, CACHE_FILE, LOCK_FILE, CACHE_MAX_AGE = 180, LOCK_MAX_AGE = 30, TOKEN_CACHE_MAX_AGE = 3600, UsageCredentialsSchema, CachedUsageDataSchema, UsageApiResponseSchema, cachedUsageData = null, usageCacheTime = 0, cachedUsageToken = null, usageTokenCacheTime = 0, USAGE_API_HOST = "api.anthropic.com", USAGE_API_PATH = "/api/oauth/usage";
|
|
59179
|
+
var import_https_proxy_agent, CACHE_DIR, CACHE_FILE, LOCK_FILE, CACHE_MAX_AGE = 180, LOCK_MAX_AGE = 30, TOKEN_CACHE_MAX_AGE = 3600, UsageCredentialsSchema, CachedUsageDataSchema, UsageApiResponseSchema, cachedUsageData = null, usageCacheTime = 0, cachedUsageToken = null, usageTokenCacheTime = 0, USAGE_API_HOST = "api.anthropic.com", USAGE_API_PATH = "/api/oauth/usage", USAGE_API_TIMEOUT_MS = 5000;
|
|
58067
59180
|
var init_usage_fetch = __esm(() => {
|
|
58068
59181
|
init_zod();
|
|
58069
59182
|
init_claude_settings();
|
|
58070
59183
|
init_usage_types();
|
|
59184
|
+
import_https_proxy_agent = __toESM(require_dist2(), 1);
|
|
58071
59185
|
CACHE_DIR = path2.join(os3.homedir(), ".cache", "ccstatusline");
|
|
58072
59186
|
CACHE_FILE = path2.join(CACHE_DIR, "usage.json");
|
|
58073
59187
|
LOCK_FILE = path2.join(CACHE_DIR, "usage.lock");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccstatusline",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "A customizable status line formatter for Claude Code CLI",
|
|
5
5
|
"module": "src/ccstatusline.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"postbuild": "bun run scripts/replace-version.ts",
|
|
17
17
|
"example": "cat scripts/payload.example.json | bun start",
|
|
18
18
|
"prepublishOnly": "bun run build",
|
|
19
|
-
"lint": "bun tsc --noEmit && eslint . --config eslint.config.js --max-warnings=
|
|
19
|
+
"lint": "bun tsc --noEmit && eslint . --config eslint.config.js --max-warnings=0",
|
|
20
|
+
"lint:fix": "bun tsc --noEmit && eslint . --config eslint.config.js --max-warnings=0 --fix",
|
|
20
21
|
"docs": "typedoc",
|
|
21
22
|
"docs:clean": "rm -rf docs"
|
|
22
23
|
},
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
"eslint-plugin-import-newlines": "^1.4.0",
|
|
34
35
|
"eslint-plugin-react": "^7.37.5",
|
|
35
36
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
37
|
+
"https-proxy-agent": "^7.0.0",
|
|
36
38
|
"ink": "6.2.0",
|
|
37
39
|
"ink-gradient": "^3.0.0",
|
|
38
40
|
"ink-select-input": "^6.2.0",
|