@kitman-sh/cli 0.31.0 → 0.32.0
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/dist/{chunk-nndgeync.js → chunk-1an3xh3b.js} +6 -6
- package/dist/{chunk-pd3azxev.js → chunk-1hgsf81a.js} +1 -1
- package/dist/{chunk-qbrkeg49.js → chunk-3cneth9k.js} +4 -4
- package/dist/{chunk-9a6wbk11.js → chunk-4qrb09w4.js} +3 -3
- package/dist/{chunk-qb11yda6.js → chunk-4tzzmrz2.js} +9 -9
- package/dist/chunk-56gs4z53.js +399 -0
- package/dist/{chunk-emw9ragp.js → chunk-5hp8ams4.js} +20 -20
- package/dist/{chunk-y64ssczv.js → chunk-61dmxexa.js} +13 -157
- package/dist/{chunk-9vqkjkya.js → chunk-6e6t0f8y.js} +1 -1
- package/dist/{chunk-fjdp3rd6.js → chunk-a0bjjbhg.js} +20 -20
- package/dist/{chunk-9yvknsnj.js → chunk-abyssa8p.js} +3 -3
- package/dist/{chunk-njgay1ed.js → chunk-acmyagwp.js} +6 -6
- package/dist/{chunk-yjc2w86k.js → chunk-af8kftyw.js} +7 -7
- package/dist/{chunk-vwynec02.js → chunk-ah59jrtr.js} +1 -1
- package/dist/{chunk-s4r49vbj.js → chunk-awx0zevr.js} +4 -4
- package/dist/{chunk-2sazk478.js → chunk-c8eg05nh.js} +8 -4
- package/dist/{chunk-vh2a72d1.js → chunk-er0e8d8v.js} +2 -2
- package/dist/{chunk-xxcxramy.js → chunk-nb6h112w.js} +18 -13
- package/dist/{chunk-zy21drtv.js → chunk-q8e58p57.js} +2 -2
- package/dist/{chunk-qjxgew0k.js → chunk-qqb6djs7.js} +2 -2
- package/dist/{chunk-5qrjf4xq.js → chunk-r3mjxsmn.js} +4 -4
- package/dist/{chunk-r2kzvdrg.js → chunk-rbpn35g5.js} +1 -1
- package/dist/{chunk-38drrdzp.js → chunk-rnm5ybw4.js} +4 -4
- package/dist/{chunk-nk0ew12p.js → chunk-x4d4t28n.js} +108 -19
- package/dist/{chunk-z59pvcbk.js → chunk-z0gqrc8c.js} +169 -21
- package/dist/{chunk-m1qp6swh.js → chunk-znhjs0t6.js} +1 -1
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-kx8rpa62.js +0 -230
|
@@ -81,6 +81,8 @@ import {
|
|
|
81
81
|
fiberRunIn,
|
|
82
82
|
makeLatchUnsafe,
|
|
83
83
|
makeLatch,
|
|
84
|
+
ClockRef,
|
|
85
|
+
currentTimeMillis2,
|
|
84
86
|
succeed3,
|
|
85
87
|
failCause2,
|
|
86
88
|
fail4,
|
|
@@ -188,7 +190,6 @@ import {
|
|
|
188
190
|
mapEager,
|
|
189
191
|
flatMapEager,
|
|
190
192
|
catchEager,
|
|
191
|
-
fromInputUnsafe2,
|
|
192
193
|
Pointer,
|
|
193
194
|
passthrough,
|
|
194
195
|
transformEffect,
|
|
@@ -204,7 +205,7 @@ import {
|
|
|
204
205
|
String4,
|
|
205
206
|
toCodecStringTree,
|
|
206
207
|
encodeUnknownJsonStringSync
|
|
207
|
-
} from "./chunk-
|
|
208
|
+
} from "./chunk-61dmxexa.js";
|
|
208
209
|
|
|
209
210
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Iterable.js
|
|
210
211
|
var headUnsafe = (self) => {
|
|
@@ -253,6 +254,145 @@ var makeEquivalence = (equivalence) => {
|
|
|
253
254
|
return (self, that) => is(self, that) && is(that, self);
|
|
254
255
|
};
|
|
255
256
|
|
|
257
|
+
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Clock.js
|
|
258
|
+
var Clock = ClockRef;
|
|
259
|
+
var currentTimeMillis = currentTimeMillis2;
|
|
260
|
+
|
|
261
|
+
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/ByteSize.js
|
|
262
|
+
var bigint0 = /* @__PURE__ */ BigInt(0);
|
|
263
|
+
var bigint1 = /* @__PURE__ */ BigInt(1);
|
|
264
|
+
var decimalBase = /* @__PURE__ */ BigInt(1000);
|
|
265
|
+
var binaryBase = /* @__PURE__ */ BigInt(1024);
|
|
266
|
+
var decimalUnits = [{
|
|
267
|
+
symbol: "B",
|
|
268
|
+
factor: bigint1,
|
|
269
|
+
names: ["B", "byte", "bytes"]
|
|
270
|
+
}, {
|
|
271
|
+
symbol: "kB",
|
|
272
|
+
factor: decimalBase,
|
|
273
|
+
names: ["kB", "kilobyte", "kilobytes"]
|
|
274
|
+
}, {
|
|
275
|
+
symbol: "MB",
|
|
276
|
+
factor: decimalBase ** /* @__PURE__ */ BigInt(2),
|
|
277
|
+
names: ["MB", "megabyte", "megabytes"]
|
|
278
|
+
}, {
|
|
279
|
+
symbol: "GB",
|
|
280
|
+
factor: decimalBase ** /* @__PURE__ */ BigInt(3),
|
|
281
|
+
names: ["GB", "gigabyte", "gigabytes"]
|
|
282
|
+
}, {
|
|
283
|
+
symbol: "TB",
|
|
284
|
+
factor: decimalBase ** /* @__PURE__ */ BigInt(4),
|
|
285
|
+
names: ["TB", "terabyte", "terabytes"]
|
|
286
|
+
}, {
|
|
287
|
+
symbol: "PB",
|
|
288
|
+
factor: decimalBase ** /* @__PURE__ */ BigInt(5),
|
|
289
|
+
names: ["PB", "petabyte", "petabytes"]
|
|
290
|
+
}, {
|
|
291
|
+
symbol: "EB",
|
|
292
|
+
factor: decimalBase ** /* @__PURE__ */ BigInt(6),
|
|
293
|
+
names: ["EB", "exabyte", "exabytes"]
|
|
294
|
+
}, {
|
|
295
|
+
symbol: "ZB",
|
|
296
|
+
factor: decimalBase ** /* @__PURE__ */ BigInt(7),
|
|
297
|
+
names: ["ZB", "zettabyte", "zettabytes"]
|
|
298
|
+
}, {
|
|
299
|
+
symbol: "YB",
|
|
300
|
+
factor: decimalBase ** /* @__PURE__ */ BigInt(8),
|
|
301
|
+
names: ["YB", "yottabyte", "yottabytes"]
|
|
302
|
+
}, {
|
|
303
|
+
symbol: "RB",
|
|
304
|
+
factor: decimalBase ** /* @__PURE__ */ BigInt(9),
|
|
305
|
+
names: ["RB", "ronnabyte", "ronnabytes"]
|
|
306
|
+
}, {
|
|
307
|
+
symbol: "QB",
|
|
308
|
+
factor: decimalBase ** /* @__PURE__ */ BigInt(10),
|
|
309
|
+
names: ["QB", "quettabyte", "quettabytes"]
|
|
310
|
+
}];
|
|
311
|
+
var binaryUnits = [decimalUnits[0], {
|
|
312
|
+
symbol: "KiB",
|
|
313
|
+
factor: binaryBase,
|
|
314
|
+
names: ["KiB", "kibibyte", "kibibytes"]
|
|
315
|
+
}, {
|
|
316
|
+
symbol: "MiB",
|
|
317
|
+
factor: binaryBase ** /* @__PURE__ */ BigInt(2),
|
|
318
|
+
names: ["MiB", "mebibyte", "mebibytes"]
|
|
319
|
+
}, {
|
|
320
|
+
symbol: "GiB",
|
|
321
|
+
factor: binaryBase ** /* @__PURE__ */ BigInt(3),
|
|
322
|
+
names: ["GiB", "gibibyte", "gibibytes"]
|
|
323
|
+
}, {
|
|
324
|
+
symbol: "TiB",
|
|
325
|
+
factor: binaryBase ** /* @__PURE__ */ BigInt(4),
|
|
326
|
+
names: ["TiB", "tebibyte", "tebibytes"]
|
|
327
|
+
}, {
|
|
328
|
+
symbol: "PiB",
|
|
329
|
+
factor: binaryBase ** /* @__PURE__ */ BigInt(5),
|
|
330
|
+
names: ["PiB", "pebibyte", "pebibytes"]
|
|
331
|
+
}, {
|
|
332
|
+
symbol: "EiB",
|
|
333
|
+
factor: binaryBase ** /* @__PURE__ */ BigInt(6),
|
|
334
|
+
names: ["EiB", "exbibyte", "exbibytes"]
|
|
335
|
+
}, {
|
|
336
|
+
symbol: "ZiB",
|
|
337
|
+
factor: binaryBase ** /* @__PURE__ */ BigInt(7),
|
|
338
|
+
names: ["ZiB", "zebibyte", "zebibytes"]
|
|
339
|
+
}, {
|
|
340
|
+
symbol: "YiB",
|
|
341
|
+
factor: binaryBase ** /* @__PURE__ */ BigInt(8),
|
|
342
|
+
names: ["YiB", "yobibyte", "yobibytes"]
|
|
343
|
+
}];
|
|
344
|
+
var allUnits = [...decimalUnits, .../* @__PURE__ */ binaryUnits.slice(1)];
|
|
345
|
+
var unitsByName = /* @__PURE__ */ new Map(/* @__PURE__ */ allUnits.flatMap((unit) => unit.names.map((name) => [name, unit])));
|
|
346
|
+
var make = (value) => value;
|
|
347
|
+
var invalid = (message) => {
|
|
348
|
+
throw new Error(`Invalid ByteSize: ${message}`);
|
|
349
|
+
};
|
|
350
|
+
var fromNumber = (input) => {
|
|
351
|
+
if (!Number.isSafeInteger(input) || input < 0) {
|
|
352
|
+
return invalid(`expected a non-negative safe integer, received ${input}`);
|
|
353
|
+
}
|
|
354
|
+
return make(BigInt(input));
|
|
355
|
+
};
|
|
356
|
+
var maxSafeInteger = /* @__PURE__ */ BigInt(Number.MAX_SAFE_INTEGER);
|
|
357
|
+
var scaleDecimal = (quantity, factor) => {
|
|
358
|
+
const match = /^(\d+)(?:\.(\d+))?(?:e([+-]\d+))?$/.exec(quantity);
|
|
359
|
+
if (match === null)
|
|
360
|
+
return;
|
|
361
|
+
const fraction = match[2] ?? "";
|
|
362
|
+
const numerator = BigInt(match[1] + fraction) * factor;
|
|
363
|
+
const shift = Number(match[3] ?? 0) - fraction.length;
|
|
364
|
+
if (shift >= 0)
|
|
365
|
+
return numerator * BigInt(10) ** BigInt(shift);
|
|
366
|
+
const scale = BigInt(10) ** BigInt(-shift);
|
|
367
|
+
return numerator % scale === bigint0 ? numerator / scale : undefined;
|
|
368
|
+
};
|
|
369
|
+
var fromStringUnsafe = (input) => {
|
|
370
|
+
const match = /^\s*(\d+(?:\.\d+)?)\s*([A-Za-z]+)\s*$/.exec(input);
|
|
371
|
+
if (match === null)
|
|
372
|
+
return invalid(`unsupported syntax ${JSON.stringify(input)}`);
|
|
373
|
+
const unit = unitsByName.get(match[2]);
|
|
374
|
+
if (unit === undefined)
|
|
375
|
+
return invalid(`unsupported unit ${JSON.stringify(match[2])}`);
|
|
376
|
+
const value = scaleDecimal(match[1], unit.factor);
|
|
377
|
+
if (value === undefined)
|
|
378
|
+
return invalid(`${JSON.stringify(input)} does not represent an integral number of bytes`);
|
|
379
|
+
return make(value);
|
|
380
|
+
};
|
|
381
|
+
var fromInputUnsafe2 = (input) => {
|
|
382
|
+
switch (typeof input) {
|
|
383
|
+
case "bigint":
|
|
384
|
+
if (input < bigint0)
|
|
385
|
+
return invalid(`expected a non-negative bigint, received ${input}`);
|
|
386
|
+
return make(input);
|
|
387
|
+
case "number":
|
|
388
|
+
return fromNumber(input);
|
|
389
|
+
case "string":
|
|
390
|
+
return fromStringUnsafe(input);
|
|
391
|
+
}
|
|
392
|
+
return invalid(`unsupported input ${input}`);
|
|
393
|
+
};
|
|
394
|
+
var bytes = (value) => typeof value === "bigint" ? fromInputUnsafe2(value) : fromNumber(value);
|
|
395
|
+
|
|
256
396
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Fiber.js
|
|
257
397
|
var join = fiberJoin;
|
|
258
398
|
var interrupt = fiberInterrupt;
|
|
@@ -805,7 +945,7 @@ var isIgnorable = (error) => isMissing(error) || error.reason._tag === "Permissi
|
|
|
805
945
|
var isNotLink = (error) => isIgnorable(error) || error.reason._tag === "Unknown";
|
|
806
946
|
var DIRECTORY_CONCURRENCY = 16;
|
|
807
947
|
var byName = /* @__PURE__ */ mapInput(String3, (entry) => entry.name);
|
|
808
|
-
var
|
|
948
|
+
var make2 = (fs) => (pattern, options) => walk(fs, compile([pattern], options?.dot ?? false), options);
|
|
809
949
|
var walk = /* @__PURE__ */ fnUntraced(function* (fs, compiled, options) {
|
|
810
950
|
if (compiled.initial.size === 0) {
|
|
811
951
|
return [];
|
|
@@ -983,7 +1123,7 @@ var badArgument = (options) => new PlatformError(new BadArgument(options));
|
|
|
983
1123
|
|
|
984
1124
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Latch.js
|
|
985
1125
|
var makeUnsafe2 = makeLatchUnsafe;
|
|
986
|
-
var
|
|
1126
|
+
var make3 = makeLatch;
|
|
987
1127
|
|
|
988
1128
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/MutableRef.js
|
|
989
1129
|
var TypeId2 = "~effect/MutableRef";
|
|
@@ -1009,7 +1149,7 @@ var set = /* @__PURE__ */ dual(2, (self, value) => {
|
|
|
1009
1149
|
|
|
1010
1150
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/MutableList.js
|
|
1011
1151
|
var Empty = /* @__PURE__ */ Symbol.for("effect/MutableList/Empty");
|
|
1012
|
-
var
|
|
1152
|
+
var make4 = () => ({
|
|
1013
1153
|
head: undefined,
|
|
1014
1154
|
tail: undefined,
|
|
1015
1155
|
length: 0
|
|
@@ -1158,8 +1298,8 @@ var remove = (self, value) => filter2(self, (v) => v !== value);
|
|
|
1158
1298
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/PubSub.js
|
|
1159
1299
|
var TypeId3 = "~effect/PubSub";
|
|
1160
1300
|
var SubscriptionTypeId = "~effect/PubSub/Subscription";
|
|
1161
|
-
var
|
|
1162
|
-
var unbounded = (options) =>
|
|
1301
|
+
var make5 = (options) => sync2(() => makePubSubUnsafe(options.atomicPubSub(), new Map, makeUnsafe6(), makeUnsafe2(false), make7(false), options.strategy(), make7(none())));
|
|
1302
|
+
var unbounded = (options) => make5({
|
|
1163
1303
|
atomicPubSub: () => makeAtomicUnbounded(options),
|
|
1164
1304
|
strategy: () => new DroppingStrategy
|
|
1165
1305
|
});
|
|
@@ -1253,7 +1393,7 @@ var removeSubscribers = (subscribers, subscription, pollers) => {
|
|
|
1253
1393
|
subscribers.delete(subscription);
|
|
1254
1394
|
}
|
|
1255
1395
|
};
|
|
1256
|
-
var makeSubscriptionUnsafe = (pubsub, subscribers, strategy, ended) => new SubscriptionImpl(pubsub, subscribers, pubsub.subscribe(),
|
|
1396
|
+
var makeSubscriptionUnsafe = (pubsub, subscribers, strategy, ended) => new SubscriptionImpl(pubsub, subscribers, pubsub.subscribe(), make4(), makeUnsafe2(false), make7(false), strategy, pubsub.replayWindow(), ended);
|
|
1257
1397
|
class UnboundedPubSub {
|
|
1258
1398
|
publisherHead = {
|
|
1259
1399
|
value: AbsentValue,
|
|
@@ -1675,7 +1815,7 @@ var make8 = (options) => withFiber((fiber) => {
|
|
|
1675
1815
|
self.dispatcher = fiber.currentDispatcher;
|
|
1676
1816
|
self.capacity = options?.capacity ?? Number.POSITIVE_INFINITY;
|
|
1677
1817
|
self.strategy = options?.strategy ?? "suspend";
|
|
1678
|
-
self.messages =
|
|
1818
|
+
self.messages = make4();
|
|
1679
1819
|
self.scheduleRunning = false;
|
|
1680
1820
|
self.state = {
|
|
1681
1821
|
_tag: "Open",
|
|
@@ -2367,7 +2507,7 @@ var mergeAll = /* @__PURE__ */ dual(2, (channels, {
|
|
|
2367
2507
|
}) => fromTransformBracket(fnUntraced(function* (upstream, scope, forkedScope) {
|
|
2368
2508
|
const concurrencyN = concurrency === "unbounded" ? Number.MAX_SAFE_INTEGER : Math.max(1, concurrency);
|
|
2369
2509
|
const semaphore = switch_ ? undefined : makeUnsafe3(concurrencyN);
|
|
2370
|
-
const doneLatch = yield*
|
|
2510
|
+
const doneLatch = yield* make3(true);
|
|
2371
2511
|
const fibers = new Map;
|
|
2372
2512
|
const queue = yield* bounded(bufferSize);
|
|
2373
2513
|
yield* addFinalizer(forkedScope, shutdown(queue));
|
|
@@ -2617,6 +2757,13 @@ var runFold2 = /* @__PURE__ */ dual(3, (self, initial, f) => suspend3(() => {
|
|
|
2617
2757
|
}
|
|
2618
2758
|
}), () => succeed6(state));
|
|
2619
2759
|
}));
|
|
2760
|
+
var toPull2 = /* @__PURE__ */ fnUntraced(function* (self) {
|
|
2761
|
+
const semaphore = makeUnsafe3(1);
|
|
2762
|
+
const context2 = yield* context();
|
|
2763
|
+
const scope = get4(context2, Scope);
|
|
2764
|
+
const pull = yield* toTransform(self)(done(), scope);
|
|
2765
|
+
return pull.pipe(provideContext2(context2), semaphore.withPermits(1));
|
|
2766
|
+
}, /* @__PURE__ */ catchCause2((cause) => succeed6(failCause3(cause))));
|
|
2620
2767
|
var toPullScoped = (self, scope) => toTransform(self)(done(), scope);
|
|
2621
2768
|
|
|
2622
2769
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/internal/stream.js
|
|
@@ -2704,7 +2851,7 @@ class RcRefImpl {
|
|
|
2704
2851
|
this.idleTimeToLive = idleTimeToLive;
|
|
2705
2852
|
}
|
|
2706
2853
|
}
|
|
2707
|
-
var
|
|
2854
|
+
var make6 = (options) => withFiber2((fiber) => {
|
|
2708
2855
|
const context = fiber.context;
|
|
2709
2856
|
const scope = get4(context, Scope);
|
|
2710
2857
|
const ref = new RcRefImpl(options.acquire, context, scope, options.idleTimeToLive !== undefined ? fromInputUnsafe(options.idleTimeToLive) : undefined);
|
|
@@ -2813,7 +2960,7 @@ var release = (self, state) => {
|
|
|
2813
2960
|
};
|
|
2814
2961
|
|
|
2815
2962
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/RcRef.js
|
|
2816
|
-
var make9 =
|
|
2963
|
+
var make9 = make6;
|
|
2817
2964
|
var get3 = get2;
|
|
2818
2965
|
|
|
2819
2966
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Stream.js
|
|
@@ -2968,6 +3115,7 @@ var runForEach = /* @__PURE__ */ dual(2, (self, f) => runForEach2(self.channel,
|
|
|
2968
3115
|
});
|
|
2969
3116
|
}));
|
|
2970
3117
|
var runDrain = (self) => runDrain2(self.channel);
|
|
3118
|
+
var toPull = (self) => toPull2(self.channel);
|
|
2971
3119
|
var mkString = (self) => runFold2(self.channel, () => "", (acc, chunk) => acc + chunk.join(""));
|
|
2972
3120
|
var mkArrayBuffer = (self) => map9(mkUint8Array(self.channel), (bytes) => bytes.buffer);
|
|
2973
3121
|
var toReadableStreamWith = /* @__PURE__ */ dual((args) => isStream(args[0]), (self, context, options) => {
|
|
@@ -3028,7 +3176,7 @@ var FileSystem = /* @__PURE__ */ Service2("effect/FileSystem");
|
|
|
3028
3176
|
var make11 = (impl) => FileSystem.of({
|
|
3029
3177
|
...impl,
|
|
3030
3178
|
[TypeId10]: TypeId10,
|
|
3031
|
-
glob:
|
|
3179
|
+
glob: make2(impl),
|
|
3032
3180
|
exists: (path) => pipe(impl.access(path), as(true), catchTag("PlatformError", (e) => e.reason._tag === "NotFound" ? succeed6(false) : fail7(e))),
|
|
3033
3181
|
readFileString: (path, encoding) => flatMap3(impl.readFile(path), (_) => try_2({
|
|
3034
3182
|
try: () => new TextDecoder(encoding).decode(_),
|
|
@@ -3160,7 +3308,7 @@ function makeProvider(load, mapInput) {
|
|
|
3160
3308
|
function makeSource(get, transform) {
|
|
3161
3309
|
return makeProvider((path) => get(transform(path)), (f) => makeSource(get, (path) => f(transform(path))));
|
|
3162
3310
|
}
|
|
3163
|
-
function
|
|
3311
|
+
function make13(get) {
|
|
3164
3312
|
return makeSource(get, identityPath);
|
|
3165
3313
|
}
|
|
3166
3314
|
function emptyStringAsMissing(value, preserveEmptyStrings) {
|
|
@@ -3169,7 +3317,7 @@ function emptyStringAsMissing(value, preserveEmptyStrings) {
|
|
|
3169
3317
|
function fromEnvRecord(env, options) {
|
|
3170
3318
|
const preserveEmptyStrings = options?.preserveEmptyStrings === true;
|
|
3171
3319
|
const trie = buildEnvTrie(env);
|
|
3172
|
-
return
|
|
3320
|
+
return make13((path) => succeed6(nodeAtEnv(trie, env, path, preserveEmptyStrings)));
|
|
3173
3321
|
}
|
|
3174
3322
|
function fromEnv(options) {
|
|
3175
3323
|
const env = options?.env ?? {
|
|
@@ -3251,7 +3399,7 @@ var Proto2 = {
|
|
|
3251
3399
|
};
|
|
3252
3400
|
}
|
|
3253
3401
|
};
|
|
3254
|
-
function
|
|
3402
|
+
function make14(evaluator) {
|
|
3255
3403
|
const self = Object.create(Proto2);
|
|
3256
3404
|
self.evaluator = evaluator;
|
|
3257
3405
|
self.parse = (provider) => flatMapEager(evaluator(provider, []), fromResult);
|
|
@@ -3259,14 +3407,14 @@ function make13(evaluator) {
|
|
|
3259
3407
|
}
|
|
3260
3408
|
var evaluateAt = (self, provider, pathPrefix) => self.evaluator(provider, pathPrefix);
|
|
3261
3409
|
var map3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
3262
|
-
return
|
|
3410
|
+
return make14((provider, pathPrefix) => map9(evaluateAt(self, provider, pathPrefix), map5(f)));
|
|
3263
3411
|
});
|
|
3264
3412
|
function all(arg) {
|
|
3265
3413
|
const configs = globalThis.Array.isArray(arg) ? arg : (Symbol.iterator in arg) ? [...arg] : arg;
|
|
3266
|
-
return
|
|
3414
|
+
return make14((provider, pathPrefix) => globalThis.Array.isArray(configs) ? mapEager(all3(configs.map((config) => evaluateAt(config, provider, pathPrefix))), all2) : mapEager(all3(map(configs, (config) => evaluateAt(config, provider, pathPrefix))), all2));
|
|
3267
3415
|
}
|
|
3268
3416
|
var withDefault = /* @__PURE__ */ dual(2, (self, defaultValue) => {
|
|
3269
|
-
return
|
|
3417
|
+
return make14((provider, pathPrefix) => mapEager(evaluateAt(self, provider, pathPrefix), (resolution) => isFailure(resolution) ? succeed(defaultValue) : resolution));
|
|
3270
3418
|
});
|
|
3271
3419
|
var option = (self) => self.pipe(map3(some), withDefault(none()));
|
|
3272
3420
|
var isSourceError = (u) => isTagged(u, "SourceError");
|
|
@@ -3385,7 +3533,7 @@ function schema(codec, path) {
|
|
|
3385
3533
|
const encodedAst = toEncoded(codecStringTree.ast);
|
|
3386
3534
|
const decodeCursor = decodeUnknownEffect(make17(toConfigCursorAST(codecStringTree.ast)));
|
|
3387
3535
|
const localPath = typeof path === "string" ? [path] : path ?? [];
|
|
3388
|
-
return
|
|
3536
|
+
return make14((provider, pathPrefix) => {
|
|
3389
3537
|
const fullPath = [...pathPrefix, ...localPath];
|
|
3390
3538
|
return loadCursor(provider, fullPath).pipe(flatMapEager((cursor) => decodeCursor(cursor).pipe(mapEager(succeed), catchEager((issue) => {
|
|
3391
3539
|
const error = new ConfigError(new SchemaError(fullPath.length > 0 ? new Pointer(fullPath, issue) : issue));
|
|
@@ -3501,4 +3649,4 @@ var srtArgv2 = (srtCommand, settingsFile, argv) => [
|
|
|
3501
3649
|
...argv
|
|
3502
3650
|
];
|
|
3503
3651
|
|
|
3504
|
-
export { map, makeEquivalence, join, interrupt, getCurrent, BadArgument, systemError, badArgument, makeUnsafe2, make7, unbounded, publishUnsafe, make8, bounded, sliding, unbounded2, offer, offerUnsafe, offerAll, fail, failCause, failCauseUnsafe, end, endUnsafe, shutdownUnsafe, take, poll, makeUnsafe3, fromTransform, mapDone, isSink, fromChannel, drain, make9, get3, isStream, fromChannel2, callback, empty2, make10, suspend, fail2, fromQueue, fromPubSub, fromReadableStream, unwrap, map2, tap, drainFork, concat, merge2, filter, catchCause, tapError, mapError, take2, mapAccum, transduce, decodeText, encodeText, splitLines, interruptWhen, ensuring, provideContext, run, runCollect, runFold, runHead, runForEach, runDrain, mkString, mkArrayBuffer, toReadableStreamEffect, FileSystem, make11, FileTypeId, WatchBackend, Path, make12, embeddedFile, extractEmbeddedFile, map3, all, withDefault, option, String2, optionalEnv, operatorConfigHome, tempDirectoryScoped, harnessesUnsupportedInSrt2, harnessesUnsupportedInDocker2, compiled2, pinnedSrtCommand2, pinnedSrtStepCommand2, runSrtCli2, kitmanCacheDirectory2, srtSettings2, srtCacheEnvironment2, srtInheritedEnv2, inheritedEnvironment2, withOnlyEnvironment2, writeSrtSettings2, srtStepArgv2, srtArgv2 };
|
|
3652
|
+
export { map, makeEquivalence, Clock, currentTimeMillis, bytes, join, interrupt, getCurrent, BadArgument, systemError, badArgument, makeUnsafe2, make7, unbounded, publishUnsafe, make8, bounded, sliding, unbounded2, offer, offerUnsafe, offerAll, fail, failCause, failCauseUnsafe, end, endUnsafe, shutdownUnsafe, take, poll, makeUnsafe3, fromTransform, mapDone, isSink, fromChannel, drain, make9, get3, isStream, fromChannel2, callback, empty2, make10, suspend, fail2, fromQueue, fromPubSub, fromReadableStream, unwrap, map2, tap, drainFork, concat, merge2, filter, catchCause, tapError, mapError, take2, mapAccum, transduce, decodeText, encodeText, splitLines, interruptWhen, ensuring, provideContext, run, runCollect, runFold, runHead, runForEach, runDrain, toPull, mkString, mkArrayBuffer, toReadableStreamEffect, FileSystem, make11, FileTypeId, WatchBackend, Path, make12, embeddedFile, extractEmbeddedFile, map3, all, withDefault, option, String2, optionalEnv, operatorConfigHome, tempDirectoryScoped, harnessesUnsupportedInSrt2, harnessesUnsupportedInDocker2, compiled2, pinnedSrtCommand2, pinnedSrtStepCommand2, runSrtCli2, kitmanCacheDirectory2, srtSettings2, srtCacheEnvironment2, srtInheritedEnv2, inheritedEnvironment2, withOnlyEnvironment2, writeSrtSettings2, srtStepArgv2, srtArgv2 };
|
package/dist/index.js
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
var args = process.argv.slice(2);
|
|
6
6
|
if (args[0] === "srt") {
|
|
7
7
|
process.argv.splice(2, 1);
|
|
8
|
-
const { runSrtCli } = await import("./chunk-
|
|
8
|
+
const { runSrtCli } = await import("./chunk-qqb6djs7.js");
|
|
9
9
|
await runSrtCli();
|
|
10
10
|
} else if (args[0] === "srt-step") {
|
|
11
|
-
const { runSrtStep } = await import("./chunk-
|
|
11
|
+
const { runSrtStep } = await import("./chunk-4qrb09w4.js");
|
|
12
12
|
await runSrtStep(args.slice(1));
|
|
13
13
|
} else if (args[0] === "opencode-read") {
|
|
14
|
-
const { runOpencodeReader } = await import("./chunk-
|
|
14
|
+
const { runOpencodeReader } = await import("./chunk-c8eg05nh.js");
|
|
15
15
|
runOpencodeReader();
|
|
16
16
|
} else {
|
|
17
|
-
const { runCli } = await import("./chunk-
|
|
17
|
+
const { runCli } = await import("./chunk-a0bjjbhg.js");
|
|
18
18
|
runCli(args);
|
|
19
19
|
}
|
package/package.json
CHANGED
package/dist/chunk-kx8rpa62.js
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
getOrUndefined,
|
|
4
|
-
liftThrowable,
|
|
5
|
-
TaggedError,
|
|
6
|
-
all3,
|
|
7
|
-
suspend3,
|
|
8
|
-
void_3,
|
|
9
|
-
gen,
|
|
10
|
-
fail7,
|
|
11
|
-
try_2,
|
|
12
|
-
mapError2,
|
|
13
|
-
timeoutOrElse,
|
|
14
|
-
scoped,
|
|
15
|
-
declare,
|
|
16
|
-
decodeEffect,
|
|
17
|
-
String4,
|
|
18
|
-
Boolean2,
|
|
19
|
-
Struct,
|
|
20
|
-
ArraySchema,
|
|
21
|
-
Literals,
|
|
22
|
-
NullOr,
|
|
23
|
-
Finite,
|
|
24
|
-
isNumber2,
|
|
25
|
-
isJsonObject,
|
|
26
|
-
isString2,
|
|
27
|
-
encodeUnknownJsonStringSync
|
|
28
|
-
} from "./chunk-y64ssczv.js";
|
|
29
|
-
import {
|
|
30
|
-
make10,
|
|
31
|
-
runForEach,
|
|
32
|
-
compiled2
|
|
33
|
-
} from "./chunk-z59pvcbk.js";
|
|
34
|
-
import {
|
|
35
|
-
ChildProcessSpawner,
|
|
36
|
-
make2
|
|
37
|
-
} from "./chunk-vh2a72d1.js";
|
|
38
|
-
|
|
39
|
-
// packages/agent-runtime/src/opencode-store.ts
|
|
40
|
-
import { lstatSync, readFileSync, realpathSync } from "fs";
|
|
41
|
-
import { DatabaseSync } from "node:sqlite";
|
|
42
|
-
import { fileURLToPath } from "url";
|
|
43
|
-
class OpencodeReadFailed extends TaggedError("OpencodeReadFailed") {
|
|
44
|
-
get message() {
|
|
45
|
-
return `OpenCode's session could not be read: ${this.reason}`;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
var sliceBytes2 = 1024 * 1024;
|
|
49
|
-
var maxLineBytes2 = 8 * 1024 * 1024;
|
|
50
|
-
var linesPerTurn2 = 1024;
|
|
51
|
-
var decodedOption2 = liftThrowable((text) => JSON.parse(text));
|
|
52
|
-
var decoded2 = (text) => getOrUndefined(decodedOption2(text));
|
|
53
|
-
var Parsed = declare((_value) => true);
|
|
54
|
-
var OpencodeV2PartSchema = Struct({ ordinal: Finite, part: Parsed });
|
|
55
|
-
var OpencodeV2MessageSchema = Struct({
|
|
56
|
-
id: String4,
|
|
57
|
-
seq: Finite,
|
|
58
|
-
closed: Boolean2,
|
|
59
|
-
parts: NullOr(ArraySchema(OpencodeV2PartSchema))
|
|
60
|
-
});
|
|
61
|
-
var PartSchema = Struct({
|
|
62
|
-
id: String4,
|
|
63
|
-
position: Finite,
|
|
64
|
-
role: NullOr(String4),
|
|
65
|
-
part: Parsed
|
|
66
|
-
});
|
|
67
|
-
var maxRoleChars = 64;
|
|
68
|
-
var maxPartsPerMessage = 4096;
|
|
69
|
-
var bytesOf = (column) => `length(cast(${column} as blob))`;
|
|
70
|
-
var unlessLong = (column) => `case when ${bytesOf(column)} <= ${maxLineBytes2} then ${column} end`;
|
|
71
|
-
var decodedParts = (db, ids) => {
|
|
72
|
-
const statement = db.prepare(`select part.rowid as position, ${unlessLong("message.data")} as message, ${unlessLong("part.data")} as part from part join message on message.id = part.message_id where part.id = ?`);
|
|
73
|
-
const parts = [];
|
|
74
|
-
let bytes = 0;
|
|
75
|
-
let reached = 0;
|
|
76
|
-
while (reached < ids.length && bytes < sliceBytes2) {
|
|
77
|
-
const id = ids[reached++];
|
|
78
|
-
const row = id === undefined ? undefined : statement.get(id);
|
|
79
|
-
if (id !== undefined && isNumber2(row?.position)) {
|
|
80
|
-
const message = isString2(row.message) ? decoded2(row.message) : undefined;
|
|
81
|
-
const part = isString2(row.part) ? decoded2(row.part) : undefined;
|
|
82
|
-
bytes += isString2(row.part) ? row.part.length : 0;
|
|
83
|
-
const role = isJsonObject(message) ? message.role : undefined;
|
|
84
|
-
const shortRole = isString2(role) && role.length <= maxRoleChars ? role : null;
|
|
85
|
-
parts.push({ id, position: row.position, role: shortRole, part: part ?? null });
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return { parts, rest: ids.slice(reached) };
|
|
89
|
-
};
|
|
90
|
-
var partsPast = "from part join message on message.id = part.message_id where part.session_id = ? and part.rowid > ?";
|
|
91
|
-
var opencodeV2Parts = (db, hasPartTable, id, data) => {
|
|
92
|
-
const rows = hasPartTable ? db.prepare("select ordinal, data from session_part where message_id = ? order by ordinal").all(id) : [];
|
|
93
|
-
if (rows.length > 0)
|
|
94
|
-
return rows.flatMap((row) => isNumber2(row.ordinal) && isString2(row.data) ? [{ ordinal: row.ordinal, part: decoded2(row.data) ?? null }] : []);
|
|
95
|
-
const content = isJsonObject(data) ? data.content : undefined;
|
|
96
|
-
return Array.isArray(content) ? content.map((part, ordinal) => ({ ordinal, part })) : [];
|
|
97
|
-
};
|
|
98
|
-
var opencodeSessionTables = [
|
|
99
|
-
{ table: "session_v2", kind: "opencode_v2" },
|
|
100
|
-
{ table: "session", kind: "opencode" }
|
|
101
|
-
];
|
|
102
|
-
var reading = (output, read) => ({
|
|
103
|
-
output,
|
|
104
|
-
read
|
|
105
|
-
});
|
|
106
|
-
var readings = {
|
|
107
|
-
newestSession: reading(NullOr(Struct({ kind: Literals(["opencode", "opencode_v2"]), id: String4, createdAt: Finite })), (db, { worktree, startedAt }) => {
|
|
108
|
-
const present = new Set(db.prepare("select name from sqlite_master where type = 'table'").all().map((row) => row.name));
|
|
109
|
-
const newest = opencodeSessionTables.filter(({ table }) => present.has(table)).flatMap(({ table, kind }) => {
|
|
110
|
-
const row = db.prepare(`select id, time_created from ${table} where directory = ? and parent_id is null and time_created >= ? order by time_created desc limit 1`).get(worktree, startedAt);
|
|
111
|
-
return isString2(row?.id) && isNumber2(row.time_created) ? [{ kind, id: row.id, createdAt: row.time_created }] : [];
|
|
112
|
-
});
|
|
113
|
-
return newest.reduce((best, session) => best === null || session.createdAt > best.createdAt ? session : best, null);
|
|
114
|
-
}),
|
|
115
|
-
parts: reading(Struct({ parts: ArraySchema(PartSchema), rest: ArraySchema(String4) }), (db, { ids }) => decodedParts(db, ids)),
|
|
116
|
-
partsPast: reading(ArraySchema(PartSchema), (db, { position }, sessionId) => {
|
|
117
|
-
const rows = db.prepare(`select part.id as id ${partsPast} order by part.rowid limit ?`).all(sessionId, position, linesPerTurn2);
|
|
118
|
-
return decodedParts(db, rows.flatMap((row) => isString2(row.id) ? [row.id] : [])).parts;
|
|
119
|
-
}),
|
|
120
|
-
partsPastCount: reading(Finite, (db, { position }, sessionId) => Number(db.prepare(`select count(*) as parts ${partsPast}`).get(sessionId, position)?.parts)),
|
|
121
|
-
messagesPast: reading(ArraySchema(OpencodeV2MessageSchema), (db, { seq }, sessionId) => {
|
|
122
|
-
const hasPartTable = db.prepare("select 1 from sqlite_master where name = 'session_part'").get() !== undefined;
|
|
123
|
-
const size = hasPartTable ? `${bytesOf("data")} + coalesce((select sum(${bytesOf("data")}) from session_part where message_id = session_message.id), 0)` : bytesOf("data");
|
|
124
|
-
const found = db.prepare(`select id, seq, ${size} as size, json_extract(data, '$.time.completed') is not null as completed from session_message where session_id = ? and type = 'assistant' and seq > ? order by seq limit ?`).all(sessionId, seq, linesPerTurn2 + 1);
|
|
125
|
-
const read = db.prepare("select data from session_message where id = ?");
|
|
126
|
-
const messages = [];
|
|
127
|
-
let bytes = 0;
|
|
128
|
-
for (const [index, row] of found.slice(0, linesPerTurn2).entries()) {
|
|
129
|
-
if (bytes >= sliceBytes2)
|
|
130
|
-
break;
|
|
131
|
-
if (!isString2(row.id) || !isNumber2(row.seq) || !isNumber2(row.size))
|
|
132
|
-
continue;
|
|
133
|
-
const closed = row.completed === 1 || index < found.length - 1;
|
|
134
|
-
if (row.size > maxLineBytes2) {
|
|
135
|
-
messages.push({ id: row.id, seq: row.seq, closed, parts: null });
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
const data = read.get(row.id)?.data;
|
|
139
|
-
bytes += row.size;
|
|
140
|
-
const parts = opencodeV2Parts(db, hasPartTable, row.id, isString2(data) ? decoded2(data) : undefined);
|
|
141
|
-
messages.push({ id: row.id, seq: row.seq, closed, parts: parts.length > maxPartsPerMessage ? null : parts });
|
|
142
|
-
}
|
|
143
|
-
return messages;
|
|
144
|
-
}),
|
|
145
|
-
lastError: reading(Parsed, (db, { v2 }, sessionId) => {
|
|
146
|
-
const error = unlessLong("json_extract(data, '$.error')");
|
|
147
|
-
const row = v2 ? db.prepare(`select ${error} as error from session_message where session_id = ? and type = 'assistant' order by seq desc limit 1`).get(sessionId) : db.prepare(`select ${error} as error from message where session_id = ? and json_extract(data, '$.role') = 'assistant' order by time_created desc, rowid desc limit 1`).get(sessionId);
|
|
148
|
-
return isString2(row?.error) ? decoded2(row.error) ?? null : null;
|
|
149
|
-
}),
|
|
150
|
-
lastModel: reading(NullOr(String4), (db, { v2 }, sessionId) => {
|
|
151
|
-
const named = (provider, model) => `case when length(cast(${model} as blob)) <= 200 and length(cast(coalesce(${provider}, '') as blob)) <= 200 then case when ${provider} is null then ${model} else ${provider} || '/' || ${model} end end`;
|
|
152
|
-
const row = v2 ? db.prepare(`select ${named("json_extract(data, '$.model.providerID')", "json_extract(data, '$.model.id')")} as model from session_message where session_id = ? and type = 'assistant' and json_type(data, '$.model.id') = 'text' order by seq desc limit 1`).get(sessionId) : db.prepare(`select ${named("json_extract(data, '$.providerID')", "json_extract(data, '$.modelID')")} as model from message where session_id = ? and json_extract(data, '$.role') = 'assistant' and json_type(data, '$.modelID') = 'text' order by time_created desc, rowid desc limit 1`).get(sessionId);
|
|
153
|
-
return isString2(row?.model) ? row.model : null;
|
|
154
|
-
}),
|
|
155
|
-
extent: reading(Finite, (db, _input, sessionId) => Number(db.prepare(`with recursive sessions(id) as (select ? union select session_v2.id from session_v2 join sessions on session_v2.parent_id = sessions.id)
|
|
156
|
-
select coalesce(max(time_updated), 0) as extent from session_message where session_id in sessions`).get(sessionId)?.extent))
|
|
157
|
-
};
|
|
158
|
-
var maxReaderHeapBytes = 256 * 1024 * 1024;
|
|
159
|
-
var inDatabase = (database, hostile, use) => {
|
|
160
|
-
const db = new DatabaseSync(database, { readOnly: true });
|
|
161
|
-
try {
|
|
162
|
-
if (hostile)
|
|
163
|
-
db.exec(`pragma trusted_schema = off; pragma query_only = on; pragma hard_heap_limit = ${maxReaderHeapBytes};`);
|
|
164
|
-
return use(db);
|
|
165
|
-
} finally {
|
|
166
|
-
db.close();
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
var maxAnswerBytes = 16 * 1024 * 1024;
|
|
170
|
-
var answerTimeout = "3 seconds";
|
|
171
|
-
var opencodeReaderCommand = () => compiled2 ? [process.execPath, "opencode-read"] : [process.execPath, fileURLToPath(import.meta.resolve("./opencode-reader.main.ts"))];
|
|
172
|
-
var isolatedRead = (store, name, input) => gen(function* () {
|
|
173
|
-
const spawner = yield* ChildProcessSpawner;
|
|
174
|
-
const [command, ...args] = opencodeReaderCommand();
|
|
175
|
-
const handle = yield* spawner.spawn(make2(command, args, {
|
|
176
|
-
stdin: make10(new TextEncoder().encode(encodeUnknownJsonStringSync({ store, name, input }))),
|
|
177
|
-
stderr: "ignore",
|
|
178
|
-
extendEnv: false,
|
|
179
|
-
env: {},
|
|
180
|
-
killSignal: "SIGKILL"
|
|
181
|
-
}));
|
|
182
|
-
const chunks = [];
|
|
183
|
-
let bytes = 0;
|
|
184
|
-
const [, exitCode] = yield* all3([
|
|
185
|
-
runForEach(handle.stdout, (chunk) => suspend3(() => {
|
|
186
|
-
bytes += chunk.length;
|
|
187
|
-
chunks.push(chunk);
|
|
188
|
-
return bytes > maxAnswerBytes ? fail7(new OpencodeReadFailed({ reason: "the reader said too much" })) : void_3;
|
|
189
|
-
})),
|
|
190
|
-
handle.exitCode
|
|
191
|
-
], { concurrency: 2 });
|
|
192
|
-
if (exitCode !== 0)
|
|
193
|
-
return yield* new OpencodeReadFailed({ reason: `the reader exited with ${exitCode}` });
|
|
194
|
-
const answer = decoded2(new TextDecoder().decode(Buffer.concat(chunks)));
|
|
195
|
-
return yield* decodeEffect(readings[name].output)(answer);
|
|
196
|
-
}).pipe(scoped, mapError2((error) => error instanceof OpencodeReadFailed ? error : new OpencodeReadFailed({ reason: error.message })), timeoutOrElse({
|
|
197
|
-
duration: answerTimeout,
|
|
198
|
-
orElse: () => fail7(new OpencodeReadFailed({ reason: "the reader did not answer in time" }))
|
|
199
|
-
}));
|
|
200
|
-
var readOpencode2 = (store, name, input) => store.confinedTo === undefined ? try_2({
|
|
201
|
-
try: () => answerFrom(store, name, input, false),
|
|
202
|
-
catch: (error) => new OpencodeReadFailed({ reason: String(error) })
|
|
203
|
-
}) : isolatedRead(store, name, input);
|
|
204
|
-
var answerFrom = (store, name, input, hostile) => inDatabase(store.database, hostile, (db) => readings[name].read(db, input, store.sessionId ?? ""));
|
|
205
|
-
var assertConfined = (database, root) => {
|
|
206
|
-
for (const file of [database, `${database}-wal`, `${database}-shm`, `${database}-journal`]) {
|
|
207
|
-
const stat = lstatSync(file, { throwIfNoEntry: false });
|
|
208
|
-
if (file === database && stat === undefined)
|
|
209
|
-
throw new Error("No database");
|
|
210
|
-
if (stat !== undefined && (!stat.isFile() || stat.nlink !== 1))
|
|
211
|
-
throw new Error("Not a plain file");
|
|
212
|
-
}
|
|
213
|
-
if (!realpathSync(database).startsWith(`${realpathSync(root)}/`))
|
|
214
|
-
throw new Error("Outside its directory");
|
|
215
|
-
};
|
|
216
|
-
var runOpencodeReader2 = () => {
|
|
217
|
-
const request = decoded2(readFileSync(0, "utf8"));
|
|
218
|
-
if (!isJsonObject(request) || !isJsonObject(request.store))
|
|
219
|
-
throw new Error("No request");
|
|
220
|
-
const { database, sessionId, confinedTo } = request.store;
|
|
221
|
-
if (!isString2(database) || !isString2(confinedTo))
|
|
222
|
-
throw new Error("No confined database");
|
|
223
|
-
assertConfined(database, confinedTo);
|
|
224
|
-
const store = { database, confinedTo, ...isString2(sessionId) ? { sessionId } : undefined };
|
|
225
|
-
const reading = request.name;
|
|
226
|
-
const input = request.input;
|
|
227
|
-
process.stdout.write(encodeUnknownJsonStringSync(answerFrom(store, reading, input, true)));
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
export { sliceBytes2, maxLineBytes2, linesPerTurn2, decodedOption2, decoded2, readOpencode2, runOpencodeReader2 };
|