switchroom 0.7.13 → 0.7.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/agent-scheduler/index.js +80 -80
- package/dist/cli/switchroom.js +1881 -2878
- package/dist/vault/approvals/kernel-server.js +88 -85
- package/dist/vault/broker/server.js +495 -1785
- package/package.json +2 -4
- package/telegram-plugin/bridge/bridge.ts +17 -0
- package/telegram-plugin/dist/bridge/bridge.js +128 -112
- package/telegram-plugin/dist/foreman/foreman.js +185 -1696
- package/telegram-plugin/dist/gateway/gateway.js +542 -1682
- package/telegram-plugin/dist/server.js +176 -160
- package/telegram-plugin/gateway/gateway.ts +495 -7
- package/telegram-plugin/secret-detect/vault-error.test.ts +134 -0
- package/telegram-plugin/secret-detect/vault-error.ts +202 -0
- package/skills/docx/scripts/office/validators/__pycache__/__init__.cpython-313.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/base.cpython-313.pyc +0 -0
- package/telegram-plugin/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/telegram-plugin/server.js +0 -41795
|
@@ -1,1572 +1,23 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
2
|
var __defProp = Object.defineProperty;
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (cached)
|
|
18
|
-
return cached;
|
|
19
|
-
}
|
|
20
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
|
-
for (let key of __getOwnPropNames(mod))
|
|
23
|
-
if (!__hasOwnProp.call(to, key))
|
|
24
|
-
__defProp(to, key, {
|
|
25
|
-
get: __accessProp.bind(mod, key),
|
|
26
|
-
enumerable: true
|
|
27
|
-
});
|
|
28
|
-
if (canCache)
|
|
29
|
-
cache.set(mod, to);
|
|
30
|
-
return to;
|
|
31
|
-
};
|
|
32
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
|
-
var __returnValue = (v) => v;
|
|
34
|
-
function __exportSetter(name, newValue) {
|
|
35
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
36
|
-
}
|
|
37
|
-
var __export = (target, all) => {
|
|
38
|
-
for (var name in all)
|
|
39
|
-
__defProp(target, name, {
|
|
40
|
-
get: all[name],
|
|
41
|
-
enumerable: true,
|
|
42
|
-
configurable: true,
|
|
43
|
-
set: __exportSetter.bind(all, name)
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
47
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
48
|
-
|
|
49
|
-
// node_modules/.bun/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
|
|
50
|
-
var require_polyfills = __commonJS((exports, module) => {
|
|
51
|
-
var constants = __require("constants");
|
|
52
|
-
var origCwd = process.cwd;
|
|
53
|
-
var cwd = null;
|
|
54
|
-
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
55
|
-
process.cwd = function() {
|
|
56
|
-
if (!cwd)
|
|
57
|
-
cwd = origCwd.call(process);
|
|
58
|
-
return cwd;
|
|
59
|
-
};
|
|
60
|
-
try {
|
|
61
|
-
process.cwd();
|
|
62
|
-
} catch (er) {}
|
|
63
|
-
if (typeof process.chdir === "function") {
|
|
64
|
-
chdir = process.chdir;
|
|
65
|
-
process.chdir = function(d) {
|
|
66
|
-
cwd = null;
|
|
67
|
-
chdir.call(process, d);
|
|
68
|
-
};
|
|
69
|
-
if (Object.setPrototypeOf)
|
|
70
|
-
Object.setPrototypeOf(process.chdir, chdir);
|
|
71
|
-
}
|
|
72
|
-
var chdir;
|
|
73
|
-
module.exports = patch;
|
|
74
|
-
function patch(fs) {
|
|
75
|
-
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
76
|
-
patchLchmod(fs);
|
|
77
|
-
}
|
|
78
|
-
if (!fs.lutimes) {
|
|
79
|
-
patchLutimes(fs);
|
|
80
|
-
}
|
|
81
|
-
fs.chown = chownFix(fs.chown);
|
|
82
|
-
fs.fchown = chownFix(fs.fchown);
|
|
83
|
-
fs.lchown = chownFix(fs.lchown);
|
|
84
|
-
fs.chmod = chmodFix(fs.chmod);
|
|
85
|
-
fs.fchmod = chmodFix(fs.fchmod);
|
|
86
|
-
fs.lchmod = chmodFix(fs.lchmod);
|
|
87
|
-
fs.chownSync = chownFixSync(fs.chownSync);
|
|
88
|
-
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
89
|
-
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
90
|
-
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
91
|
-
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
92
|
-
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
93
|
-
fs.stat = statFix(fs.stat);
|
|
94
|
-
fs.fstat = statFix(fs.fstat);
|
|
95
|
-
fs.lstat = statFix(fs.lstat);
|
|
96
|
-
fs.statSync = statFixSync(fs.statSync);
|
|
97
|
-
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
98
|
-
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
99
|
-
if (fs.chmod && !fs.lchmod) {
|
|
100
|
-
fs.lchmod = function(path, mode, cb) {
|
|
101
|
-
if (cb)
|
|
102
|
-
process.nextTick(cb);
|
|
103
|
-
};
|
|
104
|
-
fs.lchmodSync = function() {};
|
|
105
|
-
}
|
|
106
|
-
if (fs.chown && !fs.lchown) {
|
|
107
|
-
fs.lchown = function(path, uid, gid, cb) {
|
|
108
|
-
if (cb)
|
|
109
|
-
process.nextTick(cb);
|
|
110
|
-
};
|
|
111
|
-
fs.lchownSync = function() {};
|
|
112
|
-
}
|
|
113
|
-
if (platform === "win32") {
|
|
114
|
-
fs.rename = typeof fs.rename !== "function" ? fs.rename : function(fs$rename) {
|
|
115
|
-
function rename(from, to, cb) {
|
|
116
|
-
var start = Date.now();
|
|
117
|
-
var backoff = 0;
|
|
118
|
-
fs$rename(from, to, function CB(er) {
|
|
119
|
-
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 60000) {
|
|
120
|
-
setTimeout(function() {
|
|
121
|
-
fs.stat(to, function(stater, st) {
|
|
122
|
-
if (stater && stater.code === "ENOENT")
|
|
123
|
-
fs$rename(from, to, CB);
|
|
124
|
-
else
|
|
125
|
-
cb(er);
|
|
126
|
-
});
|
|
127
|
-
}, backoff);
|
|
128
|
-
if (backoff < 100)
|
|
129
|
-
backoff += 10;
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
if (cb)
|
|
133
|
-
cb(er);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
if (Object.setPrototypeOf)
|
|
137
|
-
Object.setPrototypeOf(rename, fs$rename);
|
|
138
|
-
return rename;
|
|
139
|
-
}(fs.rename);
|
|
140
|
-
}
|
|
141
|
-
fs.read = typeof fs.read !== "function" ? fs.read : function(fs$read) {
|
|
142
|
-
function read(fd, buffer, offset, length, position, callback_) {
|
|
143
|
-
var callback;
|
|
144
|
-
if (callback_ && typeof callback_ === "function") {
|
|
145
|
-
var eagCounter = 0;
|
|
146
|
-
callback = function(er, _, __) {
|
|
147
|
-
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
148
|
-
eagCounter++;
|
|
149
|
-
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
150
|
-
}
|
|
151
|
-
callback_.apply(this, arguments);
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
155
|
-
}
|
|
156
|
-
if (Object.setPrototypeOf)
|
|
157
|
-
Object.setPrototypeOf(read, fs$read);
|
|
158
|
-
return read;
|
|
159
|
-
}(fs.read);
|
|
160
|
-
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) {
|
|
161
|
-
return function(fd, buffer, offset, length, position) {
|
|
162
|
-
var eagCounter = 0;
|
|
163
|
-
while (true) {
|
|
164
|
-
try {
|
|
165
|
-
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
166
|
-
} catch (er) {
|
|
167
|
-
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
168
|
-
eagCounter++;
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
throw er;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
}(fs.readSync);
|
|
176
|
-
function patchLchmod(fs2) {
|
|
177
|
-
fs2.lchmod = function(path, mode, callback) {
|
|
178
|
-
fs2.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
|
|
179
|
-
if (err) {
|
|
180
|
-
if (callback)
|
|
181
|
-
callback(err);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
fs2.fchmod(fd, mode, function(err2) {
|
|
185
|
-
fs2.close(fd, function(err22) {
|
|
186
|
-
if (callback)
|
|
187
|
-
callback(err2 || err22);
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
};
|
|
192
|
-
fs2.lchmodSync = function(path, mode) {
|
|
193
|
-
var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
194
|
-
var threw = true;
|
|
195
|
-
var ret;
|
|
196
|
-
try {
|
|
197
|
-
ret = fs2.fchmodSync(fd, mode);
|
|
198
|
-
threw = false;
|
|
199
|
-
} finally {
|
|
200
|
-
if (threw) {
|
|
201
|
-
try {
|
|
202
|
-
fs2.closeSync(fd);
|
|
203
|
-
} catch (er) {}
|
|
204
|
-
} else {
|
|
205
|
-
fs2.closeSync(fd);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return ret;
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
function patchLutimes(fs2) {
|
|
212
|
-
if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
|
|
213
|
-
fs2.lutimes = function(path, at, mt, cb) {
|
|
214
|
-
fs2.open(path, constants.O_SYMLINK, function(er, fd) {
|
|
215
|
-
if (er) {
|
|
216
|
-
if (cb)
|
|
217
|
-
cb(er);
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
fs2.futimes(fd, at, mt, function(er2) {
|
|
221
|
-
fs2.close(fd, function(er22) {
|
|
222
|
-
if (cb)
|
|
223
|
-
cb(er2 || er22);
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
};
|
|
228
|
-
fs2.lutimesSync = function(path, at, mt) {
|
|
229
|
-
var fd = fs2.openSync(path, constants.O_SYMLINK);
|
|
230
|
-
var ret;
|
|
231
|
-
var threw = true;
|
|
232
|
-
try {
|
|
233
|
-
ret = fs2.futimesSync(fd, at, mt);
|
|
234
|
-
threw = false;
|
|
235
|
-
} finally {
|
|
236
|
-
if (threw) {
|
|
237
|
-
try {
|
|
238
|
-
fs2.closeSync(fd);
|
|
239
|
-
} catch (er) {}
|
|
240
|
-
} else {
|
|
241
|
-
fs2.closeSync(fd);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return ret;
|
|
245
|
-
};
|
|
246
|
-
} else if (fs2.futimes) {
|
|
247
|
-
fs2.lutimes = function(_a, _b, _c, cb) {
|
|
248
|
-
if (cb)
|
|
249
|
-
process.nextTick(cb);
|
|
250
|
-
};
|
|
251
|
-
fs2.lutimesSync = function() {};
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
function chmodFix(orig) {
|
|
255
|
-
if (!orig)
|
|
256
|
-
return orig;
|
|
257
|
-
return function(target, mode, cb) {
|
|
258
|
-
return orig.call(fs, target, mode, function(er) {
|
|
259
|
-
if (chownErOk(er))
|
|
260
|
-
er = null;
|
|
261
|
-
if (cb)
|
|
262
|
-
cb.apply(this, arguments);
|
|
263
|
-
});
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
function chmodFixSync(orig) {
|
|
267
|
-
if (!orig)
|
|
268
|
-
return orig;
|
|
269
|
-
return function(target, mode) {
|
|
270
|
-
try {
|
|
271
|
-
return orig.call(fs, target, mode);
|
|
272
|
-
} catch (er) {
|
|
273
|
-
if (!chownErOk(er))
|
|
274
|
-
throw er;
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
function chownFix(orig) {
|
|
279
|
-
if (!orig)
|
|
280
|
-
return orig;
|
|
281
|
-
return function(target, uid, gid, cb) {
|
|
282
|
-
return orig.call(fs, target, uid, gid, function(er) {
|
|
283
|
-
if (chownErOk(er))
|
|
284
|
-
er = null;
|
|
285
|
-
if (cb)
|
|
286
|
-
cb.apply(this, arguments);
|
|
287
|
-
});
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
function chownFixSync(orig) {
|
|
291
|
-
if (!orig)
|
|
292
|
-
return orig;
|
|
293
|
-
return function(target, uid, gid) {
|
|
294
|
-
try {
|
|
295
|
-
return orig.call(fs, target, uid, gid);
|
|
296
|
-
} catch (er) {
|
|
297
|
-
if (!chownErOk(er))
|
|
298
|
-
throw er;
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
function statFix(orig) {
|
|
303
|
-
if (!orig)
|
|
304
|
-
return orig;
|
|
305
|
-
return function(target, options, cb) {
|
|
306
|
-
if (typeof options === "function") {
|
|
307
|
-
cb = options;
|
|
308
|
-
options = null;
|
|
309
|
-
}
|
|
310
|
-
function callback(er, stats) {
|
|
311
|
-
if (stats) {
|
|
312
|
-
if (stats.uid < 0)
|
|
313
|
-
stats.uid += 4294967296;
|
|
314
|
-
if (stats.gid < 0)
|
|
315
|
-
stats.gid += 4294967296;
|
|
316
|
-
}
|
|
317
|
-
if (cb)
|
|
318
|
-
cb.apply(this, arguments);
|
|
319
|
-
}
|
|
320
|
-
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
function statFixSync(orig) {
|
|
324
|
-
if (!orig)
|
|
325
|
-
return orig;
|
|
326
|
-
return function(target, options) {
|
|
327
|
-
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
|
|
328
|
-
if (stats) {
|
|
329
|
-
if (stats.uid < 0)
|
|
330
|
-
stats.uid += 4294967296;
|
|
331
|
-
if (stats.gid < 0)
|
|
332
|
-
stats.gid += 4294967296;
|
|
333
|
-
}
|
|
334
|
-
return stats;
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
function chownErOk(er) {
|
|
338
|
-
if (!er)
|
|
339
|
-
return true;
|
|
340
|
-
if (er.code === "ENOSYS")
|
|
341
|
-
return true;
|
|
342
|
-
var nonroot = !process.getuid || process.getuid() !== 0;
|
|
343
|
-
if (nonroot) {
|
|
344
|
-
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
345
|
-
return true;
|
|
346
|
-
}
|
|
347
|
-
return false;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
// node_modules/.bun/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
|
|
353
|
-
var require_legacy_streams = __commonJS((exports, module) => {
|
|
354
|
-
var Stream = __require("stream").Stream;
|
|
355
|
-
module.exports = legacy;
|
|
356
|
-
function legacy(fs) {
|
|
357
|
-
return {
|
|
358
|
-
ReadStream,
|
|
359
|
-
WriteStream
|
|
360
|
-
};
|
|
361
|
-
function ReadStream(path, options) {
|
|
362
|
-
if (!(this instanceof ReadStream))
|
|
363
|
-
return new ReadStream(path, options);
|
|
364
|
-
Stream.call(this);
|
|
365
|
-
var self = this;
|
|
366
|
-
this.path = path;
|
|
367
|
-
this.fd = null;
|
|
368
|
-
this.readable = true;
|
|
369
|
-
this.paused = false;
|
|
370
|
-
this.flags = "r";
|
|
371
|
-
this.mode = 438;
|
|
372
|
-
this.bufferSize = 64 * 1024;
|
|
373
|
-
options = options || {};
|
|
374
|
-
var keys = Object.keys(options);
|
|
375
|
-
for (var index = 0, length = keys.length;index < length; index++) {
|
|
376
|
-
var key = keys[index];
|
|
377
|
-
this[key] = options[key];
|
|
378
|
-
}
|
|
379
|
-
if (this.encoding)
|
|
380
|
-
this.setEncoding(this.encoding);
|
|
381
|
-
if (this.start !== undefined) {
|
|
382
|
-
if (typeof this.start !== "number") {
|
|
383
|
-
throw TypeError("start must be a Number");
|
|
384
|
-
}
|
|
385
|
-
if (this.end === undefined) {
|
|
386
|
-
this.end = Infinity;
|
|
387
|
-
} else if (typeof this.end !== "number") {
|
|
388
|
-
throw TypeError("end must be a Number");
|
|
389
|
-
}
|
|
390
|
-
if (this.start > this.end) {
|
|
391
|
-
throw new Error("start must be <= end");
|
|
392
|
-
}
|
|
393
|
-
this.pos = this.start;
|
|
394
|
-
}
|
|
395
|
-
if (this.fd !== null) {
|
|
396
|
-
process.nextTick(function() {
|
|
397
|
-
self._read();
|
|
398
|
-
});
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
402
|
-
if (err) {
|
|
403
|
-
self.emit("error", err);
|
|
404
|
-
self.readable = false;
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
self.fd = fd;
|
|
408
|
-
self.emit("open", fd);
|
|
409
|
-
self._read();
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
function WriteStream(path, options) {
|
|
413
|
-
if (!(this instanceof WriteStream))
|
|
414
|
-
return new WriteStream(path, options);
|
|
415
|
-
Stream.call(this);
|
|
416
|
-
this.path = path;
|
|
417
|
-
this.fd = null;
|
|
418
|
-
this.writable = true;
|
|
419
|
-
this.flags = "w";
|
|
420
|
-
this.encoding = "binary";
|
|
421
|
-
this.mode = 438;
|
|
422
|
-
this.bytesWritten = 0;
|
|
423
|
-
options = options || {};
|
|
424
|
-
var keys = Object.keys(options);
|
|
425
|
-
for (var index = 0, length = keys.length;index < length; index++) {
|
|
426
|
-
var key = keys[index];
|
|
427
|
-
this[key] = options[key];
|
|
428
|
-
}
|
|
429
|
-
if (this.start !== undefined) {
|
|
430
|
-
if (typeof this.start !== "number") {
|
|
431
|
-
throw TypeError("start must be a Number");
|
|
432
|
-
}
|
|
433
|
-
if (this.start < 0) {
|
|
434
|
-
throw new Error("start must be >= zero");
|
|
435
|
-
}
|
|
436
|
-
this.pos = this.start;
|
|
437
|
-
}
|
|
438
|
-
this.busy = false;
|
|
439
|
-
this._queue = [];
|
|
440
|
-
if (this.fd === null) {
|
|
441
|
-
this._open = fs.open;
|
|
442
|
-
this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
|
|
443
|
-
this.flush();
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
|
|
449
|
-
// node_modules/.bun/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
|
|
450
|
-
var require_clone = __commonJS((exports, module) => {
|
|
451
|
-
module.exports = clone;
|
|
452
|
-
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
453
|
-
return obj.__proto__;
|
|
454
|
-
};
|
|
455
|
-
function clone(obj) {
|
|
456
|
-
if (obj === null || typeof obj !== "object")
|
|
457
|
-
return obj;
|
|
458
|
-
if (obj instanceof Object)
|
|
459
|
-
var copy = { __proto__: getPrototypeOf(obj) };
|
|
460
|
-
else
|
|
461
|
-
var copy = Object.create(null);
|
|
462
|
-
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
463
|
-
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
464
|
-
});
|
|
465
|
-
return copy;
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
|
|
469
|
-
// node_modules/.bun/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
470
|
-
var require_graceful_fs = __commonJS((exports, module) => {
|
|
471
|
-
var fs = __require("fs");
|
|
472
|
-
var polyfills = require_polyfills();
|
|
473
|
-
var legacy = require_legacy_streams();
|
|
474
|
-
var clone = require_clone();
|
|
475
|
-
var util = __require("util");
|
|
476
|
-
var gracefulQueue;
|
|
477
|
-
var previousSymbol;
|
|
478
|
-
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
479
|
-
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
480
|
-
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
481
|
-
} else {
|
|
482
|
-
gracefulQueue = "___graceful-fs.queue";
|
|
483
|
-
previousSymbol = "___graceful-fs.previous";
|
|
484
|
-
}
|
|
485
|
-
function noop() {}
|
|
486
|
-
function publishQueue(context, queue2) {
|
|
487
|
-
Object.defineProperty(context, gracefulQueue, {
|
|
488
|
-
get: function() {
|
|
489
|
-
return queue2;
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
var debug = noop;
|
|
494
|
-
if (util.debuglog)
|
|
495
|
-
debug = util.debuglog("gfs4");
|
|
496
|
-
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
|
|
497
|
-
debug = function() {
|
|
498
|
-
var m = util.format.apply(util, arguments);
|
|
499
|
-
m = "GFS4: " + m.split(/\n/).join(`
|
|
500
|
-
GFS4: `);
|
|
501
|
-
console.error(m);
|
|
502
|
-
};
|
|
503
|
-
if (!fs[gracefulQueue]) {
|
|
504
|
-
queue = global[gracefulQueue] || [];
|
|
505
|
-
publishQueue(fs, queue);
|
|
506
|
-
fs.close = function(fs$close) {
|
|
507
|
-
function close(fd, cb) {
|
|
508
|
-
return fs$close.call(fs, fd, function(err) {
|
|
509
|
-
if (!err) {
|
|
510
|
-
resetQueue();
|
|
511
|
-
}
|
|
512
|
-
if (typeof cb === "function")
|
|
513
|
-
cb.apply(this, arguments);
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
Object.defineProperty(close, previousSymbol, {
|
|
517
|
-
value: fs$close
|
|
518
|
-
});
|
|
519
|
-
return close;
|
|
520
|
-
}(fs.close);
|
|
521
|
-
fs.closeSync = function(fs$closeSync) {
|
|
522
|
-
function closeSync(fd) {
|
|
523
|
-
fs$closeSync.apply(fs, arguments);
|
|
524
|
-
resetQueue();
|
|
525
|
-
}
|
|
526
|
-
Object.defineProperty(closeSync, previousSymbol, {
|
|
527
|
-
value: fs$closeSync
|
|
528
|
-
});
|
|
529
|
-
return closeSync;
|
|
530
|
-
}(fs.closeSync);
|
|
531
|
-
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
532
|
-
process.on("exit", function() {
|
|
533
|
-
debug(fs[gracefulQueue]);
|
|
534
|
-
__require("assert").equal(fs[gracefulQueue].length, 0);
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
var queue;
|
|
539
|
-
if (!global[gracefulQueue]) {
|
|
540
|
-
publishQueue(global, fs[gracefulQueue]);
|
|
541
|
-
}
|
|
542
|
-
module.exports = patch(clone(fs));
|
|
543
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
|
544
|
-
module.exports = patch(fs);
|
|
545
|
-
fs.__patched = true;
|
|
546
|
-
}
|
|
547
|
-
function patch(fs2) {
|
|
548
|
-
polyfills(fs2);
|
|
549
|
-
fs2.gracefulify = patch;
|
|
550
|
-
fs2.createReadStream = createReadStream;
|
|
551
|
-
fs2.createWriteStream = createWriteStream;
|
|
552
|
-
var fs$readFile = fs2.readFile;
|
|
553
|
-
fs2.readFile = readFile;
|
|
554
|
-
function readFile(path, options, cb) {
|
|
555
|
-
if (typeof options === "function")
|
|
556
|
-
cb = options, options = null;
|
|
557
|
-
return go$readFile(path, options, cb);
|
|
558
|
-
function go$readFile(path2, options2, cb2, startTime) {
|
|
559
|
-
return fs$readFile(path2, options2, function(err) {
|
|
560
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
561
|
-
enqueue([go$readFile, [path2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
562
|
-
else {
|
|
563
|
-
if (typeof cb2 === "function")
|
|
564
|
-
cb2.apply(this, arguments);
|
|
565
|
-
}
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
var fs$writeFile = fs2.writeFile;
|
|
570
|
-
fs2.writeFile = writeFile;
|
|
571
|
-
function writeFile(path, data, options, cb) {
|
|
572
|
-
if (typeof options === "function")
|
|
573
|
-
cb = options, options = null;
|
|
574
|
-
return go$writeFile(path, data, options, cb);
|
|
575
|
-
function go$writeFile(path2, data2, options2, cb2, startTime) {
|
|
576
|
-
return fs$writeFile(path2, data2, options2, function(err) {
|
|
577
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
578
|
-
enqueue([go$writeFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
579
|
-
else {
|
|
580
|
-
if (typeof cb2 === "function")
|
|
581
|
-
cb2.apply(this, arguments);
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
var fs$appendFile = fs2.appendFile;
|
|
587
|
-
if (fs$appendFile)
|
|
588
|
-
fs2.appendFile = appendFile;
|
|
589
|
-
function appendFile(path, data, options, cb) {
|
|
590
|
-
if (typeof options === "function")
|
|
591
|
-
cb = options, options = null;
|
|
592
|
-
return go$appendFile(path, data, options, cb);
|
|
593
|
-
function go$appendFile(path2, data2, options2, cb2, startTime) {
|
|
594
|
-
return fs$appendFile(path2, data2, options2, function(err) {
|
|
595
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
596
|
-
enqueue([go$appendFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
597
|
-
else {
|
|
598
|
-
if (typeof cb2 === "function")
|
|
599
|
-
cb2.apply(this, arguments);
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
var fs$copyFile = fs2.copyFile;
|
|
605
|
-
if (fs$copyFile)
|
|
606
|
-
fs2.copyFile = copyFile;
|
|
607
|
-
function copyFile(src, dest, flags, cb) {
|
|
608
|
-
if (typeof flags === "function") {
|
|
609
|
-
cb = flags;
|
|
610
|
-
flags = 0;
|
|
611
|
-
}
|
|
612
|
-
return go$copyFile(src, dest, flags, cb);
|
|
613
|
-
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
|
|
614
|
-
return fs$copyFile(src2, dest2, flags2, function(err) {
|
|
615
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
616
|
-
enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
617
|
-
else {
|
|
618
|
-
if (typeof cb2 === "function")
|
|
619
|
-
cb2.apply(this, arguments);
|
|
620
|
-
}
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
var fs$readdir = fs2.readdir;
|
|
625
|
-
fs2.readdir = readdir;
|
|
626
|
-
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
627
|
-
function readdir(path, options, cb) {
|
|
628
|
-
if (typeof options === "function")
|
|
629
|
-
cb = options, options = null;
|
|
630
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path2, options2, cb2, startTime) {
|
|
631
|
-
return fs$readdir(path2, fs$readdirCallback(path2, options2, cb2, startTime));
|
|
632
|
-
} : function go$readdir2(path2, options2, cb2, startTime) {
|
|
633
|
-
return fs$readdir(path2, options2, fs$readdirCallback(path2, options2, cb2, startTime));
|
|
634
|
-
};
|
|
635
|
-
return go$readdir(path, options, cb);
|
|
636
|
-
function fs$readdirCallback(path2, options2, cb2, startTime) {
|
|
637
|
-
return function(err, files) {
|
|
638
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
639
|
-
enqueue([
|
|
640
|
-
go$readdir,
|
|
641
|
-
[path2, options2, cb2],
|
|
642
|
-
err,
|
|
643
|
-
startTime || Date.now(),
|
|
644
|
-
Date.now()
|
|
645
|
-
]);
|
|
646
|
-
else {
|
|
647
|
-
if (files && files.sort)
|
|
648
|
-
files.sort();
|
|
649
|
-
if (typeof cb2 === "function")
|
|
650
|
-
cb2.call(this, err, files);
|
|
651
|
-
}
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
if (process.version.substr(0, 4) === "v0.8") {
|
|
656
|
-
var legStreams = legacy(fs2);
|
|
657
|
-
ReadStream = legStreams.ReadStream;
|
|
658
|
-
WriteStream = legStreams.WriteStream;
|
|
659
|
-
}
|
|
660
|
-
var fs$ReadStream = fs2.ReadStream;
|
|
661
|
-
if (fs$ReadStream) {
|
|
662
|
-
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
663
|
-
ReadStream.prototype.open = ReadStream$open;
|
|
664
|
-
}
|
|
665
|
-
var fs$WriteStream = fs2.WriteStream;
|
|
666
|
-
if (fs$WriteStream) {
|
|
667
|
-
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
668
|
-
WriteStream.prototype.open = WriteStream$open;
|
|
669
|
-
}
|
|
670
|
-
Object.defineProperty(fs2, "ReadStream", {
|
|
671
|
-
get: function() {
|
|
672
|
-
return ReadStream;
|
|
673
|
-
},
|
|
674
|
-
set: function(val) {
|
|
675
|
-
ReadStream = val;
|
|
676
|
-
},
|
|
677
|
-
enumerable: true,
|
|
678
|
-
configurable: true
|
|
679
|
-
});
|
|
680
|
-
Object.defineProperty(fs2, "WriteStream", {
|
|
681
|
-
get: function() {
|
|
682
|
-
return WriteStream;
|
|
683
|
-
},
|
|
684
|
-
set: function(val) {
|
|
685
|
-
WriteStream = val;
|
|
686
|
-
},
|
|
687
|
-
enumerable: true,
|
|
688
|
-
configurable: true
|
|
689
|
-
});
|
|
690
|
-
var FileReadStream = ReadStream;
|
|
691
|
-
Object.defineProperty(fs2, "FileReadStream", {
|
|
692
|
-
get: function() {
|
|
693
|
-
return FileReadStream;
|
|
694
|
-
},
|
|
695
|
-
set: function(val) {
|
|
696
|
-
FileReadStream = val;
|
|
697
|
-
},
|
|
698
|
-
enumerable: true,
|
|
699
|
-
configurable: true
|
|
700
|
-
});
|
|
701
|
-
var FileWriteStream = WriteStream;
|
|
702
|
-
Object.defineProperty(fs2, "FileWriteStream", {
|
|
703
|
-
get: function() {
|
|
704
|
-
return FileWriteStream;
|
|
705
|
-
},
|
|
706
|
-
set: function(val) {
|
|
707
|
-
FileWriteStream = val;
|
|
708
|
-
},
|
|
709
|
-
enumerable: true,
|
|
710
|
-
configurable: true
|
|
711
|
-
});
|
|
712
|
-
function ReadStream(path, options) {
|
|
713
|
-
if (this instanceof ReadStream)
|
|
714
|
-
return fs$ReadStream.apply(this, arguments), this;
|
|
715
|
-
else
|
|
716
|
-
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
717
|
-
}
|
|
718
|
-
function ReadStream$open() {
|
|
719
|
-
var that = this;
|
|
720
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
721
|
-
if (err) {
|
|
722
|
-
if (that.autoClose)
|
|
723
|
-
that.destroy();
|
|
724
|
-
that.emit("error", err);
|
|
725
|
-
} else {
|
|
726
|
-
that.fd = fd;
|
|
727
|
-
that.emit("open", fd);
|
|
728
|
-
that.read();
|
|
729
|
-
}
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
function WriteStream(path, options) {
|
|
733
|
-
if (this instanceof WriteStream)
|
|
734
|
-
return fs$WriteStream.apply(this, arguments), this;
|
|
735
|
-
else
|
|
736
|
-
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
737
|
-
}
|
|
738
|
-
function WriteStream$open() {
|
|
739
|
-
var that = this;
|
|
740
|
-
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
741
|
-
if (err) {
|
|
742
|
-
that.destroy();
|
|
743
|
-
that.emit("error", err);
|
|
744
|
-
} else {
|
|
745
|
-
that.fd = fd;
|
|
746
|
-
that.emit("open", fd);
|
|
747
|
-
}
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
function createReadStream(path, options) {
|
|
751
|
-
return new fs2.ReadStream(path, options);
|
|
752
|
-
}
|
|
753
|
-
function createWriteStream(path, options) {
|
|
754
|
-
return new fs2.WriteStream(path, options);
|
|
755
|
-
}
|
|
756
|
-
var fs$open = fs2.open;
|
|
757
|
-
fs2.open = open;
|
|
758
|
-
function open(path, flags, mode, cb) {
|
|
759
|
-
if (typeof mode === "function")
|
|
760
|
-
cb = mode, mode = null;
|
|
761
|
-
return go$open(path, flags, mode, cb);
|
|
762
|
-
function go$open(path2, flags2, mode2, cb2, startTime) {
|
|
763
|
-
return fs$open(path2, flags2, mode2, function(err, fd) {
|
|
764
|
-
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
765
|
-
enqueue([go$open, [path2, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
766
|
-
else {
|
|
767
|
-
if (typeof cb2 === "function")
|
|
768
|
-
cb2.apply(this, arguments);
|
|
769
|
-
}
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
return fs2;
|
|
774
|
-
}
|
|
775
|
-
function enqueue(elem) {
|
|
776
|
-
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
777
|
-
fs[gracefulQueue].push(elem);
|
|
778
|
-
retry();
|
|
779
|
-
}
|
|
780
|
-
var retryTimer;
|
|
781
|
-
function resetQueue() {
|
|
782
|
-
var now = Date.now();
|
|
783
|
-
for (var i = 0;i < fs[gracefulQueue].length; ++i) {
|
|
784
|
-
if (fs[gracefulQueue][i].length > 2) {
|
|
785
|
-
fs[gracefulQueue][i][3] = now;
|
|
786
|
-
fs[gracefulQueue][i][4] = now;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
retry();
|
|
790
|
-
}
|
|
791
|
-
function retry() {
|
|
792
|
-
clearTimeout(retryTimer);
|
|
793
|
-
retryTimer = undefined;
|
|
794
|
-
if (fs[gracefulQueue].length === 0)
|
|
795
|
-
return;
|
|
796
|
-
var elem = fs[gracefulQueue].shift();
|
|
797
|
-
var fn = elem[0];
|
|
798
|
-
var args = elem[1];
|
|
799
|
-
var err = elem[2];
|
|
800
|
-
var startTime = elem[3];
|
|
801
|
-
var lastTime = elem[4];
|
|
802
|
-
if (startTime === undefined) {
|
|
803
|
-
debug("RETRY", fn.name, args);
|
|
804
|
-
fn.apply(null, args);
|
|
805
|
-
} else if (Date.now() - startTime >= 60000) {
|
|
806
|
-
debug("TIMEOUT", fn.name, args);
|
|
807
|
-
var cb = args.pop();
|
|
808
|
-
if (typeof cb === "function")
|
|
809
|
-
cb.call(null, err);
|
|
810
|
-
} else {
|
|
811
|
-
var sinceAttempt = Date.now() - lastTime;
|
|
812
|
-
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
813
|
-
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
814
|
-
if (sinceAttempt >= desiredDelay) {
|
|
815
|
-
debug("RETRY", fn.name, args);
|
|
816
|
-
fn.apply(null, args.concat([startTime]));
|
|
817
|
-
} else {
|
|
818
|
-
fs[gracefulQueue].push(elem);
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
if (retryTimer === undefined) {
|
|
822
|
-
retryTimer = setTimeout(retry, 0);
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
|
|
827
|
-
// node_modules/.bun/retry@0.12.0/node_modules/retry/lib/retry_operation.js
|
|
828
|
-
var require_retry_operation = __commonJS((exports, module) => {
|
|
829
|
-
function RetryOperation(timeouts, options) {
|
|
830
|
-
if (typeof options === "boolean") {
|
|
831
|
-
options = { forever: options };
|
|
832
|
-
}
|
|
833
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
834
|
-
this._timeouts = timeouts;
|
|
835
|
-
this._options = options || {};
|
|
836
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
837
|
-
this._fn = null;
|
|
838
|
-
this._errors = [];
|
|
839
|
-
this._attempts = 1;
|
|
840
|
-
this._operationTimeout = null;
|
|
841
|
-
this._operationTimeoutCb = null;
|
|
842
|
-
this._timeout = null;
|
|
843
|
-
this._operationStart = null;
|
|
844
|
-
if (this._options.forever) {
|
|
845
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
module.exports = RetryOperation;
|
|
849
|
-
RetryOperation.prototype.reset = function() {
|
|
850
|
-
this._attempts = 1;
|
|
851
|
-
this._timeouts = this._originalTimeouts;
|
|
852
|
-
};
|
|
853
|
-
RetryOperation.prototype.stop = function() {
|
|
854
|
-
if (this._timeout) {
|
|
855
|
-
clearTimeout(this._timeout);
|
|
856
|
-
}
|
|
857
|
-
this._timeouts = [];
|
|
858
|
-
this._cachedTimeouts = null;
|
|
859
|
-
};
|
|
860
|
-
RetryOperation.prototype.retry = function(err) {
|
|
861
|
-
if (this._timeout) {
|
|
862
|
-
clearTimeout(this._timeout);
|
|
863
|
-
}
|
|
864
|
-
if (!err) {
|
|
865
|
-
return false;
|
|
866
|
-
}
|
|
867
|
-
var currentTime = new Date().getTime();
|
|
868
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
869
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
870
|
-
return false;
|
|
871
|
-
}
|
|
872
|
-
this._errors.push(err);
|
|
873
|
-
var timeout = this._timeouts.shift();
|
|
874
|
-
if (timeout === undefined) {
|
|
875
|
-
if (this._cachedTimeouts) {
|
|
876
|
-
this._errors.splice(this._errors.length - 1, this._errors.length);
|
|
877
|
-
this._timeouts = this._cachedTimeouts.slice(0);
|
|
878
|
-
timeout = this._timeouts.shift();
|
|
879
|
-
} else {
|
|
880
|
-
return false;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
var self = this;
|
|
884
|
-
var timer = setTimeout(function() {
|
|
885
|
-
self._attempts++;
|
|
886
|
-
if (self._operationTimeoutCb) {
|
|
887
|
-
self._timeout = setTimeout(function() {
|
|
888
|
-
self._operationTimeoutCb(self._attempts);
|
|
889
|
-
}, self._operationTimeout);
|
|
890
|
-
if (self._options.unref) {
|
|
891
|
-
self._timeout.unref();
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
self._fn(self._attempts);
|
|
895
|
-
}, timeout);
|
|
896
|
-
if (this._options.unref) {
|
|
897
|
-
timer.unref();
|
|
898
|
-
}
|
|
899
|
-
return true;
|
|
900
|
-
};
|
|
901
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
902
|
-
this._fn = fn;
|
|
903
|
-
if (timeoutOps) {
|
|
904
|
-
if (timeoutOps.timeout) {
|
|
905
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
906
|
-
}
|
|
907
|
-
if (timeoutOps.cb) {
|
|
908
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
var self = this;
|
|
912
|
-
if (this._operationTimeoutCb) {
|
|
913
|
-
this._timeout = setTimeout(function() {
|
|
914
|
-
self._operationTimeoutCb();
|
|
915
|
-
}, self._operationTimeout);
|
|
916
|
-
}
|
|
917
|
-
this._operationStart = new Date().getTime();
|
|
918
|
-
this._fn(this._attempts);
|
|
919
|
-
};
|
|
920
|
-
RetryOperation.prototype.try = function(fn) {
|
|
921
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
922
|
-
this.attempt(fn);
|
|
923
|
-
};
|
|
924
|
-
RetryOperation.prototype.start = function(fn) {
|
|
925
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
926
|
-
this.attempt(fn);
|
|
927
|
-
};
|
|
928
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
929
|
-
RetryOperation.prototype.errors = function() {
|
|
930
|
-
return this._errors;
|
|
931
|
-
};
|
|
932
|
-
RetryOperation.prototype.attempts = function() {
|
|
933
|
-
return this._attempts;
|
|
934
|
-
};
|
|
935
|
-
RetryOperation.prototype.mainError = function() {
|
|
936
|
-
if (this._errors.length === 0) {
|
|
937
|
-
return null;
|
|
938
|
-
}
|
|
939
|
-
var counts = {};
|
|
940
|
-
var mainError = null;
|
|
941
|
-
var mainErrorCount = 0;
|
|
942
|
-
for (var i = 0;i < this._errors.length; i++) {
|
|
943
|
-
var error = this._errors[i];
|
|
944
|
-
var message = error.message;
|
|
945
|
-
var count = (counts[message] || 0) + 1;
|
|
946
|
-
counts[message] = count;
|
|
947
|
-
if (count >= mainErrorCount) {
|
|
948
|
-
mainError = error;
|
|
949
|
-
mainErrorCount = count;
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
return mainError;
|
|
953
|
-
};
|
|
954
|
-
});
|
|
955
|
-
|
|
956
|
-
// node_modules/.bun/retry@0.12.0/node_modules/retry/lib/retry.js
|
|
957
|
-
var require_retry = __commonJS((exports) => {
|
|
958
|
-
var RetryOperation = require_retry_operation();
|
|
959
|
-
exports.operation = function(options) {
|
|
960
|
-
var timeouts = exports.timeouts(options);
|
|
961
|
-
return new RetryOperation(timeouts, {
|
|
962
|
-
forever: options && options.forever,
|
|
963
|
-
unref: options && options.unref,
|
|
964
|
-
maxRetryTime: options && options.maxRetryTime
|
|
965
|
-
});
|
|
966
|
-
};
|
|
967
|
-
exports.timeouts = function(options) {
|
|
968
|
-
if (options instanceof Array) {
|
|
969
|
-
return [].concat(options);
|
|
970
|
-
}
|
|
971
|
-
var opts = {
|
|
972
|
-
retries: 10,
|
|
973
|
-
factor: 2,
|
|
974
|
-
minTimeout: 1 * 1000,
|
|
975
|
-
maxTimeout: Infinity,
|
|
976
|
-
randomize: false
|
|
977
|
-
};
|
|
978
|
-
for (var key in options) {
|
|
979
|
-
opts[key] = options[key];
|
|
980
|
-
}
|
|
981
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
982
|
-
throw new Error("minTimeout is greater than maxTimeout");
|
|
983
|
-
}
|
|
984
|
-
var timeouts = [];
|
|
985
|
-
for (var i = 0;i < opts.retries; i++) {
|
|
986
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
987
|
-
}
|
|
988
|
-
if (options && options.forever && !timeouts.length) {
|
|
989
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
990
|
-
}
|
|
991
|
-
timeouts.sort(function(a, b) {
|
|
992
|
-
return a - b;
|
|
993
|
-
});
|
|
994
|
-
return timeouts;
|
|
995
|
-
};
|
|
996
|
-
exports.createTimeout = function(attempt, opts) {
|
|
997
|
-
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
998
|
-
var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
|
|
999
|
-
timeout = Math.min(timeout, opts.maxTimeout);
|
|
1000
|
-
return timeout;
|
|
1001
|
-
};
|
|
1002
|
-
exports.wrap = function(obj, options, methods) {
|
|
1003
|
-
if (options instanceof Array) {
|
|
1004
|
-
methods = options;
|
|
1005
|
-
options = null;
|
|
1006
|
-
}
|
|
1007
|
-
if (!methods) {
|
|
1008
|
-
methods = [];
|
|
1009
|
-
for (var key in obj) {
|
|
1010
|
-
if (typeof obj[key] === "function") {
|
|
1011
|
-
methods.push(key);
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
for (var i = 0;i < methods.length; i++) {
|
|
1016
|
-
var method = methods[i];
|
|
1017
|
-
var original = obj[method];
|
|
1018
|
-
obj[method] = function retryWrapper(original2) {
|
|
1019
|
-
var op = exports.operation(options);
|
|
1020
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
1021
|
-
var callback = args.pop();
|
|
1022
|
-
args.push(function(err) {
|
|
1023
|
-
if (op.retry(err)) {
|
|
1024
|
-
return;
|
|
1025
|
-
}
|
|
1026
|
-
if (err) {
|
|
1027
|
-
arguments[0] = op.mainError();
|
|
1028
|
-
}
|
|
1029
|
-
callback.apply(this, arguments);
|
|
1030
|
-
});
|
|
1031
|
-
op.attempt(function() {
|
|
1032
|
-
original2.apply(obj, args);
|
|
1033
|
-
});
|
|
1034
|
-
}.bind(obj, original);
|
|
1035
|
-
obj[method].options = options;
|
|
1036
|
-
}
|
|
1037
|
-
};
|
|
1038
|
-
});
|
|
1039
|
-
|
|
1040
|
-
// node_modules/.bun/signal-exit@3.0.7/node_modules/signal-exit/signals.js
|
|
1041
|
-
var require_signals = __commonJS((exports, module) => {
|
|
1042
|
-
module.exports = [
|
|
1043
|
-
"SIGABRT",
|
|
1044
|
-
"SIGALRM",
|
|
1045
|
-
"SIGHUP",
|
|
1046
|
-
"SIGINT",
|
|
1047
|
-
"SIGTERM"
|
|
1048
|
-
];
|
|
1049
|
-
if (process.platform !== "win32") {
|
|
1050
|
-
module.exports.push("SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
1051
|
-
}
|
|
1052
|
-
if (process.platform === "linux") {
|
|
1053
|
-
module.exports.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT", "SIGUNUSED");
|
|
1054
|
-
}
|
|
1055
|
-
});
|
|
1056
|
-
|
|
1057
|
-
// node_modules/.bun/signal-exit@3.0.7/node_modules/signal-exit/index.js
|
|
1058
|
-
var require_signal_exit = __commonJS((exports, module) => {
|
|
1059
|
-
var process2 = global.process;
|
|
1060
|
-
var processOk = function(process3) {
|
|
1061
|
-
return process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
|
|
1062
|
-
};
|
|
1063
|
-
if (!processOk(process2)) {
|
|
1064
|
-
module.exports = function() {
|
|
1065
|
-
return function() {};
|
|
1066
|
-
};
|
|
1067
|
-
} else {
|
|
1068
|
-
assert = __require("assert");
|
|
1069
|
-
signals = require_signals();
|
|
1070
|
-
isWin = /^win/i.test(process2.platform);
|
|
1071
|
-
EE = __require("events");
|
|
1072
|
-
if (typeof EE !== "function") {
|
|
1073
|
-
EE = EE.EventEmitter;
|
|
1074
|
-
}
|
|
1075
|
-
if (process2.__signal_exit_emitter__) {
|
|
1076
|
-
emitter = process2.__signal_exit_emitter__;
|
|
1077
|
-
} else {
|
|
1078
|
-
emitter = process2.__signal_exit_emitter__ = new EE;
|
|
1079
|
-
emitter.count = 0;
|
|
1080
|
-
emitter.emitted = {};
|
|
1081
|
-
}
|
|
1082
|
-
if (!emitter.infinite) {
|
|
1083
|
-
emitter.setMaxListeners(Infinity);
|
|
1084
|
-
emitter.infinite = true;
|
|
1085
|
-
}
|
|
1086
|
-
module.exports = function(cb, opts) {
|
|
1087
|
-
if (!processOk(global.process)) {
|
|
1088
|
-
return function() {};
|
|
1089
|
-
}
|
|
1090
|
-
assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
|
|
1091
|
-
if (loaded === false) {
|
|
1092
|
-
load();
|
|
1093
|
-
}
|
|
1094
|
-
var ev = "exit";
|
|
1095
|
-
if (opts && opts.alwaysLast) {
|
|
1096
|
-
ev = "afterexit";
|
|
1097
|
-
}
|
|
1098
|
-
var remove = function() {
|
|
1099
|
-
emitter.removeListener(ev, cb);
|
|
1100
|
-
if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
|
|
1101
|
-
unload();
|
|
1102
|
-
}
|
|
1103
|
-
};
|
|
1104
|
-
emitter.on(ev, cb);
|
|
1105
|
-
return remove;
|
|
1106
|
-
};
|
|
1107
|
-
unload = function unload2() {
|
|
1108
|
-
if (!loaded || !processOk(global.process)) {
|
|
1109
|
-
return;
|
|
1110
|
-
}
|
|
1111
|
-
loaded = false;
|
|
1112
|
-
signals.forEach(function(sig) {
|
|
1113
|
-
try {
|
|
1114
|
-
process2.removeListener(sig, sigListeners[sig]);
|
|
1115
|
-
} catch (er) {}
|
|
1116
|
-
});
|
|
1117
|
-
process2.emit = originalProcessEmit;
|
|
1118
|
-
process2.reallyExit = originalProcessReallyExit;
|
|
1119
|
-
emitter.count -= 1;
|
|
1120
|
-
};
|
|
1121
|
-
module.exports.unload = unload;
|
|
1122
|
-
emit = function emit2(event, code, signal) {
|
|
1123
|
-
if (emitter.emitted[event]) {
|
|
1124
|
-
return;
|
|
1125
|
-
}
|
|
1126
|
-
emitter.emitted[event] = true;
|
|
1127
|
-
emitter.emit(event, code, signal);
|
|
1128
|
-
};
|
|
1129
|
-
sigListeners = {};
|
|
1130
|
-
signals.forEach(function(sig) {
|
|
1131
|
-
sigListeners[sig] = function listener() {
|
|
1132
|
-
if (!processOk(global.process)) {
|
|
1133
|
-
return;
|
|
1134
|
-
}
|
|
1135
|
-
var listeners = process2.listeners(sig);
|
|
1136
|
-
if (listeners.length === emitter.count) {
|
|
1137
|
-
unload();
|
|
1138
|
-
emit("exit", null, sig);
|
|
1139
|
-
emit("afterexit", null, sig);
|
|
1140
|
-
if (isWin && sig === "SIGHUP") {
|
|
1141
|
-
sig = "SIGINT";
|
|
1142
|
-
}
|
|
1143
|
-
process2.kill(process2.pid, sig);
|
|
1144
|
-
}
|
|
1145
|
-
};
|
|
1146
|
-
});
|
|
1147
|
-
module.exports.signals = function() {
|
|
1148
|
-
return signals;
|
|
1149
|
-
};
|
|
1150
|
-
loaded = false;
|
|
1151
|
-
load = function load2() {
|
|
1152
|
-
if (loaded || !processOk(global.process)) {
|
|
1153
|
-
return;
|
|
1154
|
-
}
|
|
1155
|
-
loaded = true;
|
|
1156
|
-
emitter.count += 1;
|
|
1157
|
-
signals = signals.filter(function(sig) {
|
|
1158
|
-
try {
|
|
1159
|
-
process2.on(sig, sigListeners[sig]);
|
|
1160
|
-
return true;
|
|
1161
|
-
} catch (er) {
|
|
1162
|
-
return false;
|
|
1163
|
-
}
|
|
1164
|
-
});
|
|
1165
|
-
process2.emit = processEmit;
|
|
1166
|
-
process2.reallyExit = processReallyExit;
|
|
1167
|
-
};
|
|
1168
|
-
module.exports.load = load;
|
|
1169
|
-
originalProcessReallyExit = process2.reallyExit;
|
|
1170
|
-
processReallyExit = function processReallyExit2(code) {
|
|
1171
|
-
if (!processOk(global.process)) {
|
|
1172
|
-
return;
|
|
1173
|
-
}
|
|
1174
|
-
process2.exitCode = code || 0;
|
|
1175
|
-
emit("exit", process2.exitCode, null);
|
|
1176
|
-
emit("afterexit", process2.exitCode, null);
|
|
1177
|
-
originalProcessReallyExit.call(process2, process2.exitCode);
|
|
1178
|
-
};
|
|
1179
|
-
originalProcessEmit = process2.emit;
|
|
1180
|
-
processEmit = function processEmit2(ev, arg) {
|
|
1181
|
-
if (ev === "exit" && processOk(global.process)) {
|
|
1182
|
-
if (arg !== undefined) {
|
|
1183
|
-
process2.exitCode = arg;
|
|
1184
|
-
}
|
|
1185
|
-
var ret = originalProcessEmit.apply(this, arguments);
|
|
1186
|
-
emit("exit", process2.exitCode, null);
|
|
1187
|
-
emit("afterexit", process2.exitCode, null);
|
|
1188
|
-
return ret;
|
|
1189
|
-
} else {
|
|
1190
|
-
return originalProcessEmit.apply(this, arguments);
|
|
1191
|
-
}
|
|
1192
|
-
};
|
|
1193
|
-
}
|
|
1194
|
-
var assert;
|
|
1195
|
-
var signals;
|
|
1196
|
-
var isWin;
|
|
1197
|
-
var EE;
|
|
1198
|
-
var emitter;
|
|
1199
|
-
var unload;
|
|
1200
|
-
var emit;
|
|
1201
|
-
var sigListeners;
|
|
1202
|
-
var loaded;
|
|
1203
|
-
var load;
|
|
1204
|
-
var originalProcessReallyExit;
|
|
1205
|
-
var processReallyExit;
|
|
1206
|
-
var originalProcessEmit;
|
|
1207
|
-
var processEmit;
|
|
1208
|
-
});
|
|
1209
|
-
|
|
1210
|
-
// node_modules/.bun/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js
|
|
1211
|
-
var require_mtime_precision = __commonJS((exports, module) => {
|
|
1212
|
-
var cacheSymbol = Symbol();
|
|
1213
|
-
function probe(file, fs, callback) {
|
|
1214
|
-
const cachedPrecision = fs[cacheSymbol];
|
|
1215
|
-
if (cachedPrecision) {
|
|
1216
|
-
return fs.stat(file, (err, stat) => {
|
|
1217
|
-
if (err) {
|
|
1218
|
-
return callback(err);
|
|
1219
|
-
}
|
|
1220
|
-
callback(null, stat.mtime, cachedPrecision);
|
|
1221
|
-
});
|
|
1222
|
-
}
|
|
1223
|
-
const mtime = new Date(Math.ceil(Date.now() / 1000) * 1000 + 5);
|
|
1224
|
-
fs.utimes(file, mtime, mtime, (err) => {
|
|
1225
|
-
if (err) {
|
|
1226
|
-
return callback(err);
|
|
1227
|
-
}
|
|
1228
|
-
fs.stat(file, (err2, stat) => {
|
|
1229
|
-
if (err2) {
|
|
1230
|
-
return callback(err2);
|
|
1231
|
-
}
|
|
1232
|
-
const precision = stat.mtime.getTime() % 1000 === 0 ? "s" : "ms";
|
|
1233
|
-
Object.defineProperty(fs, cacheSymbol, { value: precision });
|
|
1234
|
-
callback(null, stat.mtime, precision);
|
|
1235
|
-
});
|
|
1236
|
-
});
|
|
1237
|
-
}
|
|
1238
|
-
function getMtime(precision) {
|
|
1239
|
-
let now = Date.now();
|
|
1240
|
-
if (precision === "s") {
|
|
1241
|
-
now = Math.ceil(now / 1000) * 1000;
|
|
1242
|
-
}
|
|
1243
|
-
return new Date(now);
|
|
1244
|
-
}
|
|
1245
|
-
exports.probe = probe;
|
|
1246
|
-
exports.getMtime = getMtime;
|
|
1247
|
-
});
|
|
1248
|
-
|
|
1249
|
-
// node_modules/.bun/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js
|
|
1250
|
-
var require_lockfile = __commonJS((exports, module) => {
|
|
1251
|
-
var path = __require("path");
|
|
1252
|
-
var fs = require_graceful_fs();
|
|
1253
|
-
var retry = require_retry();
|
|
1254
|
-
var onExit = require_signal_exit();
|
|
1255
|
-
var mtimePrecision = require_mtime_precision();
|
|
1256
|
-
var locks = {};
|
|
1257
|
-
function getLockFile(file, options) {
|
|
1258
|
-
return options.lockfilePath || `${file}.lock`;
|
|
1259
|
-
}
|
|
1260
|
-
function resolveCanonicalPath(file, options, callback) {
|
|
1261
|
-
if (!options.realpath) {
|
|
1262
|
-
return callback(null, path.resolve(file));
|
|
1263
|
-
}
|
|
1264
|
-
options.fs.realpath(file, callback);
|
|
1265
|
-
}
|
|
1266
|
-
function acquireLock(file, options, callback) {
|
|
1267
|
-
const lockfilePath = getLockFile(file, options);
|
|
1268
|
-
options.fs.mkdir(lockfilePath, (err) => {
|
|
1269
|
-
if (!err) {
|
|
1270
|
-
return mtimePrecision.probe(lockfilePath, options.fs, (err2, mtime, mtimePrecision2) => {
|
|
1271
|
-
if (err2) {
|
|
1272
|
-
options.fs.rmdir(lockfilePath, () => {});
|
|
1273
|
-
return callback(err2);
|
|
1274
|
-
}
|
|
1275
|
-
callback(null, mtime, mtimePrecision2);
|
|
1276
|
-
});
|
|
1277
|
-
}
|
|
1278
|
-
if (err.code !== "EEXIST") {
|
|
1279
|
-
return callback(err);
|
|
1280
|
-
}
|
|
1281
|
-
if (options.stale <= 0) {
|
|
1282
|
-
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file }));
|
|
1283
|
-
}
|
|
1284
|
-
options.fs.stat(lockfilePath, (err2, stat) => {
|
|
1285
|
-
if (err2) {
|
|
1286
|
-
if (err2.code === "ENOENT") {
|
|
1287
|
-
return acquireLock(file, { ...options, stale: 0 }, callback);
|
|
1288
|
-
}
|
|
1289
|
-
return callback(err2);
|
|
1290
|
-
}
|
|
1291
|
-
if (!isLockStale(stat, options)) {
|
|
1292
|
-
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file }));
|
|
1293
|
-
}
|
|
1294
|
-
removeLock(file, options, (err3) => {
|
|
1295
|
-
if (err3) {
|
|
1296
|
-
return callback(err3);
|
|
1297
|
-
}
|
|
1298
|
-
acquireLock(file, { ...options, stale: 0 }, callback);
|
|
1299
|
-
});
|
|
1300
|
-
});
|
|
1301
|
-
});
|
|
1302
|
-
}
|
|
1303
|
-
function isLockStale(stat, options) {
|
|
1304
|
-
return stat.mtime.getTime() < Date.now() - options.stale;
|
|
1305
|
-
}
|
|
1306
|
-
function removeLock(file, options, callback) {
|
|
1307
|
-
options.fs.rmdir(getLockFile(file, options), (err) => {
|
|
1308
|
-
if (err && err.code !== "ENOENT") {
|
|
1309
|
-
return callback(err);
|
|
1310
|
-
}
|
|
1311
|
-
callback();
|
|
1312
|
-
});
|
|
1313
|
-
}
|
|
1314
|
-
function updateLock(file, options) {
|
|
1315
|
-
const lock2 = locks[file];
|
|
1316
|
-
if (lock2.updateTimeout) {
|
|
1317
|
-
return;
|
|
1318
|
-
}
|
|
1319
|
-
lock2.updateDelay = lock2.updateDelay || options.update;
|
|
1320
|
-
lock2.updateTimeout = setTimeout(() => {
|
|
1321
|
-
lock2.updateTimeout = null;
|
|
1322
|
-
options.fs.stat(lock2.lockfilePath, (err, stat) => {
|
|
1323
|
-
const isOverThreshold = lock2.lastUpdate + options.stale < Date.now();
|
|
1324
|
-
if (err) {
|
|
1325
|
-
if (err.code === "ENOENT" || isOverThreshold) {
|
|
1326
|
-
return setLockAsCompromised(file, lock2, Object.assign(err, { code: "ECOMPROMISED" }));
|
|
1327
|
-
}
|
|
1328
|
-
lock2.updateDelay = 1000;
|
|
1329
|
-
return updateLock(file, options);
|
|
1330
|
-
}
|
|
1331
|
-
const isMtimeOurs = lock2.mtime.getTime() === stat.mtime.getTime();
|
|
1332
|
-
if (!isMtimeOurs) {
|
|
1333
|
-
return setLockAsCompromised(file, lock2, Object.assign(new Error("Unable to update lock within the stale threshold"), { code: "ECOMPROMISED" }));
|
|
1334
|
-
}
|
|
1335
|
-
const mtime = mtimePrecision.getMtime(lock2.mtimePrecision);
|
|
1336
|
-
options.fs.utimes(lock2.lockfilePath, mtime, mtime, (err2) => {
|
|
1337
|
-
const isOverThreshold2 = lock2.lastUpdate + options.stale < Date.now();
|
|
1338
|
-
if (lock2.released) {
|
|
1339
|
-
return;
|
|
1340
|
-
}
|
|
1341
|
-
if (err2) {
|
|
1342
|
-
if (err2.code === "ENOENT" || isOverThreshold2) {
|
|
1343
|
-
return setLockAsCompromised(file, lock2, Object.assign(err2, { code: "ECOMPROMISED" }));
|
|
1344
|
-
}
|
|
1345
|
-
lock2.updateDelay = 1000;
|
|
1346
|
-
return updateLock(file, options);
|
|
1347
|
-
}
|
|
1348
|
-
lock2.mtime = mtime;
|
|
1349
|
-
lock2.lastUpdate = Date.now();
|
|
1350
|
-
lock2.updateDelay = null;
|
|
1351
|
-
updateLock(file, options);
|
|
1352
|
-
});
|
|
1353
|
-
});
|
|
1354
|
-
}, lock2.updateDelay);
|
|
1355
|
-
if (lock2.updateTimeout.unref) {
|
|
1356
|
-
lock2.updateTimeout.unref();
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
function setLockAsCompromised(file, lock2, err) {
|
|
1360
|
-
lock2.released = true;
|
|
1361
|
-
if (lock2.updateTimeout) {
|
|
1362
|
-
clearTimeout(lock2.updateTimeout);
|
|
1363
|
-
}
|
|
1364
|
-
if (locks[file] === lock2) {
|
|
1365
|
-
delete locks[file];
|
|
1366
|
-
}
|
|
1367
|
-
lock2.options.onCompromised(err);
|
|
1368
|
-
}
|
|
1369
|
-
function lock(file, options, callback) {
|
|
1370
|
-
options = {
|
|
1371
|
-
stale: 1e4,
|
|
1372
|
-
update: null,
|
|
1373
|
-
realpath: true,
|
|
1374
|
-
retries: 0,
|
|
1375
|
-
fs,
|
|
1376
|
-
onCompromised: (err) => {
|
|
1377
|
-
throw err;
|
|
1378
|
-
},
|
|
1379
|
-
...options
|
|
1380
|
-
};
|
|
1381
|
-
options.retries = options.retries || 0;
|
|
1382
|
-
options.retries = typeof options.retries === "number" ? { retries: options.retries } : options.retries;
|
|
1383
|
-
options.stale = Math.max(options.stale || 0, 2000);
|
|
1384
|
-
options.update = options.update == null ? options.stale / 2 : options.update || 0;
|
|
1385
|
-
options.update = Math.max(Math.min(options.update, options.stale / 2), 1000);
|
|
1386
|
-
resolveCanonicalPath(file, options, (err, file2) => {
|
|
1387
|
-
if (err) {
|
|
1388
|
-
return callback(err);
|
|
1389
|
-
}
|
|
1390
|
-
const operation = retry.operation(options.retries);
|
|
1391
|
-
operation.attempt(() => {
|
|
1392
|
-
acquireLock(file2, options, (err2, mtime, mtimePrecision2) => {
|
|
1393
|
-
if (operation.retry(err2)) {
|
|
1394
|
-
return;
|
|
1395
|
-
}
|
|
1396
|
-
if (err2) {
|
|
1397
|
-
return callback(operation.mainError());
|
|
1398
|
-
}
|
|
1399
|
-
const lock2 = locks[file2] = {
|
|
1400
|
-
lockfilePath: getLockFile(file2, options),
|
|
1401
|
-
mtime,
|
|
1402
|
-
mtimePrecision: mtimePrecision2,
|
|
1403
|
-
options,
|
|
1404
|
-
lastUpdate: Date.now()
|
|
1405
|
-
};
|
|
1406
|
-
updateLock(file2, options);
|
|
1407
|
-
callback(null, (releasedCallback) => {
|
|
1408
|
-
if (lock2.released) {
|
|
1409
|
-
return releasedCallback && releasedCallback(Object.assign(new Error("Lock is already released"), { code: "ERELEASED" }));
|
|
1410
|
-
}
|
|
1411
|
-
unlock(file2, { ...options, realpath: false }, releasedCallback);
|
|
1412
|
-
});
|
|
1413
|
-
});
|
|
1414
|
-
});
|
|
1415
|
-
});
|
|
1416
|
-
}
|
|
1417
|
-
function unlock(file, options, callback) {
|
|
1418
|
-
options = {
|
|
1419
|
-
fs,
|
|
1420
|
-
realpath: true,
|
|
1421
|
-
...options
|
|
1422
|
-
};
|
|
1423
|
-
resolveCanonicalPath(file, options, (err, file2) => {
|
|
1424
|
-
if (err) {
|
|
1425
|
-
return callback(err);
|
|
1426
|
-
}
|
|
1427
|
-
const lock2 = locks[file2];
|
|
1428
|
-
if (!lock2) {
|
|
1429
|
-
return callback(Object.assign(new Error("Lock is not acquired/owned by you"), { code: "ENOTACQUIRED" }));
|
|
1430
|
-
}
|
|
1431
|
-
lock2.updateTimeout && clearTimeout(lock2.updateTimeout);
|
|
1432
|
-
lock2.released = true;
|
|
1433
|
-
delete locks[file2];
|
|
1434
|
-
removeLock(file2, options, callback);
|
|
1435
|
-
});
|
|
1436
|
-
}
|
|
1437
|
-
function check(file, options, callback) {
|
|
1438
|
-
options = {
|
|
1439
|
-
stale: 1e4,
|
|
1440
|
-
realpath: true,
|
|
1441
|
-
fs,
|
|
1442
|
-
...options
|
|
1443
|
-
};
|
|
1444
|
-
options.stale = Math.max(options.stale || 0, 2000);
|
|
1445
|
-
resolveCanonicalPath(file, options, (err, file2) => {
|
|
1446
|
-
if (err) {
|
|
1447
|
-
return callback(err);
|
|
1448
|
-
}
|
|
1449
|
-
options.fs.stat(getLockFile(file2, options), (err2, stat) => {
|
|
1450
|
-
if (err2) {
|
|
1451
|
-
return err2.code === "ENOENT" ? callback(null, false) : callback(err2);
|
|
1452
|
-
}
|
|
1453
|
-
return callback(null, !isLockStale(stat, options));
|
|
1454
|
-
});
|
|
1455
|
-
});
|
|
1456
|
-
}
|
|
1457
|
-
function getLocks() {
|
|
1458
|
-
return locks;
|
|
1459
|
-
}
|
|
1460
|
-
onExit(() => {
|
|
1461
|
-
for (const file in locks) {
|
|
1462
|
-
const options = locks[file].options;
|
|
1463
|
-
try {
|
|
1464
|
-
options.fs.rmdirSync(getLockFile(file, options));
|
|
1465
|
-
} catch (e) {}
|
|
1466
|
-
}
|
|
1467
|
-
});
|
|
1468
|
-
exports.lock = lock;
|
|
1469
|
-
exports.unlock = unlock;
|
|
1470
|
-
exports.check = check;
|
|
1471
|
-
exports.getLocks = getLocks;
|
|
1472
|
-
});
|
|
1473
|
-
|
|
1474
|
-
// node_modules/.bun/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js
|
|
1475
|
-
var require_adapter = __commonJS((exports, module) => {
|
|
1476
|
-
var fs = require_graceful_fs();
|
|
1477
|
-
function createSyncFs(fs2) {
|
|
1478
|
-
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
1479
|
-
const newFs = { ...fs2 };
|
|
1480
|
-
methods.forEach((method) => {
|
|
1481
|
-
newFs[method] = (...args) => {
|
|
1482
|
-
const callback = args.pop();
|
|
1483
|
-
let ret;
|
|
1484
|
-
try {
|
|
1485
|
-
ret = fs2[`${method}Sync`](...args);
|
|
1486
|
-
} catch (err) {
|
|
1487
|
-
return callback(err);
|
|
1488
|
-
}
|
|
1489
|
-
callback(null, ret);
|
|
1490
|
-
};
|
|
1491
|
-
});
|
|
1492
|
-
return newFs;
|
|
1493
|
-
}
|
|
1494
|
-
function toPromise(method) {
|
|
1495
|
-
return (...args) => new Promise((resolve, reject) => {
|
|
1496
|
-
args.push((err, result) => {
|
|
1497
|
-
if (err) {
|
|
1498
|
-
reject(err);
|
|
1499
|
-
} else {
|
|
1500
|
-
resolve(result);
|
|
1501
|
-
}
|
|
1502
|
-
});
|
|
1503
|
-
method(...args);
|
|
3
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
4
|
+
var __returnValue = (v) => v;
|
|
5
|
+
function __exportSetter(name, newValue) {
|
|
6
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
7
|
+
}
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true,
|
|
13
|
+
configurable: true,
|
|
14
|
+
set: __exportSetter.bind(all, name)
|
|
1504
15
|
});
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
let err;
|
|
1509
|
-
let result;
|
|
1510
|
-
args.push((_err, _result) => {
|
|
1511
|
-
err = _err;
|
|
1512
|
-
result = _result;
|
|
1513
|
-
});
|
|
1514
|
-
method(...args);
|
|
1515
|
-
if (err) {
|
|
1516
|
-
throw err;
|
|
1517
|
-
}
|
|
1518
|
-
return result;
|
|
1519
|
-
};
|
|
1520
|
-
}
|
|
1521
|
-
function toSyncOptions(options) {
|
|
1522
|
-
options = { ...options };
|
|
1523
|
-
options.fs = createSyncFs(options.fs || fs);
|
|
1524
|
-
if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
|
|
1525
|
-
throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
|
|
1526
|
-
}
|
|
1527
|
-
return options;
|
|
1528
|
-
}
|
|
1529
|
-
module.exports = {
|
|
1530
|
-
toPromise,
|
|
1531
|
-
toSync,
|
|
1532
|
-
toSyncOptions
|
|
1533
|
-
};
|
|
1534
|
-
});
|
|
1535
|
-
|
|
1536
|
-
// node_modules/.bun/proper-lockfile@4.1.2/node_modules/proper-lockfile/index.js
|
|
1537
|
-
var require_proper_lockfile = __commonJS((exports, module) => {
|
|
1538
|
-
var lockfile = require_lockfile();
|
|
1539
|
-
var { toPromise, toSync, toSyncOptions } = require_adapter();
|
|
1540
|
-
async function lock(file, options) {
|
|
1541
|
-
const release = await toPromise(lockfile.lock)(file, options);
|
|
1542
|
-
return toPromise(release);
|
|
1543
|
-
}
|
|
1544
|
-
function lockSync(file, options) {
|
|
1545
|
-
const release = toSync(lockfile.lock)(file, toSyncOptions(options));
|
|
1546
|
-
return toSync(release);
|
|
1547
|
-
}
|
|
1548
|
-
function unlock(file, options) {
|
|
1549
|
-
return toPromise(lockfile.unlock)(file, options);
|
|
1550
|
-
}
|
|
1551
|
-
function unlockSync(file, options) {
|
|
1552
|
-
return toSync(lockfile.unlock)(file, toSyncOptions(options));
|
|
1553
|
-
}
|
|
1554
|
-
function check(file, options) {
|
|
1555
|
-
return toPromise(lockfile.check)(file, options);
|
|
1556
|
-
}
|
|
1557
|
-
function checkSync(file, options) {
|
|
1558
|
-
return toSync(lockfile.check)(file, toSyncOptions(options));
|
|
1559
|
-
}
|
|
1560
|
-
module.exports = lock;
|
|
1561
|
-
module.exports.lock = lock;
|
|
1562
|
-
module.exports.unlock = unlock;
|
|
1563
|
-
module.exports.lockSync = lockSync;
|
|
1564
|
-
module.exports.unlockSync = unlockSync;
|
|
1565
|
-
module.exports.check = check;
|
|
1566
|
-
module.exports.checkSync = checkSync;
|
|
1567
|
-
});
|
|
16
|
+
};
|
|
17
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
18
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
1568
19
|
|
|
1569
|
-
// node_modules
|
|
20
|
+
// node_modules/yaml/dist/nodes/identity.js
|
|
1570
21
|
var require_identity = __commonJS((exports) => {
|
|
1571
22
|
var ALIAS = Symbol.for("yaml.alias");
|
|
1572
23
|
var DOC = Symbol.for("yaml.document");
|
|
@@ -1620,7 +71,7 @@ var require_identity = __commonJS((exports) => {
|
|
|
1620
71
|
exports.isSeq = isSeq;
|
|
1621
72
|
});
|
|
1622
73
|
|
|
1623
|
-
// node_modules
|
|
74
|
+
// node_modules/yaml/dist/visit.js
|
|
1624
75
|
var require_visit = __commonJS((exports) => {
|
|
1625
76
|
var identity = require_identity();
|
|
1626
77
|
var BREAK = Symbol("break visit");
|
|
@@ -1775,7 +226,7 @@ var require_visit = __commonJS((exports) => {
|
|
|
1775
226
|
exports.visitAsync = visitAsync;
|
|
1776
227
|
});
|
|
1777
228
|
|
|
1778
|
-
// node_modules
|
|
229
|
+
// node_modules/yaml/dist/doc/directives.js
|
|
1779
230
|
var require_directives = __commonJS((exports) => {
|
|
1780
231
|
var identity = require_identity();
|
|
1781
232
|
var visit = require_visit();
|
|
@@ -1927,7 +378,7 @@ var require_directives = __commonJS((exports) => {
|
|
|
1927
378
|
exports.Directives = Directives;
|
|
1928
379
|
});
|
|
1929
380
|
|
|
1930
|
-
// node_modules
|
|
381
|
+
// node_modules/yaml/dist/doc/anchors.js
|
|
1931
382
|
var require_anchors = __commonJS((exports) => {
|
|
1932
383
|
var identity = require_identity();
|
|
1933
384
|
var visit = require_visit();
|
|
@@ -1989,7 +440,7 @@ var require_anchors = __commonJS((exports) => {
|
|
|
1989
440
|
exports.findNewAnchor = findNewAnchor;
|
|
1990
441
|
});
|
|
1991
442
|
|
|
1992
|
-
// node_modules
|
|
443
|
+
// node_modules/yaml/dist/doc/applyReviver.js
|
|
1993
444
|
var require_applyReviver = __commonJS((exports) => {
|
|
1994
445
|
function applyReviver(reviver, obj, key, val) {
|
|
1995
446
|
if (val && typeof val === "object") {
|
|
@@ -2036,7 +487,7 @@ var require_applyReviver = __commonJS((exports) => {
|
|
|
2036
487
|
exports.applyReviver = applyReviver;
|
|
2037
488
|
});
|
|
2038
489
|
|
|
2039
|
-
// node_modules
|
|
490
|
+
// node_modules/yaml/dist/nodes/toJS.js
|
|
2040
491
|
var require_toJS = __commonJS((exports) => {
|
|
2041
492
|
var identity = require_identity();
|
|
2042
493
|
function toJS(value, arg, ctx) {
|
|
@@ -2063,7 +514,7 @@ var require_toJS = __commonJS((exports) => {
|
|
|
2063
514
|
exports.toJS = toJS;
|
|
2064
515
|
});
|
|
2065
516
|
|
|
2066
|
-
// node_modules
|
|
517
|
+
// node_modules/yaml/dist/nodes/Node.js
|
|
2067
518
|
var require_Node = __commonJS((exports) => {
|
|
2068
519
|
var applyReviver = require_applyReviver();
|
|
2069
520
|
var identity = require_identity();
|
|
@@ -2100,7 +551,7 @@ var require_Node = __commonJS((exports) => {
|
|
|
2100
551
|
exports.NodeBase = NodeBase;
|
|
2101
552
|
});
|
|
2102
553
|
|
|
2103
|
-
// node_modules
|
|
554
|
+
// node_modules/yaml/dist/nodes/Alias.js
|
|
2104
555
|
var require_Alias = __commonJS((exports) => {
|
|
2105
556
|
var anchors = require_anchors();
|
|
2106
557
|
var visit = require_visit();
|
|
@@ -2208,7 +659,7 @@ var require_Alias = __commonJS((exports) => {
|
|
|
2208
659
|
exports.Alias = Alias;
|
|
2209
660
|
});
|
|
2210
661
|
|
|
2211
|
-
// node_modules
|
|
662
|
+
// node_modules/yaml/dist/nodes/Scalar.js
|
|
2212
663
|
var require_Scalar = __commonJS((exports) => {
|
|
2213
664
|
var identity = require_identity();
|
|
2214
665
|
var Node = require_Node();
|
|
@@ -2236,7 +687,7 @@ var require_Scalar = __commonJS((exports) => {
|
|
|
2236
687
|
exports.isScalarValue = isScalarValue;
|
|
2237
688
|
});
|
|
2238
689
|
|
|
2239
|
-
// node_modules
|
|
690
|
+
// node_modules/yaml/dist/doc/createNode.js
|
|
2240
691
|
var require_createNode = __commonJS((exports) => {
|
|
2241
692
|
var Alias = require_Alias();
|
|
2242
693
|
var identity = require_identity();
|
|
@@ -2308,7 +759,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
2308
759
|
exports.createNode = createNode;
|
|
2309
760
|
});
|
|
2310
761
|
|
|
2311
|
-
// node_modules
|
|
762
|
+
// node_modules/yaml/dist/nodes/Collection.js
|
|
2312
763
|
var require_Collection = __commonJS((exports) => {
|
|
2313
764
|
var createNode = require_createNode();
|
|
2314
765
|
var identity = require_identity();
|
|
@@ -2423,7 +874,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
2423
874
|
exports.isEmptyPath = isEmptyPath;
|
|
2424
875
|
});
|
|
2425
876
|
|
|
2426
|
-
// node_modules
|
|
877
|
+
// node_modules/yaml/dist/stringify/stringifyComment.js
|
|
2427
878
|
var require_stringifyComment = __commonJS((exports) => {
|
|
2428
879
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
2429
880
|
function indentComment(comment, indent) {
|
|
@@ -2440,7 +891,7 @@ var require_stringifyComment = __commonJS((exports) => {
|
|
|
2440
891
|
exports.stringifyComment = stringifyComment;
|
|
2441
892
|
});
|
|
2442
893
|
|
|
2443
|
-
// node_modules
|
|
894
|
+
// node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
2444
895
|
var require_foldFlowLines = __commonJS((exports) => {
|
|
2445
896
|
var FOLD_FLOW = "flow";
|
|
2446
897
|
var FOLD_BLOCK = "block";
|
|
@@ -2577,7 +1028,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
|
|
|
2577
1028
|
exports.foldFlowLines = foldFlowLines;
|
|
2578
1029
|
});
|
|
2579
1030
|
|
|
2580
|
-
// node_modules
|
|
1031
|
+
// node_modules/yaml/dist/stringify/stringifyString.js
|
|
2581
1032
|
var require_stringifyString = __commonJS((exports) => {
|
|
2582
1033
|
var Scalar = require_Scalar();
|
|
2583
1034
|
var foldFlowLines = require_foldFlowLines();
|
|
@@ -2875,7 +1326,7 @@ ${indent}`);
|
|
|
2875
1326
|
exports.stringifyString = stringifyString;
|
|
2876
1327
|
});
|
|
2877
1328
|
|
|
2878
|
-
// node_modules
|
|
1329
|
+
// node_modules/yaml/dist/stringify/stringify.js
|
|
2879
1330
|
var require_stringify = __commonJS((exports) => {
|
|
2880
1331
|
var anchors = require_anchors();
|
|
2881
1332
|
var identity = require_identity();
|
|
@@ -2996,7 +1447,7 @@ ${ctx.indent}${str}`;
|
|
|
2996
1447
|
exports.stringify = stringify;
|
|
2997
1448
|
});
|
|
2998
1449
|
|
|
2999
|
-
// node_modules
|
|
1450
|
+
// node_modules/yaml/dist/stringify/stringifyPair.js
|
|
3000
1451
|
var require_stringifyPair = __commonJS((exports) => {
|
|
3001
1452
|
var identity = require_identity();
|
|
3002
1453
|
var Scalar = require_Scalar();
|
|
@@ -3132,7 +1583,7 @@ ${ctx.indent}`;
|
|
|
3132
1583
|
exports.stringifyPair = stringifyPair;
|
|
3133
1584
|
});
|
|
3134
1585
|
|
|
3135
|
-
// node_modules
|
|
1586
|
+
// node_modules/yaml/dist/log.js
|
|
3136
1587
|
var require_log = __commonJS((exports) => {
|
|
3137
1588
|
var node_process = __require("process");
|
|
3138
1589
|
function debug(logLevel, ...messages) {
|
|
@@ -3151,7 +1602,7 @@ var require_log = __commonJS((exports) => {
|
|
|
3151
1602
|
exports.warn = warn;
|
|
3152
1603
|
});
|
|
3153
1604
|
|
|
3154
|
-
// node_modules
|
|
1605
|
+
// node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
3155
1606
|
var require_merge = __commonJS((exports) => {
|
|
3156
1607
|
var identity = require_identity();
|
|
3157
1608
|
var Scalar = require_Scalar();
|
|
@@ -3205,7 +1656,7 @@ var require_merge = __commonJS((exports) => {
|
|
|
3205
1656
|
exports.merge = merge;
|
|
3206
1657
|
});
|
|
3207
1658
|
|
|
3208
|
-
// node_modules
|
|
1659
|
+
// node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
3209
1660
|
var require_addPairToJSMap = __commonJS((exports) => {
|
|
3210
1661
|
var log = require_log();
|
|
3211
1662
|
var merge = require_merge();
|
|
@@ -3266,7 +1717,7 @@ var require_addPairToJSMap = __commonJS((exports) => {
|
|
|
3266
1717
|
exports.addPairToJSMap = addPairToJSMap;
|
|
3267
1718
|
});
|
|
3268
1719
|
|
|
3269
|
-
// node_modules
|
|
1720
|
+
// node_modules/yaml/dist/nodes/Pair.js
|
|
3270
1721
|
var require_Pair = __commonJS((exports) => {
|
|
3271
1722
|
var createNode = require_createNode();
|
|
3272
1723
|
var stringifyPair = require_stringifyPair();
|
|
@@ -3304,7 +1755,7 @@ var require_Pair = __commonJS((exports) => {
|
|
|
3304
1755
|
exports.createPair = createPair;
|
|
3305
1756
|
});
|
|
3306
1757
|
|
|
3307
|
-
// node_modules
|
|
1758
|
+
// node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
3308
1759
|
var require_stringifyCollection = __commonJS((exports) => {
|
|
3309
1760
|
var identity = require_identity();
|
|
3310
1761
|
var stringify = require_stringify();
|
|
@@ -3456,7 +1907,7 @@ ${indent}${end}`;
|
|
|
3456
1907
|
exports.stringifyCollection = stringifyCollection;
|
|
3457
1908
|
});
|
|
3458
1909
|
|
|
3459
|
-
// node_modules
|
|
1910
|
+
// node_modules/yaml/dist/nodes/YAMLMap.js
|
|
3460
1911
|
var require_YAMLMap = __commonJS((exports) => {
|
|
3461
1912
|
var stringifyCollection = require_stringifyCollection();
|
|
3462
1913
|
var addPairToJSMap = require_addPairToJSMap();
|
|
@@ -3583,7 +2034,7 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
3583
2034
|
exports.findPair = findPair;
|
|
3584
2035
|
});
|
|
3585
2036
|
|
|
3586
|
-
// node_modules
|
|
2037
|
+
// node_modules/yaml/dist/schema/common/map.js
|
|
3587
2038
|
var require_map = __commonJS((exports) => {
|
|
3588
2039
|
var identity = require_identity();
|
|
3589
2040
|
var YAMLMap = require_YAMLMap();
|
|
@@ -3602,7 +2053,7 @@ var require_map = __commonJS((exports) => {
|
|
|
3602
2053
|
exports.map = map;
|
|
3603
2054
|
});
|
|
3604
2055
|
|
|
3605
|
-
// node_modules
|
|
2056
|
+
// node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
3606
2057
|
var require_YAMLSeq = __commonJS((exports) => {
|
|
3607
2058
|
var createNode = require_createNode();
|
|
3608
2059
|
var stringifyCollection = require_stringifyCollection();
|
|
@@ -3695,7 +2146,7 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
3695
2146
|
exports.YAMLSeq = YAMLSeq;
|
|
3696
2147
|
});
|
|
3697
2148
|
|
|
3698
|
-
// node_modules
|
|
2149
|
+
// node_modules/yaml/dist/schema/common/seq.js
|
|
3699
2150
|
var require_seq = __commonJS((exports) => {
|
|
3700
2151
|
var identity = require_identity();
|
|
3701
2152
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -3714,7 +2165,7 @@ var require_seq = __commonJS((exports) => {
|
|
|
3714
2165
|
exports.seq = seq;
|
|
3715
2166
|
});
|
|
3716
2167
|
|
|
3717
|
-
// node_modules
|
|
2168
|
+
// node_modules/yaml/dist/schema/common/string.js
|
|
3718
2169
|
var require_string = __commonJS((exports) => {
|
|
3719
2170
|
var stringifyString = require_stringifyString();
|
|
3720
2171
|
var string = {
|
|
@@ -3730,7 +2181,7 @@ var require_string = __commonJS((exports) => {
|
|
|
3730
2181
|
exports.string = string;
|
|
3731
2182
|
});
|
|
3732
2183
|
|
|
3733
|
-
// node_modules
|
|
2184
|
+
// node_modules/yaml/dist/schema/common/null.js
|
|
3734
2185
|
var require_null = __commonJS((exports) => {
|
|
3735
2186
|
var Scalar = require_Scalar();
|
|
3736
2187
|
var nullTag = {
|
|
@@ -3745,7 +2196,7 @@ var require_null = __commonJS((exports) => {
|
|
|
3745
2196
|
exports.nullTag = nullTag;
|
|
3746
2197
|
});
|
|
3747
2198
|
|
|
3748
|
-
// node_modules
|
|
2199
|
+
// node_modules/yaml/dist/schema/core/bool.js
|
|
3749
2200
|
var require_bool = __commonJS((exports) => {
|
|
3750
2201
|
var Scalar = require_Scalar();
|
|
3751
2202
|
var boolTag = {
|
|
@@ -3766,7 +2217,7 @@ var require_bool = __commonJS((exports) => {
|
|
|
3766
2217
|
exports.boolTag = boolTag;
|
|
3767
2218
|
});
|
|
3768
2219
|
|
|
3769
|
-
// node_modules
|
|
2220
|
+
// node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
3770
2221
|
var require_stringifyNumber = __commonJS((exports) => {
|
|
3771
2222
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
3772
2223
|
if (typeof value === "bigint")
|
|
@@ -3790,7 +2241,7 @@ var require_stringifyNumber = __commonJS((exports) => {
|
|
|
3790
2241
|
exports.stringifyNumber = stringifyNumber;
|
|
3791
2242
|
});
|
|
3792
2243
|
|
|
3793
|
-
// node_modules
|
|
2244
|
+
// node_modules/yaml/dist/schema/core/float.js
|
|
3794
2245
|
var require_float = __commonJS((exports) => {
|
|
3795
2246
|
var Scalar = require_Scalar();
|
|
3796
2247
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -3833,7 +2284,7 @@ var require_float = __commonJS((exports) => {
|
|
|
3833
2284
|
exports.floatNaN = floatNaN;
|
|
3834
2285
|
});
|
|
3835
2286
|
|
|
3836
|
-
// node_modules
|
|
2287
|
+
// node_modules/yaml/dist/schema/core/int.js
|
|
3837
2288
|
var require_int = __commonJS((exports) => {
|
|
3838
2289
|
var stringifyNumber = require_stringifyNumber();
|
|
3839
2290
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -3875,7 +2326,7 @@ var require_int = __commonJS((exports) => {
|
|
|
3875
2326
|
exports.intOct = intOct;
|
|
3876
2327
|
});
|
|
3877
2328
|
|
|
3878
|
-
// node_modules
|
|
2329
|
+
// node_modules/yaml/dist/schema/core/schema.js
|
|
3879
2330
|
var require_schema = __commonJS((exports) => {
|
|
3880
2331
|
var map = require_map();
|
|
3881
2332
|
var _null = require_null();
|
|
@@ -3900,7 +2351,7 @@ var require_schema = __commonJS((exports) => {
|
|
|
3900
2351
|
exports.schema = schema;
|
|
3901
2352
|
});
|
|
3902
2353
|
|
|
3903
|
-
// node_modules
|
|
2354
|
+
// node_modules/yaml/dist/schema/json/schema.js
|
|
3904
2355
|
var require_schema2 = __commonJS((exports) => {
|
|
3905
2356
|
var Scalar = require_Scalar();
|
|
3906
2357
|
var map = require_map();
|
|
@@ -3964,7 +2415,7 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
3964
2415
|
exports.schema = schema;
|
|
3965
2416
|
});
|
|
3966
2417
|
|
|
3967
|
-
// node_modules
|
|
2418
|
+
// node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
3968
2419
|
var require_binary = __commonJS((exports) => {
|
|
3969
2420
|
var node_buffer = __require("buffer");
|
|
3970
2421
|
var Scalar = require_Scalar();
|
|
@@ -4019,7 +2470,7 @@ var require_binary = __commonJS((exports) => {
|
|
|
4019
2470
|
exports.binary = binary;
|
|
4020
2471
|
});
|
|
4021
2472
|
|
|
4022
|
-
// node_modules
|
|
2473
|
+
// node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
4023
2474
|
var require_pairs = __commonJS((exports) => {
|
|
4024
2475
|
var identity = require_identity();
|
|
4025
2476
|
var Pair = require_Pair();
|
|
@@ -4094,7 +2545,7 @@ ${cn.comment}` : item.comment;
|
|
|
4094
2545
|
exports.resolvePairs = resolvePairs;
|
|
4095
2546
|
});
|
|
4096
2547
|
|
|
4097
|
-
// node_modules
|
|
2548
|
+
// node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
4098
2549
|
var require_omap = __commonJS((exports) => {
|
|
4099
2550
|
var identity = require_identity();
|
|
4100
2551
|
var toJS = require_toJS();
|
|
@@ -4166,7 +2617,7 @@ var require_omap = __commonJS((exports) => {
|
|
|
4166
2617
|
exports.omap = omap;
|
|
4167
2618
|
});
|
|
4168
2619
|
|
|
4169
|
-
// node_modules
|
|
2620
|
+
// node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
4170
2621
|
var require_bool2 = __commonJS((exports) => {
|
|
4171
2622
|
var Scalar = require_Scalar();
|
|
4172
2623
|
function boolStringify({ value, source }, ctx) {
|
|
@@ -4195,7 +2646,7 @@ var require_bool2 = __commonJS((exports) => {
|
|
|
4195
2646
|
exports.trueTag = trueTag;
|
|
4196
2647
|
});
|
|
4197
2648
|
|
|
4198
|
-
// node_modules
|
|
2649
|
+
// node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
4199
2650
|
var require_float2 = __commonJS((exports) => {
|
|
4200
2651
|
var Scalar = require_Scalar();
|
|
4201
2652
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -4241,7 +2692,7 @@ var require_float2 = __commonJS((exports) => {
|
|
|
4241
2692
|
exports.floatNaN = floatNaN;
|
|
4242
2693
|
});
|
|
4243
2694
|
|
|
4244
|
-
// node_modules
|
|
2695
|
+
// node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
4245
2696
|
var require_int2 = __commonJS((exports) => {
|
|
4246
2697
|
var stringifyNumber = require_stringifyNumber();
|
|
4247
2698
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -4317,7 +2768,7 @@ var require_int2 = __commonJS((exports) => {
|
|
|
4317
2768
|
exports.intOct = intOct;
|
|
4318
2769
|
});
|
|
4319
2770
|
|
|
4320
|
-
// node_modules
|
|
2771
|
+
// node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
4321
2772
|
var require_set = __commonJS((exports) => {
|
|
4322
2773
|
var identity = require_identity();
|
|
4323
2774
|
var Pair = require_Pair();
|
|
@@ -4400,7 +2851,7 @@ var require_set = __commonJS((exports) => {
|
|
|
4400
2851
|
exports.set = set;
|
|
4401
2852
|
});
|
|
4402
2853
|
|
|
4403
|
-
// node_modules
|
|
2854
|
+
// node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
4404
2855
|
var require_timestamp = __commonJS((exports) => {
|
|
4405
2856
|
var stringifyNumber = require_stringifyNumber();
|
|
4406
2857
|
function parseSexagesimal(str, asBigInt) {
|
|
@@ -4482,7 +2933,7 @@ var require_timestamp = __commonJS((exports) => {
|
|
|
4482
2933
|
exports.timestamp = timestamp;
|
|
4483
2934
|
});
|
|
4484
2935
|
|
|
4485
|
-
// node_modules
|
|
2936
|
+
// node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
4486
2937
|
var require_schema3 = __commonJS((exports) => {
|
|
4487
2938
|
var map = require_map();
|
|
4488
2939
|
var _null = require_null();
|
|
@@ -4523,7 +2974,7 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
4523
2974
|
exports.schema = schema;
|
|
4524
2975
|
});
|
|
4525
2976
|
|
|
4526
|
-
// node_modules
|
|
2977
|
+
// node_modules/yaml/dist/schema/tags.js
|
|
4527
2978
|
var require_tags = __commonJS((exports) => {
|
|
4528
2979
|
var map = require_map();
|
|
4529
2980
|
var _null = require_null();
|
|
@@ -4614,7 +3065,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
4614
3065
|
exports.getTags = getTags;
|
|
4615
3066
|
});
|
|
4616
3067
|
|
|
4617
|
-
// node_modules
|
|
3068
|
+
// node_modules/yaml/dist/schema/Schema.js
|
|
4618
3069
|
var require_Schema = __commonJS((exports) => {
|
|
4619
3070
|
var identity = require_identity();
|
|
4620
3071
|
var map = require_map();
|
|
@@ -4644,7 +3095,7 @@ var require_Schema = __commonJS((exports) => {
|
|
|
4644
3095
|
exports.Schema = Schema;
|
|
4645
3096
|
});
|
|
4646
3097
|
|
|
4647
|
-
// node_modules
|
|
3098
|
+
// node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
4648
3099
|
var require_stringifyDocument = __commonJS((exports) => {
|
|
4649
3100
|
var identity = require_identity();
|
|
4650
3101
|
var stringify = require_stringify();
|
|
@@ -4724,7 +3175,7 @@ var require_stringifyDocument = __commonJS((exports) => {
|
|
|
4724
3175
|
exports.stringifyDocument = stringifyDocument;
|
|
4725
3176
|
});
|
|
4726
3177
|
|
|
4727
|
-
// node_modules
|
|
3178
|
+
// node_modules/yaml/dist/doc/Document.js
|
|
4728
3179
|
var require_Document = __commonJS((exports) => {
|
|
4729
3180
|
var Alias = require_Alias();
|
|
4730
3181
|
var Collection = require_Collection();
|
|
@@ -4959,7 +3410,7 @@ var require_Document = __commonJS((exports) => {
|
|
|
4959
3410
|
exports.Document = Document;
|
|
4960
3411
|
});
|
|
4961
3412
|
|
|
4962
|
-
// node_modules
|
|
3413
|
+
// node_modules/yaml/dist/errors.js
|
|
4963
3414
|
var require_errors = __commonJS((exports) => {
|
|
4964
3415
|
class YAMLError extends Error {
|
|
4965
3416
|
constructor(name, pos, code, message) {
|
|
@@ -5024,7 +3475,7 @@ ${pointer}
|
|
|
5024
3475
|
exports.prettifyError = prettifyError;
|
|
5025
3476
|
});
|
|
5026
3477
|
|
|
5027
|
-
// node_modules
|
|
3478
|
+
// node_modules/yaml/dist/compose/resolve-props.js
|
|
5028
3479
|
var require_resolve_props = __commonJS((exports) => {
|
|
5029
3480
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
5030
3481
|
let spaceBefore = false;
|
|
@@ -5154,7 +3605,7 @@ var require_resolve_props = __commonJS((exports) => {
|
|
|
5154
3605
|
exports.resolveProps = resolveProps;
|
|
5155
3606
|
});
|
|
5156
3607
|
|
|
5157
|
-
// node_modules
|
|
3608
|
+
// node_modules/yaml/dist/compose/util-contains-newline.js
|
|
5158
3609
|
var require_util_contains_newline = __commonJS((exports) => {
|
|
5159
3610
|
function containsNewline(key) {
|
|
5160
3611
|
if (!key)
|
|
@@ -5194,7 +3645,7 @@ var require_util_contains_newline = __commonJS((exports) => {
|
|
|
5194
3645
|
exports.containsNewline = containsNewline;
|
|
5195
3646
|
});
|
|
5196
3647
|
|
|
5197
|
-
// node_modules
|
|
3648
|
+
// node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
5198
3649
|
var require_util_flow_indent_check = __commonJS((exports) => {
|
|
5199
3650
|
var utilContainsNewline = require_util_contains_newline();
|
|
5200
3651
|
function flowIndentCheck(indent, fc, onError) {
|
|
@@ -5209,7 +3660,7 @@ var require_util_flow_indent_check = __commonJS((exports) => {
|
|
|
5209
3660
|
exports.flowIndentCheck = flowIndentCheck;
|
|
5210
3661
|
});
|
|
5211
3662
|
|
|
5212
|
-
// node_modules
|
|
3663
|
+
// node_modules/yaml/dist/compose/util-map-includes.js
|
|
5213
3664
|
var require_util_map_includes = __commonJS((exports) => {
|
|
5214
3665
|
var identity = require_identity();
|
|
5215
3666
|
function mapIncludes(ctx, items, search) {
|
|
@@ -5222,7 +3673,7 @@ var require_util_map_includes = __commonJS((exports) => {
|
|
|
5222
3673
|
exports.mapIncludes = mapIncludes;
|
|
5223
3674
|
});
|
|
5224
3675
|
|
|
5225
|
-
// node_modules
|
|
3676
|
+
// node_modules/yaml/dist/compose/resolve-block-map.js
|
|
5226
3677
|
var require_resolve_block_map = __commonJS((exports) => {
|
|
5227
3678
|
var Pair = require_Pair();
|
|
5228
3679
|
var YAMLMap = require_YAMLMap();
|
|
@@ -5329,7 +3780,7 @@ var require_resolve_block_map = __commonJS((exports) => {
|
|
|
5329
3780
|
exports.resolveBlockMap = resolveBlockMap;
|
|
5330
3781
|
});
|
|
5331
3782
|
|
|
5332
|
-
// node_modules
|
|
3783
|
+
// node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
5333
3784
|
var require_resolve_block_seq = __commonJS((exports) => {
|
|
5334
3785
|
var YAMLSeq = require_YAMLSeq();
|
|
5335
3786
|
var resolveProps = require_resolve_props();
|
|
@@ -5377,7 +3828,7 @@ var require_resolve_block_seq = __commonJS((exports) => {
|
|
|
5377
3828
|
exports.resolveBlockSeq = resolveBlockSeq;
|
|
5378
3829
|
});
|
|
5379
3830
|
|
|
5380
|
-
// node_modules
|
|
3831
|
+
// node_modules/yaml/dist/compose/resolve-end.js
|
|
5381
3832
|
var require_resolve_end = __commonJS((exports) => {
|
|
5382
3833
|
function resolveEnd(end, offset, reqSpace, onError) {
|
|
5383
3834
|
let comment = "";
|
|
@@ -5417,7 +3868,7 @@ var require_resolve_end = __commonJS((exports) => {
|
|
|
5417
3868
|
exports.resolveEnd = resolveEnd;
|
|
5418
3869
|
});
|
|
5419
3870
|
|
|
5420
|
-
// node_modules
|
|
3871
|
+
// node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
5421
3872
|
var require_resolve_flow_collection = __commonJS((exports) => {
|
|
5422
3873
|
var identity = require_identity();
|
|
5423
3874
|
var Pair = require_Pair();
|
|
@@ -5608,7 +4059,7 @@ var require_resolve_flow_collection = __commonJS((exports) => {
|
|
|
5608
4059
|
exports.resolveFlowCollection = resolveFlowCollection;
|
|
5609
4060
|
});
|
|
5610
4061
|
|
|
5611
|
-
// node_modules
|
|
4062
|
+
// node_modules/yaml/dist/compose/compose-collection.js
|
|
5612
4063
|
var require_compose_collection = __commonJS((exports) => {
|
|
5613
4064
|
var identity = require_identity();
|
|
5614
4065
|
var Scalar = require_Scalar();
|
|
@@ -5670,7 +4121,7 @@ var require_compose_collection = __commonJS((exports) => {
|
|
|
5670
4121
|
exports.composeCollection = composeCollection;
|
|
5671
4122
|
});
|
|
5672
4123
|
|
|
5673
|
-
// node_modules
|
|
4124
|
+
// node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
5674
4125
|
var require_resolve_block_scalar = __commonJS((exports) => {
|
|
5675
4126
|
var Scalar = require_Scalar();
|
|
5676
4127
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
@@ -5863,7 +4314,7 @@ var require_resolve_block_scalar = __commonJS((exports) => {
|
|
|
5863
4314
|
exports.resolveBlockScalar = resolveBlockScalar;
|
|
5864
4315
|
});
|
|
5865
4316
|
|
|
5866
|
-
// node_modules
|
|
4317
|
+
// node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
5867
4318
|
var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
5868
4319
|
var Scalar = require_Scalar();
|
|
5869
4320
|
var resolveEnd = require_resolve_end();
|
|
@@ -6079,7 +4530,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
6079
4530
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
6080
4531
|
});
|
|
6081
4532
|
|
|
6082
|
-
// node_modules
|
|
4533
|
+
// node_modules/yaml/dist/compose/compose-scalar.js
|
|
6083
4534
|
var require_compose_scalar = __commonJS((exports) => {
|
|
6084
4535
|
var identity = require_identity();
|
|
6085
4536
|
var Scalar = require_Scalar();
|
|
@@ -6157,7 +4608,7 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
6157
4608
|
exports.composeScalar = composeScalar;
|
|
6158
4609
|
});
|
|
6159
4610
|
|
|
6160
|
-
// node_modules
|
|
4611
|
+
// node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
6161
4612
|
var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
6162
4613
|
function emptyScalarPosition(offset, before, pos) {
|
|
6163
4614
|
if (before) {
|
|
@@ -6184,7 +4635,7 @@ var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
|
6184
4635
|
exports.emptyScalarPosition = emptyScalarPosition;
|
|
6185
4636
|
});
|
|
6186
4637
|
|
|
6187
|
-
// node_modules
|
|
4638
|
+
// node_modules/yaml/dist/compose/compose-node.js
|
|
6188
4639
|
var require_compose_node = __commonJS((exports) => {
|
|
6189
4640
|
var Alias = require_Alias();
|
|
6190
4641
|
var identity = require_identity();
|
|
@@ -6287,7 +4738,7 @@ var require_compose_node = __commonJS((exports) => {
|
|
|
6287
4738
|
exports.composeNode = composeNode;
|
|
6288
4739
|
});
|
|
6289
4740
|
|
|
6290
|
-
// node_modules
|
|
4741
|
+
// node_modules/yaml/dist/compose/compose-doc.js
|
|
6291
4742
|
var require_compose_doc = __commonJS((exports) => {
|
|
6292
4743
|
var Document = require_Document();
|
|
6293
4744
|
var composeNode = require_compose_node();
|
|
@@ -6327,7 +4778,7 @@ var require_compose_doc = __commonJS((exports) => {
|
|
|
6327
4778
|
exports.composeDoc = composeDoc;
|
|
6328
4779
|
});
|
|
6329
4780
|
|
|
6330
|
-
// node_modules
|
|
4781
|
+
// node_modules/yaml/dist/compose/composer.js
|
|
6331
4782
|
var require_composer = __commonJS((exports) => {
|
|
6332
4783
|
var node_process = __require("process");
|
|
6333
4784
|
var directives = require_directives();
|
|
@@ -6516,7 +4967,7 @@ ${end.comment}` : end.comment;
|
|
|
6516
4967
|
exports.Composer = Composer;
|
|
6517
4968
|
});
|
|
6518
4969
|
|
|
6519
|
-
// node_modules
|
|
4970
|
+
// node_modules/yaml/dist/parse/cst-scalar.js
|
|
6520
4971
|
var require_cst_scalar = __commonJS((exports) => {
|
|
6521
4972
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
6522
4973
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -6706,7 +5157,7 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
6706
5157
|
exports.setScalarValue = setScalarValue;
|
|
6707
5158
|
});
|
|
6708
5159
|
|
|
6709
|
-
// node_modules
|
|
5160
|
+
// node_modules/yaml/dist/parse/cst-stringify.js
|
|
6710
5161
|
var require_cst_stringify = __commonJS((exports) => {
|
|
6711
5162
|
var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
|
|
6712
5163
|
function stringifyToken(token) {
|
|
@@ -6764,7 +5215,7 @@ var require_cst_stringify = __commonJS((exports) => {
|
|
|
6764
5215
|
exports.stringify = stringify;
|
|
6765
5216
|
});
|
|
6766
5217
|
|
|
6767
|
-
// node_modules
|
|
5218
|
+
// node_modules/yaml/dist/parse/cst-visit.js
|
|
6768
5219
|
var require_cst_visit = __commonJS((exports) => {
|
|
6769
5220
|
var BREAK = Symbol("break visit");
|
|
6770
5221
|
var SKIP = Symbol("skip children");
|
|
@@ -6823,7 +5274,7 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
6823
5274
|
exports.visit = visit;
|
|
6824
5275
|
});
|
|
6825
5276
|
|
|
6826
|
-
// node_modules
|
|
5277
|
+
// node_modules/yaml/dist/parse/cst.js
|
|
6827
5278
|
var require_cst = __commonJS((exports) => {
|
|
6828
5279
|
var cstScalar = require_cst_scalar();
|
|
6829
5280
|
var cstStringify = require_cst_stringify();
|
|
@@ -6924,7 +5375,7 @@ var require_cst = __commonJS((exports) => {
|
|
|
6924
5375
|
exports.tokenType = tokenType;
|
|
6925
5376
|
});
|
|
6926
5377
|
|
|
6927
|
-
// node_modules
|
|
5378
|
+
// node_modules/yaml/dist/parse/lexer.js
|
|
6928
5379
|
var require_lexer = __commonJS((exports) => {
|
|
6929
5380
|
var cst = require_cst();
|
|
6930
5381
|
function isEmpty(ch) {
|
|
@@ -7510,7 +5961,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
7510
5961
|
exports.Lexer = Lexer;
|
|
7511
5962
|
});
|
|
7512
5963
|
|
|
7513
|
-
// node_modules
|
|
5964
|
+
// node_modules/yaml/dist/parse/line-counter.js
|
|
7514
5965
|
var require_line_counter = __commonJS((exports) => {
|
|
7515
5966
|
class LineCounter {
|
|
7516
5967
|
constructor() {
|
|
@@ -7538,7 +5989,7 @@ var require_line_counter = __commonJS((exports) => {
|
|
|
7538
5989
|
exports.LineCounter = LineCounter;
|
|
7539
5990
|
});
|
|
7540
5991
|
|
|
7541
|
-
// node_modules
|
|
5992
|
+
// node_modules/yaml/dist/parse/parser.js
|
|
7542
5993
|
var require_parser = __commonJS((exports) => {
|
|
7543
5994
|
var node_process = __require("process");
|
|
7544
5995
|
var cst = require_cst();
|
|
@@ -8387,7 +6838,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
8387
6838
|
exports.Parser = Parser;
|
|
8388
6839
|
});
|
|
8389
6840
|
|
|
8390
|
-
// node_modules
|
|
6841
|
+
// node_modules/yaml/dist/public-api.js
|
|
8391
6842
|
var require_public_api = __commonJS((exports) => {
|
|
8392
6843
|
var composer = require_composer();
|
|
8393
6844
|
var Document = require_Document();
|
|
@@ -8481,7 +6932,7 @@ var require_public_api = __commonJS((exports) => {
|
|
|
8481
6932
|
exports.stringify = stringify;
|
|
8482
6933
|
});
|
|
8483
6934
|
|
|
8484
|
-
// node_modules
|
|
6935
|
+
// node_modules/yaml/dist/index.js
|
|
8485
6936
|
var composer, Document, Schema, errors, Alias, identity, Pair, Scalar, YAMLMap, YAMLSeq, cst, lexer, lineCounter, parser, publicApi, visit, $Composer, $Document, $Schema, $YAMLError, $YAMLParseError, $YAMLWarning, $Alias, $isAlias, $isCollection, $isDocument, $isMap, $isNode, $isPair, $isScalar, $isSeq, $Pair, $Scalar, $YAMLMap, $YAMLSeq, $Lexer, $LineCounter, $Parser, $parse, $parseAllDocuments, $parseDocument, $stringify, $visit, $visitAsync;
|
|
8486
6937
|
var init_dist = __esm(() => {
|
|
8487
6938
|
composer = require_composer();
|
|
@@ -8530,7 +6981,7 @@ var init_dist = __esm(() => {
|
|
|
8530
6981
|
$visitAsync = visit.visitAsync;
|
|
8531
6982
|
});
|
|
8532
6983
|
|
|
8533
|
-
// node_modules
|
|
6984
|
+
// node_modules/zod/v3/helpers/util.js
|
|
8534
6985
|
var util, objectUtil, ZodParsedType, getParsedType = (data) => {
|
|
8535
6986
|
const t = typeof data;
|
|
8536
6987
|
switch (t) {
|
|
@@ -8661,7 +7112,7 @@ var init_util = __esm(() => {
|
|
|
8661
7112
|
]);
|
|
8662
7113
|
});
|
|
8663
7114
|
|
|
8664
|
-
// node_modules
|
|
7115
|
+
// node_modules/zod/v3/ZodError.js
|
|
8665
7116
|
var ZodIssueCode, quotelessJson = (obj) => {
|
|
8666
7117
|
const json = JSON.stringify(obj, null, 2);
|
|
8667
7118
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
@@ -8782,7 +7233,7 @@ var init_ZodError = __esm(() => {
|
|
|
8782
7233
|
};
|
|
8783
7234
|
});
|
|
8784
7235
|
|
|
8785
|
-
// node_modules
|
|
7236
|
+
// node_modules/zod/v3/locales/en.js
|
|
8786
7237
|
var errorMap = (issue, _ctx) => {
|
|
8787
7238
|
let message;
|
|
8788
7239
|
switch (issue.code) {
|
|
@@ -8889,7 +7340,7 @@ var init_en = __esm(() => {
|
|
|
8889
7340
|
en_default = errorMap;
|
|
8890
7341
|
});
|
|
8891
7342
|
|
|
8892
|
-
// node_modules
|
|
7343
|
+
// node_modules/zod/v3/errors.js
|
|
8893
7344
|
function setErrorMap(map) {
|
|
8894
7345
|
overrideErrorMap = map;
|
|
8895
7346
|
}
|
|
@@ -8902,7 +7353,7 @@ var init_errors = __esm(() => {
|
|
|
8902
7353
|
overrideErrorMap = en_default;
|
|
8903
7354
|
});
|
|
8904
7355
|
|
|
8905
|
-
// node_modules
|
|
7356
|
+
// node_modules/zod/v3/helpers/parseUtil.js
|
|
8906
7357
|
function addIssueToContext(ctx, issueData) {
|
|
8907
7358
|
const overrideMap = getErrorMap();
|
|
8908
7359
|
const issue = makeIssue({
|
|
@@ -9007,10 +7458,10 @@ var init_parseUtil = __esm(() => {
|
|
|
9007
7458
|
});
|
|
9008
7459
|
});
|
|
9009
7460
|
|
|
9010
|
-
// node_modules
|
|
7461
|
+
// node_modules/zod/v3/helpers/typeAliases.js
|
|
9011
7462
|
var init_typeAliases = () => {};
|
|
9012
7463
|
|
|
9013
|
-
// node_modules
|
|
7464
|
+
// node_modules/zod/v3/helpers/errorUtil.js
|
|
9014
7465
|
var errorUtil;
|
|
9015
7466
|
var init_errorUtil = __esm(() => {
|
|
9016
7467
|
(function(errorUtil2) {
|
|
@@ -9019,7 +7470,7 @@ var init_errorUtil = __esm(() => {
|
|
|
9019
7470
|
})(errorUtil || (errorUtil = {}));
|
|
9020
7471
|
});
|
|
9021
7472
|
|
|
9022
|
-
// node_modules
|
|
7473
|
+
// node_modules/zod/v3/types.js
|
|
9023
7474
|
class ParseInputLazyPath {
|
|
9024
7475
|
constructor(parent, value, path, key) {
|
|
9025
7476
|
this._cachedPath = [];
|
|
@@ -12370,7 +10821,7 @@ var init_types = __esm(() => {
|
|
|
12370
10821
|
NEVER = INVALID;
|
|
12371
10822
|
});
|
|
12372
10823
|
|
|
12373
|
-
// node_modules
|
|
10824
|
+
// node_modules/zod/v3/external.js
|
|
12374
10825
|
var exports_external = {};
|
|
12375
10826
|
__export(exports_external, {
|
|
12376
10827
|
void: () => voidType,
|
|
@@ -12490,7 +10941,7 @@ var init_external = __esm(() => {
|
|
|
12490
10941
|
init_ZodError();
|
|
12491
10942
|
});
|
|
12492
10943
|
|
|
12493
|
-
// node_modules
|
|
10944
|
+
// node_modules/zod/index.js
|
|
12494
10945
|
var init_zod = __esm(() => {
|
|
12495
10946
|
init_external();
|
|
12496
10947
|
init_external();
|
|
@@ -12806,7 +11257,7 @@ var init_schema = __esm(() => {
|
|
|
12806
11257
|
});
|
|
12807
11258
|
|
|
12808
11259
|
// src/config/paths.ts
|
|
12809
|
-
import { existsSync as
|
|
11260
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
12810
11261
|
import { resolve as resolve2 } from "node:path";
|
|
12811
11262
|
function home() {
|
|
12812
11263
|
return process.env.HOME ?? "/root";
|
|
@@ -12818,9 +11269,9 @@ function resolveDualPath(pathStr) {
|
|
|
12818
11269
|
const absolute = resolve2(h, rest);
|
|
12819
11270
|
if (rest.startsWith(`${DEFAULT_STATE_DIR}/`)) {
|
|
12820
11271
|
const frag = rest.slice(DEFAULT_STATE_DIR.length + 1);
|
|
12821
|
-
if (!
|
|
11272
|
+
if (!existsSync4(absolute)) {
|
|
12822
11273
|
const legacy = resolve2(h, LEGACY_STATE_DIR, frag);
|
|
12823
|
-
if (
|
|
11274
|
+
if (existsSync4(legacy))
|
|
12824
11275
|
return legacy;
|
|
12825
11276
|
}
|
|
12826
11277
|
}
|
|
@@ -12840,7 +11291,7 @@ __export(exports_loader, {
|
|
|
12840
11291
|
findConfigFile: () => findConfigFile,
|
|
12841
11292
|
ConfigError: () => ConfigError
|
|
12842
11293
|
});
|
|
12843
|
-
import { readFileSync as
|
|
11294
|
+
import { readFileSync as readFileSync4, existsSync as existsSync5 } from "node:fs";
|
|
12844
11295
|
import { homedir } from "node:os";
|
|
12845
11296
|
import { resolve as resolve3 } from "node:path";
|
|
12846
11297
|
function formatZodErrors(error) {
|
|
@@ -12869,7 +11320,7 @@ function findConfigFile(startDir) {
|
|
|
12869
11320
|
resolve3(userDir, "clerk.yml")
|
|
12870
11321
|
].filter(Boolean);
|
|
12871
11322
|
for (const path of searchPaths) {
|
|
12872
|
-
if (
|
|
11323
|
+
if (existsSync5(path)) {
|
|
12873
11324
|
return path;
|
|
12874
11325
|
}
|
|
12875
11326
|
}
|
|
@@ -12877,12 +11328,12 @@ function findConfigFile(startDir) {
|
|
|
12877
11328
|
}
|
|
12878
11329
|
function loadConfig(configPath) {
|
|
12879
11330
|
const filePath = configPath ?? findConfigFile();
|
|
12880
|
-
if (!
|
|
11331
|
+
if (!existsSync5(filePath)) {
|
|
12881
11332
|
throw new ConfigError(`Config file not found: ${filePath}`);
|
|
12882
11333
|
}
|
|
12883
11334
|
let raw;
|
|
12884
11335
|
try {
|
|
12885
|
-
raw =
|
|
11336
|
+
raw = readFileSync4(filePath, "utf-8");
|
|
12886
11337
|
} catch (err) {
|
|
12887
11338
|
throw new ConfigError(`Failed to read config file: ${filePath}`, [
|
|
12888
11339
|
` ${err.message}`
|
|
@@ -12934,7 +11385,7 @@ var init_loader = __esm(() => {
|
|
|
12934
11385
|
|
|
12935
11386
|
// src/vault/broker/server.ts
|
|
12936
11387
|
import * as net from "node:net";
|
|
12937
|
-
import { mkdirSync as mkdirSync5, chmodSync as chmodSync4, chownSync, existsSync as
|
|
11388
|
+
import { mkdirSync as mkdirSync5, chmodSync as chmodSync4, chownSync, existsSync as existsSync7, readFileSync as readFileSync7, readdirSync as readdirSync2, unlinkSync as unlinkSync4, writeFileSync as writeFileSync3, renameSync as renameSync3 } from "node:fs";
|
|
12938
11389
|
|
|
12939
11390
|
// src/agents/compose.ts
|
|
12940
11391
|
import { createHash } from "node:crypto";
|
|
@@ -13230,17 +11681,170 @@ import * as os3 from "node:os";
|
|
|
13230
11681
|
import * as path3 from "node:path";
|
|
13231
11682
|
|
|
13232
11683
|
// src/vault/vault.ts
|
|
13233
|
-
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
13234
11684
|
import { randomBytes, scryptSync, createCipheriv, createDecipheriv } from "node:crypto";
|
|
13235
11685
|
import {
|
|
13236
|
-
readFileSync,
|
|
11686
|
+
readFileSync as readFileSync2,
|
|
13237
11687
|
writeFileSync,
|
|
13238
|
-
existsSync,
|
|
11688
|
+
existsSync as existsSync2,
|
|
13239
11689
|
renameSync,
|
|
13240
11690
|
mkdirSync,
|
|
13241
|
-
unlinkSync
|
|
11691
|
+
unlinkSync as unlinkSync2
|
|
13242
11692
|
} from "node:fs";
|
|
13243
11693
|
import { dirname, basename, resolve } from "node:path";
|
|
11694
|
+
|
|
11695
|
+
// src/vault/flock.ts
|
|
11696
|
+
import {
|
|
11697
|
+
existsSync,
|
|
11698
|
+
openSync,
|
|
11699
|
+
closeSync,
|
|
11700
|
+
writeSync,
|
|
11701
|
+
fsyncSync,
|
|
11702
|
+
unlinkSync,
|
|
11703
|
+
readFileSync,
|
|
11704
|
+
readdirSync,
|
|
11705
|
+
rmdirSync,
|
|
11706
|
+
statSync,
|
|
11707
|
+
constants as fsConstants
|
|
11708
|
+
} from "node:fs";
|
|
11709
|
+
var DEFAULT_LOCK_RETRY_MS = 5000;
|
|
11710
|
+
function lockPathFor(vaultPath) {
|
|
11711
|
+
return `${vaultPath}.lock`;
|
|
11712
|
+
}
|
|
11713
|
+
function readLockHolder(lockPath) {
|
|
11714
|
+
try {
|
|
11715
|
+
const raw = readFileSync(lockPath, "utf8");
|
|
11716
|
+
const lines = raw.split(`
|
|
11717
|
+
`);
|
|
11718
|
+
const pid = Number.parseInt(lines[0] ?? "", 10);
|
|
11719
|
+
const acquiredAtMs = Number.parseInt(lines[1] ?? "", 10);
|
|
11720
|
+
if (!Number.isFinite(pid) || pid <= 0)
|
|
11721
|
+
return null;
|
|
11722
|
+
if (!Number.isFinite(acquiredAtMs) || acquiredAtMs <= 0)
|
|
11723
|
+
return null;
|
|
11724
|
+
return { pid, acquiredAtMs, argv0: lines[2] ?? "" };
|
|
11725
|
+
} catch {
|
|
11726
|
+
return null;
|
|
11727
|
+
}
|
|
11728
|
+
}
|
|
11729
|
+
function pidIsLive(pid) {
|
|
11730
|
+
if (process.platform === "linux") {
|
|
11731
|
+
return existsSync(`/proc/${pid}`);
|
|
11732
|
+
}
|
|
11733
|
+
try {
|
|
11734
|
+
process.kill(pid, 0);
|
|
11735
|
+
return true;
|
|
11736
|
+
} catch {
|
|
11737
|
+
return false;
|
|
11738
|
+
}
|
|
11739
|
+
}
|
|
11740
|
+
function clearStaleSentinelDir(lockPath) {
|
|
11741
|
+
try {
|
|
11742
|
+
if (!existsSync(lockPath))
|
|
11743
|
+
return true;
|
|
11744
|
+
const s = statSync(lockPath);
|
|
11745
|
+
if (!s.isDirectory())
|
|
11746
|
+
return true;
|
|
11747
|
+
for (const entry of readdirSync(lockPath)) {
|
|
11748
|
+
try {
|
|
11749
|
+
unlinkSync(`${lockPath}/${entry}`);
|
|
11750
|
+
} catch {}
|
|
11751
|
+
}
|
|
11752
|
+
rmdirSync(lockPath);
|
|
11753
|
+
return true;
|
|
11754
|
+
} catch {
|
|
11755
|
+
return false;
|
|
11756
|
+
}
|
|
11757
|
+
}
|
|
11758
|
+
function acquireLock(vaultPath, options = {}) {
|
|
11759
|
+
const budgetMs = options.budgetMs ?? DEFAULT_LOCK_RETRY_MS;
|
|
11760
|
+
const lockPath = lockPathFor(vaultPath);
|
|
11761
|
+
const deadline = Date.now() + budgetMs;
|
|
11762
|
+
const sleepBuf = new Int32Array(new SharedArrayBuffer(4));
|
|
11763
|
+
while (true) {
|
|
11764
|
+
let fd = null;
|
|
11765
|
+
try {
|
|
11766
|
+
fd = openSync(lockPath, fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL, 384);
|
|
11767
|
+
} catch (err) {
|
|
11768
|
+
const code = err?.code ?? "";
|
|
11769
|
+
if (code === "EEXIST") {
|
|
11770
|
+
let isDir = false;
|
|
11771
|
+
try {
|
|
11772
|
+
isDir = statSync(lockPath).isDirectory();
|
|
11773
|
+
} catch {}
|
|
11774
|
+
if (isDir) {
|
|
11775
|
+
if (clearStaleSentinelDir(lockPath))
|
|
11776
|
+
continue;
|
|
11777
|
+
}
|
|
11778
|
+
const holder = readLockHolder(lockPath);
|
|
11779
|
+
if (holder && !pidIsLive(holder.pid)) {
|
|
11780
|
+
try {
|
|
11781
|
+
unlinkSync(lockPath);
|
|
11782
|
+
} catch {}
|
|
11783
|
+
continue;
|
|
11784
|
+
}
|
|
11785
|
+
if (Date.now() >= deadline) {
|
|
11786
|
+
throw makeBusyError(vaultPath, lockPath, holder, budgetMs);
|
|
11787
|
+
}
|
|
11788
|
+
Atomics.wait(sleepBuf, 0, 0, 100);
|
|
11789
|
+
continue;
|
|
11790
|
+
} else {
|
|
11791
|
+
throw err;
|
|
11792
|
+
}
|
|
11793
|
+
}
|
|
11794
|
+
try {
|
|
11795
|
+
const meta = `${process.pid}
|
|
11796
|
+
${Date.now()}
|
|
11797
|
+
${process.argv[1] ?? ""}
|
|
11798
|
+
`;
|
|
11799
|
+
writeSync(fd, meta);
|
|
11800
|
+
fsyncSync(fd);
|
|
11801
|
+
} catch {
|
|
11802
|
+
try {
|
|
11803
|
+
closeSync(fd);
|
|
11804
|
+
} catch {}
|
|
11805
|
+
try {
|
|
11806
|
+
unlinkSync(lockPath);
|
|
11807
|
+
} catch {}
|
|
11808
|
+
throw new Error(`vault flock: failed to write holder metadata to ${lockPath}`);
|
|
11809
|
+
}
|
|
11810
|
+
const ownedFd = fd;
|
|
11811
|
+
return {
|
|
11812
|
+
release: () => {
|
|
11813
|
+
try {
|
|
11814
|
+
closeSync(ownedFd);
|
|
11815
|
+
} catch {}
|
|
11816
|
+
try {
|
|
11817
|
+
unlinkSync(lockPath);
|
|
11818
|
+
} catch {}
|
|
11819
|
+
}
|
|
11820
|
+
};
|
|
11821
|
+
}
|
|
11822
|
+
}
|
|
11823
|
+
|
|
11824
|
+
class VaultBusyError extends Error {
|
|
11825
|
+
vaultPath;
|
|
11826
|
+
lockPath;
|
|
11827
|
+
holderPid;
|
|
11828
|
+
heldForMs;
|
|
11829
|
+
budgetMs;
|
|
11830
|
+
constructor(message, fields) {
|
|
11831
|
+
super(message);
|
|
11832
|
+
this.name = "VaultBusyError";
|
|
11833
|
+
this.vaultPath = fields.vaultPath;
|
|
11834
|
+
this.lockPath = fields.lockPath;
|
|
11835
|
+
this.holderPid = fields.holderPid;
|
|
11836
|
+
this.heldForMs = fields.heldForMs;
|
|
11837
|
+
this.budgetMs = fields.budgetMs;
|
|
11838
|
+
}
|
|
11839
|
+
}
|
|
11840
|
+
function makeBusyError(vaultPath, lockPath, holder, budgetMs) {
|
|
11841
|
+
const holderPid = holder?.pid ?? null;
|
|
11842
|
+
const heldForMs = holder ? Date.now() - holder.acquiredAtMs : null;
|
|
11843
|
+
const holderClause = holder ? `held by pid ${holder.pid} (acquired ${Math.round((heldForMs ?? 0) / 1000)}s ago)` : "held by another writer (holder PID unreadable — lock file empty or unparseable)";
|
|
11844
|
+
return new VaultBusyError(`vault busy: ${holderClause} at ${lockPath} (retried for ${budgetMs}ms). ` + `Try again in a moment. If the holder process is gone, the next acquirer ` + `will clear the stale lock automatically.`, { vaultPath, lockPath, holderPid, heldForMs, budgetMs });
|
|
11845
|
+
}
|
|
11846
|
+
|
|
11847
|
+
// src/vault/vault.ts
|
|
13244
11848
|
var KNOWN_VAULT_ARTIFACT_NAMES = new Set([
|
|
13245
11849
|
"vault.enc",
|
|
13246
11850
|
"vault.enc.bak",
|
|
@@ -13248,7 +11852,7 @@ var KNOWN_VAULT_ARTIFACT_NAMES = new Set([
|
|
|
13248
11852
|
"vault.enc.lock",
|
|
13249
11853
|
".vault.enc.symlink-tmp"
|
|
13250
11854
|
]);
|
|
13251
|
-
var SAVE_VAULT_LOCK_RETRY_MS =
|
|
11855
|
+
var SAVE_VAULT_LOCK_RETRY_MS = DEFAULT_LOCK_RETRY_MS;
|
|
13252
11856
|
var SCRYPT_N = 32768;
|
|
13253
11857
|
var SCRYPT_R = 8;
|
|
13254
11858
|
var SCRYPT_P = 1;
|
|
@@ -13261,17 +11865,20 @@ function atomicWriteFileSync(path, data, mode) {
|
|
|
13261
11865
|
renameSync(tmp, path);
|
|
13262
11866
|
} catch (err) {
|
|
13263
11867
|
try {
|
|
13264
|
-
if (
|
|
13265
|
-
|
|
11868
|
+
if (existsSync2(tmp))
|
|
11869
|
+
unlinkSync2(tmp);
|
|
13266
11870
|
} catch {}
|
|
13267
11871
|
throw err;
|
|
13268
11872
|
}
|
|
13269
11873
|
}
|
|
13270
11874
|
|
|
13271
11875
|
class VaultError extends Error {
|
|
13272
|
-
|
|
11876
|
+
cause;
|
|
11877
|
+
constructor(message, options) {
|
|
13273
11878
|
super(message);
|
|
13274
11879
|
this.name = "VaultError";
|
|
11880
|
+
if (options?.cause !== undefined)
|
|
11881
|
+
this.cause = options.cause;
|
|
13275
11882
|
}
|
|
13276
11883
|
}
|
|
13277
11884
|
var LEGACY_SCRYPT_N = 16384;
|
|
@@ -13317,12 +11924,12 @@ function normalizeSecrets(raw) {
|
|
|
13317
11924
|
return out;
|
|
13318
11925
|
}
|
|
13319
11926
|
function openVault(passphrase, vaultPath) {
|
|
13320
|
-
if (!
|
|
11927
|
+
if (!existsSync2(vaultPath)) {
|
|
13321
11928
|
throw new VaultError(`Vault file not found: ${vaultPath}`);
|
|
13322
11929
|
}
|
|
13323
11930
|
let vaultFile;
|
|
13324
11931
|
try {
|
|
13325
|
-
vaultFile = JSON.parse(
|
|
11932
|
+
vaultFile = JSON.parse(readFileSync2(vaultPath, "utf8"));
|
|
13326
11933
|
} catch {
|
|
13327
11934
|
throw new VaultError(`Failed to read vault file: ${vaultPath}`);
|
|
13328
11935
|
}
|
|
@@ -13344,38 +11951,22 @@ function openVault(passphrase, vaultPath) {
|
|
|
13344
11951
|
return normalizeSecrets(vaultData.secrets ?? {});
|
|
13345
11952
|
}
|
|
13346
11953
|
function saveVault(passphrase, vaultPath, secrets) {
|
|
13347
|
-
if (!
|
|
11954
|
+
if (!existsSync2(vaultPath)) {
|
|
13348
11955
|
throw new VaultError(`Vault file not found: ${vaultPath}`);
|
|
13349
11956
|
}
|
|
13350
11957
|
let releaseLock = null;
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
releaseLock = import_proper_lockfile.default.lockSync(vaultPath, {
|
|
13357
|
-
stale: SAVE_VAULT_LOCK_RETRY_MS * 2,
|
|
13358
|
-
realpath: true
|
|
13359
|
-
});
|
|
13360
|
-
lastErr = null;
|
|
13361
|
-
break;
|
|
13362
|
-
} catch (err) {
|
|
13363
|
-
lastErr = err;
|
|
13364
|
-
const code = err?.code ?? "";
|
|
13365
|
-
if (code !== "ELOCKED")
|
|
13366
|
-
throw err;
|
|
13367
|
-
Atomics.wait(sleepBuf, 0, 0, 100);
|
|
13368
|
-
}
|
|
13369
|
-
}
|
|
13370
|
-
if (releaseLock === null) {
|
|
13371
|
-
if (lastErr) {
|
|
13372
|
-
throw new VaultError(`vault busy: another writer holds the lock at ${vaultPath} ` + `(retried for ${SAVE_VAULT_LOCK_RETRY_MS}ms). Try again in a moment.`);
|
|
11958
|
+
try {
|
|
11959
|
+
releaseLock = acquireLock(vaultPath, { budgetMs: SAVE_VAULT_LOCK_RETRY_MS }).release;
|
|
11960
|
+
} catch (err) {
|
|
11961
|
+
if (err instanceof VaultBusyError) {
|
|
11962
|
+
throw new VaultError(err.message, { cause: err });
|
|
13373
11963
|
}
|
|
11964
|
+
throw err;
|
|
13374
11965
|
}
|
|
13375
11966
|
try {
|
|
13376
11967
|
let vaultFile;
|
|
13377
11968
|
try {
|
|
13378
|
-
vaultFile = JSON.parse(
|
|
11969
|
+
vaultFile = JSON.parse(readFileSync2(vaultPath, "utf8"));
|
|
13379
11970
|
} catch {
|
|
13380
11971
|
throw new VaultError(`Failed to read vault file: ${vaultPath}`);
|
|
13381
11972
|
}
|
|
@@ -13389,45 +11980,39 @@ function saveVault(passphrase, vaultPath, secrets) {
|
|
|
13389
11980
|
vaultFile.tag = tag;
|
|
13390
11981
|
atomicWriteFileSync(vaultPath, JSON.stringify(vaultFile, null, 2), 384);
|
|
13391
11982
|
} finally {
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
11983
|
+
if (releaseLock !== null) {
|
|
11984
|
+
try {
|
|
11985
|
+
releaseLock();
|
|
11986
|
+
} catch {}
|
|
11987
|
+
}
|
|
13395
11988
|
}
|
|
13396
11989
|
}
|
|
13397
11990
|
function acquireVaultLock(vaultPath) {
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
stale: SAVE_VAULT_LOCK_RETRY_MS * 2,
|
|
13404
|
-
realpath: true
|
|
13405
|
-
});
|
|
13406
|
-
} catch (err) {
|
|
13407
|
-
const code = err?.code ?? "";
|
|
13408
|
-
if (code !== "ELOCKED")
|
|
13409
|
-
throw err;
|
|
13410
|
-
Atomics.wait(sleepBuf, 0, 0, 100);
|
|
11991
|
+
try {
|
|
11992
|
+
return acquireLock(vaultPath, { budgetMs: SAVE_VAULT_LOCK_RETRY_MS }).release;
|
|
11993
|
+
} catch (err) {
|
|
11994
|
+
if (err instanceof VaultBusyError) {
|
|
11995
|
+
throw new VaultError(err.message, { cause: err });
|
|
13411
11996
|
}
|
|
11997
|
+
throw err;
|
|
13412
11998
|
}
|
|
13413
|
-
throw new VaultError(`vault busy: another writer holds the lock at ${vaultPath} ` + `(retried for ${SAVE_VAULT_LOCK_RETRY_MS}ms).`);
|
|
13414
11999
|
}
|
|
13415
12000
|
|
|
13416
12001
|
// src/vault/migrate-layout.ts
|
|
13417
12002
|
import {
|
|
13418
12003
|
copyFileSync,
|
|
13419
12004
|
chmodSync,
|
|
13420
|
-
existsSync as
|
|
13421
|
-
fsyncSync as
|
|
12005
|
+
existsSync as existsSync3,
|
|
12006
|
+
fsyncSync as fsyncSync3,
|
|
13422
12007
|
lstatSync,
|
|
13423
12008
|
mkdirSync as mkdirSync2,
|
|
13424
|
-
openSync as
|
|
13425
|
-
closeSync as
|
|
13426
|
-
readFileSync as
|
|
12009
|
+
openSync as openSync3,
|
|
12010
|
+
closeSync as closeSync3,
|
|
12011
|
+
readFileSync as readFileSync3,
|
|
13427
12012
|
renameSync as renameSync2,
|
|
13428
|
-
statSync,
|
|
12013
|
+
statSync as statSync2,
|
|
13429
12014
|
symlinkSync,
|
|
13430
|
-
unlinkSync as
|
|
12015
|
+
unlinkSync as unlinkSync3
|
|
13431
12016
|
} from "node:fs";
|
|
13432
12017
|
import { createHash as createHash2 } from "node:crypto";
|
|
13433
12018
|
import { basename as basename2, dirname as dirname2, join } from "node:path";
|
|
@@ -13445,11 +12030,11 @@ function inspectVaultLayout(home) {
|
|
|
13445
12030
|
}
|
|
13446
12031
|
function runMigration(home, opts) {
|
|
13447
12032
|
const { oldPath, newPath, parent, switchroomRoot } = vaultLayoutPaths(home);
|
|
13448
|
-
const lockTarget =
|
|
12033
|
+
const lockTarget = existsSync3(newPath) ? newPath : existsSync3(oldPath) ? oldPath : null;
|
|
13449
12034
|
const release = !opts.dryRun && lockTarget !== null ? acquireVaultLock(lockTarget) : null;
|
|
13450
12035
|
try {
|
|
13451
12036
|
const oldStat = lstatSyncOrNull(oldPath);
|
|
13452
|
-
const newExists =
|
|
12037
|
+
const newExists = existsSync3(newPath);
|
|
13453
12038
|
if (oldStat === null && !newExists) {
|
|
13454
12039
|
return { kind: "no-vault" };
|
|
13455
12040
|
}
|
|
@@ -13466,8 +12051,8 @@ function runMigration(home, opts) {
|
|
|
13466
12051
|
fsyncDir(switchroomRoot);
|
|
13467
12052
|
return { kind: "completed-partial" };
|
|
13468
12053
|
}
|
|
13469
|
-
const oldRealStat =
|
|
13470
|
-
const newRealStat =
|
|
12054
|
+
const oldRealStat = statSync2(oldPath);
|
|
12055
|
+
const newRealStat = statSync2(newPath);
|
|
13471
12056
|
return {
|
|
13472
12057
|
kind: "divergent",
|
|
13473
12058
|
details: {
|
|
@@ -13513,33 +12098,33 @@ function lstatSyncOrNull(path) {
|
|
|
13513
12098
|
}
|
|
13514
12099
|
}
|
|
13515
12100
|
function sha256File(path) {
|
|
13516
|
-
const data =
|
|
12101
|
+
const data = readFileSync3(path);
|
|
13517
12102
|
return createHash2("sha256").update(data).digest("hex");
|
|
13518
12103
|
}
|
|
13519
12104
|
function atomicReplaceWithSymlink(target, linkTarget) {
|
|
13520
12105
|
const tmp = join(dirname2(target), `.${basename2(target)}.symlink-tmp`);
|
|
13521
|
-
if (
|
|
12106
|
+
if (existsSync3(tmp)) {
|
|
13522
12107
|
try {
|
|
13523
|
-
|
|
12108
|
+
unlinkSync3(tmp);
|
|
13524
12109
|
} catch {}
|
|
13525
12110
|
}
|
|
13526
12111
|
symlinkSync(linkTarget, tmp);
|
|
13527
12112
|
renameSync2(tmp, target);
|
|
13528
12113
|
}
|
|
13529
12114
|
function fsyncFile(path) {
|
|
13530
|
-
const fd =
|
|
12115
|
+
const fd = openSync3(path, "r+");
|
|
13531
12116
|
try {
|
|
13532
|
-
|
|
12117
|
+
fsyncSync3(fd);
|
|
13533
12118
|
} finally {
|
|
13534
|
-
|
|
12119
|
+
closeSync3(fd);
|
|
13535
12120
|
}
|
|
13536
12121
|
}
|
|
13537
12122
|
function fsyncDir(path) {
|
|
13538
|
-
const fd =
|
|
12123
|
+
const fd = openSync3(path, "r");
|
|
13539
12124
|
try {
|
|
13540
|
-
|
|
12125
|
+
fsyncSync3(fd);
|
|
13541
12126
|
} finally {
|
|
13542
|
-
|
|
12127
|
+
closeSync3(fd);
|
|
13543
12128
|
}
|
|
13544
12129
|
}
|
|
13545
12130
|
|
|
@@ -13548,7 +12133,7 @@ init_loader();
|
|
|
13548
12133
|
|
|
13549
12134
|
// src/vault/auto-unlock.ts
|
|
13550
12135
|
import { createHmac, randomBytes as randomBytes2, createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2 } from "node:crypto";
|
|
13551
|
-
import { chmodSync as chmodSync2, existsSync as
|
|
12136
|
+
import { chmodSync as chmodSync2, existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "node:fs";
|
|
13552
12137
|
var FORMAT_VERSION = 1;
|
|
13553
12138
|
var SALT_LEN = 16;
|
|
13554
12139
|
var NONCE_LEN = 12;
|
|
@@ -13576,7 +12161,7 @@ class AutoUnlockDecryptError extends Error {
|
|
|
13576
12161
|
function readMachineId() {
|
|
13577
12162
|
for (const path of [MACHINE_ID_PRIMARY, MACHINE_ID_FALLBACK]) {
|
|
13578
12163
|
try {
|
|
13579
|
-
const id =
|
|
12164
|
+
const id = readFileSync5(path, "utf8").trim();
|
|
13580
12165
|
if (id.length > 0)
|
|
13581
12166
|
return id;
|
|
13582
12167
|
} catch {}
|
|
@@ -13613,12 +12198,12 @@ function decryptAutoUnlock(blob, machineId) {
|
|
|
13613
12198
|
}
|
|
13614
12199
|
}
|
|
13615
12200
|
function readAutoUnlockFile(filePath) {
|
|
13616
|
-
if (!
|
|
12201
|
+
if (!existsSync6(filePath)) {
|
|
13617
12202
|
throw new AutoUnlockDecryptError("io");
|
|
13618
12203
|
}
|
|
13619
12204
|
let blob;
|
|
13620
12205
|
try {
|
|
13621
|
-
blob =
|
|
12206
|
+
blob = readFileSync5(filePath);
|
|
13622
12207
|
} catch {
|
|
13623
12208
|
throw new AutoUnlockDecryptError("io");
|
|
13624
12209
|
}
|
|
@@ -13628,7 +12213,7 @@ var DEFAULT_AUTO_UNLOCK_PATH = "~/.switchroom/vault-auto-unlock";
|
|
|
13628
12213
|
|
|
13629
12214
|
// src/vault/broker/peercred.ts
|
|
13630
12215
|
import { execFileSync } from "node:child_process";
|
|
13631
|
-
import { readFileSync as
|
|
12216
|
+
import { readFileSync as readFileSync6, readlinkSync, fstatSync } from "node:fs";
|
|
13632
12217
|
|
|
13633
12218
|
// src/vault/broker/peercred-ffi.ts
|
|
13634
12219
|
function getPeerCred(fd) {
|
|
@@ -13754,7 +12339,7 @@ function findClientPidByServerInode(rows, socketPath, serverInode) {
|
|
|
13754
12339
|
}
|
|
13755
12340
|
function readUid(pid) {
|
|
13756
12341
|
try {
|
|
13757
|
-
const status =
|
|
12342
|
+
const status = readFileSync6(`/proc/${pid}/status`, "utf8");
|
|
13758
12343
|
const m = status.match(/^Uid:\s+(\d+)/m);
|
|
13759
12344
|
if (!m)
|
|
13760
12345
|
return null;
|
|
@@ -13772,7 +12357,7 @@ function readExe(pid) {
|
|
|
13772
12357
|
}
|
|
13773
12358
|
function readSystemdUnit(pid) {
|
|
13774
12359
|
try {
|
|
13775
|
-
const content =
|
|
12360
|
+
const content = readFileSync6(`/proc/${pid}/cgroup`, "utf8");
|
|
13776
12361
|
const lines = content.split(`
|
|
13777
12362
|
`);
|
|
13778
12363
|
for (const line of lines) {
|
|
@@ -14035,7 +12620,8 @@ var PutRequestSchema = exports_external.object({
|
|
|
14035
12620
|
exports_external.object({ kind: exports_external.literal("string"), value: exports_external.string() }),
|
|
14036
12621
|
exports_external.object({ kind: exports_external.literal("binary"), value: exports_external.string() })
|
|
14037
12622
|
]),
|
|
14038
|
-
token: exports_external.string().optional()
|
|
12623
|
+
token: exports_external.string().optional(),
|
|
12624
|
+
passphrase: exports_external.string().optional()
|
|
14039
12625
|
});
|
|
14040
12626
|
var ListRequestSchema = exports_external.object({
|
|
14041
12627
|
v: exports_external.literal(1),
|
|
@@ -14046,9 +12632,10 @@ var MintGrantRequestSchema = exports_external.object({
|
|
|
14046
12632
|
v: exports_external.literal(1),
|
|
14047
12633
|
op: exports_external.literal("mint_grant"),
|
|
14048
12634
|
agent: exports_external.string().min(1),
|
|
14049
|
-
keys: exports_external.array(exports_external.string().min(1))
|
|
12635
|
+
keys: exports_external.array(exports_external.string().min(1)),
|
|
14050
12636
|
ttl_seconds: exports_external.number().int().positive().nullable(),
|
|
14051
|
-
description: exports_external.string().optional()
|
|
12637
|
+
description: exports_external.string().optional(),
|
|
12638
|
+
write_keys: exports_external.array(exports_external.string().min(1)).optional()
|
|
14052
12639
|
});
|
|
14053
12640
|
var ListGrantsRequestSchema = exports_external.object({
|
|
14054
12641
|
v: exports_external.literal(1),
|
|
@@ -14189,6 +12776,7 @@ var GrantMetaSchema = exports_external.object({
|
|
|
14189
12776
|
id: exports_external.string(),
|
|
14190
12777
|
agent_slug: exports_external.string(),
|
|
14191
12778
|
key_allow: exports_external.array(exports_external.string()),
|
|
12779
|
+
write_allow: exports_external.array(exports_external.string()).default([]),
|
|
14192
12780
|
expires_at: exports_external.number().nullable(),
|
|
14193
12781
|
created_at: exports_external.number(),
|
|
14194
12782
|
description: exports_external.string().nullable()
|
|
@@ -14359,7 +12947,7 @@ function createAuditLogger(opts = {}) {
|
|
|
14359
12947
|
// src/vault/grants.ts
|
|
14360
12948
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
14361
12949
|
|
|
14362
|
-
// node_modules
|
|
12950
|
+
// node_modules/bcryptjs/index.js
|
|
14363
12951
|
import nodeCrypto from "crypto";
|
|
14364
12952
|
var randomFallback = null;
|
|
14365
12953
|
function randomBytes3(len) {
|
|
@@ -16044,6 +14632,11 @@ function migrateGrantsSchema(db) {
|
|
|
16044
14632
|
description TEXT
|
|
16045
14633
|
)
|
|
16046
14634
|
`);
|
|
14635
|
+
const cols = db.query(`PRAGMA table_info(vault_grants)`).all();
|
|
14636
|
+
const hasWriteAllow = cols.some((c) => c.name === "write_allow");
|
|
14637
|
+
if (!hasWriteAllow) {
|
|
14638
|
+
db.run(`ALTER TABLE vault_grants ADD COLUMN write_allow TEXT NOT NULL DEFAULT '[]'`);
|
|
14639
|
+
}
|
|
16047
14640
|
}
|
|
16048
14641
|
var BCRYPT_COST = 10;
|
|
16049
14642
|
function generateId() {
|
|
@@ -16067,21 +14660,43 @@ function rowToGrant(row) {
|
|
|
16067
14660
|
id: row.id,
|
|
16068
14661
|
agent_slug: row.agent_slug,
|
|
16069
14662
|
key_allow: parseKeyAllow(row.key_allow),
|
|
14663
|
+
write_allow: parseKeyAllow(row.write_allow ?? "[]"),
|
|
16070
14664
|
expires_at: row.expires_at ?? null,
|
|
16071
14665
|
revoked_at: row.revoked_at ?? null,
|
|
16072
14666
|
created_at: row.created_at,
|
|
16073
14667
|
description: row.description ?? null
|
|
16074
14668
|
};
|
|
16075
14669
|
}
|
|
16076
|
-
|
|
14670
|
+
function keyMatchesPatterns(patterns, key) {
|
|
14671
|
+
for (const pat of patterns) {
|
|
14672
|
+
if (pat.endsWith("*")) {
|
|
14673
|
+
const prefix = pat.slice(0, -1);
|
|
14674
|
+
if (key.startsWith(prefix))
|
|
14675
|
+
return true;
|
|
14676
|
+
} else if (pat === key) {
|
|
14677
|
+
return true;
|
|
14678
|
+
}
|
|
14679
|
+
}
|
|
14680
|
+
return false;
|
|
14681
|
+
}
|
|
14682
|
+
async function mintGrant(db, agent_slug, key_allow, ttl_seconds, description, write_allow = []) {
|
|
16077
14683
|
const id = generateId();
|
|
16078
14684
|
const secret = generateSecret();
|
|
16079
14685
|
const token = `${id}.${secret}`;
|
|
16080
14686
|
const secret_hash = await hash(secret, BCRYPT_COST);
|
|
16081
14687
|
const now = Math.floor(Date.now() / 1000);
|
|
16082
14688
|
const expires_at = ttl_seconds != null ? now + ttl_seconds : null;
|
|
16083
|
-
db.run(`INSERT INTO vault_grants (id, secret_hash, agent_slug, key_allow, expires_at, revoked_at, created_at, description)
|
|
16084
|
-
VALUES (?, ?, ?, ?, ?, NULL, ?, ?)`, [
|
|
14689
|
+
db.run(`INSERT INTO vault_grants (id, secret_hash, agent_slug, key_allow, write_allow, expires_at, revoked_at, created_at, description)
|
|
14690
|
+
VALUES (?, ?, ?, ?, ?, ?, NULL, ?, ?)`, [
|
|
14691
|
+
id,
|
|
14692
|
+
secret_hash,
|
|
14693
|
+
agent_slug,
|
|
14694
|
+
JSON.stringify(key_allow),
|
|
14695
|
+
JSON.stringify(write_allow),
|
|
14696
|
+
expires_at,
|
|
14697
|
+
now,
|
|
14698
|
+
description ?? null
|
|
14699
|
+
]);
|
|
16085
14700
|
return { token, id, expires_at };
|
|
16086
14701
|
}
|
|
16087
14702
|
async function validateGrant(db, token, key) {
|
|
@@ -16122,6 +14737,41 @@ async function validateGrant(db, token, key) {
|
|
|
16122
14737
|
}
|
|
16123
14738
|
return { ok: true, grant };
|
|
16124
14739
|
}
|
|
14740
|
+
async function validateGrantForWrite(db, token, key) {
|
|
14741
|
+
const dotIdx = token.indexOf(".");
|
|
14742
|
+
if (dotIdx === -1 || !token.startsWith("vg_")) {
|
|
14743
|
+
return { ok: false, reason: "grant-invalid" };
|
|
14744
|
+
}
|
|
14745
|
+
const id = token.slice(0, dotIdx);
|
|
14746
|
+
const secret = token.slice(dotIdx + 1);
|
|
14747
|
+
if (!id || !secret) {
|
|
14748
|
+
return { ok: false, reason: "grant-invalid" };
|
|
14749
|
+
}
|
|
14750
|
+
const row = db.query(`SELECT id, secret_hash, agent_slug, key_allow, write_allow, expires_at, revoked_at, created_at, description
|
|
14751
|
+
FROM vault_grants WHERE id = ?`).get(id);
|
|
14752
|
+
if (!row)
|
|
14753
|
+
return { ok: false, reason: "grant-invalid" };
|
|
14754
|
+
const secretHash = row.secret_hash;
|
|
14755
|
+
let hashMatches;
|
|
14756
|
+
try {
|
|
14757
|
+
hashMatches = await compare(secret, secretHash);
|
|
14758
|
+
} catch {
|
|
14759
|
+
hashMatches = false;
|
|
14760
|
+
}
|
|
14761
|
+
if (!hashMatches)
|
|
14762
|
+
return { ok: false, reason: "grant-invalid" };
|
|
14763
|
+
const grant = rowToGrant(row);
|
|
14764
|
+
const now = Math.floor(Date.now() / 1000);
|
|
14765
|
+
if (grant.revoked_at !== null)
|
|
14766
|
+
return { ok: false, reason: "grant-revoked" };
|
|
14767
|
+
if (grant.expires_at !== null && grant.expires_at < now) {
|
|
14768
|
+
return { ok: false, reason: "grant-expired" };
|
|
14769
|
+
}
|
|
14770
|
+
if (!keyMatchesPatterns(grant.write_allow, key)) {
|
|
14771
|
+
return { ok: false, reason: "grant-write-not-allowed" };
|
|
14772
|
+
}
|
|
14773
|
+
return { ok: true, grant };
|
|
14774
|
+
}
|
|
16125
14775
|
function revokeGrant(db, id) {
|
|
16126
14776
|
const now = Math.floor(Date.now() / 1000);
|
|
16127
14777
|
const result = db.run(`UPDATE vault_grants SET revoked_at = ? WHERE id = ? AND revoked_at IS NULL`, [now, id]);
|
|
@@ -16130,11 +14780,11 @@ function revokeGrant(db, id) {
|
|
|
16130
14780
|
function listGrants(db, agent_slug) {
|
|
16131
14781
|
let rows;
|
|
16132
14782
|
if (agent_slug !== undefined) {
|
|
16133
|
-
rows = db.query(`SELECT id, agent_slug, key_allow, expires_at, revoked_at, created_at, description
|
|
14783
|
+
rows = db.query(`SELECT id, agent_slug, key_allow, write_allow, expires_at, revoked_at, created_at, description
|
|
16134
14784
|
FROM vault_grants WHERE revoked_at IS NULL AND agent_slug = ?
|
|
16135
14785
|
ORDER BY created_at DESC`).all(agent_slug);
|
|
16136
14786
|
} else {
|
|
16137
|
-
rows = db.query(`SELECT id, agent_slug, key_allow, expires_at, revoked_at, created_at, description
|
|
14787
|
+
rows = db.query(`SELECT id, agent_slug, key_allow, write_allow, expires_at, revoked_at, created_at, description
|
|
16138
14788
|
FROM vault_grants WHERE revoked_at IS NULL
|
|
16139
14789
|
ORDER BY created_at DESC`).all();
|
|
16140
14790
|
}
|
|
@@ -16279,12 +14929,12 @@ function countPendingNonces(db, now = Date.now()) {
|
|
|
16279
14929
|
WHERE consumed_at IS NULL AND expires_at > ?
|
|
16280
14930
|
GROUP BY agent_unit`).all(now);
|
|
16281
14931
|
const perAgent = new Map;
|
|
16282
|
-
let
|
|
14932
|
+
let global = 0;
|
|
16283
14933
|
for (const r of rows) {
|
|
16284
14934
|
perAgent.set(r.agent_unit, r.n);
|
|
16285
|
-
|
|
14935
|
+
global += r.n;
|
|
16286
14936
|
}
|
|
16287
|
-
return { perAgent, global
|
|
14937
|
+
return { perAgent, global };
|
|
16288
14938
|
}
|
|
16289
14939
|
function computeRetryAfterMs(db, agent_unit, now = Date.now()) {
|
|
16290
14940
|
const row = agent_unit ? db.query(`SELECT MIN(expires_at) AS expires_at FROM approval_nonces
|
|
@@ -16565,9 +15215,9 @@ class VaultBroker {
|
|
|
16565
15215
|
chmodSync4(parentDir, 448);
|
|
16566
15216
|
} catch {}
|
|
16567
15217
|
for (const p of [this.socketPath, this.unlockSocketPath]) {
|
|
16568
|
-
if (
|
|
15218
|
+
if (existsSync7(p)) {
|
|
16569
15219
|
try {
|
|
16570
|
-
|
|
15220
|
+
unlinkSync4(p);
|
|
16571
15221
|
} catch {}
|
|
16572
15222
|
}
|
|
16573
15223
|
}
|
|
@@ -16615,24 +15265,24 @@ class VaultBroker {
|
|
|
16615
15265
|
try {
|
|
16616
15266
|
entry.server.close();
|
|
16617
15267
|
} catch {}
|
|
16618
|
-
if (
|
|
15268
|
+
if (existsSync7(sockPath)) {
|
|
16619
15269
|
try {
|
|
16620
|
-
|
|
15270
|
+
unlinkSync4(sockPath);
|
|
16621
15271
|
} catch {}
|
|
16622
15272
|
}
|
|
16623
15273
|
}
|
|
16624
15274
|
this.agentServers.clear();
|
|
16625
15275
|
for (const p of [this.socketPath, this.unlockSocketPath]) {
|
|
16626
|
-
if (p &&
|
|
15276
|
+
if (p && existsSync7(p)) {
|
|
16627
15277
|
try {
|
|
16628
|
-
|
|
15278
|
+
unlinkSync4(p);
|
|
16629
15279
|
} catch {}
|
|
16630
15280
|
}
|
|
16631
15281
|
}
|
|
16632
15282
|
try {
|
|
16633
15283
|
const pidPath = resolvePath(PID_FILE_DEFAULT);
|
|
16634
|
-
if (
|
|
16635
|
-
|
|
15284
|
+
if (existsSync7(pidPath))
|
|
15285
|
+
unlinkSync4(pidPath);
|
|
16636
15286
|
} catch {}
|
|
16637
15287
|
}
|
|
16638
15288
|
getStatus() {
|
|
@@ -16654,7 +15304,7 @@ class VaultBroker {
|
|
|
16654
15304
|
return new Promise((resolveP, rejectP) => {
|
|
16655
15305
|
if (abs.endsWith("/sock")) {
|
|
16656
15306
|
const dir = abs.slice(0, -"/sock".length);
|
|
16657
|
-
if (
|
|
15307
|
+
if (existsSync7(dir)) {
|
|
16658
15308
|
try {
|
|
16659
15309
|
chownSync(dir, 0, 0);
|
|
16660
15310
|
} catch {}
|
|
@@ -16663,9 +15313,9 @@ class VaultBroker {
|
|
|
16663
15313
|
} catch {}
|
|
16664
15314
|
}
|
|
16665
15315
|
}
|
|
16666
|
-
if (
|
|
15316
|
+
if (existsSync7(abs)) {
|
|
16667
15317
|
try {
|
|
16668
|
-
|
|
15318
|
+
unlinkSync4(abs);
|
|
16669
15319
|
} catch (err) {
|
|
16670
15320
|
const msg = err instanceof Error ? err.message : String(err);
|
|
16671
15321
|
process.stderr.write(`[vault-broker] could not unlink stale socket agent=${agentName} sock=${abs}: ${msg}
|
|
@@ -17018,30 +15668,71 @@ class VaultBroker {
|
|
|
17018
15668
|
socket.write(encodeResponse(errorResponse("LOCKED", "Vault is locked")));
|
|
17019
15669
|
return;
|
|
17020
15670
|
}
|
|
17021
|
-
|
|
17022
|
-
|
|
15671
|
+
let passphraseAttested = false;
|
|
15672
|
+
if (req.passphrase !== undefined && req.passphrase !== "") {
|
|
15673
|
+
if (req.passphrase === this.passphrase) {
|
|
15674
|
+
passphraseAttested = true;
|
|
15675
|
+
} else {
|
|
15676
|
+
this.auditLogger.write({
|
|
15677
|
+
ts: new Date().toISOString(),
|
|
15678
|
+
op: "put",
|
|
15679
|
+
key: req.key,
|
|
15680
|
+
caller: auditCaller,
|
|
15681
|
+
pid: auditPid,
|
|
15682
|
+
cgroup: auditCgroup,
|
|
15683
|
+
result: "denied:passphrase-mismatch",
|
|
15684
|
+
method: "passphrase"
|
|
15685
|
+
});
|
|
15686
|
+
socket.write(encodeResponse(errorResponse("DENIED", "supplied passphrase does not match the broker's unlocked passphrase")));
|
|
15687
|
+
return;
|
|
15688
|
+
}
|
|
15689
|
+
}
|
|
15690
|
+
let writeGrantId = null;
|
|
15691
|
+
if (req.token !== undefined && req.token !== "") {
|
|
15692
|
+
const v = await validateGrantForWrite(this.grantsDb, req.token, req.key);
|
|
15693
|
+
if (v.ok) {
|
|
15694
|
+
writeGrantId = v.grant.id;
|
|
15695
|
+
} else if (v.reason === "grant-expired" || v.reason === "grant-revoked") {
|
|
15696
|
+
this.auditLogger.write({
|
|
15697
|
+
ts: new Date().toISOString(),
|
|
15698
|
+
op: "put",
|
|
15699
|
+
key: req.key,
|
|
15700
|
+
caller: auditCaller,
|
|
15701
|
+
pid: auditPid,
|
|
15702
|
+
cgroup: auditCgroup,
|
|
15703
|
+
result: `denied:${v.reason}`,
|
|
15704
|
+
method: "grant"
|
|
15705
|
+
});
|
|
15706
|
+
socket.write(encodeResponse(errorResponse("DENIED", v.reason)));
|
|
15707
|
+
return;
|
|
15708
|
+
}
|
|
15709
|
+
}
|
|
15710
|
+
if (writeGrantId === null && !passphraseAttested && agentName === null) {
|
|
15711
|
+
socket.write(encodeResponse(errorResponse("DENIED", "put requires path-as-identity, a valid write-grant token, or operator-passphrase attestation")));
|
|
17023
15712
|
return;
|
|
17024
15713
|
}
|
|
17025
15714
|
if (this.config === null) {
|
|
17026
15715
|
socket.write(encodeResponse(errorResponse("INTERNAL", "Broker config not loaded")));
|
|
17027
15716
|
return;
|
|
17028
15717
|
}
|
|
17029
|
-
|
|
17030
|
-
|
|
17031
|
-
|
|
17032
|
-
|
|
17033
|
-
|
|
17034
|
-
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17038
|
-
|
|
17039
|
-
|
|
17040
|
-
|
|
17041
|
-
|
|
15718
|
+
if (writeGrantId === null && !passphraseAttested) {
|
|
15719
|
+
const aclResult = checkAclByAgent(this.config, agentName, req.key);
|
|
15720
|
+
if (!aclResult.allow) {
|
|
15721
|
+
this.auditLogger.write({
|
|
15722
|
+
ts: new Date().toISOString(),
|
|
15723
|
+
op: "put",
|
|
15724
|
+
key: req.key,
|
|
15725
|
+
caller: auditCaller,
|
|
15726
|
+
pid: auditPid,
|
|
15727
|
+
cgroup: auditCgroup,
|
|
15728
|
+
result: `denied:${aclResult.reason}`
|
|
15729
|
+
});
|
|
15730
|
+
socket.write(encodeResponse(errorResponse("DENIED", aclResult.reason)));
|
|
15731
|
+
return;
|
|
15732
|
+
}
|
|
17042
15733
|
}
|
|
17043
15734
|
const existing = this.secrets[req.key];
|
|
17044
|
-
if (existing === undefined) {
|
|
15735
|
+
if (existing === undefined && writeGrantId === null && !passphraseAttested) {
|
|
17045
15736
|
this.auditLogger.write({
|
|
17046
15737
|
ts: new Date().toISOString(),
|
|
17047
15738
|
op: "put",
|
|
@@ -17051,10 +15742,10 @@ class VaultBroker {
|
|
|
17051
15742
|
cgroup: auditCgroup,
|
|
17052
15743
|
result: "denied:unknown_key"
|
|
17053
15744
|
});
|
|
17054
|
-
socket.write(encodeResponse(errorResponse("UNKNOWN_KEY", `Key not found: ${req.key} (broker put cannot introduce new keys; ask operator to set it once via 'switchroom vault set' from the host)`)));
|
|
15745
|
+
socket.write(encodeResponse(errorResponse("UNKNOWN_KEY", `Key not found: ${req.key} (broker put cannot introduce new keys without a write-grant; ask operator to 'switchroom vault grant <agent> --write ${req.key}' or set it once via 'switchroom vault set' from the host)`)));
|
|
17055
15746
|
return;
|
|
17056
15747
|
}
|
|
17057
|
-
if (existing.kind !== req.entry.kind) {
|
|
15748
|
+
if (existing !== undefined && existing.kind !== req.entry.kind && !passphraseAttested) {
|
|
17058
15749
|
this.auditLogger.write({
|
|
17059
15750
|
ts: new Date().toISOString(),
|
|
17060
15751
|
op: "put",
|
|
@@ -17072,7 +15763,11 @@ class VaultBroker {
|
|
|
17072
15763
|
try {
|
|
17073
15764
|
saveVault(this.passphrase, this.vaultPath, this.secrets);
|
|
17074
15765
|
} catch (err) {
|
|
17075
|
-
|
|
15766
|
+
if (previousEntry === undefined) {
|
|
15767
|
+
delete this.secrets[req.key];
|
|
15768
|
+
} else {
|
|
15769
|
+
this.secrets[req.key] = previousEntry;
|
|
15770
|
+
}
|
|
17076
15771
|
this.auditLogger.write({
|
|
17077
15772
|
ts: new Date().toISOString(),
|
|
17078
15773
|
op: "put",
|
|
@@ -17080,7 +15775,8 @@ class VaultBroker {
|
|
|
17080
15775
|
caller: auditCaller,
|
|
17081
15776
|
pid: auditPid,
|
|
17082
15777
|
cgroup: auditCgroup,
|
|
17083
|
-
result: `error:${err?.message ?? "save failed"}
|
|
15778
|
+
result: `error:${err?.message ?? "save failed"}`,
|
|
15779
|
+
...passphraseAttested ? { method: "passphrase" } : writeGrantId !== null ? { method: "grant", grant_id: writeGrantId } : {}
|
|
17084
15780
|
});
|
|
17085
15781
|
socket.write(encodeResponse(errorResponse("INTERNAL", `Failed to persist: ${err?.message ?? "unknown"}`)));
|
|
17086
15782
|
return;
|
|
@@ -17092,7 +15788,8 @@ class VaultBroker {
|
|
|
17092
15788
|
caller: auditCaller,
|
|
17093
15789
|
pid: auditPid,
|
|
17094
15790
|
cgroup: auditCgroup,
|
|
17095
|
-
result: "allowed"
|
|
15791
|
+
result: "allowed",
|
|
15792
|
+
...passphraseAttested ? { method: "passphrase" } : writeGrantId !== null ? { method: "grant", grant_id: writeGrantId } : {}
|
|
17096
15793
|
});
|
|
17097
15794
|
socket.write(encodeResponse({ ok: true, put: true, key: req.key }));
|
|
17098
15795
|
return;
|
|
@@ -17145,10 +15842,22 @@ class VaultBroker {
|
|
|
17145
15842
|
}
|
|
17146
15843
|
}
|
|
17147
15844
|
if (req.op === "mint_grant") {
|
|
17148
|
-
const { agent, keys, ttl_seconds, description } = req;
|
|
15845
|
+
const { agent, keys, ttl_seconds, description, write_keys } = req;
|
|
15846
|
+
if (keys.length === 0 && (write_keys?.length ?? 0) === 0) {
|
|
15847
|
+
this.auditLogger.write({
|
|
15848
|
+
ts: new Date().toISOString(),
|
|
15849
|
+
op: "mint_grant",
|
|
15850
|
+
caller: auditCaller,
|
|
15851
|
+
pid: auditPid,
|
|
15852
|
+
cgroup: auditCgroup,
|
|
15853
|
+
result: "denied:no-capabilities"
|
|
15854
|
+
});
|
|
15855
|
+
socket.write(encodeResponse(errorResponse("BAD_REQUEST", "mint_grant requires at least one of `keys` or `write_keys` to be non-empty")));
|
|
15856
|
+
return;
|
|
15857
|
+
}
|
|
17149
15858
|
let mintResult;
|
|
17150
15859
|
try {
|
|
17151
|
-
mintResult = await mintGrant(this.grantsDb, agent, keys, ttl_seconds, description);
|
|
15860
|
+
mintResult = await mintGrant(this.grantsDb, agent, keys, ttl_seconds, description, write_keys ?? []);
|
|
17152
15861
|
} catch (err) {
|
|
17153
15862
|
const msg = err instanceof Error ? err.message : String(err);
|
|
17154
15863
|
this.auditLogger.write({
|
|
@@ -17201,10 +15910,11 @@ class VaultBroker {
|
|
|
17201
15910
|
cgroup: auditCgroup,
|
|
17202
15911
|
result: `allowed:${grants.length}`
|
|
17203
15912
|
});
|
|
17204
|
-
const grantMetas = grants.map(({ id, agent_slug, key_allow, expires_at, created_at, description }) => ({
|
|
15913
|
+
const grantMetas = grants.map(({ id, agent_slug, key_allow, write_allow, expires_at, created_at, description }) => ({
|
|
17205
15914
|
id,
|
|
17206
15915
|
agent_slug,
|
|
17207
15916
|
key_allow,
|
|
15917
|
+
write_allow,
|
|
17208
15918
|
expires_at,
|
|
17209
15919
|
created_at,
|
|
17210
15920
|
description
|
|
@@ -17219,9 +15929,9 @@ class VaultBroker {
|
|
|
17219
15929
|
const row = this.grantsDb.query("SELECT agent_slug FROM vault_grants WHERE id = ?").get(id);
|
|
17220
15930
|
if (row) {
|
|
17221
15931
|
const tokenPath = path3.join(os3.homedir(), ".switchroom", "agents", row.agent_slug, ".vault-token");
|
|
17222
|
-
if (
|
|
15932
|
+
if (existsSync7(tokenPath)) {
|
|
17223
15933
|
try {
|
|
17224
|
-
|
|
15934
|
+
unlinkSync4(tokenPath);
|
|
17225
15935
|
} catch {}
|
|
17226
15936
|
}
|
|
17227
15937
|
}
|
|
@@ -17462,7 +16172,7 @@ class VaultBroker {
|
|
|
17462
16172
|
const envPath = process.env.SWITCHROOM_VAULT_BROKER_AUTO_UNLOCK_PATH;
|
|
17463
16173
|
const configuredPath = (envPath && envPath.length > 0 ? envPath : undefined) ?? this.config?.vault?.broker?.autoUnlockCredentialPath ?? DEFAULT_AUTO_UNLOCK_PATH;
|
|
17464
16174
|
const filePath = resolvePath(configuredPath);
|
|
17465
|
-
if (!
|
|
16175
|
+
if (!existsSync7(filePath))
|
|
17466
16176
|
return false;
|
|
17467
16177
|
let passphrase;
|
|
17468
16178
|
try {
|
|
@@ -17499,7 +16209,7 @@ class VaultBroker {
|
|
|
17499
16209
|
const credPath = `${dir}/vault-passphrase`;
|
|
17500
16210
|
let passphrase;
|
|
17501
16211
|
try {
|
|
17502
|
-
passphrase =
|
|
16212
|
+
passphrase = readFileSync7(credPath, "utf8").replace(/\n+$/, "");
|
|
17503
16213
|
} catch (err) {
|
|
17504
16214
|
const code = err.code;
|
|
17505
16215
|
if (code === "ENOENT") {
|
|
@@ -17571,8 +16281,8 @@ async function main() {
|
|
|
17571
16281
|
const vaultPath = process.env.SWITCHROOM_VAULT_PATH;
|
|
17572
16282
|
let perAgentTargets = [];
|
|
17573
16283
|
try {
|
|
17574
|
-
if (
|
|
17575
|
-
const entries =
|
|
16284
|
+
if (existsSync7(perAgentDir)) {
|
|
16285
|
+
const entries = readdirSync2(perAgentDir, { withFileTypes: true });
|
|
17576
16286
|
const flat = [];
|
|
17577
16287
|
const subdirs = [];
|
|
17578
16288
|
for (const e of entries) {
|