piclaw 0.0.4 → 0.0.6

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 (185) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/dist-D51xeTP2.js +12 -0
  3. package/.output/public/assets/index-B3x2_en6.css +1 -0
  4. package/.output/public/assets/index-SfjxJZSD.js +38 -0
  5. package/.output/public/assets/md4x-CNLJ57xO.wasm +0 -0
  6. package/.output/public/assets/md4x-CyfQToGJ.js +1 -0
  7. package/.output/public/assets/wasm-Cm7RZrwg.js +1 -0
  8. package/.output/public/icon.svg +25 -0
  9. package/.output/public/index.html +3 -2
  10. package/.output/public/manifest.json +1 -1
  11. package/.output/server/_chunks/bun.mjs +49 -0
  12. package/.output/server/_chunks/commands.mjs +280 -0
  13. package/.output/server/_chunks/config.mjs +2 -4
  14. package/.output/server/_chunks/db.mjs +11 -5
  15. package/.output/server/_chunks/logger.mjs +1 -1
  16. package/.output/server/_chunks/node.mjs +31 -0
  17. package/.output/server/_chunks/ntfy.mjs +45 -0
  18. package/.output/server/_chunks/pi.mjs +33 -1
  19. package/.output/server/_chunks/renderer-template.mjs +1 -1
  20. package/.output/server/_chunks/{bootstrap.mjs → server.mjs} +203 -205
  21. package/.output/server/_chunks/session.mjs +249 -40
  22. package/.output/server/_chunks/settings.mjs +1 -1
  23. package/.output/server/_chunks/terminal.mjs +35 -20
  24. package/.output/server/_chunks/virtual.mjs +129 -0
  25. package/.output/server/_jid_.delete.mjs +2 -2
  26. package/.output/server/_jid_.patch.mjs +30 -3
  27. package/.output/server/_jid_2.delete.mjs +2 -2
  28. package/.output/server/_libs/@aws-sdk/client-bedrock-runtime+[...].mjs +13148 -13149
  29. package/.output/server/_libs/@aws-sdk/credential-provider-http+[...].mjs +1 -1
  30. package/.output/server/_libs/@aws-sdk/credential-provider-ini+[...].mjs +2 -2
  31. package/.output/server/_libs/@aws-sdk/credential-provider-process+[...].mjs +1 -1
  32. package/.output/server/_libs/@aws-sdk/credential-provider-sso+[...].mjs +1 -1
  33. package/.output/server/_libs/@aws-sdk/credential-provider-web-identity+[...].mjs +1 -1
  34. package/.output/server/_libs/@google/genai.mjs +2 -2
  35. package/.output/server/_libs/@mariozechner/pi-agent-core+[...].mjs +40 -74
  36. package/.output/server/_libs/@mariozechner/pi-coding-agent+[...].mjs +1315 -1210
  37. package/.output/server/_libs/@smithy/credential-provider-imds+[...].mjs +3 -3
  38. package/.output/server/_libs/_.mjs +3 -2
  39. package/.output/server/_libs/_100.mjs +3 -0
  40. package/.output/server/_libs/_101.mjs +2 -0
  41. package/.output/server/_libs/_102.mjs +3 -0
  42. package/.output/server/_libs/_103.mjs +2 -0
  43. package/.output/server/_libs/_16.mjs +2 -5
  44. package/.output/server/_libs/_17.mjs +2 -3
  45. package/.output/server/_libs/_18.mjs +2 -3
  46. package/.output/server/_libs/_19.mjs +2 -4
  47. package/.output/server/_libs/_2.mjs +2 -3
  48. package/.output/server/_libs/_20.mjs +2 -2
  49. package/.output/server/_libs/_21.mjs +2 -0
  50. package/.output/server/_libs/_22.mjs +2 -0
  51. package/.output/server/_libs/_23.mjs +2 -0
  52. package/.output/server/_libs/_24.mjs +2 -0
  53. package/.output/server/_libs/_25.mjs +2 -0
  54. package/.output/server/_libs/_26.mjs +2 -0
  55. package/.output/server/_libs/_27.mjs +2 -0
  56. package/.output/server/_libs/_28.mjs +2 -0
  57. package/.output/server/_libs/_29.mjs +2 -0
  58. package/.output/server/_libs/_30.mjs +2 -0
  59. package/.output/server/_libs/_31.mjs +2 -0
  60. package/.output/server/_libs/_32.mjs +2 -0
  61. package/.output/server/_libs/_33.mjs +2 -0
  62. package/.output/server/_libs/_34.mjs +2 -0
  63. package/.output/server/_libs/_35.mjs +2 -0
  64. package/.output/server/_libs/_36.mjs +2 -0
  65. package/.output/server/_libs/_37.mjs +2 -0
  66. package/.output/server/_libs/_38.mjs +2 -0
  67. package/.output/server/_libs/_39.mjs +2 -0
  68. package/.output/server/_libs/_40.mjs +2 -0
  69. package/.output/server/_libs/_41.mjs +2 -0
  70. package/.output/server/_libs/_42.mjs +2 -0
  71. package/.output/server/_libs/_43.mjs +2 -0
  72. package/.output/server/_libs/_44.mjs +2 -0
  73. package/.output/server/_libs/_45.mjs +2 -0
  74. package/.output/server/_libs/_46.mjs +2 -0
  75. package/.output/server/_libs/_47.mjs +2 -0
  76. package/.output/server/_libs/_48.mjs +2 -0
  77. package/.output/server/_libs/_49.mjs +2 -0
  78. package/.output/server/_libs/_50.mjs +2 -0
  79. package/.output/server/_libs/_51.mjs +2 -0
  80. package/.output/server/_libs/_52.mjs +2 -0
  81. package/.output/server/_libs/_53.mjs +2 -0
  82. package/.output/server/_libs/_54.mjs +2 -0
  83. package/.output/server/_libs/_55.mjs +2 -0
  84. package/.output/server/_libs/_56.mjs +2 -0
  85. package/.output/server/_libs/_57.mjs +2 -0
  86. package/.output/server/_libs/_58.mjs +2 -0
  87. package/.output/server/_libs/_59.mjs +2 -0
  88. package/.output/server/_libs/_60.mjs +2 -0
  89. package/.output/server/_libs/_61.mjs +2 -0
  90. package/.output/server/_libs/_62.mjs +2 -0
  91. package/.output/server/_libs/_63.mjs +2 -0
  92. package/.output/server/_libs/_64.mjs +2 -0
  93. package/.output/server/_libs/_65.mjs +2 -0
  94. package/.output/server/_libs/_66.mjs +2 -0
  95. package/.output/server/_libs/_67.mjs +2 -0
  96. package/.output/server/_libs/_68.mjs +2 -0
  97. package/.output/server/_libs/_69.mjs +2 -0
  98. package/.output/server/_libs/_70.mjs +2 -0
  99. package/.output/server/_libs/_71.mjs +2 -0
  100. package/.output/server/_libs/_72.mjs +2 -0
  101. package/.output/server/_libs/_73.mjs +2 -0
  102. package/.output/server/_libs/_74.mjs +2 -0
  103. package/.output/server/_libs/_75.mjs +2 -0
  104. package/.output/server/_libs/_76.mjs +2 -0
  105. package/.output/server/_libs/_77.mjs +2 -0
  106. package/.output/server/_libs/_78.mjs +2 -0
  107. package/.output/server/_libs/_79.mjs +2 -0
  108. package/.output/server/_libs/_80.mjs +2 -0
  109. package/.output/server/_libs/_81.mjs +2 -0
  110. package/.output/server/_libs/_82.mjs +2 -0
  111. package/.output/server/_libs/_83.mjs +2 -0
  112. package/.output/server/_libs/_84.mjs +2 -0
  113. package/.output/server/_libs/_85.mjs +2 -0
  114. package/.output/server/_libs/_86.mjs +2 -0
  115. package/.output/server/_libs/_87.mjs +2 -0
  116. package/.output/server/_libs/_88.mjs +2 -0
  117. package/.output/server/_libs/_89.mjs +2 -0
  118. package/.output/server/_libs/_90.mjs +2 -0
  119. package/.output/server/_libs/_91.mjs +2 -0
  120. package/.output/server/_libs/_92.mjs +2 -0
  121. package/.output/server/_libs/_93.mjs +2 -0
  122. package/.output/server/_libs/_94.mjs +2 -0
  123. package/.output/server/_libs/_95.mjs +2 -0
  124. package/.output/server/_libs/_96.mjs +2 -0
  125. package/.output/server/_libs/_97.mjs +2 -0
  126. package/.output/server/_libs/_98.mjs +2 -0
  127. package/.output/server/_libs/_99.mjs +5 -0
  128. package/.output/server/_libs/amdefine.mjs +188 -0
  129. package/.output/server/_libs/aws-sdk__nested-clients.mjs +1 -1
  130. package/.output/server/_libs/compressjs.mjs +50 -0
  131. package/.output/server/_libs/diff.mjs +137 -0
  132. package/.output/server/_libs/get-uri.mjs +1 -1
  133. package/.output/server/_libs/http-proxy-agent.mjs +1 -1
  134. package/.output/server/_libs/https-proxy-agent.mjs +1 -1
  135. package/.output/server/_libs/just-bash+[...].mjs +80359 -0
  136. package/.output/server/_libs/md4x.mjs +73 -0
  137. package/.output/server/_libs/mixmark-io__domino.mjs +14801 -0
  138. package/.output/server/_libs/node-fetch.mjs +1 -1
  139. package/.output/server/_libs/node-liblzma.mjs +1107 -0
  140. package/.output/server/_libs/pac-proxy-agent+[...].mjs +1 -1
  141. package/.output/server/_libs/proxy-agent+proxy-from-env.mjs +1 -1
  142. package/.output/server/_libs/smithy__core.mjs +1 -1
  143. package/.output/server/_routes/api/files/delete.mjs +2 -2
  144. package/.output/server/_routes/api/files/groups.mjs +14 -0
  145. package/.output/server/_routes/api/files/raw.mjs +1 -1
  146. package/.output/server/_routes/api/files/read.mjs +1 -1
  147. package/.output/server/_routes/api/files/watch.mjs +1 -1
  148. package/.output/server/_routes/api/files/write.mjs +3 -2
  149. package/.output/server/_routes/api/files.mjs +1 -1
  150. package/.output/server/_routes/api/groups.mjs +2 -2
  151. package/.output/server/_routes/api/groups2.mjs +3 -2
  152. package/.output/server/_routes/api/health.mjs +2 -2
  153. package/.output/server/_routes/api/logs.mjs +4 -2
  154. package/.output/server/_routes/api/ntfy/setup.mjs +54 -0
  155. package/.output/server/_routes/api/ntfy/status.mjs +12 -0
  156. package/.output/server/_routes/api/pi/apikey.mjs +1 -1
  157. package/.output/server/_routes/api/pi/apikey_providers.mjs +1 -1
  158. package/.output/server/_routes/api/pi/commands.mjs +6 -0
  159. package/.output/server/_routes/api/pi/login/events.mjs +1 -1
  160. package/.output/server/_routes/api/pi/login/respond.mjs +1 -1
  161. package/.output/server/_routes/api/pi/login.mjs +1 -1
  162. package/.output/server/_routes/api/pi/logout.mjs +1 -1
  163. package/.output/server/_routes/api/pi/models.mjs +1 -1
  164. package/.output/server/_routes/api/pi/status.mjs +1 -1
  165. package/.output/server/_routes/api/send.mjs +22 -3
  166. package/.output/server/_routes/api/status.mjs +9 -7
  167. package/.output/server/_routes/api/tasks2.mjs +2 -2
  168. package/.output/server/_routes/api/telegram/setup.mjs +2 -2
  169. package/.output/server/_routes/api/telegram/status.mjs +2 -2
  170. package/.output/server/_routes/api/terminal2.mjs +3 -2
  171. package/.output/server/_utils.mjs +12 -4
  172. package/.output/server/build/md4x.wasm +0 -0
  173. package/.output/server/index.mjs +223 -149
  174. package/.output/server/node_modules/@mongodb-js/zstd/lib/index.js +55 -0
  175. package/.output/server/node_modules/@mongodb-js/zstd/package.json +51 -0
  176. package/.output/server/package.json +1 -0
  177. package/README.md +118 -24
  178. package/bin/piclaw.mjs +39 -1
  179. package/package.json +16 -13
  180. package/.output/public/assets/client-TIs-Ghqj.js +0 -9
  181. package/.output/public/assets/dist-BVjfG3ok.js +0 -12
  182. package/.output/public/assets/dist-DJh8l6yS.js +0 -1
  183. package/.output/public/assets/index-BNNEMkNV.js +0 -39
  184. package/.output/public/assets/index-CdWBxO5V.css +0 -1
  185. package/.output/public/assets/react-DFP7nCmh.js +0 -1
@@ -8,25 +8,25 @@ import * as crypto$2 from "node:crypto";
8
8
  import { createHash, randomBytes } from "node:crypto";
9
9
  import * as fs$9 from "node:fs";
