@yaklabs-ai/plugin-sdk 0.12.5 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -33
- package/THIRD-PARTY-INVENTORY.json +1 -1
- package/dist/disclosure.d.ts +59 -77
- package/dist/disclosure.js +4 -14
- package/dist/fs.d.ts +156 -0
- package/dist/fs.js +895 -0
- package/dist/jev.d.ts +1 -1
- package/dist/kay-agent-testing.d.ts +58 -76
- package/dist/kay-agent-testing.js +4 -12
- package/dist/kay-agent.d.ts +65 -119
- package/dist/kay-agent.js +0 -11
- package/dist/kay-app.d.ts +156 -61
- package/dist/kay-app.js +22 -1
- package/dist/signals.d.ts +175 -1
- package/dist/signals.js +141 -2
- package/package.json +5 -1
- package/skills/directory-plugin-authoring/SKILL.md +18 -17
package/dist/fs.js
ADDED
|
@@ -0,0 +1,895 @@
|
|
|
1
|
+
// packages/plugin-sdk/dist/fs/index.js
|
|
2
|
+
import { Buffer as Buffer3 } from "node:buffer";
|
|
3
|
+
import { constants } from "node:fs";
|
|
4
|
+
import * as nodeFsp from "node:fs/promises";
|
|
5
|
+
import { basename, dirname, join, resolve as resolve2 } from "node:path";
|
|
6
|
+
|
|
7
|
+
// packages/plugin-sdk/dist/fs/handle.js
|
|
8
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
9
|
+
import { EventEmitter } from "node:events";
|
|
10
|
+
import { createInterface } from "node:readline";
|
|
11
|
+
import { Readable, Writable } from "node:stream";
|
|
12
|
+
|
|
13
|
+
// packages/plugin-sdk/dist/fs/internal.js
|
|
14
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
15
|
+
import { Buffer } from "node:buffer";
|
|
16
|
+
import { Dirent, Stats } from "node:fs";
|
|
17
|
+
import { resolve } from "node:path";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
19
|
+
var KAY_FS_DEFAULT_TIMEOUT_MS = 3e4;
|
|
20
|
+
var KAY_FS_DEADLINE = "ERR_KAY_FS_DEADLINE";
|
|
21
|
+
var KAY_FS_COOLING_DOWN = "ERR_KAY_FS_COOLING_DOWN";
|
|
22
|
+
var KAY_FS_SATURATED = "ERR_KAY_FS_SATURATED";
|
|
23
|
+
var KAY_FS_UNAVAILABLE = "ERR_KAY_FS_UNAVAILABLE";
|
|
24
|
+
var KAY_FS_UNSUPPORTED = "ERR_KAY_FS_UNSUPPORTED";
|
|
25
|
+
var FINISHED = Symbol("kay.fs.finished");
|
|
26
|
+
function wirePath(path) {
|
|
27
|
+
if (path instanceof URL)
|
|
28
|
+
return fileURLToPath(path);
|
|
29
|
+
if (typeof path === "string" || Buffer.isBuffer(path))
|
|
30
|
+
return path;
|
|
31
|
+
if (path instanceof Uint8Array)
|
|
32
|
+
return Buffer.from(path);
|
|
33
|
+
throw Object.assign(new TypeError(`The "path" argument must be of type string or an instance of Buffer or URL. Received ${describeArg(path)}`), { code: "ERR_INVALID_ARG_TYPE" });
|
|
34
|
+
}
|
|
35
|
+
function describeArg(value) {
|
|
36
|
+
if (value === null || value === void 0)
|
|
37
|
+
return String(value);
|
|
38
|
+
if (typeof value === "function")
|
|
39
|
+
return `function ${value.name}`;
|
|
40
|
+
if (typeof value === "object") {
|
|
41
|
+
const name = value.constructor?.name;
|
|
42
|
+
return name === void 0 ? "an object" : `an instance of ${name}`;
|
|
43
|
+
}
|
|
44
|
+
const primitive = value;
|
|
45
|
+
return `type ${typeof value} (${String(primitive)})`;
|
|
46
|
+
}
|
|
47
|
+
function keyPath(path) {
|
|
48
|
+
const wire = wirePath(path);
|
|
49
|
+
return resolve(typeof wire === "string" ? wire : wire.toString());
|
|
50
|
+
}
|
|
51
|
+
function isOptionsObject(value) {
|
|
52
|
+
if (typeof value !== "object" || value === null)
|
|
53
|
+
return false;
|
|
54
|
+
const prototype = Object.getPrototypeOf(value);
|
|
55
|
+
return prototype === Object.prototype || prototype === null;
|
|
56
|
+
}
|
|
57
|
+
function callOptionsOf(options) {
|
|
58
|
+
return isOptionsObject(options) ? options : void 0;
|
|
59
|
+
}
|
|
60
|
+
var scopedTimeout = new AsyncLocalStorage();
|
|
61
|
+
function withTimeout(timeoutMs, run) {
|
|
62
|
+
return scopedTimeout.run(timeoutMs, run);
|
|
63
|
+
}
|
|
64
|
+
var positive = (value) => typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
65
|
+
function timeoutOf(options) {
|
|
66
|
+
const own = callOptionsOf(options)?.timeoutMs;
|
|
67
|
+
if (positive(own))
|
|
68
|
+
return own;
|
|
69
|
+
const scoped = scopedTimeout.getStore();
|
|
70
|
+
return positive(scoped) ? scoped : KAY_FS_DEFAULT_TIMEOUT_MS;
|
|
71
|
+
}
|
|
72
|
+
function signalOf(options) {
|
|
73
|
+
const value = callOptionsOf(options)?.signal;
|
|
74
|
+
return value instanceof AbortSignal ? value : void 0;
|
|
75
|
+
}
|
|
76
|
+
function wireOptions(options) {
|
|
77
|
+
if (callOptionsOf(options) === void 0)
|
|
78
|
+
return options;
|
|
79
|
+
const { signal: _signal, timeoutMs: _timeoutMs, ...rest } = options;
|
|
80
|
+
void _signal;
|
|
81
|
+
void _timeoutMs;
|
|
82
|
+
return rest;
|
|
83
|
+
}
|
|
84
|
+
function wireData(data) {
|
|
85
|
+
if (typeof data === "string" || Buffer.isBuffer(data))
|
|
86
|
+
return data;
|
|
87
|
+
if (ArrayBuffer.isView(data)) {
|
|
88
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
89
|
+
}
|
|
90
|
+
return data;
|
|
91
|
+
}
|
|
92
|
+
function asBuffer(value) {
|
|
93
|
+
if (Buffer.isBuffer(value))
|
|
94
|
+
return value;
|
|
95
|
+
const bytes = value;
|
|
96
|
+
return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
97
|
+
}
|
|
98
|
+
function stringOrBuffer(value) {
|
|
99
|
+
return typeof value === "string" ? value : asBuffer(value);
|
|
100
|
+
}
|
|
101
|
+
function asStats(value) {
|
|
102
|
+
return Object.assign(Object.create(Stats.prototype), value);
|
|
103
|
+
}
|
|
104
|
+
function asDirent(value) {
|
|
105
|
+
const entry = value;
|
|
106
|
+
const DirentClass = Dirent;
|
|
107
|
+
const name = typeof entry.name === "string" ? entry.name : asBuffer(entry.name);
|
|
108
|
+
return new DirentClass(name, entry.type, entry.parentPath);
|
|
109
|
+
}
|
|
110
|
+
function asEntries(value, withFileTypes2) {
|
|
111
|
+
const list = value;
|
|
112
|
+
if (withFileTypes2)
|
|
113
|
+
return list.map(asDirent);
|
|
114
|
+
return list.map((entry) => typeof entry === "string" ? entry : asBuffer(entry));
|
|
115
|
+
}
|
|
116
|
+
function assignFields(target, fields) {
|
|
117
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
118
|
+
if (value !== void 0) {
|
|
119
|
+
Object.defineProperty(target, key, {
|
|
120
|
+
value,
|
|
121
|
+
enumerable: true,
|
|
122
|
+
writable: true,
|
|
123
|
+
configurable: true
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return target;
|
|
128
|
+
}
|
|
129
|
+
var ERROR_CLASSES = {
|
|
130
|
+
TypeError,
|
|
131
|
+
RangeError,
|
|
132
|
+
SyntaxError
|
|
133
|
+
};
|
|
134
|
+
function nodeError(error) {
|
|
135
|
+
const ErrorClass = ERROR_CLASSES[error.name ?? ""] ?? Error;
|
|
136
|
+
const rebuilt = new ErrorClass(error.message);
|
|
137
|
+
if (error.name !== void 0 && error.name !== rebuilt.name) {
|
|
138
|
+
rebuilt.name = error.name;
|
|
139
|
+
}
|
|
140
|
+
return assignFields(rebuilt, {
|
|
141
|
+
errno: error.errno,
|
|
142
|
+
code: error.code,
|
|
143
|
+
syscall: error.syscall,
|
|
144
|
+
path: error.path,
|
|
145
|
+
dest: error.dest
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function kayError(code, detail, syscall, path) {
|
|
149
|
+
return assignFields(new Error(`${code}: ${detail}, ${syscall}${path === void 0 ? "" : ` '${path}'`}`), { code, syscall, path });
|
|
150
|
+
}
|
|
151
|
+
function abortError(signal) {
|
|
152
|
+
const error = new Error("The operation was aborted", {
|
|
153
|
+
cause: signal?.reason
|
|
154
|
+
});
|
|
155
|
+
error.name = "AbortError";
|
|
156
|
+
return assignFields(error, { code: "ABORT_ERR" });
|
|
157
|
+
}
|
|
158
|
+
function unsupported(syscall, what) {
|
|
159
|
+
return kayError(KAY_FS_UNSUPPORTED, `${what} is not supported by @kay/plugin-sdk/fs`, syscall, void 0);
|
|
160
|
+
}
|
|
161
|
+
function finishedOf(error) {
|
|
162
|
+
return error?.[FINISHED];
|
|
163
|
+
}
|
|
164
|
+
var TIMEOUT_CODES = {
|
|
165
|
+
deadline: KAY_FS_DEADLINE,
|
|
166
|
+
"cooling-down": KAY_FS_COOLING_DOWN,
|
|
167
|
+
saturated: KAY_FS_SATURATED
|
|
168
|
+
};
|
|
169
|
+
function unwrap(result, syscall, path, signal) {
|
|
170
|
+
switch (result.kind) {
|
|
171
|
+
case "ok":
|
|
172
|
+
return result.value;
|
|
173
|
+
case "error":
|
|
174
|
+
throw nodeError(result.error);
|
|
175
|
+
case "aborted": {
|
|
176
|
+
const error = abortError(signal);
|
|
177
|
+
if (result.finished !== void 0) {
|
|
178
|
+
Object.defineProperty(error, FINISHED, { value: result.finished });
|
|
179
|
+
}
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
case "unavailable":
|
|
183
|
+
throw kayError(KAY_FS_UNAVAILABLE, result.detail, syscall, path);
|
|
184
|
+
case "timeout": {
|
|
185
|
+
const error = kayError(TIMEOUT_CODES[result.reason], result.detail, syscall, path);
|
|
186
|
+
if (result.reason === "deadline") {
|
|
187
|
+
Object.defineProperty(error, FINISHED, { value: result.finished });
|
|
188
|
+
}
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
async function invoke(backend, name, args, options) {
|
|
194
|
+
if (options.signal?.aborted === true)
|
|
195
|
+
throw abortError(options.signal);
|
|
196
|
+
const request = {
|
|
197
|
+
op: "call",
|
|
198
|
+
name,
|
|
199
|
+
args,
|
|
200
|
+
paths: options.paths,
|
|
201
|
+
timeoutMs: options.timeoutMs ?? timeoutOf(void 0),
|
|
202
|
+
...options.signal === void 0 ? {} : { signal: options.signal },
|
|
203
|
+
...options.opensFd === true ? { opensFd: true } : {},
|
|
204
|
+
...options.walksTree === true ? { walksTree: true } : {}
|
|
205
|
+
};
|
|
206
|
+
return unwrap(await backend.run(request), name, options.paths[0], options.signal);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// packages/plugin-sdk/dist/fs/handle.js
|
|
210
|
+
var DEFAULT_READ_BYTES = 16 * 1024;
|
|
211
|
+
var STREAM_HIGH_WATER_MARK = 64 * 1024;
|
|
212
|
+
function closeDescriptor(token) {
|
|
213
|
+
return token.backend.run({
|
|
214
|
+
op: "call",
|
|
215
|
+
name: "close",
|
|
216
|
+
args: [token.fd],
|
|
217
|
+
paths: [],
|
|
218
|
+
timeoutMs: KAY_FS_DEFAULT_TIMEOUT_MS
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function closeWhenIdle(token) {
|
|
222
|
+
void Promise.all(token.workers).then(() => closeDescriptor(token));
|
|
223
|
+
}
|
|
224
|
+
var collector = new FinalizationRegistry(closeWhenIdle);
|
|
225
|
+
function bytesOf(view) {
|
|
226
|
+
return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
227
|
+
}
|
|
228
|
+
function positionOf(value) {
|
|
229
|
+
if (typeof value === "bigint")
|
|
230
|
+
return Number(value);
|
|
231
|
+
return typeof value === "number" && value >= 0 ? value : null;
|
|
232
|
+
}
|
|
233
|
+
function readArgs(args) {
|
|
234
|
+
const [first, second, third, fourth] = args;
|
|
235
|
+
if (first === void 0 || !ArrayBuffer.isView(first) && typeof first === "object") {
|
|
236
|
+
const options = first ?? {};
|
|
237
|
+
const buffer2 = options["buffer"] ?? Buffer2.alloc(DEFAULT_READ_BYTES);
|
|
238
|
+
const offset2 = options["offset"] ?? 0;
|
|
239
|
+
return {
|
|
240
|
+
buffer: buffer2,
|
|
241
|
+
offset: offset2,
|
|
242
|
+
length: options["length"] ?? buffer2.byteLength - offset2,
|
|
243
|
+
position: positionOf(options["position"])
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
const buffer = first;
|
|
247
|
+
if (typeof second === "object" && second !== null) {
|
|
248
|
+
const options = second;
|
|
249
|
+
const offset2 = options["offset"] ?? 0;
|
|
250
|
+
return {
|
|
251
|
+
buffer,
|
|
252
|
+
offset: offset2,
|
|
253
|
+
length: options["length"] ?? buffer.byteLength - offset2,
|
|
254
|
+
position: positionOf(options["position"])
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
const offset = second ?? 0;
|
|
258
|
+
return {
|
|
259
|
+
buffer,
|
|
260
|
+
offset,
|
|
261
|
+
length: third ?? buffer.byteLength - offset,
|
|
262
|
+
position: positionOf(fourth)
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
var KayFileHandle = class extends EventEmitter {
|
|
266
|
+
#fd;
|
|
267
|
+
#path;
|
|
268
|
+
#backend;
|
|
269
|
+
#token;
|
|
270
|
+
/** Calls whose caller has not been answered yet; `close()` waits for them. */
|
|
271
|
+
#callers = /* @__PURE__ */ new Set();
|
|
272
|
+
#closed = false;
|
|
273
|
+
/** Set when a call missed its deadline: settles once that call stops running. */
|
|
274
|
+
#stuck;
|
|
275
|
+
constructor(fd, path, backend) {
|
|
276
|
+
super();
|
|
277
|
+
this.#fd = fd;
|
|
278
|
+
this.#path = path;
|
|
279
|
+
this.#backend = backend;
|
|
280
|
+
this.#token = { fd, backend, workers: /* @__PURE__ */ new Set() };
|
|
281
|
+
collector.register(this, this.#token, this);
|
|
282
|
+
}
|
|
283
|
+
get fd() {
|
|
284
|
+
return this.#fd;
|
|
285
|
+
}
|
|
286
|
+
#usable(syscall) {
|
|
287
|
+
if (this.#closed) {
|
|
288
|
+
throw Object.assign(new Error("file closed"), { code: "EBADF", syscall });
|
|
289
|
+
}
|
|
290
|
+
if (this.#stuck !== void 0) {
|
|
291
|
+
throw kayError(KAY_FS_DEADLINE, "an earlier call on this file handle did not finish; it can only be closed", syscall, this.#path);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
async #settle(syscall, run, signal) {
|
|
295
|
+
this.#usable(syscall);
|
|
296
|
+
if (signal?.aborted === true)
|
|
297
|
+
throw abortError(signal);
|
|
298
|
+
const workers = this.#token.workers;
|
|
299
|
+
let workerDone;
|
|
300
|
+
const worker = new Promise((resolveWorker) => {
|
|
301
|
+
workerDone = () => {
|
|
302
|
+
workers.delete(worker);
|
|
303
|
+
resolveWorker();
|
|
304
|
+
};
|
|
305
|
+
});
|
|
306
|
+
workers.add(worker);
|
|
307
|
+
const pending = run();
|
|
308
|
+
this.#callers.add(pending);
|
|
309
|
+
let result;
|
|
310
|
+
try {
|
|
311
|
+
result = await pending;
|
|
312
|
+
} finally {
|
|
313
|
+
this.#callers.delete(pending);
|
|
314
|
+
}
|
|
315
|
+
const finished = "finished" in result ? result.finished : void 0;
|
|
316
|
+
if (finished === void 0)
|
|
317
|
+
workerDone();
|
|
318
|
+
else
|
|
319
|
+
void finished.then(workerDone);
|
|
320
|
+
try {
|
|
321
|
+
return unwrap(result, syscall, this.#path, signal);
|
|
322
|
+
} catch (error) {
|
|
323
|
+
if (result.kind === "timeout")
|
|
324
|
+
this.#stuck = finishedOf(error);
|
|
325
|
+
throw error;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
#call(name, args, options) {
|
|
329
|
+
const signal = signalOf(options);
|
|
330
|
+
return this.#settle(name, () => this.#backend.run({
|
|
331
|
+
op: "call",
|
|
332
|
+
name,
|
|
333
|
+
args: [this.#fd, ...args],
|
|
334
|
+
paths: [this.#path],
|
|
335
|
+
timeoutMs: timeoutOf(options),
|
|
336
|
+
...signal === void 0 ? {} : { signal }
|
|
337
|
+
}), signal);
|
|
338
|
+
}
|
|
339
|
+
async read(...args) {
|
|
340
|
+
const { buffer, offset, length, position } = readArgs(args);
|
|
341
|
+
if (length === 0)
|
|
342
|
+
return { bytesRead: 0, buffer };
|
|
343
|
+
const value = await this.#settle("read", () => this.#backend.run({
|
|
344
|
+
op: "read",
|
|
345
|
+
fd: this.#fd,
|
|
346
|
+
length,
|
|
347
|
+
position,
|
|
348
|
+
paths: [this.#path],
|
|
349
|
+
timeoutMs: timeoutOf(void 0)
|
|
350
|
+
}));
|
|
351
|
+
bytesOf(buffer).set(value.bytes, offset);
|
|
352
|
+
return { bytesRead: value.bytesRead, buffer };
|
|
353
|
+
}
|
|
354
|
+
async readv(buffers, position) {
|
|
355
|
+
let bytesRead = 0;
|
|
356
|
+
let at = positionOf(position);
|
|
357
|
+
for (const buffer of buffers) {
|
|
358
|
+
const { bytesRead: n } = await this.read(buffer, 0, buffer.byteLength, at);
|
|
359
|
+
bytesRead += n;
|
|
360
|
+
if (at !== null)
|
|
361
|
+
at += n;
|
|
362
|
+
if (n < buffer.byteLength)
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
return { bytesRead, buffers: [...buffers] };
|
|
366
|
+
}
|
|
367
|
+
async write(data, ...rest) {
|
|
368
|
+
if (typeof data === "string") {
|
|
369
|
+
const [position2, encoding] = rest;
|
|
370
|
+
const bytesWritten2 = await this.#call("write", [
|
|
371
|
+
data,
|
|
372
|
+
positionOf(position2),
|
|
373
|
+
encoding ?? "utf8"
|
|
374
|
+
]);
|
|
375
|
+
return { bytesWritten: bytesWritten2, buffer: data };
|
|
376
|
+
}
|
|
377
|
+
const view = data;
|
|
378
|
+
const options = isOptionsObject(rest[0]) ? rest[0] : void 0;
|
|
379
|
+
const offset = options === void 0 ? rest[0] ?? 0 : options["offset"] ?? 0;
|
|
380
|
+
const length = options === void 0 ? rest[1] ?? view.byteLength - offset : options["length"] ?? view.byteLength - offset;
|
|
381
|
+
const position = positionOf(options === void 0 ? rest[2] : options["position"]);
|
|
382
|
+
const bytes = bytesOf(view).slice(offset, offset + length);
|
|
383
|
+
const bytesWritten = await this.#call("write", [
|
|
384
|
+
bytes,
|
|
385
|
+
0,
|
|
386
|
+
length,
|
|
387
|
+
position
|
|
388
|
+
]);
|
|
389
|
+
return { bytesWritten, buffer: data };
|
|
390
|
+
}
|
|
391
|
+
async writev(buffers, position) {
|
|
392
|
+
let bytesWritten = 0;
|
|
393
|
+
let at = positionOf(position);
|
|
394
|
+
for (const buffer of buffers) {
|
|
395
|
+
const n = await this.#writeAll(bytesOf(buffer), at);
|
|
396
|
+
bytesWritten += n;
|
|
397
|
+
if (at !== null)
|
|
398
|
+
at += n;
|
|
399
|
+
}
|
|
400
|
+
return { bytesWritten, buffers: [...buffers] };
|
|
401
|
+
}
|
|
402
|
+
async #writeAll(bytes, position) {
|
|
403
|
+
let written = 0;
|
|
404
|
+
while (written < bytes.byteLength) {
|
|
405
|
+
const { bytesWritten } = await this.write(bytes, written, bytes.byteLength - written, position === null ? null : position + written);
|
|
406
|
+
if (bytesWritten === 0)
|
|
407
|
+
break;
|
|
408
|
+
written += bytesWritten;
|
|
409
|
+
}
|
|
410
|
+
return written;
|
|
411
|
+
}
|
|
412
|
+
async readFile(options) {
|
|
413
|
+
return stringOrBuffer(await this.#call("readFile", [wireOptions(options)], options));
|
|
414
|
+
}
|
|
415
|
+
async writeFile(data, options) {
|
|
416
|
+
if (typeof data === "string" || ArrayBuffer.isView(data)) {
|
|
417
|
+
await this.#call("writeFile", [wireData(data), wireOptions(options)], options);
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
const encoding = typeof options === "string" ? options : options?.encoding ?? "utf8";
|
|
421
|
+
for await (const chunk of data) {
|
|
422
|
+
const bytes = typeof chunk === "string" ? Buffer2.from(chunk, encoding) : bytesOf(chunk);
|
|
423
|
+
await this.#writeAll(bytes, null);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
async appendFile(data, options) {
|
|
427
|
+
if (typeof data === "string" || ArrayBuffer.isView(data)) {
|
|
428
|
+
await this.#call("appendFile", [wireData(data), wireOptions(options)], options);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
await this.writeFile(data, options);
|
|
432
|
+
}
|
|
433
|
+
async stat(options) {
|
|
434
|
+
if (options?.bigint === true)
|
|
435
|
+
throw unsupported("fstat", "bigint stats");
|
|
436
|
+
return asStats(await this.#call("fstat", []));
|
|
437
|
+
}
|
|
438
|
+
async truncate(length) {
|
|
439
|
+
await this.#call("ftruncate", [length ?? 0]);
|
|
440
|
+
}
|
|
441
|
+
async sync() {
|
|
442
|
+
await this.#call("fsync", []);
|
|
443
|
+
}
|
|
444
|
+
async datasync() {
|
|
445
|
+
await this.#call("fdatasync", []);
|
|
446
|
+
}
|
|
447
|
+
async utimes(atime, mtime) {
|
|
448
|
+
await this.#call("futimes", [atime, mtime]);
|
|
449
|
+
}
|
|
450
|
+
async chmod(mode) {
|
|
451
|
+
await this.#call("fchmod", [mode]);
|
|
452
|
+
}
|
|
453
|
+
async chown(uid, gid) {
|
|
454
|
+
await this.#call("fchown", [uid, gid]);
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Like Node's, waits for calls still pending on this handle, then closes the fd. A call that
|
|
458
|
+
* missed its deadline or was aborted may leave a worker inside it: closing then could hand the
|
|
459
|
+
* fd's number to a new file mid-call, so the host closes it once that call returns, and this
|
|
460
|
+
* answers without waiting for that.
|
|
461
|
+
*/
|
|
462
|
+
async close() {
|
|
463
|
+
if (this.#closed)
|
|
464
|
+
return;
|
|
465
|
+
this.#closed = true;
|
|
466
|
+
this.#fd = -1;
|
|
467
|
+
collector.unregister(this);
|
|
468
|
+
try {
|
|
469
|
+
await Promise.allSettled(this.#callers);
|
|
470
|
+
if (this.#token.workers.size > 0) {
|
|
471
|
+
closeWhenIdle(this.#token);
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
unwrap(await closeDescriptor(this.#token), "close", this.#path);
|
|
475
|
+
} finally {
|
|
476
|
+
this.emit("close");
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
[Symbol.asyncDispose]() {
|
|
480
|
+
return this.close();
|
|
481
|
+
}
|
|
482
|
+
createReadStream(options) {
|
|
483
|
+
const highWaterMark = options?.highWaterMark ?? STREAM_HIGH_WATER_MARK;
|
|
484
|
+
const end = options?.end ?? Number.POSITIVE_INFINITY;
|
|
485
|
+
let position = options?.start ?? (options?.end === void 0 ? null : 0);
|
|
486
|
+
const autoClose = options?.autoClose ?? true;
|
|
487
|
+
const stream = new Readable({
|
|
488
|
+
highWaterMark,
|
|
489
|
+
read: () => {
|
|
490
|
+
const remaining = position === null ? highWaterMark : Math.min(highWaterMark, end - position + 1);
|
|
491
|
+
if (remaining <= 0) {
|
|
492
|
+
stream.push(null);
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
this.read(Buffer2.allocUnsafe(remaining), 0, remaining, position).then(({ bytesRead, buffer }) => {
|
|
496
|
+
if (bytesRead === 0) {
|
|
497
|
+
stream.push(null);
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
if (position !== null)
|
|
501
|
+
position += bytesRead;
|
|
502
|
+
stream.push(buffer.subarray(0, bytesRead));
|
|
503
|
+
}, (error) => stream.destroy(error));
|
|
504
|
+
},
|
|
505
|
+
destroy: (error, callback) => {
|
|
506
|
+
if (!autoClose) {
|
|
507
|
+
callback(error);
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
this.close().then(() => callback(error), (closeError) => callback(error ?? closeError));
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
if (options?.encoding !== void 0 && options.encoding !== null) {
|
|
514
|
+
stream.setEncoding(options.encoding);
|
|
515
|
+
}
|
|
516
|
+
return stream;
|
|
517
|
+
}
|
|
518
|
+
createWriteStream(options) {
|
|
519
|
+
let position = options?.start ?? null;
|
|
520
|
+
const autoClose = options?.autoClose ?? true;
|
|
521
|
+
const encoding = options?.encoding ?? "utf8";
|
|
522
|
+
const stream = new Writable({
|
|
523
|
+
highWaterMark: options?.highWaterMark ?? STREAM_HIGH_WATER_MARK,
|
|
524
|
+
// Strings written without an encoding are encoded with the stream's, as Node's are.
|
|
525
|
+
defaultEncoding: encoding,
|
|
526
|
+
write: (chunk, chunkEncoding, callback) => {
|
|
527
|
+
const bytes = typeof chunk === "string" ? Buffer2.from(chunk, chunkEncoding === "buffer" ? encoding : chunkEncoding) : bytesOf(chunk);
|
|
528
|
+
this.#writeAll(bytes, position).then((written) => {
|
|
529
|
+
if (position !== null)
|
|
530
|
+
position += written;
|
|
531
|
+
callback();
|
|
532
|
+
}, (error) => callback(error));
|
|
533
|
+
},
|
|
534
|
+
final: (callback) => {
|
|
535
|
+
if (options?.flush !== true) {
|
|
536
|
+
callback();
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
this.sync().then(() => callback(), (error) => callback(error));
|
|
540
|
+
},
|
|
541
|
+
destroy: (error, callback) => {
|
|
542
|
+
if (!autoClose) {
|
|
543
|
+
callback(error);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
this.close().then(() => callback(error), (closeError) => callback(error ?? closeError));
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
return stream;
|
|
550
|
+
}
|
|
551
|
+
readLines(options) {
|
|
552
|
+
return createInterface({
|
|
553
|
+
input: this.createReadStream(options),
|
|
554
|
+
crlfDelay: Number.POSITIVE_INFINITY
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
readableWebStream() {
|
|
558
|
+
return Readable.toWeb(this.createReadStream());
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
function asFileHandle(handle) {
|
|
562
|
+
return handle;
|
|
563
|
+
}
|
|
564
|
+
var KayDir = class {
|
|
565
|
+
path;
|
|
566
|
+
#entries;
|
|
567
|
+
#closed = false;
|
|
568
|
+
constructor(path, entries) {
|
|
569
|
+
this.path = path;
|
|
570
|
+
this.#entries = entries;
|
|
571
|
+
}
|
|
572
|
+
async read() {
|
|
573
|
+
if (this.#closed) {
|
|
574
|
+
throw Object.assign(new Error("Directory handle was closed"), {
|
|
575
|
+
code: "ERR_DIR_CLOSED"
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
return this.#entries.shift() ?? null;
|
|
579
|
+
}
|
|
580
|
+
async close() {
|
|
581
|
+
this.#closed = true;
|
|
582
|
+
}
|
|
583
|
+
readSync() {
|
|
584
|
+
throw unsupported("readdir", "Dir.readSync");
|
|
585
|
+
}
|
|
586
|
+
closeSync() {
|
|
587
|
+
throw unsupported("closedir", "Dir.closeSync");
|
|
588
|
+
}
|
|
589
|
+
async *[Symbol.asyncIterator]() {
|
|
590
|
+
try {
|
|
591
|
+
const first = await this.read();
|
|
592
|
+
if (first === null)
|
|
593
|
+
return;
|
|
594
|
+
yield first;
|
|
595
|
+
yield* this.#entries.splice(0);
|
|
596
|
+
} finally {
|
|
597
|
+
await this.close();
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
[Symbol.asyncDispose]() {
|
|
601
|
+
return this.close();
|
|
602
|
+
}
|
|
603
|
+
[Symbol.dispose]() {
|
|
604
|
+
this.#closed = true;
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
// packages/plugin-sdk/dist/fs/host.js
|
|
609
|
+
var KAY_FS_BACKEND = Symbol.for("kay.plugin-sdk.fs.backend.v1");
|
|
610
|
+
function currentKayFsBackend() {
|
|
611
|
+
return globalThis[KAY_FS_BACKEND];
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// packages/plugin-sdk/dist/fs/index.js
|
|
615
|
+
function route(node, host) {
|
|
616
|
+
return ((...args) => {
|
|
617
|
+
const backend = currentKayFsBackend();
|
|
618
|
+
if (backend === void 0) {
|
|
619
|
+
return node()(...args);
|
|
620
|
+
}
|
|
621
|
+
try {
|
|
622
|
+
return host(backend, ...args);
|
|
623
|
+
} catch (error) {
|
|
624
|
+
return Promise.reject(error);
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
function lastOptions(args) {
|
|
629
|
+
const last = args.at(-1);
|
|
630
|
+
return isOptionsObject(last) ? last : void 0;
|
|
631
|
+
}
|
|
632
|
+
function recursive(options) {
|
|
633
|
+
return options?.recursive === true;
|
|
634
|
+
}
|
|
635
|
+
function onPath(backend, name, path, rest, walksTree = false) {
|
|
636
|
+
const options = lastOptions(rest);
|
|
637
|
+
const signal = signalOf(options);
|
|
638
|
+
return invoke(backend, name, [
|
|
639
|
+
wirePath(path),
|
|
640
|
+
...rest.map((arg) => arg === options ? wireOptions(arg) : arg)
|
|
641
|
+
], {
|
|
642
|
+
paths: [keyPath(path)],
|
|
643
|
+
timeoutMs: timeoutOf(options),
|
|
644
|
+
walksTree,
|
|
645
|
+
...signal === void 0 ? {} : { signal }
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
function onTwoPaths(backend, name, from, to, rest, walksTree = false) {
|
|
649
|
+
const options = lastOptions(rest);
|
|
650
|
+
return invoke(backend, name, [
|
|
651
|
+
wirePath(from),
|
|
652
|
+
wirePath(to),
|
|
653
|
+
...rest.map((arg) => arg === options ? wireOptions(arg) : arg)
|
|
654
|
+
], {
|
|
655
|
+
paths: [keyPath(from), keyPath(to)],
|
|
656
|
+
timeoutMs: timeoutOf(options),
|
|
657
|
+
walksTree
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
function rejectBigint(syscall, options) {
|
|
661
|
+
if (options?.bigint === true) {
|
|
662
|
+
throw unsupported(syscall, "bigint stats");
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
function withFileTypes(options) {
|
|
666
|
+
return options?.withFileTypes === true;
|
|
667
|
+
}
|
|
668
|
+
var isHandle = (value) => value instanceof KayFileHandle;
|
|
669
|
+
var voidResult = async (pending) => {
|
|
670
|
+
await pending;
|
|
671
|
+
};
|
|
672
|
+
var access2 = route(() => nodeFsp.access, (backend, path, ...rest) => voidResult(onPath(backend, "access", path, rest)));
|
|
673
|
+
var appendFile2 = route(() => nodeFsp.appendFile, (backend, path, data, options) => isHandle(path) ? path.appendFile(data, options) : voidResult(onPath(backend, "appendFile", path, [wireData(data), options])));
|
|
674
|
+
var chmod2 = route(() => nodeFsp.chmod, (backend, path, mode) => voidResult(onPath(backend, "chmod", path, [mode])));
|
|
675
|
+
var chown2 = route(() => nodeFsp.chown, (backend, path, uid, gid) => voidResult(onPath(backend, "chown", path, [uid, gid])));
|
|
676
|
+
var lchown2 = route(() => nodeFsp.lchown, (backend, path, uid, gid) => voidResult(onPath(backend, "lchown", path, [uid, gid])));
|
|
677
|
+
var lchmod2 = route(() => nodeFsp.lchmod, async () => {
|
|
678
|
+
throw unsupported("lchmod", "lchmod");
|
|
679
|
+
});
|
|
680
|
+
var copyFile2 = route(() => nodeFsp.copyFile, (backend, from, to, mode) => voidResult(onTwoPaths(backend, "copyFile", from, to, mode === void 0 ? [] : [mode])));
|
|
681
|
+
var cp2 = route(() => nodeFsp.cp, async (backend, from, to, options) => {
|
|
682
|
+
if (typeof options?.filter === "function") {
|
|
683
|
+
throw unsupported("cp", "a cp filter function");
|
|
684
|
+
}
|
|
685
|
+
await onTwoPaths(backend, "cp", from, to, options === void 0 ? [] : [options], recursive(options));
|
|
686
|
+
});
|
|
687
|
+
var link2 = route(() => nodeFsp.link, (backend, existing, created) => voidResult(onTwoPaths(backend, "link", existing, created, [])));
|
|
688
|
+
var symlink2 = route(
|
|
689
|
+
() => nodeFsp.symlink,
|
|
690
|
+
// The target is stored as text and may be relative to the link, so only the link is a path.
|
|
691
|
+
(backend, target, path, type) => voidResult(invoke(backend, "symlink", [wirePath(target), wirePath(path), type ?? null], {
|
|
692
|
+
paths: [keyPath(path)]
|
|
693
|
+
}))
|
|
694
|
+
);
|
|
695
|
+
var lstat2 = route(() => nodeFsp.lstat, async (backend, path, options) => {
|
|
696
|
+
rejectBigint("lstat", options);
|
|
697
|
+
return asStats(await onPath(backend, "lstat", path, options === void 0 ? [] : [options]));
|
|
698
|
+
});
|
|
699
|
+
var stat2 = route(() => nodeFsp.stat, async (backend, path, options) => {
|
|
700
|
+
rejectBigint("stat", options);
|
|
701
|
+
return asStats(await onPath(backend, "stat", path, options === void 0 ? [] : [options]));
|
|
702
|
+
});
|
|
703
|
+
var statfs2 = route(() => nodeFsp.statfs, async (backend, path, options) => {
|
|
704
|
+
rejectBigint("statfs", options);
|
|
705
|
+
return onPath(backend, "statfs", path, options === void 0 ? [] : [options]);
|
|
706
|
+
});
|
|
707
|
+
var lutimes2 = route(() => nodeFsp.lutimes, (backend, path, atime, mtime) => voidResult(onPath(backend, "lutimes", path, [atime, mtime])));
|
|
708
|
+
var utimes2 = route(() => nodeFsp.utimes, (backend, path, atime, mtime) => voidResult(onPath(backend, "utimes", path, [atime, mtime])));
|
|
709
|
+
var mkdir2 = route(() => nodeFsp.mkdir, async (backend, path, options) => {
|
|
710
|
+
const created = await onPath(backend, "mkdir", path, options === void 0 ? [] : [options]);
|
|
711
|
+
return created === null ? void 0 : created;
|
|
712
|
+
});
|
|
713
|
+
var mkdtemp2 = route(() => nodeFsp.mkdtemp, async (backend, prefix, options) => stringOrBuffer(await invoke(backend, "mkdtemp", [wirePath(prefix), wireOptions(options) ?? null], {
|
|
714
|
+
paths: [dirname(keyPath(prefix))],
|
|
715
|
+
timeoutMs: timeoutOf(options)
|
|
716
|
+
})));
|
|
717
|
+
var mkdtempDisposable2 = route(() => nodeFsp.mkdtempDisposable, async (_backend, prefix, options) => {
|
|
718
|
+
const path = await mkdtemp2(prefix, options);
|
|
719
|
+
const remove = () => rm2(path, { recursive: true, force: true });
|
|
720
|
+
return { path, remove, [Symbol.asyncDispose]: remove };
|
|
721
|
+
});
|
|
722
|
+
var open2 = route(() => nodeFsp.open, async (backend, path, flags, mode) => {
|
|
723
|
+
const fd = await invoke(backend, "open", [wirePath(path), flags ?? "r", mode ?? 438], { paths: [keyPath(path)], opensFd: true });
|
|
724
|
+
return asFileHandle(new KayFileHandle(fd, keyPath(path), backend));
|
|
725
|
+
});
|
|
726
|
+
var readdir2 = route(() => nodeFsp.readdir, async (backend, path, options) => asEntries(await onPath(backend, "readdir", path, options === void 0 ? [] : [options], recursive(options)), withFileTypes(options)));
|
|
727
|
+
var opendir2 = route(() => nodeFsp.opendir, async (backend, path, options) => {
|
|
728
|
+
const walks = recursive(options);
|
|
729
|
+
const entries = asEntries(await onPath(backend, "readdir", path, [{ withFileTypes: true, recursive: walks }], walks), true);
|
|
730
|
+
const shown = typeof path === "string" ? path : keyPath(path);
|
|
731
|
+
return new KayDir(shown, entries);
|
|
732
|
+
});
|
|
733
|
+
var readFile2 = route(() => nodeFsp.readFile, async (backend, path, options) => isHandle(path) ? path.readFile(options) : stringOrBuffer(await onPath(backend, "readFile", path, options === void 0 ? [] : [options])));
|
|
734
|
+
var readlink2 = route(() => nodeFsp.readlink, async (backend, path, options) => stringOrBuffer(await onPath(backend, "readlink", path, options === void 0 ? [] : [options])));
|
|
735
|
+
var realpath2 = route(() => nodeFsp.realpath, async (backend, path, options) => stringOrBuffer(await onPath(backend, "realpath", path, options === void 0 ? [] : [options])));
|
|
736
|
+
var rename2 = route(() => nodeFsp.rename, (backend, from, to) => voidResult(onTwoPaths(backend, "rename", from, to, [])));
|
|
737
|
+
var rm2 = route(() => nodeFsp.rm, (backend, path, options) => voidResult(onPath(backend, "rm", path, options === void 0 ? [] : [options], recursive(options))));
|
|
738
|
+
var rmdir2 = route(() => nodeFsp.rmdir, (backend, path, options) => voidResult(onPath(backend, "rmdir", path, options === void 0 ? [] : [options])));
|
|
739
|
+
var truncate2 = route(() => nodeFsp.truncate, (backend, path, length) => voidResult(onPath(backend, "truncate", path, [length ?? 0])));
|
|
740
|
+
var unlink2 = route(() => nodeFsp.unlink, (backend, path) => voidResult(onPath(backend, "unlink", path, [])));
|
|
741
|
+
var writeFile2 = route(() => nodeFsp.writeFile, async (backend, path, data, options) => {
|
|
742
|
+
if (isHandle(path))
|
|
743
|
+
return path.writeFile(data, options);
|
|
744
|
+
if (typeof data === "string" || ArrayBuffer.isView(data)) {
|
|
745
|
+
await onPath(backend, "writeFile", path, [wireData(data), options]);
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
const flag = options?.flag ?? "w";
|
|
749
|
+
const mode = options?.mode;
|
|
750
|
+
const handle = await open2(path, flag, mode);
|
|
751
|
+
try {
|
|
752
|
+
await handle.writeFile(data, options);
|
|
753
|
+
} finally {
|
|
754
|
+
await handle.close();
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
var glob2 = route(() => nodeFsp.glob, (backend, pattern, options) => {
|
|
758
|
+
const exclude = options?.exclude;
|
|
759
|
+
const cwd = options?.cwd;
|
|
760
|
+
return (async function* () {
|
|
761
|
+
if (typeof exclude === "function") {
|
|
762
|
+
throw unsupported("glob", "a glob exclude function");
|
|
763
|
+
}
|
|
764
|
+
const wire = wireOptions(options);
|
|
765
|
+
const found = await invoke(backend, "glob", [
|
|
766
|
+
pattern,
|
|
767
|
+
wire === void 0 ? {} : { ...wire, ...cwd === void 0 ? {} : { cwd: wirePath(cwd) } }
|
|
768
|
+
], {
|
|
769
|
+
paths: [cwd === void 0 ? resolve2(".") : keyPath(cwd)],
|
|
770
|
+
timeoutMs: timeoutOf(options),
|
|
771
|
+
walksTree: true
|
|
772
|
+
});
|
|
773
|
+
yield* asEntries(found, withFileTypes(options));
|
|
774
|
+
})();
|
|
775
|
+
});
|
|
776
|
+
var watch2 = route(
|
|
777
|
+
() => nodeFsp.watch,
|
|
778
|
+
// Node returns the iterator at once and fails on iteration; so does this.
|
|
779
|
+
() => (async function* () {
|
|
780
|
+
yield* [];
|
|
781
|
+
throw unsupported("watch", "fs watching (it has its own host worker)");
|
|
782
|
+
})()
|
|
783
|
+
);
|
|
784
|
+
async function writeFileAtomic(path, data, options) {
|
|
785
|
+
if (options?.timeoutMs !== void 0) {
|
|
786
|
+
const { timeoutMs, ...rest } = options;
|
|
787
|
+
return withTimeout(timeoutMs, () => writeFileAtomic(path, data, rest));
|
|
788
|
+
}
|
|
789
|
+
const target = keyPath(path);
|
|
790
|
+
const folder = dirname(target);
|
|
791
|
+
const temporary = join(folder, `.${basename(target)}.${globalThis.crypto.randomUUID()}.tmp`);
|
|
792
|
+
const handle = await open2(temporary, "wx", options?.mode ?? 438);
|
|
793
|
+
try {
|
|
794
|
+
await handle.writeFile(typeof data === "string" ? Buffer3.from(data, options?.encoding ?? "utf8") : new Uint8Array(data.buffer, data.byteOffset, data.byteLength));
|
|
795
|
+
await handle.sync();
|
|
796
|
+
await handle.close();
|
|
797
|
+
await rename2(temporary, target);
|
|
798
|
+
} catch (error) {
|
|
799
|
+
await handle.close().catch(() => void 0);
|
|
800
|
+
await rm2(temporary, { force: true }).catch(() => void 0);
|
|
801
|
+
throw error;
|
|
802
|
+
}
|
|
803
|
+
if (process.platform !== "win32") {
|
|
804
|
+
try {
|
|
805
|
+
const directory = await open2(folder, "r");
|
|
806
|
+
try {
|
|
807
|
+
await directory.sync();
|
|
808
|
+
} finally {
|
|
809
|
+
await directory.close();
|
|
810
|
+
}
|
|
811
|
+
} catch {
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
var index_default = {
|
|
816
|
+
access: access2,
|
|
817
|
+
appendFile: appendFile2,
|
|
818
|
+
chmod: chmod2,
|
|
819
|
+
chown: chown2,
|
|
820
|
+
constants,
|
|
821
|
+
copyFile: copyFile2,
|
|
822
|
+
cp: cp2,
|
|
823
|
+
glob: glob2,
|
|
824
|
+
lchmod: lchmod2,
|
|
825
|
+
lchown: lchown2,
|
|
826
|
+
link: link2,
|
|
827
|
+
lstat: lstat2,
|
|
828
|
+
lutimes: lutimes2,
|
|
829
|
+
mkdir: mkdir2,
|
|
830
|
+
mkdtemp: mkdtemp2,
|
|
831
|
+
mkdtempDisposable: mkdtempDisposable2,
|
|
832
|
+
open: open2,
|
|
833
|
+
opendir: opendir2,
|
|
834
|
+
readdir: readdir2,
|
|
835
|
+
readFile: readFile2,
|
|
836
|
+
readlink: readlink2,
|
|
837
|
+
realpath: realpath2,
|
|
838
|
+
rename: rename2,
|
|
839
|
+
rm: rm2,
|
|
840
|
+
rmdir: rmdir2,
|
|
841
|
+
stat: stat2,
|
|
842
|
+
statfs: statfs2,
|
|
843
|
+
symlink: symlink2,
|
|
844
|
+
truncate: truncate2,
|
|
845
|
+
unlink: unlink2,
|
|
846
|
+
utimes: utimes2,
|
|
847
|
+
watch: watch2,
|
|
848
|
+
writeFile: writeFile2,
|
|
849
|
+
writeFileAtomic,
|
|
850
|
+
withTimeout
|
|
851
|
+
};
|
|
852
|
+
export {
|
|
853
|
+
KAY_FS_COOLING_DOWN,
|
|
854
|
+
KAY_FS_DEADLINE,
|
|
855
|
+
KAY_FS_DEFAULT_TIMEOUT_MS,
|
|
856
|
+
KAY_FS_SATURATED,
|
|
857
|
+
KAY_FS_UNAVAILABLE,
|
|
858
|
+
KAY_FS_UNSUPPORTED,
|
|
859
|
+
access2 as access,
|
|
860
|
+
appendFile2 as appendFile,
|
|
861
|
+
chmod2 as chmod,
|
|
862
|
+
chown2 as chown,
|
|
863
|
+
constants,
|
|
864
|
+
copyFile2 as copyFile,
|
|
865
|
+
cp2 as cp,
|
|
866
|
+
index_default as default,
|
|
867
|
+
glob2 as glob,
|
|
868
|
+
lchmod2 as lchmod,
|
|
869
|
+
lchown2 as lchown,
|
|
870
|
+
link2 as link,
|
|
871
|
+
lstat2 as lstat,
|
|
872
|
+
lutimes2 as lutimes,
|
|
873
|
+
mkdir2 as mkdir,
|
|
874
|
+
mkdtemp2 as mkdtemp,
|
|
875
|
+
mkdtempDisposable2 as mkdtempDisposable,
|
|
876
|
+
open2 as open,
|
|
877
|
+
opendir2 as opendir,
|
|
878
|
+
readFile2 as readFile,
|
|
879
|
+
readdir2 as readdir,
|
|
880
|
+
readlink2 as readlink,
|
|
881
|
+
realpath2 as realpath,
|
|
882
|
+
rename2 as rename,
|
|
883
|
+
rm2 as rm,
|
|
884
|
+
rmdir2 as rmdir,
|
|
885
|
+
stat2 as stat,
|
|
886
|
+
statfs2 as statfs,
|
|
887
|
+
symlink2 as symlink,
|
|
888
|
+
truncate2 as truncate,
|
|
889
|
+
unlink2 as unlink,
|
|
890
|
+
utimes2 as utimes,
|
|
891
|
+
watch2 as watch,
|
|
892
|
+
withTimeout,
|
|
893
|
+
writeFile2 as writeFile,
|
|
894
|
+
writeFileAtomic
|
|
895
|
+
};
|