10
10
  import { accessSync, constants, createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
11
- import { fileURLToPath } from "node:url";
12
11
  import * as path$6 from "node:path";
13
12
  import { basename, delimiter, dirname, isAbsolute, join, posix, relative, resolve, sep, win32 } from "node:path";
14
13
  import { arch, homedir, platform } from "os";
15
14
  import * as path$3 from "path";
16
15
  import path$1, { basename as basename$1, dirname as dirname$1, isAbsolute as isAbsolute$1, join as join$1, relative as relative$1, resolve as resolve$1, sep as sep$1 } from "path";
17
- import { Readable as Readable$1 } from "stream";
18
- import { access, lstat, open, readFile, readdir, readlink, realpath, stat, unlink } from "node:fs/promises";
19
- import { randomUUID as randomUUID$1 } from "crypto";
20
- import { access as access$1, mkdir as mkdir$1, readFile as readFile$1, readdir as readdir$1, stat as stat$1, writeFile as writeFile$1 } from "fs/promises";
21
16
  import * as os$3 from "node:os";
22
17
  import os$1, { homedir as homedir$1, tmpdir } from "node:os";
18
+ import { access, lstat, open, readFile, readdir, readlink, realpath, stat, unlink } from "node:fs/promises";
23
19
  import { spawn, spawnSync } from "node:child_process";
24
- import process$1 from "node:process";
25
- import { appendFileSync, chmodSync, closeSync, constants as constants$1, createWriteStream as createWriteStream$1, existsSync as existsSync$1, lstatSync as lstatSync$1, mkdirSync as mkdirSync$1, openSync, readFileSync as readFileSync$1, readSync, readdir as readdir$2, readdirSync as readdirSync$1, readlinkSync, realpathSync, renameSync, rmSync as rmSync$1, statSync as statSync$1, watch as watch$1, writeFileSync as writeFileSync$1 } from "fs";
26
- import { fileURLToPath as fileURLToPath$1 } from "url";
27
- import { EventEmitter } from "events";
20
+ import { appendFileSync, chmodSync, closeSync, constants as constants$1, createWriteStream as createWriteStream$1, existsSync as existsSync$1, lstatSync as lstatSync$1, mkdirSync as mkdirSync$1, openSync, readFileSync as readFileSync$1, readSync, readdir as readdir$1, readdirSync as readdirSync$1, readlinkSync, realpathSync, renameSync, rmSync as rmSync$1, statSync as statSync$1, watch as watch$1, writeFileSync as writeFileSync$1 } from "fs";
21
+ import { fileURLToPath } from "url";
28
22
  import { exec as exec$1, execSync, spawn as spawn$1, spawnSync as spawnSync$1 } from "child_process";
23
+ import { Readable as Readable$1 } from "stream";
24
+ import { EventEmitter } from "events";
25
+ import { randomUUID as randomUUID$1 } from "crypto";
26
+ import { access as access$1, mkdir as mkdir$1, readFile as readFile$1, readdir as readdir$2, stat as stat$1, writeFile as writeFile$1 } from "fs/promises";
27
+ import process$1 from "node:process";
29
28
  import tty from "node:tty";
29
+ import { fileURLToPath as fileURLToPath$1 } from "node:url";
30
30
  import { createRequire as createRequire$1 } from "module";
31
31
  import { EventEmitter as EventEmitter$1 } from "node:events";
32
32
  import { StringDecoder } from "node:string_decoder";
@@ -34,804 +34,7 @@ import { finished } from "stream/promises";
34
34
  import { createInterface } from "node:readline";
35
35
  import * as readline from "readline";
36
36
  import { createInterface as createInterface$1 } from "readline";
37
- var require_ms = /* @__PURE__ */ __commonJSMin(((exports, module) => {
38
- /**
39
- * Helpers.
40
- */
41
- var s = 1e3;
42
- var m = s * 60;
43
- var h = m * 60;
44
- var d = h * 24;
45
- var w = d * 7;
46
- var y = d * 365.25;
47
- /**
48
- * Parse or format the given `val`.
49
- *
50
- * Options:
51
- *
52
- * - `long` verbose formatting [false]
53
- *
54
- * @param {String|Number} val
55
- * @param {Object} [options]
56
- * @throws {Error} throw an error if val is not a non-empty string or a number
57
- * @return {String|Number}
58
- * @api public
59
- */
60
- module.exports = function(val, options) {
61
- options = options || {};
62
- var type = typeof val;
63
- if (type === "string" && val.length > 0) return parse(val);
64
- else if (type === "number" && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
65
- throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
66
- };
67
- /**
68
- * Parse the given `str` and return milliseconds.
69
- *
70
- * @param {String} str
71
- * @return {Number}
72
- * @api private
73
- */
74
- function parse(str) {
75
- str = String(str);
76
- if (str.length > 100) return;
77
- 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);
78
- if (!match) return;
79
- var n = parseFloat(match[1]);
80
- switch ((match[2] || "ms").toLowerCase()) {
81
- case "years":
82
- case "year":
83
- case "yrs":
84
- case "yr":
85
- case "y": return n * y;
86
- case "weeks":
87
- case "week":
88
- case "w": return n * w;
89
- case "days":
90
- case "day":
91
- case "d": return n * d;
92
- case "hours":
93
- case "hour":
94
- case "hrs":
95
- case "hr":
96
- case "h": return n * h;
97
- case "minutes":
98
- case "minute":
99
- case "mins":
100
- case "min":
101
- case "m": return n * m;
102
- case "seconds":
103
- case "second":
104
- case "secs":
105
- case "sec":
106
- case "s": return n * s;
107
- case "milliseconds":
108
- case "millisecond":
109
- case "msecs":
110
- case "msec":
111
- case "ms": return n;
112
- default: return;
113
- }
114
- }
115
- /**
116
- * Short format for `ms`.
117
- *
118
- * @param {Number} ms
119
- * @return {String}
120
- * @api private
121
- */
122
- function fmtShort(ms) {
123
- var msAbs = Math.abs(ms);
124
- if (msAbs >= d) return Math.round(ms / d) + "d";
125
- if (msAbs >= h) return Math.round(ms / h) + "h";
126
- if (msAbs >= m) return Math.round(ms / m) + "m";
127
- if (msAbs >= s) return Math.round(ms / s) + "s";
128
- return ms + "ms";
129
- }
130
- /**
131
- * Long format for `ms`.
132
- *
133
- * @param {Number} ms
134
- * @return {String}
135
- * @api private
136
- */
137
- function fmtLong(ms) {
138
- var msAbs = Math.abs(ms);
139
- if (msAbs >= d) return plural(ms, msAbs, d, "day");
140
- if (msAbs >= h) return plural(ms, msAbs, h, "hour");
141
- if (msAbs >= m) return plural(ms, msAbs, m, "minute");
142
- if (msAbs >= s) return plural(ms, msAbs, s, "second");
143
- return ms + " ms";
144
- }
145
- /**
146
- * Pluralization helper.
147
- */
148
- function plural(ms, msAbs, n, name) {
149
- var isPlural = msAbs >= n * 1.5;
150
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
151
- }
152
- }));
153
- var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
154
- /**
155
- * This is the common logic for both the Node.js and web browser
156
- * implementations of `debug()`.
157
- */
158
- function setup(env) {
159
- createDebug.debug = createDebug;
160
- createDebug.default = createDebug;
161
- createDebug.coerce = coerce;
162
- createDebug.disable = disable;
163
- createDebug.enable = enable;
164
- createDebug.enabled = enabled;
165
- createDebug.humanize = require_ms();
166
- createDebug.destroy = destroy;
167
- Object.keys(env).forEach((key) => {
168
- createDebug[key] = env[key];
169
- });
170
- /**
171
- * The currently active debug mode names, and names to skip.
172
- */
173
- createDebug.names = [];
174
- createDebug.skips = [];
175
- /**
176
- * Map of special "%n" handling functions, for the debug "format" argument.
177
- *
178
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
179
- */
180
- createDebug.formatters = {};
181
- /**
182
- * Selects a color for a debug namespace
183
- * @param {String} namespace The namespace string for the debug instance to be colored
184
- * @return {Number|String} An ANSI color code for the given namespace
185
- * @api private
186
- */
187
- function selectColor(namespace) {
188
- let hash = 0;
189
- for (let i = 0; i < namespace.length; i++) {
190
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
191
- hash |= 0;
192
- }
193
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
194
- }
195
- createDebug.selectColor = selectColor;
196
- /**
197
- * Create a debugger with the given `namespace`.
198
- *
199
- * @param {String} namespace
200
- * @return {Function}
201
- * @api public
202
- */
203
- function createDebug(namespace) {
204
- let prevTime;
205
- let enableOverride = null;
206
- let namespacesCache;
207
- let enabledCache;
208
- function debug(...args) {
209
- if (!debug.enabled) return;
210
- const self = debug;
211
- const curr = Number(/* @__PURE__ */ new Date());
212
- self.diff = curr - (prevTime || curr);
213
- self.prev = prevTime;
214
- self.curr = curr;
215
- prevTime = curr;
216
- args[0] = createDebug.coerce(args[0]);
217
- if (typeof args[0] !== "string") args.unshift("%O");
218
- let index = 0;
219
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
220
- if (match === "%%") return "%";
221
- index++;
222
- const formatter = createDebug.formatters[format];
223
- if (typeof formatter === "function") {
224
- const val = args[index];
225
- match = formatter.call(self, val);
226
- args.splice(index, 1);
227
- index--;
228
- }
229
- return match;
230
- });
231
- createDebug.formatArgs.call(self, args);
232
- (self.log || createDebug.log).apply(self, args);
233
- }
234
- debug.namespace = namespace;
235
- debug.useColors = createDebug.useColors();
236
- debug.color = createDebug.selectColor(namespace);
237
- debug.extend = extend;
238
- debug.destroy = createDebug.destroy;
239
- Object.defineProperty(debug, "enabled", {
240
- enumerable: true,
241
- configurable: false,
242
- get: () => {
243
- if (enableOverride !== null) return enableOverride;
244
- if (namespacesCache !== createDebug.namespaces) {
245
- namespacesCache = createDebug.namespaces;
246
- enabledCache = createDebug.enabled(namespace);
247
- }
248
- return enabledCache;
249
- },
250
- set: (v) => {
251
- enableOverride = v;
252
- }
253
- });
254
- if (typeof createDebug.init === "function") createDebug.init(debug);
255
- return debug;
256
- }
257
- function extend(namespace, delimiter) {
258
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
259
- newDebug.log = this.log;
260
- return newDebug;
261
- }
262
- /**
263
- * Enables a debug mode by namespaces. This can include modes
264
- * separated by a colon and wildcards.
265
- *
266
- * @param {String} namespaces
267
- * @api public
268
- */
269
- function enable(namespaces) {
270
- createDebug.save(namespaces);
271
- createDebug.namespaces = namespaces;
272
- createDebug.names = [];
273
- createDebug.skips = [];
274
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
275
- for (const ns of split) if (ns[0] === "-") createDebug.skips.push(ns.slice(1));
276
- else createDebug.names.push(ns);
277
- }
278
- /**
279
- * Checks if the given string matches a namespace template, honoring
280
- * asterisks as wildcards.
281
- *
282
- * @param {String} search
283
- * @param {String} template
284
- * @return {Boolean}
285
- */
286
- function matchesTemplate(search, template) {
287
- let searchIndex = 0;
288
- let templateIndex = 0;
289
- let starIndex = -1;
290
- let matchIndex = 0;
291
- while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
292
- starIndex = templateIndex;
293
- matchIndex = searchIndex;
294
- templateIndex++;
295
- } else {
296
- searchIndex++;
297
- templateIndex++;
298
- }
299
- else if (starIndex !== -1) {
300
- templateIndex = starIndex + 1;
301
- matchIndex++;
302
- searchIndex = matchIndex;
303
- } else return false;
304
- while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
305
- return templateIndex === template.length;
306
- }
307
- /**
308
- * Disable debug output.
309
- *
310
- * @return {String} namespaces
311
- * @api public
312
- */
313
- function disable() {
314
- const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
315
- createDebug.enable("");
316
- return namespaces;
317
- }
318
- /**
319
- * Returns true if the given mode name is enabled, false otherwise.
320
- *
321
- * @param {String} name
322
- * @return {Boolean}
323
- * @api public
324
- */
325
- function enabled(name) {
326
- for (const skip of createDebug.skips) if (matchesTemplate(name, skip)) return false;
327
- for (const ns of createDebug.names) if (matchesTemplate(name, ns)) return true;
328
- return false;
329
- }
330
- /**
331
- * Coerce `val`.
332
- *
333
- * @param {Mixed} val
334
- * @return {Mixed}
335
- * @api private
336
- */
337
- function coerce(val) {
338
- if (val instanceof Error) return val.stack || val.message;
339
- return val;
340
- }
341
- /**
342
- * XXX DO NOT USE. This is a temporary stub function.
343
- * XXX It WILL be removed in the next major release.
344
- */
345
- function destroy() {
346
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
347
- }
348
- createDebug.enable(createDebug.load());
349
- return createDebug;
350
- }
351
- module.exports = setup;
352
- }));
353
- var require_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
354
- /**
355
- * This is the web browser implementation of `debug()`.
356
- */
357
- exports.formatArgs = formatArgs;
358
- exports.save = save;
359
- exports.load = load;
360
- exports.useColors = useColors;
361
- exports.storage = localstorage();
362
- exports.destroy = (() => {
363
- let warned = false;
364
- return () => {
365
- if (!warned) {
366
- warned = true;
367
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
368
- }
369
- };
370
- })();
371
- /**
372
- * Colors.
373
- */
374
- exports.colors = [
375
- "#0000CC",
376
- "#0000FF",
377
- "#0033CC",
378
- "#0033FF",
379
- "#0066CC",
380
- "#0066FF",
381
- "#0099CC",
382
- "#0099FF",
383
- "#00CC00",
384
- "#00CC33",
385
- "#00CC66",
386
- "#00CC99",
387
- "#00CCCC",
388
- "#00CCFF",
389
- "#3300CC",
390
- "#3300FF",
391
- "#3333CC",
392
- "#3333FF",
393
- "#3366CC",
394
- "#3366FF",
395
- "#3399CC",
396
- "#3399FF",
397
- "#33CC00",
398
- "#33CC33",
399
- "#33CC66",
400
- "#33CC99",
401
- "#33CCCC",
402
- "#33CCFF",
403
- "#6600CC",
404
- "#6600FF",
405
- "#6633CC",
406
- "#6633FF",
407
- "#66CC00",
408
- "#66CC33",
409
- "#9900CC",
410
- "#9900FF",
411
- "#9933CC",
412
- "#9933FF",
413
- "#99CC00",
414
- "#99CC33",
415
- "#CC0000",
416
- "#CC0033",
417
- "#CC0066",
418
- "#CC0099",
419
- "#CC00CC",
420
- "#CC00FF",
421
- "#CC3300",
422
- "#CC3333",
423
- "#CC3366",
424
- "#CC3399",
425
- "#CC33CC",
426
- "#CC33FF",
427
- "#CC6600",
428
- "#CC6633",
429
- "#CC9900",
430
- "#CC9933",
431
- "#CCCC00",
432
- "#CCCC33",
433
- "#FF0000",
434
- "#FF0033",
435
- "#FF0066",
436
- "#FF0099",
437
- "#FF00CC",
438
- "#FF00FF",
439
- "#FF3300",
440
- "#FF3333",
441
- "#FF3366",
442
- "#FF3399",
443
- "#FF33CC",
444
- "#FF33FF",
445
- "#FF6600",
446
- "#FF6633",
447
- "#FF9900",
448
- "#FF9933",
449
- "#FFCC00",
450
- "#FFCC33"
451
- ];
452
- /**
453
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
454
- * and the Firebug extension (any Firefox version) are known
455
- * to support "%c" CSS customizations.
456
- *
457
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
458
- */
459
- function useColors() {
460
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
461
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
462
- let m;
463
- 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+)/);
464
- }
465
- /**
466
- * Colorize log arguments if enabled.
467
- *
468
- * @api public
469
- */
470
- function formatArgs(args) {
471
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
472
- if (!this.useColors) return;
473
- const c = "color: " + this.color;
474
- args.splice(1, 0, c, "color: inherit");
475
- let index = 0;
476
- let lastC = 0;
477
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
478
- if (match === "%%") return;
479
- index++;
480
- if (match === "%c") lastC = index;
481
- });
482
- args.splice(lastC, 0, c);
483
- }
484
- /**
485
- * Invokes `console.debug()` when available.
486
- * No-op when `console.debug` is not a "function".
487
- * If `console.debug` is not available, falls back
488
- * to `console.log`.
489
- *
490
- * @api public
491
- */
492
- exports.log = console.debug || console.log || (() => {});
493
- /**
494
- * Save `namespaces`.
495
- *
496
- * @param {String} namespaces
497
- * @api private
498
- */
499
- function save(namespaces) {
500
- try {
501
- if (namespaces) exports.storage.setItem("debug", namespaces);
502
- else exports.storage.removeItem("debug");
503
- } catch (error) {}
504
- }
505
- /**
506
- * Load `namespaces`.
507
- *
508
- * @return {String} returns the previously persisted debug modes
509
- * @api private
510
- */
511
- function load() {
512
- let r;
513
- try {
514
- r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
515
- } catch (error) {}
516
- if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
517
- return r;
518
- }
519
- /**
520
- * Localstorage attempts to return the localstorage.
521
- *
522
- * This is necessary because safari throws
523
- * when a user disables cookies/localstorage
524
- * and you attempt to access it.
525
- *
526
- * @return {LocalStorage}
527
- * @api private
528
- */
529
- function localstorage() {
530
- try {
531
- return localStorage;
532
- } catch (error) {}
533
- }
534
- module.exports = require_common()(exports);
535
- var { formatters } = module.exports;
536
- /**
537
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
538
- */
539
- formatters.j = function(v) {
540
- try {
541
- return JSON.stringify(v);
542
- } catch (error) {
543
- return "[UnexpectedJSONParseError]: " + error.message;
544
- }
545
- };
546
- }));
547
- var require_has_flag = /* @__PURE__ */ __commonJSMin(((exports, module) => {
548
- module.exports = (flag, argv = process.argv) => {
549
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
550
- const position = argv.indexOf(prefix + flag);
551
- const terminatorPosition = argv.indexOf("--");
552
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
553
- };
554
- }));
555
- var require_supports_color = /* @__PURE__ */ __commonJSMin(((exports, module) => {
556
- var os$4 = __require("os");
557
- var tty$2 = __require("tty");
558
- var hasFlag = require_has_flag();
559
- var { env } = process;
560
- var forceColor;
561
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) forceColor = 0;
562
- else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = 1;
563
- if ("FORCE_COLOR" in env) if (env.FORCE_COLOR === "true") forceColor = 1;
564
- else if (env.FORCE_COLOR === "false") forceColor = 0;
565
- else forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
566
- function translateLevel(level) {
567
- if (level === 0) return false;
568
- return {
569
- level,
570
- hasBasic: true,
571
- has256: level >= 2,
572
- has16m: level >= 3
573
- };
574
- }
575
- function supportsColor(haveStream, streamIsTTY) {
576
- if (forceColor === 0) return 0;
577
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
578
- if (hasFlag("color=256")) return 2;
579
- if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
580
- const min = forceColor || 0;
581
- if (env.TERM === "dumb") return min;
582
- if (process.platform === "win32") {
583
- const osRelease = os$4.release().split(".");
584
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
585
- return 1;
586
- }
587
- if ("CI" in env) {
588
- if ([
589
- "TRAVIS",
590
- "CIRCLECI",
591
- "APPVEYOR",
592
- "GITLAB_CI",
593
- "GITHUB_ACTIONS",
594
- "BUILDKITE"
595
- ].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
596
- return min;
597
- }
598
- if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
599
- if (env.COLORTERM === "truecolor") return 3;
600
- if ("TERM_PROGRAM" in env) {
601
- const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
602
- switch (env.TERM_PROGRAM) {
603
- case "iTerm.app": return version >= 3 ? 3 : 2;
604
- case "Apple_Terminal": return 2;
605
- }
606
- }
607
- if (/-256(color)?$/i.test(env.TERM)) return 2;
608
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
609
- if ("COLORTERM" in env) return 1;
610
- return min;
611
- }
612
- function getSupportLevel(stream) {
613
- return translateLevel(supportsColor(stream, stream && stream.isTTY));
614
- }
615
- module.exports = {
616
- supportsColor: getSupportLevel,
617
- stdout: translateLevel(supportsColor(true, tty$2.isatty(1))),
618
- stderr: translateLevel(supportsColor(true, tty$2.isatty(2)))
619
- };
620
- }));
621
- var require_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
622
- /**
623
- * Module dependencies.
624
- */
625
- var tty$1 = __require("tty");
626
- var util$3 = __require("util");
627
- /**
628
- * This is the Node.js implementation of `debug()`.
629
- */
630
- exports.init = init;
631
- exports.log = log;
632
- exports.formatArgs = formatArgs;
633
- exports.save = save;
634
- exports.load = load;
635
- exports.useColors = useColors;
636
- exports.destroy = util$3.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
637
- /**
638
- * Colors.
639
- */
640
- exports.colors = [
641
- 6,
642
- 2,
643
- 3,
644
- 4,
645
- 5,
646
- 1
647
- ];
648
- try {
649
- const supportsColor = require_supports_color();
650
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
651
- 20,
652
- 21,
653
- 26,
654
- 27,
655
- 32,
656
- 33,
657
- 38,
658
- 39,
659
- 40,
660
- 41,
661
- 42,
662
- 43,
663
- 44,
664
- 45,
665
- 56,
666
- 57,
667
- 62,
668
- 63,
669
- 68,
670
- 69,
671
- 74,
672
- 75,
673
- 76,
674
- 77,
675
- 78,
676
- 79,
677
- 80,
678
- 81,
679
- 92,
680
- 93,
681
- 98,
682
- 99,
683
- 112,
684
- 113,
685
- 128,
686
- 129,
687
- 134,
688
- 135,
689
- 148,
690
- 149,
691
- 160,
692
- 161,
693
- 162,
694
- 163,
695
- 164,
696
- 165,
697
- 166,
698
- 167,
699
- 168,
700
- 169,
701
- 170,
702
- 171,
703
- 172,
704
- 173,
705
- 178,
706
- 179,
707
- 184,
708
- 185,
709
- 196,
710
- 197,
711
- 198,
712
- 199,
713
- 200,
714
- 201,
715
- 202,
716
- 203,
717
- 204,
718
- 205,
719
- 206,
720
- 207,
721
- 208,
722
- 209,
723
- 214,
724
- 215,
725
- 220,
726
- 221
727
- ];
728
- } catch (error) {}
729
- /**
730
- * Build up the default `inspectOpts` object from the environment variables.
731
- *
732
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
733
- */
734
- exports.inspectOpts = Object.keys(process.env).filter((key) => {
735
- return /^debug_/i.test(key);
736
- }).reduce((obj, key) => {
737
- const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
738
- return k.toUpperCase();
739
- });
740
- let val = process.env[key];
741
- if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
742
- else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
743
- else if (val === "null") val = null;
744
- else val = Number(val);
745
- obj[prop] = val;
746
- return obj;
747
- }, {});
748
- /**
749
- * Is stdout a TTY? Colored output is enabled when `true`.
750
- */
751
- function useColors() {
752
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty$1.isatty(process.stderr.fd);
753
- }
754
- /**
755
- * Adds ANSI color escape codes if enabled.
756
- *
757
- * @api public
758
- */
759
- function formatArgs(args) {
760
- const { namespace: name, useColors } = this;
761
- if (useColors) {
762
- const c = this.color;
763
- const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
764
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
765
- args[0] = prefix + args[0].split("\n").join("\n" + prefix);
766
- args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
767
- } else args[0] = getDate() + name + " " + args[0];
768
- }
769
- function getDate() {
770
- if (exports.inspectOpts.hideDate) return "";
771
- return (/* @__PURE__ */ new Date()).toISOString() + " ";
772
- }
773
- /**
774
- * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
775
- */
776
- function log(...args) {
777
- return process.stderr.write(util$3.formatWithOptions(exports.inspectOpts, ...args) + "\n");
778
- }
779
- /**
780
- * Save `namespaces`.
781
- *
782
- * @param {String} namespaces
783
- * @api private
784
- */
785
- function save(namespaces) {
786
- if (namespaces) process.env.DEBUG = namespaces;
787
- else delete process.env.DEBUG;
788
- }
789
- /**
790
- * Load `namespaces`.
791
- *
792
- * @return {String} returns the previously persisted debug modes
793
- * @api private
794
- */
795
- function load() {
796
- return process.env.DEBUG;
797
- }
798
- /**
799
- * Init logic for `debug` instances.
800
- *
801
- * Create a new `inspectOpts` object in case `useColors` is set
802
- * differently for a particular `debug` instance.
803
- */
804
- function init(debug) {
805
- debug.inspectOpts = {};
806
- const keys = Object.keys(exports.inspectOpts);
807
- for (let i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
808
- }
809
- module.exports = require_common()(exports);
810
- var { formatters } = module.exports;
811
- /**
812
- * Map %o to `util.inspect()`, all on a single line.
813
- */
814
- formatters.o = function(v) {
815
- this.inspectOpts.colors = this.useColors;
816
- return util$3.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
817
- };
818
- /**
819
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
820
- */
821
- formatters.O = function(v) {
822
- this.inspectOpts.colors = this.useColors;
823
- return util$3.inspect(v, this.inspectOpts);
824
- };
825
- }));
826
- var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
827
- /**
828
- * Detect Electron renderer / nwjs process, which is node, but we should
829
- * treat as a browser.
830
- */
831
- if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) module.exports = require_browser();
832
- else module.exports = require_node();
833
- }));
834
- var __dirname = dirname$1(fileURLToPath$1(import.meta.url));
37
+ var __dirname = dirname$1(fileURLToPath(import.meta.url));
835
38
  /**
836
39
  * Detect if we're running as a Bun compiled binary.
837
40
  * Bun binaries have import.meta.url containing "$bunfs", "~BUN", or "%7EBUN" (Bun's virtual filesystem path)
@@ -60932,6 +60135,80 @@ var require_ansi_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
60932
60135
  get: assembleStyles
60933
60136
  });
60934
60137
  }));
60138
+ var require_has_flag = /* @__PURE__ */ __commonJSMin(((exports, module) => {
60139
+ module.exports = (flag, argv = process.argv) => {
60140
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
60141
+ const position = argv.indexOf(prefix + flag);
60142
+ const terminatorPosition = argv.indexOf("--");
60143
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
60144
+ };
60145
+ }));
60146
+ var require_supports_color = /* @__PURE__ */ __commonJSMin(((exports, module) => {
60147
+ var os$4 = __require("os");
60148
+ var tty$2 = __require("tty");
60149
+ var hasFlag = require_has_flag();
60150
+ var { env } = process;
60151
+ var forceColor;
60152
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) forceColor = 0;
60153
+ else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = 1;
60154
+ if ("FORCE_COLOR" in env) if (env.FORCE_COLOR === "true") forceColor = 1;
60155
+ else if (env.FORCE_COLOR === "false") forceColor = 0;
60156
+ else forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
60157
+ function translateLevel(level) {
60158
+ if (level === 0) return false;
60159
+ return {
60160
+ level,
60161
+ hasBasic: true,
60162
+ has256: level >= 2,
60163
+ has16m: level >= 3
60164
+ };
60165
+ }
60166
+ function supportsColor(haveStream, streamIsTTY) {
60167
+ if (forceColor === 0) return 0;
60168
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
60169
+ if (hasFlag("color=256")) return 2;
60170
+ if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
60171
+ const min = forceColor || 0;
60172
+ if (env.TERM === "dumb") return min;
60173
+ if (process.platform === "win32") {
60174
+ const osRelease = os$4.release().split(".");
60175
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
60176
+ return 1;
60177
+ }
60178
+ if ("CI" in env) {
60179
+ if ([
60180
+ "TRAVIS",
60181
+ "CIRCLECI",
60182
+ "APPVEYOR",
60183
+ "GITLAB_CI",
60184
+ "GITHUB_ACTIONS",
60185
+ "BUILDKITE"
60186
+ ].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
60187
+ return min;
60188
+ }
60189
+ if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
60190
+ if (env.COLORTERM === "truecolor") return 3;
60191
+ if ("TERM_PROGRAM" in env) {
60192
+ const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
60193
+ switch (env.TERM_PROGRAM) {
60194
+ case "iTerm.app": return version >= 3 ? 3 : 2;
60195
+ case "Apple_Terminal": return 2;
60196
+ }
60197
+ }
60198
+ if (/-256(color)?$/i.test(env.TERM)) return 2;
60199
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
60200
+ if ("COLORTERM" in env) return 1;
60201
+ return min;
60202
+ }
60203
+ function getSupportLevel(stream) {
60204
+ return translateLevel(supportsColor(stream, stream && stream.isTTY));
60205
+ }
60206
+ module.exports = {
60207
+ supportsColor: getSupportLevel,
60208
+ stdout: translateLevel(supportsColor(true, tty$2.isatty(1))),
60209
+ stderr: translateLevel(supportsColor(true, tty$2.isatty(2)))
60210
+ };
60211
+ }));
60935
60212
  var require_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
60936
60213
  var stringReplaceAll = (string, substring, replacer) => {
60937
60214
  let index = string.indexOf(substring);
@@ -69010,7 +68287,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
69010
68287
  var polyfills = require_polyfills();
69011
68288
  var legacy = require_legacy_streams();
69012
68289
  var clone = require_clone();
69013
- var util$2 = __require("util");
68290
+ var util$3 = __require("util");
69014
68291
  /* istanbul ignore next - node 0.x polyfill */
69015
68292
  var gracefulQueue;
69016
68293
  var previousSymbol;
@@ -69029,9 +68306,9 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
69029
68306
  } });
69030
68307
  }
69031
68308
  var debug = noop;
69032
- if (util$2.debuglog) debug = util$2.debuglog("gfs4");
68309
+ if (util$3.debuglog) debug = util$3.debuglog("gfs4");
69033
68310
  else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
69034
- var m = util$2.format.apply(util$2, arguments);
68311
+ var m = util$3.format.apply(util$3, arguments);
69035
68312
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
69036
68313
  console.error(m);
69037
68314
  };
@@ -72165,7 +71442,7 @@ async function listSessionsFromDir(dir, onProgress, progressOffset = 0, progress
72165
71442
  const sessions = [];
72166
71443
  if (!existsSync$1(dir)) return sessions;
72167
71444
  try {
72168
- const files = (await readdir$1(dir)).filter((f) => f.endsWith(".jsonl")).map((f) => join$1(dir, f));
71445
+ const files = (await readdir$2(dir)).filter((f) => f.endsWith(".jsonl")).map((f) => join$1(dir, f));
72169
71446
  const total = progressTotal ?? files.length;
72170
71447
  let loaded = 0;
72171
71448
  const results = await Promise.all(files.map(async (file) => {
@@ -72725,11 +72002,11 @@ var SessionManager = class SessionManager {
72725
72002
  const sessionsDir = getSessionsDir();
72726
72003
  try {
72727
72004
  if (!existsSync$1(sessionsDir)) return [];
72728
- const dirs = (await readdir$1(sessionsDir, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => join$1(sessionsDir, e.name));
72005
+ const dirs = (await readdir$2(sessionsDir, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => join$1(sessionsDir, e.name));
72729
72006
  let totalFiles = 0;
72730
72007
  const dirFiles = [];
72731
72008
  for (const dir of dirs) try {
72732
- const files = (await readdir$1(dir)).filter((f) => f.endsWith(".jsonl"));
72009
+ const files = (await readdir$2(dir)).filter((f) => f.endsWith(".jsonl"));
72733
72010
  dirFiles.push(files.map((f) => join$1(dir, f)));
72734
72011
  totalFiles += files.length;
72735
72012
  } catch {
@@ -73107,7 +72384,9 @@ function createToolHtmlRenderer(deps) {
73107
72384
  try {
73108
72385
  const toolDef = getToolDefinition(toolName);
73109
72386
  if (!toolDef?.renderCall) return;
73110
- return ansiLinesToHtml(toolDef.renderCall(args, theme).render(width));
72387
+ const component = toolDef.renderCall(args, theme);
72388
+ if (!component) return;
72389
+ return ansiLinesToHtml(component.render(width));
73111
72390
  } catch {
73112
72391
  return;
73113
72392
  }
@@ -73121,10 +72400,12 @@ function createToolHtmlRenderer(deps) {
73121
72400
  details,
73122
72401
  isError
73123
72402
  };
73124
- return ansiLinesToHtml(toolDef.renderResult(agentToolResult, {
72403
+ const component = toolDef.renderResult(agentToolResult, {
73125
72404
  expanded: true,
73126
72405
  isPartial: false
73127
- }, theme).render(width));
72406
+ }, theme);
72407
+ if (!component) return;
72408
+ return ansiLinesToHtml(component.render(width));
73128
72409
  } catch {
73129
72410
  return;
73130
72411
  }
@@ -81771,7 +81052,7 @@ var require$2 = createRequire(import.meta.url);
81771
81052
  var _aliases = null;
81772
81053
  function getAliases() {
81773
81054
  if (_aliases) return _aliases;
81774
- const __dirname = path$6.dirname(fileURLToPath(import.meta.url));
81055
+ const __dirname = path$6.dirname(fileURLToPath$1(import.meta.url));
81775
81056
  const packageIndex = path$6.resolve(__dirname, "../..", "index.js");
81776
81057
  const typeboxRoot = require$2.resolve("@sinclair/typebox").replace(/[\\/]build[\\/]cjs[\\/]index\.js$/, "");
81777
81058
  _aliases = {
@@ -81816,6 +81097,7 @@ function createExtensionRuntime() {
81816
81097
  getActiveTools: notInitialized,
81817
81098
  getAllTools: notInitialized,
81818
81099
  setActiveTools: notInitialized,
81100
+ refreshTools: () => {},
81819
81101
  getCommands: notInitialized,
81820
81102
  setModel: () => Promise.reject(/* @__PURE__ */ new Error("Extension runtime not initialized")),
81821
81103
  getThinkingLevel: notInitialized,
@@ -81851,6 +81133,7 @@ function createExtensionAPI(extension, runtime, cwd, eventBus) {
81851
81133
  definition: tool,
81852
81134
  extensionPath: extension.path
81853
81135
  });
81136
+ runtime.refreshTools();
81854
81137
  },
81855
81138
  registerCommand(name, options) {
81856
81139
  extension.commands.set(name, {
@@ -82224,6 +81507,7 @@ var ExtensionRunner = class {
82224
81507
  this.runtime.getActiveTools = actions.getActiveTools;
82225
81508
  this.runtime.getAllTools = actions.getAllTools;
82226
81509
  this.runtime.setActiveTools = actions.setActiveTools;
81510
+ this.runtime.refreshTools = actions.refreshTools;
82227
81511
  this.runtime.getCommands = actions.getCommands;
82228
81512
  this.runtime.setModel = actions.setModel;
82229
81513
  this.runtime.getThinkingLevel = actions.getThinkingLevel;
@@ -83621,7 +82905,7 @@ var toolDescriptions = {
83621
82905
  };
83622
82906
  /** Build the system prompt with tools, guidelines, and context */
83623
82907
  function buildSystemPrompt(options = {}) {
83624
- const { customPrompt, selectedTools, appendSystemPrompt, cwd, contextFiles: providedContextFiles, skills: providedSkills } = options;
82908
+ const { customPrompt, selectedTools, toolSnippets, promptGuidelines, appendSystemPrompt, cwd, contextFiles: providedContextFiles, skills: providedSkills } = options;
83625
82909
  const resolvedCwd = cwd ?? process.cwd();
83626
82910
  const dateTime = (/* @__PURE__ */ new Date()).toLocaleString("en-US", {
83627
82911
  weekday: "long",
@@ -83652,14 +82936,22 @@ function buildSystemPrompt(options = {}) {
83652
82936
  const readmePath = getReadmePath();
83653
82937
  const docsPath = getDocsPath();
83654
82938
  const examplesPath = getExamplesPath();
83655
- const tools = (selectedTools || [
82939
+ const tools = selectedTools || [
83656
82940
  "read",
83657
82941
  "bash",
83658
82942
  "edit",
83659
82943
  "write"
83660
- ]).filter((t) => t in toolDescriptions);
83661
- const toolsList = tools.length > 0 ? tools.map((t) => `- ${t}: ${toolDescriptions[t]}`).join("\n") : "(none)";
82944
+ ];
82945
+ const toolsList = tools.length > 0 ? tools.map((name) => {
82946
+ return `- ${name}: ${toolSnippets?.[name] ?? toolDescriptions[name] ?? name}`;
82947
+ }).join("\n") : "(none)";
83662
82948
  const guidelinesList = [];
82949
+ const guidelinesSet = /* @__PURE__ */ new Set();
82950
+ const addGuideline = (guideline) => {
82951
+ if (guidelinesSet.has(guideline)) return;
82952
+ guidelinesSet.add(guideline);
82953
+ guidelinesList.push(guideline);
82954
+ };
83663
82955
  const hasBash = tools.includes("bash");
83664
82956
  const hasEdit = tools.includes("edit");
83665
82957
  const hasWrite = tools.includes("write");
@@ -83667,14 +82959,18 @@ function buildSystemPrompt(options = {}) {
83667
82959
  const hasFind = tools.includes("find");
83668
82960
  const hasLs = tools.includes("ls");
83669
82961
  const hasRead = tools.includes("read");
83670
- if (hasBash && !hasGrep && !hasFind && !hasLs) guidelinesList.push("Use bash for file operations like ls, rg, find");
83671
- else if (hasBash && (hasGrep || hasFind || hasLs)) guidelinesList.push("Prefer grep/find/ls tools over bash for file exploration (faster, respects .gitignore)");
83672
- if (hasRead && hasEdit) guidelinesList.push("Use read to examine files before editing. You must use this tool instead of cat or sed.");
83673
- if (hasEdit) guidelinesList.push("Use edit for precise changes (old text must match exactly)");
83674
- if (hasWrite) guidelinesList.push("Use write only for new files or complete rewrites");
83675
- if (hasEdit || hasWrite) guidelinesList.push("When summarizing your actions, output plain text directly - do NOT use cat or bash to display what you did");
83676
- guidelinesList.push("Be concise in your responses");
83677
- guidelinesList.push("Show file paths clearly when working with files");
82962
+ if (hasBash && !hasGrep && !hasFind && !hasLs) addGuideline("Use bash for file operations like ls, rg, find");
82963
+ else if (hasBash && (hasGrep || hasFind || hasLs)) addGuideline("Prefer grep/find/ls tools over bash for file exploration (faster, respects .gitignore)");
82964
+ if (hasRead && hasEdit) addGuideline("Use read to examine files before editing. You must use this tool instead of cat or sed.");
82965
+ if (hasEdit) addGuideline("Use edit for precise changes (old text must match exactly)");
82966
+ if (hasWrite) addGuideline("Use write only for new files or complete rewrites");
82967
+ if (hasEdit || hasWrite) addGuideline("When summarizing your actions, output plain text directly - do NOT use cat or bash to display what you did");
82968
+ for (const guideline of promptGuidelines ?? []) {
82969
+ const normalized = guideline.trim();
82970
+ if (normalized.length > 0) addGuideline(normalized);
82971
+ }
82972
+ addGuideline("Be concise in your responses");
82973
+ addGuideline("Show file paths clearly when working with files");
83678
82974
  let prompt = `You are an expert coding assistant operating inside pi, a coding agent harness. You help users by reading files, executing commands, editing code, and writing new files.
83679
82975
 
83680
82976
  Available tools:
@@ -86298,7 +85594,7 @@ while (this[Le](this[Ft]()) && this[C].length);
86298
85594
  }
86299
85595
  }, wt = {
86300
85596
  lstatSync: lstatSync$1,
86301
- readdir: readdir$2,
85597
+ readdir: readdir$1,
86302
85598
  readdirSync: readdirSync$1,
86303
85599
  readlinkSync,
86304
85600
  realpathSync: realpathSync.native,
@@ -86794,7 +86090,7 @@ while (this[Le](this[Ft]()) && this[C].length);
86794
86090
  nocase;
86795
86091
  #r;
86796
86092
  constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: o = wt } = {}) {
86797
- this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = fileURLToPath(t));
86093
+ this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = fileURLToPath$1(t));
86798
86094
  let h = e.resolve(t);
86799
86095
  this.roots = Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne(r);
86800
86096
  let a = h.substring(this.rootPath.length).split(s);
@@ -87328,372 +86624,1095 @@ var oe = class n {
87328
86624
  } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
87329
86625
  }
87330
86626
  }
87331
- testRegExp(t, e, s, i) {
87332
- e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
87333
- }
87334
- testString(t, e, s, i) {
87335
- t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
87336
- }
87337
- };
87338
- var Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n, zt = class {
87339
- path;
87340
- patterns;
87341
- opts;
87342
- seen = /* @__PURE__ */ new Set();
87343
- paused = !1;
87344
- aborted = !1;
87345
- #t = [];
87346
- #s;
87347
- #n;
87348
- signal;
87349
- maxDepth;
87350
- includeChildMatches;
87351
- constructor(t, e, s) {
87352
- if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== !1, (s.ignore || !this.includeChildMatches) && (this.#s = Li(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) throw new Error("cannot ignore child matches, ignore lacks add() method.");
87353
- this.maxDepth = s.maxDepth || Infinity, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
87354
- this.#t.length = 0;
87355
- }));
87356
- }
87357
- #r(t) {
87358
- return this.seen.has(t) || !!this.#s?.ignored?.(t);
87359
- }
87360
- #o(t) {
87361
- return !!this.#s?.childrenIgnored?.(t);
87362
- }
87363
- pause() {
87364
- this.paused = !0;
86627
+ testRegExp(t, e, s, i) {
86628
+ e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
86629
+ }
86630
+ testString(t, e, s, i) {
86631
+ t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
86632
+ }
86633
+ };
86634
+ var Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n, zt = class {
86635
+ path;
86636
+ patterns;
86637
+ opts;
86638
+ seen = /* @__PURE__ */ new Set();
86639
+ paused = !1;
86640
+ aborted = !1;
86641
+ #t = [];
86642
+ #s;
86643
+ #n;
86644
+ signal;
86645
+ maxDepth;
86646
+ includeChildMatches;
86647
+ constructor(t, e, s) {
86648
+ if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== !1, (s.ignore || !this.includeChildMatches) && (this.#s = Li(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) throw new Error("cannot ignore child matches, ignore lacks add() method.");
86649
+ this.maxDepth = s.maxDepth || Infinity, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
86650
+ this.#t.length = 0;
86651
+ }));
86652
+ }
86653
+ #r(t) {
86654
+ return this.seen.has(t) || !!this.#s?.ignored?.(t);
86655
+ }
86656
+ #o(t) {
86657
+ return !!this.#s?.childrenIgnored?.(t);
86658
+ }
86659
+ pause() {
86660
+ this.paused = !0;
86661
+ }
86662
+ resume() {
86663
+ if (this.signal?.aborted) return;
86664
+ this.paused = !1;
86665
+ let t;
86666
+ for (; !this.paused && (t = this.#t.shift());) t();
86667
+ }
86668
+ onResume(t) {
86669
+ this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
86670
+ }
86671
+ async matchCheck(t, e) {
86672
+ if (e && this.opts.nodir) return;
86673
+ let s;
86674
+ if (this.opts.realpath) {
86675
+ if (s = t.realpathCached() || await t.realpath(), !s) return;
86676
+ t = s;
86677
+ }
86678
+ let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
86679
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
86680
+ let o = await r.realpath();
86681
+ o && (o.isUnknown() || this.opts.stat) && await o.lstat();
86682
+ }
86683
+ return this.matchCheckTest(r, e);
86684
+ }
86685
+ matchCheckTest(t, e) {
86686
+ return t && (this.maxDepth === Infinity || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#r(t) ? t : void 0;
86687
+ }
86688
+ matchCheckSync(t, e) {
86689
+ if (e && this.opts.nodir) return;
86690
+ let s;
86691
+ if (this.opts.realpath) {
86692
+ if (s = t.realpathCached() || t.realpathSync(), !s) return;
86693
+ t = s;
86694
+ }
86695
+ let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
86696
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
86697
+ let o = r.realpathSync();
86698
+ o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
86699
+ }
86700
+ return this.matchCheckTest(r, e);
86701
+ }
86702
+ matchFinish(t, e) {
86703
+ if (this.#r(t)) return;
86704
+ if (!this.includeChildMatches && this.#s?.add) {
86705
+ let r = `${t.relativePosix()}/**`;
86706
+ this.#s.add(r);
86707
+ }
86708
+ let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
86709
+ this.seen.add(t);
86710
+ let i = this.opts.mark && t.isDirectory() ? this.#n : "";
86711
+ if (this.opts.withFileTypes) this.matchEmit(t);
86712
+ else if (s) {
86713
+ let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
86714
+ this.matchEmit(r + i);
86715
+ } else {
86716
+ let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
86717
+ this.matchEmit(r ? o + r + i : "." + i);
86718
+ }
86719
+ }
86720
+ async match(t, e, s) {
86721
+ let i = await this.matchCheck(t, s);
86722
+ i && this.matchFinish(i, e);
86723
+ }
86724
+ matchSync(t, e, s) {
86725
+ let i = this.matchCheckSync(t, s);
86726
+ i && this.matchFinish(i, e);
86727
+ }
86728
+ walkCB(t, e, s) {
86729
+ this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
86730
+ }
86731
+ walkCB2(t, e, s, i) {
86732
+ if (this.#o(t)) return i();
86733
+ if (this.signal?.aborted && i(), this.paused) {
86734
+ this.onResume(() => this.walkCB2(t, e, s, i));
86735
+ return;
86736
+ }
86737
+ s.processPatterns(t, e);
86738
+ let r = 1, o = () => {
86739
+ --r === 0 && i();
86740
+ };
86741
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
86742
+ for (let h of s.subwalkTargets()) {
86743
+ if (this.maxDepth !== Infinity && h.depth() >= this.maxDepth) continue;
86744
+ r++;
86745
+ let a = h.readdirCached();
86746
+ h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), !0);
86747
+ }
86748
+ o();
86749
+ }
86750
+ walkCB3(t, e, s, i) {
86751
+ s = s.filterEntries(t, e);
86752
+ let r = 1, o = () => {
86753
+ --r === 0 && i();
86754
+ };
86755
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
86756
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2(h, a, s.child(), o);
86757
+ o();
86758
+ }
86759
+ walkCBSync(t, e, s) {
86760
+ this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
86761
+ }
86762
+ walkCB2Sync(t, e, s, i) {
86763
+ if (this.#o(t)) return i();
86764
+ if (this.signal?.aborted && i(), this.paused) {
86765
+ this.onResume(() => this.walkCB2Sync(t, e, s, i));
86766
+ return;
86767
+ }
86768
+ s.processPatterns(t, e);
86769
+ let r = 1, o = () => {
86770
+ --r === 0 && i();
86771
+ };
86772
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
86773
+ for (let h of s.subwalkTargets()) {
86774
+ if (this.maxDepth !== Infinity && h.depth() >= this.maxDepth) continue;
86775
+ r++;
86776
+ let a = h.readdirSync();
86777
+ this.walkCB3Sync(h, a, s, o);
86778
+ }
86779
+ o();
86780
+ }
86781
+ walkCB3Sync(t, e, s, i) {
86782
+ s = s.filterEntries(t, e);
86783
+ let r = 1, o = () => {
86784
+ --r === 0 && i();
86785
+ };
86786
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
86787
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
86788
+ o();
86789
+ }
86790
+ }, xt = class extends zt {
86791
+ matches = /* @__PURE__ */ new Set();
86792
+ constructor(t, e, s) {
86793
+ super(t, e, s);
86794
+ }
86795
+ matchEmit(t) {
86796
+ this.matches.add(t);
86797
+ }
86798
+ async walk() {
86799
+ if (this.signal?.aborted) throw this.signal.reason;
86800
+ return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
86801
+ this.walkCB(this.path, this.patterns, () => {
86802
+ this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
86803
+ });
86804
+ }), this.matches;
86805
+ }
86806
+ walkSync() {
86807
+ if (this.signal?.aborted) throw this.signal.reason;
86808
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
86809
+ if (this.signal?.aborted) throw this.signal.reason;
86810
+ }), this.matches;
86811
+ }
86812
+ }, vt = class extends zt {
86813
+ results;
86814
+ constructor(t, e, s) {
86815
+ super(t, e, s), this.results = new V({
86816
+ signal: this.signal,
86817
+ objectMode: !0
86818
+ }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
86819
+ }
86820
+ matchEmit(t) {
86821
+ this.results.write(t), this.results.flowing || this.pause();
86822
+ }
86823
+ stream() {
86824
+ let t = this.path;
86825
+ return t.isUnknown() ? t.lstat().then(() => {
86826
+ this.walkCB(t, this.patterns, () => this.results.end());
86827
+ }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
86828
+ }
86829
+ streamSync() {
86830
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
86831
+ }
86832
+ };
86833
+ var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", I = class {
86834
+ absolute;
86835
+ cwd;
86836
+ root;
86837
+ dot;
86838
+ dotRelative;
86839
+ follow;
86840
+ ignore;
86841
+ magicalBraces;
86842
+ mark;
86843
+ matchBase;
86844
+ maxDepth;
86845
+ nobrace;
86846
+ nocase;
86847
+ nodir;
86848
+ noext;
86849
+ noglobstar;
86850
+ pattern;
86851
+ platform;
86852
+ realpath;
86853
+ scurry;
86854
+ stat;
86855
+ signal;
86856
+ windowsPathsNoEscape;
86857
+ withFileTypes;
86858
+ includeChildMatches;
86859
+ opts;
86860
+ patterns;
86861
+ constructor(t, e) {
86862
+ if (!e) throw new TypeError("glob options required");
86863
+ if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = fileURLToPath$1(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== !1, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : Infinity, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
86864
+ if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
86865
+ if (e.noglobstar) throw new TypeError("base matching requires globstar");
86866
+ t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
86867
+ }
86868
+ if (this.pattern = t, this.platform = e.platform || Pi, this.opts = {
86869
+ ...e,
86870
+ platform: this.platform
86871
+ }, e.scurry) {
86872
+ if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
86873
+ } else this.scurry = new (e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe)(this.cwd, {
86874
+ nocase: e.nocase,
86875
+ fs: e.fs
86876
+ });
86877
+ this.nocase = this.scurry.nocase;
86878
+ let s = this.platform === "darwin" || this.platform === "win32", i = {
86879
+ braceExpandMax: 1e4,
86880
+ ...e,
86881
+ dot: this.dot,
86882
+ matchBase: this.matchBase,
86883
+ nobrace: this.nobrace,
86884
+ nocase: this.nocase,
86885
+ nocaseMagicOnly: s,
86886
+ nocomment: !0,
86887
+ noext: this.noext,
86888
+ nonegate: !0,
86889
+ optimizationLevel: 2,
86890
+ platform: this.platform,
86891
+ windowsPathsNoEscape: this.windowsPathsNoEscape,
86892
+ debug: !!this.opts.debug
86893
+ }, [o, h] = this.pattern.map((a) => new D(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
86894
+ this.patterns = o.map((a, l) => {
86895
+ let u = h[l];
86896
+ if (!u) throw new Error("invalid pattern object");
86897
+ return new nt(a, u, 0, this.platform);
86898
+ });
86899
+ }
86900
+ async walk() {
86901
+ return [...await new xt(this.patterns, this.scurry.cwd, {
86902
+ ...this.opts,
86903
+ maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
86904
+ platform: this.platform,
86905
+ nocase: this.nocase,
86906
+ includeChildMatches: this.includeChildMatches
86907
+ }).walk()];
86908
+ }
86909
+ walkSync() {
86910
+ return [...new xt(this.patterns, this.scurry.cwd, {
86911
+ ...this.opts,
86912
+ maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
86913
+ platform: this.platform,
86914
+ nocase: this.nocase,
86915
+ includeChildMatches: this.includeChildMatches
86916
+ }).walkSync()];
86917
+ }
86918
+ stream() {
86919
+ return new vt(this.patterns, this.scurry.cwd, {
86920
+ ...this.opts,
86921
+ maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
86922
+ platform: this.platform,
86923
+ nocase: this.nocase,
86924
+ includeChildMatches: this.includeChildMatches
86925
+ }).stream();
86926
+ }
86927
+ streamSync() {
86928
+ return new vt(this.patterns, this.scurry.cwd, {
86929
+ ...this.opts,
86930
+ maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
86931
+ platform: this.platform,
86932
+ nocase: this.nocase,
86933
+ includeChildMatches: this.includeChildMatches
86934
+ }).streamSync();
86935
+ }
86936
+ iterateSync() {
86937
+ return this.streamSync()[Symbol.iterator]();
86938
+ }
86939
+ [Symbol.iterator]() {
86940
+ return this.iterateSync();
86941
+ }
86942
+ iterate() {
86943
+ return this.stream()[Symbol.asyncIterator]();
86944
+ }
86945
+ [Symbol.asyncIterator]() {
86946
+ return this.iterate();
86947
+ }
86948
+ };
86949
+ var le = (n, t = {}) => {
86950
+ Array.isArray(n) || (n = [n]);
86951
+ for (let e of n) if (new D(e, t).hasMagic()) return !0;
86952
+ return !1;
86953
+ };
86954
+ function Bt(n, t = {}) {
86955
+ return new I(n, t).streamSync();
86956
+ }
86957
+ function Qe(n, t = {}) {
86958
+ return new I(n, t).stream();
86959
+ }
86960
+ function ts(n, t = {}) {
86961
+ return new I(n, t).walkSync();
86962
+ }
86963
+ async function Je(n, t = {}) {
86964
+ return new I(n, t).walk();
86965
+ }
86966
+ function Ut(n, t = {}) {
86967
+ return new I(n, t).iterateSync();
86968
+ }
86969
+ function es(n, t = {}) {
86970
+ return new I(n, t).iterate();
86971
+ }
86972
+ var ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(es, { sync: Ut }), Ui = Object.assign(ts, {
86973
+ stream: Bt,
86974
+ iterate: Ut
86975
+ }), Ze = Object.assign(Je, {
86976
+ glob: Je,
86977
+ globSync: ts,
86978
+ sync: Ui,
86979
+ globStream: Qe,
86980
+ stream: Ii,
86981
+ globStreamSync: Bt,
86982
+ streamSync: ji,
86983
+ globIterate: es,
86984
+ iterate: Bi,
86985
+ globIterateSync: Ut,
86986
+ iterateSync: zi,
86987
+ Glob: I,
86988
+ hasMagic: le,
86989
+ escape: tt,
86990
+ unescape: W
86991
+ });
86992
+ Ze.glob = Ze;
86993
+ var require_ms = /* @__PURE__ */ __commonJSMin(((exports, module) => {
86994
+ /**
86995
+ * Helpers.
86996
+ */
86997
+ var s = 1e3;
86998
+ var m = s * 60;
86999
+ var h = m * 60;
87000
+ var d = h * 24;
87001
+ var w = d * 7;
87002
+ var y = d * 365.25;
87003
+ /**
87004
+ * Parse or format the given `val`.
87005
+ *
87006
+ * Options:
87007
+ *
87008
+ * - `long` verbose formatting [false]
87009
+ *
87010
+ * @param {String|Number} val
87011
+ * @param {Object} [options]
87012
+ * @throws {Error} throw an error if val is not a non-empty string or a number
87013
+ * @return {String|Number}
87014
+ * @api public
87015
+ */
87016
+ module.exports = function(val, options) {
87017
+ options = options || {};
87018
+ var type = typeof val;
87019
+ if (type === "string" && val.length > 0) return parse(val);
87020
+ else if (type === "number" && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
87021
+ throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
87022
+ };
87023
+ /**
87024
+ * Parse the given `str` and return milliseconds.
87025
+ *
87026
+ * @param {String} str
87027
+ * @return {Number}
87028
+ * @api private
87029
+ */
87030
+ function parse(str) {
87031
+ str = String(str);
87032
+ if (str.length > 100) return;
87033
+ 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);
87034
+ if (!match) return;
87035
+ var n = parseFloat(match[1]);
87036
+ switch ((match[2] || "ms").toLowerCase()) {
87037
+ case "years":
87038
+ case "year":
87039
+ case "yrs":
87040
+ case "yr":
87041
+ case "y": return n * y;
87042
+ case "weeks":
87043
+ case "week":
87044
+ case "w": return n * w;
87045
+ case "days":
87046
+ case "day":
87047
+ case "d": return n * d;
87048
+ case "hours":
87049
+ case "hour":
87050
+ case "hrs":
87051
+ case "hr":
87052
+ case "h": return n * h;
87053
+ case "minutes":
87054
+ case "minute":
87055
+ case "mins":
87056
+ case "min":
87057
+ case "m": return n * m;
87058
+ case "seconds":
87059
+ case "second":
87060
+ case "secs":
87061
+ case "sec":
87062
+ case "s": return n * s;
87063
+ case "milliseconds":
87064
+ case "millisecond":
87065
+ case "msecs":
87066
+ case "msec":
87067
+ case "ms": return n;
87068
+ default: return;
87069
+ }
87070
+ }
87071
+ /**
87072
+ * Short format for `ms`.
87073
+ *
87074
+ * @param {Number} ms
87075
+ * @return {String}
87076
+ * @api private
87077
+ */
87078
+ function fmtShort(ms) {
87079
+ var msAbs = Math.abs(ms);
87080
+ if (msAbs >= d) return Math.round(ms / d) + "d";
87081
+ if (msAbs >= h) return Math.round(ms / h) + "h";
87082
+ if (msAbs >= m) return Math.round(ms / m) + "m";
87083
+ if (msAbs >= s) return Math.round(ms / s) + "s";
87084
+ return ms + "ms";
87365
87085
  }
87366
- resume() {
87367
- if (this.signal?.aborted) return;
87368
- this.paused = !1;
87369
- let t;
87370
- for (; !this.paused && (t = this.#t.shift());) t();
87086
+ /**
87087
+ * Long format for `ms`.
87088
+ *
87089
+ * @param {Number} ms
87090
+ * @return {String}
87091
+ * @api private
87092
+ */
87093
+ function fmtLong(ms) {
87094
+ var msAbs = Math.abs(ms);
87095
+ if (msAbs >= d) return plural(ms, msAbs, d, "day");
87096
+ if (msAbs >= h) return plural(ms, msAbs, h, "hour");
87097
+ if (msAbs >= m) return plural(ms, msAbs, m, "minute");
87098
+ if (msAbs >= s) return plural(ms, msAbs, s, "second");
87099
+ return ms + " ms";
87371
87100
  }
87372
- onResume(t) {
87373
- this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
87101
+ /**
87102
+ * Pluralization helper.
87103
+ */
87104
+ function plural(ms, msAbs, n, name) {
87105
+ var isPlural = msAbs >= n * 1.5;
87106
+ return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
87374
87107
  }
87375
- async matchCheck(t, e) {
87376
- if (e && this.opts.nodir) return;
87377
- let s;
87378
- if (this.opts.realpath) {
87379
- if (s = t.realpathCached() || await t.realpath(), !s) return;
87380
- t = s;
87381
- }
87382
- let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
87383
- if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
87384
- let o = await r.realpath();
87385
- o && (o.isUnknown() || this.opts.stat) && await o.lstat();
87108
+ }));
87109
+ var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
87110
+ /**
87111
+ * This is the common logic for both the Node.js and web browser
87112
+ * implementations of `debug()`.
87113
+ */
87114
+ function setup(env) {
87115
+ createDebug.debug = createDebug;
87116
+ createDebug.default = createDebug;
87117
+ createDebug.coerce = coerce;
87118
+ createDebug.disable = disable;
87119
+ createDebug.enable = enable;
87120
+ createDebug.enabled = enabled;
87121
+ createDebug.humanize = require_ms();
87122
+ createDebug.destroy = destroy;
87123
+ Object.keys(env).forEach((key) => {
87124
+ createDebug[key] = env[key];
87125
+ });
87126
+ /**
87127
+ * The currently active debug mode names, and names to skip.
87128
+ */
87129
+ createDebug.names = [];
87130
+ createDebug.skips = [];
87131
+ /**
87132
+ * Map of special "%n" handling functions, for the debug "format" argument.
87133
+ *
87134
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
87135
+ */
87136
+ createDebug.formatters = {};
87137
+ /**
87138
+ * Selects a color for a debug namespace
87139
+ * @param {String} namespace The namespace string for the debug instance to be colored
87140
+ * @return {Number|String} An ANSI color code for the given namespace
87141
+ * @api private
87142
+ */
87143
+ function selectColor(namespace) {
87144
+ let hash = 0;
87145
+ for (let i = 0; i < namespace.length; i++) {
87146
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
87147
+ hash |= 0;
87148
+ }
87149
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
87386
87150
  }
87387
- return this.matchCheckTest(r, e);
87388
- }
87389
- matchCheckTest(t, e) {
87390
- return t && (this.maxDepth === Infinity || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#r(t) ? t : void 0;
87391
- }
87392
- matchCheckSync(t, e) {
87393
- if (e && this.opts.nodir) return;
87394
- let s;
87395
- if (this.opts.realpath) {
87396
- if (s = t.realpathCached() || t.realpathSync(), !s) return;
87397
- t = s;
87151
+ createDebug.selectColor = selectColor;
87152
+ /**
87153
+ * Create a debugger with the given `namespace`.
87154
+ *
87155
+ * @param {String} namespace
87156
+ * @return {Function}
87157
+ * @api public
87158
+ */
87159
+ function createDebug(namespace) {
87160
+ let prevTime;
87161
+ let enableOverride = null;
87162
+ let namespacesCache;
87163
+ let enabledCache;
87164
+ function debug(...args) {
87165
+ if (!debug.enabled) return;
87166
+ const self = debug;
87167
+ const curr = Number(/* @__PURE__ */ new Date());
87168
+ self.diff = curr - (prevTime || curr);
87169
+ self.prev = prevTime;
87170
+ self.curr = curr;
87171
+ prevTime = curr;
87172
+ args[0] = createDebug.coerce(args[0]);
87173
+ if (typeof args[0] !== "string") args.unshift("%O");
87174
+ let index = 0;
87175
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
87176
+ if (match === "%%") return "%";
87177
+ index++;
87178
+ const formatter = createDebug.formatters[format];
87179
+ if (typeof formatter === "function") {
87180
+ const val = args[index];
87181
+ match = formatter.call(self, val);
87182
+ args.splice(index, 1);
87183
+ index--;
87184
+ }
87185
+ return match;
87186
+ });
87187
+ createDebug.formatArgs.call(self, args);
87188
+ (self.log || createDebug.log).apply(self, args);
87189
+ }
87190
+ debug.namespace = namespace;
87191
+ debug.useColors = createDebug.useColors();
87192
+ debug.color = createDebug.selectColor(namespace);
87193
+ debug.extend = extend;
87194
+ debug.destroy = createDebug.destroy;
87195
+ Object.defineProperty(debug, "enabled", {
87196
+ enumerable: true,
87197
+ configurable: false,
87198
+ get: () => {
87199
+ if (enableOverride !== null) return enableOverride;
87200
+ if (namespacesCache !== createDebug.namespaces) {
87201
+ namespacesCache = createDebug.namespaces;
87202
+ enabledCache = createDebug.enabled(namespace);
87203
+ }
87204
+ return enabledCache;
87205
+ },
87206
+ set: (v) => {
87207
+ enableOverride = v;
87208
+ }
87209
+ });
87210
+ if (typeof createDebug.init === "function") createDebug.init(debug);
87211
+ return debug;
87398
87212
  }
87399
- let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
87400
- if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
87401
- let o = r.realpathSync();
87402
- o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
87213
+ function extend(namespace, delimiter) {
87214
+ const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
87215
+ newDebug.log = this.log;
87216
+ return newDebug;
87403
87217
  }
87404
- return this.matchCheckTest(r, e);
87405
- }
87406
- matchFinish(t, e) {
87407
- if (this.#r(t)) return;
87408
- if (!this.includeChildMatches && this.#s?.add) {
87409
- let r = `${t.relativePosix()}/**`;
87410
- this.#s.add(r);
87218
+ /**
87219
+ * Enables a debug mode by namespaces. This can include modes
87220
+ * separated by a colon and wildcards.
87221
+ *
87222
+ * @param {String} namespaces
87223
+ * @api public
87224
+ */
87225
+ function enable(namespaces) {
87226
+ createDebug.save(namespaces);
87227
+ createDebug.namespaces = namespaces;
87228
+ createDebug.names = [];
87229
+ createDebug.skips = [];
87230
+ const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
87231
+ for (const ns of split) if (ns[0] === "-") createDebug.skips.push(ns.slice(1));
87232
+ else createDebug.names.push(ns);
87411
87233
  }
87412
- let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
87413
- this.seen.add(t);
87414
- let i = this.opts.mark && t.isDirectory() ? this.#n : "";
87415
- if (this.opts.withFileTypes) this.matchEmit(t);
87416
- else if (s) {
87417
- let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
87418
- this.matchEmit(r + i);
87419
- } else {
87420
- let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
87421
- this.matchEmit(r ? o + r + i : "." + i);
87234
+ /**
87235
+ * Checks if the given string matches a namespace template, honoring
87236
+ * asterisks as wildcards.
87237
+ *
87238
+ * @param {String} search
87239
+ * @param {String} template
87240
+ * @return {Boolean}
87241
+ */
87242
+ function matchesTemplate(search, template) {
87243
+ let searchIndex = 0;
87244
+ let templateIndex = 0;
87245
+ let starIndex = -1;
87246
+ let matchIndex = 0;
87247
+ while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
87248
+ starIndex = templateIndex;
87249
+ matchIndex = searchIndex;
87250
+ templateIndex++;
87251
+ } else {
87252
+ searchIndex++;
87253
+ templateIndex++;
87254
+ }
87255
+ else if (starIndex !== -1) {
87256
+ templateIndex = starIndex + 1;
87257
+ matchIndex++;
87258
+ searchIndex = matchIndex;
87259
+ } else return false;
87260
+ while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
87261
+ return templateIndex === template.length;
87422
87262
  }
87423
- }
87424
- async match(t, e, s) {
87425
- let i = await this.matchCheck(t, s);
87426
- i && this.matchFinish(i, e);
87427
- }
87428
- matchSync(t, e, s) {
87429
- let i = this.matchCheckSync(t, s);
87430
- i && this.matchFinish(i, e);
87431
- }
87432
- walkCB(t, e, s) {
87433
- this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
87434
- }
87435
- walkCB2(t, e, s, i) {
87436
- if (this.#o(t)) return i();
87437
- if (this.signal?.aborted && i(), this.paused) {
87438
- this.onResume(() => this.walkCB2(t, e, s, i));
87439
- return;
87263
+ /**
87264
+ * Disable debug output.
87265
+ *
87266
+ * @return {String} namespaces
87267
+ * @api public
87268
+ */
87269
+ function disable() {
87270
+ const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
87271
+ createDebug.enable("");
87272
+ return namespaces;
87440
87273
  }
87441
- s.processPatterns(t, e);
87442
- let r = 1, o = () => {
87443
- --r === 0 && i();
87444
- };
87445
- for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
87446
- for (let h of s.subwalkTargets()) {
87447
- if (this.maxDepth !== Infinity && h.depth() >= this.maxDepth) continue;
87448
- r++;
87449
- let a = h.readdirCached();
87450
- h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), !0);
87274
+ /**
87275
+ * Returns true if the given mode name is enabled, false otherwise.
87276
+ *
87277
+ * @param {String} name
87278
+ * @return {Boolean}
87279
+ * @api public
87280
+ */
87281
+ function enabled(name) {
87282
+ for (const skip of createDebug.skips) if (matchesTemplate(name, skip)) return false;
87283
+ for (const ns of createDebug.names) if (matchesTemplate(name, ns)) return true;
87284
+ return false;
87451
87285
  }
87452
- o();
87453
- }
87454
- walkCB3(t, e, s, i) {
87455
- s = s.filterEntries(t, e);
87456
- let r = 1, o = () => {
87457
- --r === 0 && i();
87458
- };
87459
- for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
87460
- for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2(h, a, s.child(), o);
87461
- o();
87462
- }
87463
- walkCBSync(t, e, s) {
87464
- this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
87465
- }
87466
- walkCB2Sync(t, e, s, i) {
87467
- if (this.#o(t)) return i();
87468
- if (this.signal?.aborted && i(), this.paused) {
87469
- this.onResume(() => this.walkCB2Sync(t, e, s, i));
87470
- return;
87286
+ /**
87287
+ * Coerce `val`.
87288
+ *
87289
+ * @param {Mixed} val
87290
+ * @return {Mixed}
87291
+ * @api private
87292
+ */
87293
+ function coerce(val) {
87294
+ if (val instanceof Error) return val.stack || val.message;
87295
+ return val;
87471
87296
  }
87472
- s.processPatterns(t, e);
87473
- let r = 1, o = () => {
87474
- --r === 0 && i();
87475
- };
87476
- for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
87477
- for (let h of s.subwalkTargets()) {
87478
- if (this.maxDepth !== Infinity && h.depth() >= this.maxDepth) continue;
87479
- r++;
87480
- let a = h.readdirSync();
87481
- this.walkCB3Sync(h, a, s, o);
87297
+ /**
87298
+ * XXX DO NOT USE. This is a temporary stub function.
87299
+ * XXX It WILL be removed in the next major release.
87300
+ */
87301
+ function destroy() {
87302
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
87482
87303
  }
87483
- o();
87304
+ createDebug.enable(createDebug.load());
87305
+ return createDebug;
87484
87306
  }
87485
- walkCB3Sync(t, e, s, i) {
87486
- s = s.filterEntries(t, e);
87487
- let r = 1, o = () => {
87488
- --r === 0 && i();
87307
+ module.exports = setup;
87308
+ }));
87309
+ var require_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
87310
+ /**
87311
+ * This is the web browser implementation of `debug()`.
87312
+ */
87313
+ exports.formatArgs = formatArgs;
87314
+ exports.save = save;
87315
+ exports.load = load;
87316
+ exports.useColors = useColors;
87317
+ exports.storage = localstorage();
87318
+ exports.destroy = (() => {
87319
+ let warned = false;
87320
+ return () => {
87321
+ if (!warned) {
87322
+ warned = true;
87323
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
87324
+ }
87489
87325
  };
87490
- for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
87491
- for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
87492
- o();
87493
- }
87494
- }, xt = class extends zt {
87495
- matches = /* @__PURE__ */ new Set();
87496
- constructor(t, e, s) {
87497
- super(t, e, s);
87498
- }
87499
- matchEmit(t) {
87500
- this.matches.add(t);
87501
- }
87502
- async walk() {
87503
- if (this.signal?.aborted) throw this.signal.reason;
87504
- return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
87505
- this.walkCB(this.path, this.patterns, () => {
87506
- this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
87507
- });
87508
- }), this.matches;
87509
- }
87510
- walkSync() {
87511
- if (this.signal?.aborted) throw this.signal.reason;
87512
- return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
87513
- if (this.signal?.aborted) throw this.signal.reason;
87514
- }), this.matches;
87326
+ })();
87327
+ /**
87328
+ * Colors.
87329
+ */
87330
+ exports.colors = [
87331
+ "#0000CC",
87332
+ "#0000FF",
87333
+ "#0033CC",
87334
+ "#0033FF",
87335
+ "#0066CC",
87336
+ "#0066FF",
87337
+ "#0099CC",
87338
+ "#0099FF",
87339
+ "#00CC00",
87340
+ "#00CC33",
87341
+ "#00CC66",
87342
+ "#00CC99",
87343
+ "#00CCCC",
87344
+ "#00CCFF",
87345
+ "#3300CC",
87346
+ "#3300FF",
87347
+ "#3333CC",
87348
+ "#3333FF",
87349
+ "#3366CC",
87350
+ "#3366FF",
87351
+ "#3399CC",
87352
+ "#3399FF",
87353
+ "#33CC00",
87354
+ "#33CC33",
87355
+ "#33CC66",
87356
+ "#33CC99",
87357
+ "#33CCCC",
87358
+ "#33CCFF",
87359
+ "#6600CC",
87360
+ "#6600FF",
87361
+ "#6633CC",
87362
+ "#6633FF",
87363
+ "#66CC00",
87364
+ "#66CC33",
87365
+ "#9900CC",
87366
+ "#9900FF",
87367
+ "#9933CC",
87368
+ "#9933FF",
87369
+ "#99CC00",
87370
+ "#99CC33",
87371
+ "#CC0000",
87372
+ "#CC0033",
87373
+ "#CC0066",
87374
+ "#CC0099",
87375
+ "#CC00CC",
87376
+ "#CC00FF",
87377
+ "#CC3300",
87378
+ "#CC3333",
87379
+ "#CC3366",
87380
+ "#CC3399",
87381
+ "#CC33CC",
87382
+ "#CC33FF",
87383
+ "#CC6600",
87384
+ "#CC6633",
87385
+ "#CC9900",
87386
+ "#CC9933",
87387
+ "#CCCC00",
87388
+ "#CCCC33",
87389
+ "#FF0000",
87390
+ "#FF0033",
87391
+ "#FF0066",
87392
+ "#FF0099",
87393
+ "#FF00CC",
87394
+ "#FF00FF",
87395
+ "#FF3300",
87396
+ "#FF3333",
87397
+ "#FF3366",
87398
+ "#FF3399",
87399
+ "#FF33CC",
87400
+ "#FF33FF",
87401
+ "#FF6600",
87402
+ "#FF6633",
87403
+ "#FF9900",
87404
+ "#FF9933",
87405
+ "#FFCC00",
87406
+ "#FFCC33"
87407
+ ];
87408
+ /**
87409
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
87410
+ * and the Firebug extension (any Firefox version) are known
87411
+ * to support "%c" CSS customizations.
87412
+ *
87413
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
87414
+ */
87415
+ function useColors() {
87416
+ if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
87417
+ if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
87418
+ let m;
87419
+ 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+)/);
87515
87420
  }
87516
- }, vt = class extends zt {
87517
- results;
87518
- constructor(t, e, s) {
87519
- super(t, e, s), this.results = new V({
87520
- signal: this.signal,
87521
- objectMode: !0
87522
- }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
87421
+ /**
87422
+ * Colorize log arguments if enabled.
87423
+ *
87424
+ * @api public
87425
+ */
87426
+ function formatArgs(args) {
87427
+ args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
87428
+ if (!this.useColors) return;
87429
+ const c = "color: " + this.color;
87430
+ args.splice(1, 0, c, "color: inherit");
87431
+ let index = 0;
87432
+ let lastC = 0;
87433
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
87434
+ if (match === "%%") return;
87435
+ index++;
87436
+ if (match === "%c") lastC = index;
87437
+ });
87438
+ args.splice(lastC, 0, c);
87523
87439
  }
87524
- matchEmit(t) {
87525
- this.results.write(t), this.results.flowing || this.pause();
87440
+ /**
87441
+ * Invokes `console.debug()` when available.
87442
+ * No-op when `console.debug` is not a "function".
87443
+ * If `console.debug` is not available, falls back
87444
+ * to `console.log`.
87445
+ *
87446
+ * @api public
87447
+ */
87448
+ exports.log = console.debug || console.log || (() => {});
87449
+ /**
87450
+ * Save `namespaces`.
87451
+ *
87452
+ * @param {String} namespaces
87453
+ * @api private
87454
+ */
87455
+ function save(namespaces) {
87456
+ try {
87457
+ if (namespaces) exports.storage.setItem("debug", namespaces);
87458
+ else exports.storage.removeItem("debug");
87459
+ } catch (error) {}
87526
87460
  }
87527
- stream() {
87528
- let t = this.path;
87529
- return t.isUnknown() ? t.lstat().then(() => {
87530
- this.walkCB(t, this.patterns, () => this.results.end());
87531
- }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
87461
+ /**
87462
+ * Load `namespaces`.
87463
+ *
87464
+ * @return {String} returns the previously persisted debug modes
87465
+ * @api private
87466
+ */
87467
+ function load() {
87468
+ let r;
87469
+ try {
87470
+ r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
87471
+ } catch (error) {}
87472
+ if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
87473
+ return r;
87532
87474
  }
87533
- streamSync() {
87534
- return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
87475
+ /**
87476
+ * Localstorage attempts to return the localstorage.
87477
+ *
87478
+ * This is necessary because safari throws
87479
+ * when a user disables cookies/localstorage
87480
+ * and you attempt to access it.
87481
+ *
87482
+ * @return {LocalStorage}
87483
+ * @api private
87484
+ */
87485
+ function localstorage() {
87486
+ try {
87487
+ return localStorage;
87488
+ } catch (error) {}
87535
87489
  }
87536
- };
87537
- var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", I = class {
87538
- absolute;
87539
- cwd;
87540
- root;
87541
- dot;
87542
- dotRelative;
87543
- follow;
87544
- ignore;
87545
- magicalBraces;
87546
- mark;
87547
- matchBase;
87548
- maxDepth;
87549
- nobrace;
87550
- nocase;
87551
- nodir;
87552
- noext;
87553
- noglobstar;
87554
- pattern;
87555
- platform;
87556
- realpath;
87557
- scurry;
87558
- stat;
87559
- signal;
87560
- windowsPathsNoEscape;
87561
- withFileTypes;
87562
- includeChildMatches;
87563
- opts;
87564
- patterns;
87565
- constructor(t, e) {
87566
- if (!e) throw new TypeError("glob options required");
87567
- if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = fileURLToPath(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== !1, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : Infinity, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
87568
- if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
87569
- if (e.noglobstar) throw new TypeError("base matching requires globstar");
87570
- t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
87490
+ module.exports = require_common()(exports);
87491
+ var { formatters } = module.exports;
87492
+ /**
87493
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
87494
+ */
87495
+ formatters.j = function(v) {
87496
+ try {
87497
+ return JSON.stringify(v);
87498
+ } catch (error) {
87499
+ return "[UnexpectedJSONParseError]: " + error.message;
87571
87500
  }
87572
- if (this.pattern = t, this.platform = e.platform || Pi, this.opts = {
87573
- ...e,
87574
- platform: this.platform
87575
- }, e.scurry) {
87576
- if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
87577
- } else this.scurry = new (e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe)(this.cwd, {
87578
- nocase: e.nocase,
87579
- fs: e.fs
87580
- });
87581
- this.nocase = this.scurry.nocase;
87582
- let s = this.platform === "darwin" || this.platform === "win32", i = {
87583
- braceExpandMax: 1e4,
87584
- ...e,
87585
- dot: this.dot,
87586
- matchBase: this.matchBase,
87587
- nobrace: this.nobrace,
87588
- nocase: this.nocase,
87589
- nocaseMagicOnly: s,
87590
- nocomment: !0,
87591
- noext: this.noext,
87592
- nonegate: !0,
87593
- optimizationLevel: 2,
87594
- platform: this.platform,
87595
- windowsPathsNoEscape: this.windowsPathsNoEscape,
87596
- debug: !!this.opts.debug
87597
- }, [o, h] = this.pattern.map((a) => new D(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
87598
- this.patterns = o.map((a, l) => {
87599
- let u = h[l];
87600
- if (!u) throw new Error("invalid pattern object");
87601
- return new nt(a, u, 0, this.platform);
87501
+ };
87502
+ }));
87503
+ var require_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
87504
+ /**
87505
+ * Module dependencies.
87506
+ */
87507
+ var tty$1 = __require("tty");
87508
+ var util$2 = __require("util");
87509
+ /**
87510
+ * This is the Node.js implementation of `debug()`.
87511
+ */
87512
+ exports.init = init;
87513
+ exports.log = log;
87514
+ exports.formatArgs = formatArgs;
87515
+ exports.save = save;
87516
+ exports.load = load;
87517
+ exports.useColors = useColors;
87518
+ exports.destroy = util$2.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
87519
+ /**
87520
+ * Colors.
87521
+ */
87522
+ exports.colors = [
87523
+ 6,
87524
+ 2,
87525
+ 3,
87526
+ 4,
87527
+ 5,
87528
+ 1
87529
+ ];
87530
+ try {
87531
+ const supportsColor = require_supports_color();
87532
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
87533
+ 20,
87534
+ 21,
87535
+ 26,
87536
+ 27,
87537
+ 32,
87538
+ 33,
87539
+ 38,
87540
+ 39,
87541
+ 40,
87542
+ 41,
87543
+ 42,
87544
+ 43,
87545
+ 44,
87546
+ 45,
87547
+ 56,
87548
+ 57,
87549
+ 62,
87550
+ 63,
87551
+ 68,
87552
+ 69,
87553
+ 74,
87554
+ 75,
87555
+ 76,
87556
+ 77,
87557
+ 78,
87558
+ 79,
87559
+ 80,
87560
+ 81,
87561
+ 92,
87562
+ 93,
87563
+ 98,
87564
+ 99,
87565
+ 112,
87566
+ 113,
87567
+ 128,
87568
+ 129,
87569
+ 134,
87570
+ 135,
87571
+ 148,
87572
+ 149,
87573
+ 160,
87574
+ 161,
87575
+ 162,
87576
+ 163,
87577
+ 164,
87578
+ 165,
87579
+ 166,
87580
+ 167,
87581
+ 168,
87582
+ 169,
87583
+ 170,
87584
+ 171,
87585
+ 172,
87586
+ 173,
87587
+ 178,
87588
+ 179,
87589
+ 184,
87590
+ 185,
87591
+ 196,
87592
+ 197,
87593
+ 198,
87594
+ 199,
87595
+ 200,
87596
+ 201,
87597
+ 202,
87598
+ 203,
87599
+ 204,
87600
+ 205,
87601
+ 206,
87602
+ 207,
87603
+ 208,
87604
+ 209,
87605
+ 214,
87606
+ 215,
87607
+ 220,
87608
+ 221
87609
+ ];
87610
+ } catch (error) {}
87611
+ /**
87612
+ * Build up the default `inspectOpts` object from the environment variables.
87613
+ *
87614
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
87615
+ */
87616
+ exports.inspectOpts = Object.keys(process.env).filter((key) => {
87617
+ return /^debug_/i.test(key);
87618
+ }).reduce((obj, key) => {
87619
+ const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
87620
+ return k.toUpperCase();
87602
87621
  });
87622
+ let val = process.env[key];
87623
+ if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
87624
+ else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
87625
+ else if (val === "null") val = null;
87626
+ else val = Number(val);
87627
+ obj[prop] = val;
87628
+ return obj;
87629
+ }, {});
87630
+ /**
87631
+ * Is stdout a TTY? Colored output is enabled when `true`.
87632
+ */
87633
+ function useColors() {
87634
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty$1.isatty(process.stderr.fd);
87603
87635
  }
87604
- async walk() {
87605
- return [...await new xt(this.patterns, this.scurry.cwd, {
87606
- ...this.opts,
87607
- maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
87608
- platform: this.platform,
87609
- nocase: this.nocase,
87610
- includeChildMatches: this.includeChildMatches
87611
- }).walk()];
87612
- }
87613
- walkSync() {
87614
- return [...new xt(this.patterns, this.scurry.cwd, {
87615
- ...this.opts,
87616
- maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
87617
- platform: this.platform,
87618
- nocase: this.nocase,
87619
- includeChildMatches: this.includeChildMatches
87620
- }).walkSync()];
87621
- }
87622
- stream() {
87623
- return new vt(this.patterns, this.scurry.cwd, {
87624
- ...this.opts,
87625
- maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
87626
- platform: this.platform,
87627
- nocase: this.nocase,
87628
- includeChildMatches: this.includeChildMatches
87629
- }).stream();
87636
+ /**
87637
+ * Adds ANSI color escape codes if enabled.
87638
+ *
87639
+ * @api public
87640
+ */
87641
+ function formatArgs(args) {
87642
+ const { namespace: name, useColors } = this;
87643
+ if (useColors) {
87644
+ const c = this.color;
87645
+ const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
87646
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
87647
+ args[0] = prefix + args[0].split("\n").join("\n" + prefix);
87648
+ args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
87649
+ } else args[0] = getDate() + name + " " + args[0];
87630
87650
  }
87631
- streamSync() {
87632
- return new vt(this.patterns, this.scurry.cwd, {
87633
- ...this.opts,
87634
- maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
87635
- platform: this.platform,
87636
- nocase: this.nocase,
87637
- includeChildMatches: this.includeChildMatches
87638
- }).streamSync();
87651
+ function getDate() {
87652
+ if (exports.inspectOpts.hideDate) return "";
87653
+ return (/* @__PURE__ */ new Date()).toISOString() + " ";
87639
87654
  }
87640
- iterateSync() {
87641
- return this.streamSync()[Symbol.iterator]();
87655
+ /**
87656
+ * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
87657
+ */
87658
+ function log(...args) {
87659
+ return process.stderr.write(util$2.formatWithOptions(exports.inspectOpts, ...args) + "\n");
87642
87660
  }
87643
- [Symbol.iterator]() {
87644
- return this.iterateSync();
87661
+ /**
87662
+ * Save `namespaces`.
87663
+ *
87664
+ * @param {String} namespaces
87665
+ * @api private
87666
+ */
87667
+ function save(namespaces) {
87668
+ if (namespaces) process.env.DEBUG = namespaces;
87669
+ else delete process.env.DEBUG;
87645
87670
  }
87646
- iterate() {
87647
- return this.stream()[Symbol.asyncIterator]();
87671
+ /**
87672
+ * Load `namespaces`.
87673
+ *
87674
+ * @return {String} returns the previously persisted debug modes
87675
+ * @api private
87676
+ */
87677
+ function load() {
87678
+ return process.env.DEBUG;
87648
87679
  }
87649
- [Symbol.asyncIterator]() {
87650
- return this.iterate();
87680
+ /**
87681
+ * Init logic for `debug` instances.
87682
+ *
87683
+ * Create a new `inspectOpts` object in case `useColors` is set
87684
+ * differently for a particular `debug` instance.
87685
+ */
87686
+ function init(debug) {
87687
+ debug.inspectOpts = {};
87688
+ const keys = Object.keys(exports.inspectOpts);
87689
+ for (let i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
87651
87690
  }
87652
- };
87653
- var le = (n, t = {}) => {
87654
- Array.isArray(n) || (n = [n]);
87655
- for (let e of n) if (new D(e, t).hasMagic()) return !0;
87656
- return !1;
87657
- };
87658
- function Bt(n, t = {}) {
87659
- return new I(n, t).streamSync();
87660
- }
87661
- function Qe(n, t = {}) {
87662
- return new I(n, t).stream();
87663
- }
87664
- function ts(n, t = {}) {
87665
- return new I(n, t).walkSync();
87666
- }
87667
- async function Je(n, t = {}) {
87668
- return new I(n, t).walk();
87669
- }
87670
- function Ut(n, t = {}) {
87671
- return new I(n, t).iterateSync();
87672
- }
87673
- function es(n, t = {}) {
87674
- return new I(n, t).iterate();
87675
- }
87676
- var ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(es, { sync: Ut }), Ui = Object.assign(ts, {
87677
- stream: Bt,
87678
- iterate: Ut
87679
- }), Ze = Object.assign(Je, {
87680
- glob: Je,
87681
- globSync: ts,
87682
- sync: Ui,
87683
- globStream: Qe,
87684
- stream: Ii,
87685
- globStreamSync: Bt,
87686
- streamSync: ji,
87687
- globIterate: es,
87688
- iterate: Bi,
87689
- globIterateSync: Ut,
87690
- iterateSync: zi,
87691
- Glob: I,
87692
- hasMagic: le,
87693
- escape: tt,
87694
- unescape: W
87695
- });
87696
- Ze.glob = Ze;
87691
+ module.exports = require_common()(exports);
87692
+ var { formatters } = module.exports;
87693
+ /**
87694
+ * Map %o to `util.inspect()`, all on a single line.
87695
+ */
87696
+ formatters.o = function(v) {
87697
+ this.inspectOpts.colors = this.useColors;
87698
+ return util$2.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
87699
+ };
87700
+ /**
87701
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
87702
+ */
87703
+ formatters.O = function(v) {
87704
+ this.inspectOpts.colors = this.useColors;
87705
+ return util$2.inspect(v, this.inspectOpts);
87706
+ };
87707
+ }));
87708
+ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
87709
+ /**
87710
+ * Detect Electron renderer / nwjs process, which is node, but we should
87711
+ * treat as a browser.
87712
+ */
87713
+ if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) module.exports = require_browser();
87714
+ else module.exports = require_node();
87715
+ }));
87697
87716
  var require_wrappy = /* @__PURE__ */ __commonJSMin(((exports, module) => {
87698
87717
  module.exports = wrappy;
87699
87718
  function wrappy(fn, cb) {
@@ -89896,7 +89915,7 @@ var photonModule = null;
89896
89915
  var loadPromise = null;
89897
89916
  function pathOrNull(file) {
89898
89917
  if (typeof file === "string") return file;
89899
- if (file instanceof URL) return fileURLToPath$1(file);
89918
+ if (file instanceof URL) return fileURLToPath(file);
89900
89919
  return null;
89901
89920
  }
89902
89921
  function getFallbackWasmPaths() {
@@ -93230,6 +93249,7 @@ var AgentSession = class {
93230
93249
  _scopedModels;
93231
93250
  _unsubscribeAgent;
93232
93251
  _eventListeners = [];
93252
+ _agentEventQueue = Promise.resolve();
93233
93253
  /** Tracks pending steering messages for UI display. Removed when delivered. */
93234
93254
  _steeringMessages = [];
93235
93255
  /** Tracks pending follow-up messages for UI display. Removed when delivered. */
@@ -93261,6 +93281,8 @@ var AgentSession = class {
93261
93281
  _extensionErrorUnsubscriber;
93262
93282
  _modelRegistry;
93263
93283
  _toolRegistry = /* @__PURE__ */ new Map();
93284
+ _toolPromptSnippets = /* @__PURE__ */ new Map();
93285
+ _toolPromptGuidelines = /* @__PURE__ */ new Map();
93264
93286
  _baseSystemPrompt = "";
93265
93287
  constructor(config) {
93266
93288
  this.agent = config.agent;
@@ -93290,7 +93312,27 @@ var AgentSession = class {
93290
93312
  }
93291
93313
  _lastAssistantMessage = void 0;
93292
93314
  /** Internal handler for agent events - shared by subscribe and reconnect */
93293
- _handleAgentEvent = async (event) => {
93315
+ _handleAgentEvent = (event) => {
93316
+ this._createRetryPromiseForAgentEnd(event);
93317
+ this._agentEventQueue = this._agentEventQueue.then(() => this._processAgentEvent(event), () => this._processAgentEvent(event));
93318
+ this._agentEventQueue.catch(() => {});
93319
+ };
93320
+ _createRetryPromiseForAgentEnd(event) {
93321
+ if (event.type !== "agent_end" || this._retryPromise) return;
93322
+ if (!this.settingsManager.getRetrySettings().enabled) return;
93323
+ const lastAssistant = this._findLastAssistantInMessages(event.messages);
93324
+ if (!lastAssistant || !this._isRetryableError(lastAssistant)) return;
93325
+ this._retryPromise = new Promise((resolve) => {
93326
+ this._retryResolve = resolve;
93327
+ });
93328
+ }
93329
+ _findLastAssistantInMessages(messages) {
93330
+ for (let i = messages.length - 1; i >= 0; i--) {
93331
+ const message = messages[i];
93332
+ if (message.role === "assistant") return message;
93333
+ }
93334
+ }
93335
+ async _processAgentEvent(event) {
93294
93336
  if (event.type === "message_start" && event.message.role === "user") {
93295
93337
  const messageText = this._getUserMessageText(event.message);
93296
93338
  if (messageText) {
@@ -93328,7 +93370,7 @@ var AgentSession = class {
93328
93370
  }
93329
93371
  await this._checkCompaction(msg);
93330
93372
  }
93331
- };
93373
+ }
93332
93374
  /** Resolve the pending retry promise */
93333
93375
  _resolveRetry() {
93334
93376
  if (this._retryResolve) {
@@ -93565,8 +93607,30 @@ var AgentSession = class {
93565
93607
  get promptTemplates() {
93566
93608
  return this._resourceLoader.getPrompts().prompts;
93567
93609
  }
93610
+ _normalizePromptSnippet(text) {
93611
+ if (!text) return void 0;
93612
+ const oneLine = text.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
93613
+ return oneLine.length > 0 ? oneLine : void 0;
93614
+ }
93615
+ _normalizePromptGuidelines(guidelines) {
93616
+ if (!guidelines || guidelines.length === 0) return [];
93617
+ const unique = /* @__PURE__ */ new Set();
93618
+ for (const guideline of guidelines) {
93619
+ const normalized = guideline.trim();
93620
+ if (normalized.length > 0) unique.add(normalized);
93621
+ }
93622
+ return Array.from(unique);
93623
+ }
93568
93624
  _rebuildSystemPrompt(toolNames) {
93569
- const validToolNames = toolNames.filter((name) => this._baseToolRegistry.has(name));
93625
+ const validToolNames = toolNames.filter((name) => this._toolRegistry.has(name));
93626
+ const toolSnippets = {};
93627
+ const promptGuidelines = [];
93628
+ for (const name of validToolNames) {
93629
+ const snippet = this._toolPromptSnippets.get(name);
93630
+ if (snippet) toolSnippets[name] = snippet;
93631
+ const toolGuidelines = this._toolPromptGuidelines.get(name);
93632
+ if (toolGuidelines) promptGuidelines.push(...toolGuidelines);
93633
+ }
93570
93634
  const loaderSystemPrompt = this._resourceLoader.getSystemPrompt();
93571
93635
  const loaderAppendSystemPrompt = this._resourceLoader.getAppendSystemPrompt();
93572
93636
  const appendSystemPrompt = loaderAppendSystemPrompt.length > 0 ? loaderAppendSystemPrompt.join("\n\n") : void 0;
@@ -93578,7 +93642,9 @@ var AgentSession = class {
93578
93642
  contextFiles: loadedContextFiles,
93579
93643
  customPrompt: loaderSystemPrompt,
93580
93644
  appendSystemPrompt,
93581
- selectedTools: validToolNames
93645
+ selectedTools: validToolNames,
93646
+ toolSnippets,
93647
+ promptGuidelines
93582
93648
  });
93583
93649
  }
93584
93650
  /**
@@ -94450,6 +94516,7 @@ Use /login or set an API key environment variable. See ${join(getDocsPath(), "pr
94450
94516
  getActiveTools: () => this.getActiveToolNames(),
94451
94517
  getAllTools: () => this.getAllTools(),
94452
94518
  setActiveTools: (toolNames) => this.setActiveToolsByName(toolNames),
94519
+ refreshTools: () => this._refreshToolRegistry(),
94453
94520
  getCommands,
94454
94521
  setModel: async (model) => {
94455
94522
  if (!await this.modelRegistry.getApiKey(model)) return false;
@@ -94481,6 +94548,35 @@ Use /login or set an API key environment variable. See ${join(getDocsPath(), "pr
94481
94548
  getSystemPrompt: () => this.systemPrompt
94482
94549
  });
94483
94550
  }
94551
+ _refreshToolRegistry(options) {
94552
+ const previousRegistryNames = new Set(this._toolRegistry.keys());
94553
+ const previousActiveToolNames = this.getActiveToolNames();
94554
+ const allCustomTools = [...this._extensionRunner?.getAllRegisteredTools() ?? [], ...this._customTools.map((def) => ({
94555
+ definition: def,
94556
+ extensionPath: "<sdk>"
94557
+ }))];
94558
+ this._toolPromptSnippets = new Map(allCustomTools.map((registeredTool) => {
94559
+ const snippet = this._normalizePromptSnippet(registeredTool.definition.promptSnippet ?? registeredTool.definition.description);
94560
+ return snippet ? [registeredTool.definition.name, snippet] : void 0;
94561
+ }).filter((entry) => entry !== void 0));
94562
+ this._toolPromptGuidelines = new Map(allCustomTools.map((registeredTool) => {
94563
+ const guidelines = this._normalizePromptGuidelines(registeredTool.definition.promptGuidelines);
94564
+ return guidelines.length > 0 ? [registeredTool.definition.name, guidelines] : void 0;
94565
+ }).filter((entry) => entry !== void 0));
94566
+ const wrappedExtensionTools = this._extensionRunner ? wrapRegisteredTools(allCustomTools, this._extensionRunner) : [];
94567
+ const toolRegistry = new Map(this._baseToolRegistry);
94568
+ for (const tool of wrappedExtensionTools) toolRegistry.set(tool.name, tool);
94569
+ if (this._extensionRunner) {
94570
+ const wrappedAllTools = wrapToolsWithExtensions(Array.from(toolRegistry.values()), this._extensionRunner);
94571
+ this._toolRegistry = new Map(wrappedAllTools.map((tool) => [tool.name, tool]));
94572
+ } else this._toolRegistry = toolRegistry;
94573
+ const nextActiveToolNames = options?.activeToolNames ? [...options.activeToolNames] : [...previousActiveToolNames];
94574
+ if (options?.includeAllExtensionTools) for (const tool of wrappedExtensionTools) nextActiveToolNames.push(tool.name);
94575
+ else if (!options?.activeToolNames) {
94576
+ for (const toolName of this._toolRegistry.keys()) if (!previousRegistryNames.has(toolName)) nextActiveToolNames.push(toolName);
94577
+ }
94578
+ this.setActiveToolsByName([...new Set(nextActiveToolNames)]);
94579
+ }
94484
94580
  _buildRuntime(options) {
94485
94581
  const autoResizeImages = this.settingsManager.getImageAutoResize();
94486
94582
  const shellCommandPrefix = this.settingsManager.getShellCommandPrefix();
@@ -94499,13 +94595,6 @@ Use /login or set an API key environment variable. See ${join(getDocsPath(), "pr
94499
94595
  this._bindExtensionCore(this._extensionRunner);
94500
94596
  this._applyExtensionBindings(this._extensionRunner);
94501
94597
  }
94502
- const allCustomTools = [...this._extensionRunner?.getAllRegisteredTools() ?? [], ...this._customTools.map((def) => ({
94503
- definition: def,
94504
- extensionPath: "<sdk>"
94505
- }))];
94506
- const wrappedExtensionTools = this._extensionRunner ? wrapRegisteredTools(allCustomTools, this._extensionRunner) : [];
94507
- const toolRegistry = new Map(this._baseToolRegistry);
94508
- for (const tool of wrappedExtensionTools) toolRegistry.set(tool.name, tool);
94509
94598
  const defaultActiveToolNames = this._baseToolsOverride ? Object.keys(this._baseToolsOverride) : [
94510
94599
  "read",
94511
94600
  "bash",
@@ -94513,24 +94602,10 @@ Use /login or set an API key environment variable. See ${join(getDocsPath(), "pr
94513
94602
  "write"
94514
94603
  ];
94515
94604
  const baseActiveToolNames = options.activeToolNames ?? defaultActiveToolNames;
94516
- const activeToolNameSet = new Set(baseActiveToolNames);
94517
- if (options.includeAllExtensionTools) for (const tool of wrappedExtensionTools) activeToolNameSet.add(tool.name);
94518
- const extensionToolNames = new Set(wrappedExtensionTools.map((tool) => tool.name));
94519
- const activeBaseTools = Array.from(activeToolNameSet).filter((name) => this._baseToolRegistry.has(name) && !extensionToolNames.has(name)).map((name) => this._baseToolRegistry.get(name));
94520
- const activeExtensionTools = wrappedExtensionTools.filter((tool) => activeToolNameSet.has(tool.name));
94521
- const activeToolsArray = [...activeBaseTools, ...activeExtensionTools];
94522
- if (this._extensionRunner) {
94523
- const wrappedActiveTools = wrapToolsWithExtensions(activeToolsArray, this._extensionRunner);
94524
- this.agent.setTools(wrappedActiveTools);
94525
- const wrappedAllTools = wrapToolsWithExtensions(Array.from(toolRegistry.values()), this._extensionRunner);
94526
- this._toolRegistry = new Map(wrappedAllTools.map((tool) => [tool.name, tool]));
94527
- } else {
94528
- this.agent.setTools(activeToolsArray);
94529
- this._toolRegistry = toolRegistry;
94530
- }
94531
- const systemPromptToolNames = Array.from(activeToolNameSet).filter((name) => this._baseToolRegistry.has(name));
94532
- this._baseSystemPrompt = this._rebuildSystemPrompt(systemPromptToolNames);
94533
- this.agent.setSystemPrompt(this._baseSystemPrompt);
94605
+ this._refreshToolRegistry({
94606
+ activeToolNames: baseActiveToolNames,
94607
+ includeAllExtensionTools: options.includeAllExtensionTools
94608
+ });
94534
94609
  }
94535
94610
  async reload() {
94536
94611
  const previousFlagValues = this._extensionRunner?.getFlagValues();
@@ -94565,11 +94640,14 @@ Use /login or set an API key environment variable. See ${join(getDocsPath(), "pr
94565
94640
  */
94566
94641
  async _handleRetryableError(message) {
94567
94642
  const settings = this.settingsManager.getRetrySettings();
94568
- if (!settings.enabled) return false;
94569
- this._retryAttempt++;
94570
- if (this._retryAttempt === 1 && !this._retryPromise) this._retryPromise = new Promise((resolve) => {
94643
+ if (!settings.enabled) {
94644
+ this._resolveRetry();
94645
+ return false;
94646
+ }
94647
+ if (!this._retryPromise) this._retryPromise = new Promise((resolve) => {
94571
94648
  this._retryResolve = resolve;
94572
94649
  });
94650
+ this._retryAttempt++;
94573
94651
  if (this._retryAttempt > settings.maxRetries) {
94574
94652
  this._emit({
94575
94653
  type: "auto_retry_end",
@@ -105552,6 +105630,7 @@ var ToolExecutionComponent = class extends Container {
105552
105630
  editDiffArgsKey;
105553
105631
  convertedImages = /* @__PURE__ */ new Map();
105554
105632
  writeHighlightCache;
105633
+ hideComponent = false;
105555
105634
  constructor(toolName, args, options = {}, toolDefinition, ui, cwd = process.cwd()) {
105556
105635
  super();
105557
105636
  this.toolName = toolName;
@@ -105731,9 +105810,16 @@ var ToolExecutionComponent = class extends Container {
105731
105810
  super.invalidate();
105732
105811
  this.updateDisplay();
105733
105812
  }
105813
+ render(width) {
105814
+ if (this.hideComponent) return [];
105815
+ return super.render(width);
105816
+ }
105734
105817
  updateDisplay() {
105735
105818
  const bgFn = this.isPartial ? (text) => theme.bg("toolPendingBg", text) : this.result?.isError ? (text) => theme.bg("toolErrorBg", text) : (text) => theme.bg("toolSuccessBg", text);
105736
- if (this.shouldUseBuiltInRenderer()) if (this.toolName === "bash") {
105819
+ const useBuiltInRenderer = this.shouldUseBuiltInRenderer();
105820
+ let customRendererHasContent = false;
105821
+ this.hideComponent = false;
105822
+ if (useBuiltInRenderer) if (this.toolName === "bash") {
105737
105823
  this.contentBox.setBgFn(bgFn);
105738
105824
  this.contentBox.clear();
105739
105825
  this.renderBashContent();
@@ -105746,11 +105832,18 @@ var ToolExecutionComponent = class extends Container {
105746
105832
  this.contentBox.clear();
105747
105833
  if (this.toolDefinition.renderCall) try {
105748
105834
  const callComponent = this.toolDefinition.renderCall(this.args, theme);
105749
- if (callComponent) this.contentBox.addChild(callComponent);
105835
+ if (callComponent !== void 0) {
105836
+ this.contentBox.addChild(callComponent);
105837
+ customRendererHasContent = true;
105838
+ }
105750
105839
  } catch {
105751
105840
  this.contentBox.addChild(new Text(theme.fg("toolTitle", theme.bold(this.toolName)), 0, 0));
105841
+ customRendererHasContent = true;
105842
+ }
105843
+ else {
105844
+ this.contentBox.addChild(new Text(theme.fg("toolTitle", theme.bold(this.toolName)), 0, 0));
105845
+ customRendererHasContent = true;
105752
105846
  }
105753
- else this.contentBox.addChild(new Text(theme.fg("toolTitle", theme.bold(this.toolName)), 0, 0));
105754
105847
  if (this.result && this.toolDefinition.renderResult) try {
105755
105848
  const resultComponent = this.toolDefinition.renderResult({
105756
105849
  content: this.result.content,
@@ -105759,15 +105852,27 @@ var ToolExecutionComponent = class extends Container {
105759
105852
  expanded: this.expanded,
105760
105853
  isPartial: this.isPartial
105761
105854
  }, theme);
105762
- if (resultComponent) this.contentBox.addChild(resultComponent);
105855
+ if (resultComponent !== void 0) {
105856
+ this.contentBox.addChild(resultComponent);
105857
+ customRendererHasContent = true;
105858
+ }
105763
105859
  } catch {
105764
105860
  const output = this.getTextOutput();
105765
- if (output) this.contentBox.addChild(new Text(theme.fg("toolOutput", output), 0, 0));
105861
+ if (output) {
105862
+ this.contentBox.addChild(new Text(theme.fg("toolOutput", output), 0, 0));
105863
+ customRendererHasContent = true;
105864
+ }
105766
105865
  }
105767
105866
  else if (this.result) {
105768
105867
  const output = this.getTextOutput();
105769
- if (output) this.contentBox.addChild(new Text(theme.fg("toolOutput", output), 0, 0));
105868
+ if (output) {
105869
+ this.contentBox.addChild(new Text(theme.fg("toolOutput", output), 0, 0));
105870
+ customRendererHasContent = true;
105871
+ }
105770
105872
  }
105873
+ } else {
105874
+ this.contentText.setCustomBgFn(bgFn);
105875
+ this.contentText.setText(this.formatToolExecution());
105771
105876
  }
105772
105877
  for (const img of this.imageComponents) this.removeChild(img);
105773
105878
  this.imageComponents = [];
@@ -105792,6 +105897,7 @@ var ToolExecutionComponent = class extends Container {
105792
105897
  }
105793
105898
  }
105794
105899
  }
105900
+ if (!useBuiltInRenderer && this.toolDefinition) this.hideComponent = !customRendererHasContent && this.imageComponents.length === 0;
105795
105901
  }
105796
105902
  /**
105797
105903
  * Render bash content using visual line truncation (like bash-execution.ts)
@@ -108166,7 +108272,6 @@ var InteractiveMode = class InteractiveMode {
108166
108272
  this.streamingMessage = event.message;
108167
108273
  this.streamingComponent.updateContent(this.streamingMessage);
108168
108274
  for (const content of this.streamingMessage.content) if (content.type === "toolCall") if (!this.pendingTools.has(content.id)) {
108169
- this.chatContainer.addChild(new Text("", 0, 0));
108170
108275
  const component = new ToolExecutionComponent(content.name, content.arguments, { showImages: this.settingsManager.getShowImages() }, this.getRegisteredToolDefinition(content.name), this.ui);
108171
108276
  component.setExpanded(this.toolOutputExpanded);
108172
108277
  this.chatContainer.addChild(component);
@@ -111016,4 +111121,4 @@ var dist_exports = /* @__PURE__ */ __exportAll({
111016
111121
  wrapToolsWithExtensions: () => wrapToolsWithExtensions,
111017
111122
  writeTool: () => writeTool
111018
111123
  });
111019
- export { createCodingTools as a, require_src as c, AuthStorage as i, DefaultResourceLoader as n, SessionManager as o, ModelRegistry as r, SettingsManager as s, createAgentSession as t };
111124
+ export { AuthStorage as a, diffLines as c, ModelRegistry as i, SessionManager as l, DefaultResourceLoader as n, createCodingTools as o, minimatch as r, require_src as s, createAgentSession as t, SettingsManager as u };