codexuse-cli 3.6.4 → 3.6.5
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/index.js +1 -1
- package/dist/server/Cache-Ctxz7HFI.mjs +567 -0
- package/dist/server/{NodeSqliteClient-BXfshIvF.mjs → NodeSqliteClient-BPzkJKIG.mjs} +3 -3
- package/dist/server/{SqlError-Djvykpuc.mjs → SqlError-Cc34CGhm.mjs} +1 -1
- package/dist/server/{SqliteClient-DBy8Gtib.mjs → SqliteClient-BBxZHTRF.mjs} +2 -2
- package/dist/server/index.mjs +101 -651
- package/dist/server/{open-BM96ykXl.mjs → open-Cm7F9p66.mjs} +1 -1
- package/package.json +1 -1
package/dist/server/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
-
import { $ as encodeUnknownEffect, $i as isFailure, $n as asSome
|
|
3
|
+
import { $ as encodeUnknownEffect, $i as isFailure, $n as asSome, $o as BaseProto, $r as scoped, $t as runFold, A as NullOr, Aa as gen$1, An as make$20, Ao as getOrThrow, Ar as log$1, At as Size, B as Union, Bi as close, Bn as parseJson, Bo as map$5, Br as onInterrupt, Bt as fromChannel$1, C as Finite, Ca as fiberInterrupt, Ci as catchDone, Cn as offerAll, Co as sort, Cr as forkIn, Ct as assign, D as NonEmptyArray, Da as forkDetach, Di as TaggedError, Dn as unbounded, Do as makeEquivalence$2, Dr as ignoreCause, Dt as FileDescriptor, E as Literals, Ea as forever$1, Ei as Error$1, En as take, Er as ignore, Et as TypeId$16, F as TaggedErrorClass, Fa as scopeAddFinalizerExit, Fi as succeed$2, Fn as badArgument, Fo as getOrElse, Fr as map$3, Ft as decodeText, G as decodeEffect, Gi as fail$4, Gn as encodeBase64Url, Go as make$25, Gr as provideService, Gt as fromReadableStream, H as Void, Ha as sync$1, Hi as provide$2, Hn as InvalidValue$1, Ho as none$3, Hr as orElseSucceed, Ht as fromIterable$1, I as TemplateLiteral, Ii as sync$2, In as systemError, Io as getOrNull, Ir as mapError, J as decodeUnknownEffect, Ja as CurrentLogSpans, Ji as make$26, Jn as addFinalizer$1, Jo as PipeInspectableProto, Jr as runFork, Jt as merge$1, K as decodeExit, Ka as void_$2, Ki as failCause$1, Kn as acquireRelease, Ko as make$31, Kr as provideServices, Kt as isStream, L as Trim, La as sleep$1, Li as unwrap$1, Ln as nominal, Lo as getOrUndefined, Lr as matchCauseEffect, Lt as empty$4, M as Record, Ma as loggerMake, Mi as mergeAll, Mn as makeUnsafe$1, Mo as succeed$3, Mr as logError$1, Mt as make$21, N as String$1, Ni as provide$1, No as filter$1, Nr as logInfo$1, Nt as callback$1, O as NonEmptyString, Oa as formatLabel, Oi as effect, On as publish, Oo as fail$3, Or as interrupt, Ot as FileSystem, P as Struct, Pa as scope, Pi as provideMerge, Pn as BadArgument, Po as fromNullishOr, Pr as logWarning$1, Pt as concat, Q as encodeEffect, Qa as Service, Qi as hasInterrupts$1, Qn as as, Qo as withFiber, Qt as runCollect, R as Tuple, Ra as structuredMessage, Ri as Scope, Rn as transform$1, Ro as isNone, Rr as matchEffect, Rt as fail$5, S as ErrorClass, Sa as defaultLogger$1, Si as zipWith, Sn as offer$1, So as of, Sr as forkDetach$1, St as withDecodingDefault, T as Literal, Ta as fnUntraced$1, Ti as Class, Tn as shutdown, To as map$7, Tr as gen, Tt as Path$1, U as brand, Ua as tracerLogger$1, Ui as _await, Un as makeFormatterDefault, Uo as some, Ur as promise, Ut as fromPubSub, V as Unknown, Va as suspend$1, Vi as make$27, Vn as stringifyJson, Vo as match, Vr as orDie, Vt as fromEffect, W as declare, Wa as uninterruptibleMask, Wi as doneUnsafe, Wn as make$30, Wo as Number$2, Wr as provide, Wt as fromQueue, X as decodeUnknownSync, Xa as DisablePropagation, Xi as succeed$4, Xn as andThen, Xr as runPromiseWith, Xt as onExit, Y as decodeUnknownExit, Ya as MinimumLogLevel, Yi as makeUnsafe$2, Yn as all, Yo as YieldableProto, Yr as runPromise, Yt as mkString, Z as encode, Za as Reference, Zi as fail, Zn as annotateLogs, Zo as isEffect$1, Zr as runSync, Zt as run$2, _ as url, _a as andThen$1, _i as useSpan, _o as fromIterable$2, _r as fn, _s as constVoid, _t as tag, aa as UnknownError, ai as succeedNone, an as unwrap, ao as fromInputUnsafe, ar as catchFilter, as as symbolRedactable, at as isLessThanOrEqualTo, b as DateValid, ba as causePretty, bi as withParentSpan, bn as failCauseUnsafe, bo as makeEquivalence$1, br as forever, bs as pipe, bt as toType, c as FalseValues, ca as hasInterrupts, ci as tap, cn as drain, cr as catch_, cs as structure, ct as isMinLength, d as boolean$3, da as squash, di as timeoutOrElse, dn as fromTransform, do as toMillis, dr as ensuring, ds as isNotNull, dt as isSchemaError, ea as isSuccess, ei as service, en as runForEach, eo as empty$5, er as asVoid, es as Class$1, et as fromJsonString, f as map$6, fi as tryPromise, fn as mapDone, fo as toSeconds, fr as exit, fs as isNotUndefined, ft as link$1, ga as addFinalizer$2, gi as updateServices, go as flatMapNullishOr, gr as flatMap, gs as constTrue, gt as suspend$2, h as string$3, ha as LogToStderr$1, hi as uninterruptibleMask$1, ho as filter, hr as filterOrFail, hs as constFalse, ht as optional$2, ia as NoSuchElementError, ii as succeed, in as transduce, io as merge$2, ir as catchDefect, is as redact$1, it as isGreaterThanOrEqualTo, j as Number$1, ja as ignore$1, ji as empty$6, jn as set$2, jo as isFailure$1, jr as logDebug, jt as WatchBackend, k as Null, ka as formatLogSpan, ki as effectDiscard, kn as unbounded$1, kr as isEffect, kt as FileTypeId, l as TrueValues, la as hasInterruptsOnly, li as tapCause, ln as fromChannel, lo as minutes, lr as die, ls as symbol$1, lt as isNonEmpty, m as port, ma as CurrentLoggers$1, mi as uninterruptible, mo as ensure, mr as failCause, ms as isUndefined, mt as mutable, n as SqlClient, na as void_$3, ni as services, nn as suspend$3, nr as callback, ns as format$1, nt as isBetween, oa as done, oi as suspend, on as get$1, or as catchTag, os as symbol, ot as isMaxLength, p as option, pa as ConsoleRef, pi as try_, pn as make$28, po as zero, pr as fail$1, ps as isNullish, pt as makeFilter, q as decodeTo, qa as CurrentLogAnnotations, qi as isDone, qn as acquireUseRelease, qo as strictEqual, qr as result, qt as make$29, ra as Done, ri as servicesWith, rn as toReadableStreamEffect, ro as make$24, rr as catchCause, rs as formatJson$1, rt as isGreaterThan, s as Boolean$1, sa as fail$2, si as sync, sn as make$22, so as isFinite$1, sr as catchTags, ss as array, st as isMaxProperties, ta as succeed$1, ti as serviceOption, tn as splitLines, to as get$2, tr as cached, ts as NodeInspectSymbol, tt as is, u as all$1, ua as pretty, ui as timeoutOption, un as isSink, uo as seconds, ur as effectify, us as hasProperty, ut as isPattern, v as Array$1, va as as$1, vi as void_$1, vo as isArray, vr as fnUntraced, vs as dual, vt as toCodecStringTree, w as Int, wa as flatMap$1, wi as clamp, wn as offerUnsafe, wo as makeEquivalence, wr as forkScoped, wt as omit, x as Defect, xa as consolePretty$1, xi as withSpan, xn as make$23, xo as map$4, xr as forkChild, xs as pipeArguments, xt as withConstructorDefault, y as Boolean$2, yi as withFiber$1, yn as endUnsafe, yo as isReadonlyArrayNonEmpty, yr as forEach, ys as identity, yt as toJsonSchemaDocument, z as URLFromString, zi as addFinalizer, zn as transformOrFail, zo as isSome, zr as never, zt as flatMap$2 } from "./SqlClient-DSf3-WP1.mjs";
|
|
4
|
+
import { a as make$32, i as keys, n as getOption, o as makeWith$1, r as invalidate, s as set$3, t as get$3 } from "./Cache-Ctxz7HFI.mjs";
|
|
4
5
|
import { createRequire } from "node:module";
|
|
5
6
|
import * as NodeChildProcess from "node:child_process";
|
|
6
7
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
@@ -294,7 +295,7 @@ const makeHandle = (params) => Object.assign(Object.create(HandleProto), params)
|
|
|
294
295
|
* @since 4.0.0
|
|
295
296
|
* @category Models
|
|
296
297
|
*/
|
|
297
|
-
const make$
|
|
298
|
+
const make$19 = (spawn) => {
|
|
298
299
|
const streamString = (command, options) => spawn(command).pipe(map$3((handle) => decodeText(options?.includeStderr === true ? handle.all : handle.stdout)), unwrap);
|
|
299
300
|
const streamLines = (command, options) => splitLines(streamString(command, options));
|
|
300
301
|
return ChildProcessSpawner.of({
|
|
@@ -315,16 +316,16 @@ const make$20 = (spawn) => {
|
|
|
315
316
|
var ChildProcessSpawner = class extends Service()("effect/process/ChildProcessSpawner") {};
|
|
316
317
|
//#endregion
|
|
317
318
|
//#region ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@8881a9b/node_modules/effect/dist/unstable/process/ChildProcess.js
|
|
318
|
-
const TypeId$
|
|
319
|
-
const Proto$
|
|
319
|
+
const TypeId$15 = "~effect/unstable/process/ChildProcess";
|
|
320
|
+
const Proto$9 = {
|
|
320
321
|
...PipeInspectableProto,
|
|
321
322
|
...YieldableProto,
|
|
322
|
-
[TypeId$
|
|
323
|
+
[TypeId$15]: TypeId$15,
|
|
323
324
|
asEffect() {
|
|
324
325
|
return ChildProcessSpawner.use((_) => _.spawn(this));
|
|
325
326
|
}
|
|
326
327
|
};
|
|
327
|
-
const makeStandardCommand = (command, args, options) => Object.assign(Object.create(Proto$
|
|
328
|
+
const makeStandardCommand = (command, args, options) => Object.assign(Object.create(Proto$9), {
|
|
328
329
|
_tag: "StandardCommand",
|
|
329
330
|
command,
|
|
330
331
|
args,
|
|
@@ -358,7 +359,7 @@ const makeStandardCommand = (command, args, options) => Object.assign(Object.cre
|
|
|
358
359
|
* @since 4.0.0
|
|
359
360
|
* @category Constructors
|
|
360
361
|
*/
|
|
361
|
-
const make$
|
|
362
|
+
const make$18 = function make(...args) {
|
|
362
363
|
if (isTemplateString(args[0])) {
|
|
363
364
|
const [templates, ...expressions] = args;
|
|
364
365
|
const tokens = parseTemplates(templates, expressions);
|
|
@@ -604,7 +605,7 @@ const readableToPullUnsafe = (options) => {
|
|
|
604
605
|
const readable = options.readable;
|
|
605
606
|
if (readable.readableEnded) return succeed(done());
|
|
606
607
|
const closeOnDone = options.closeOnDone ?? true;
|
|
607
|
-
const exit = options.exit ?? make$
|
|
608
|
+
const exit = options.exit ?? make$20(void 0);
|
|
608
609
|
const latch = makeUnsafe$1(false);
|
|
609
610
|
function onReadable() {
|
|
610
611
|
latch.openUnsafe();
|
|
@@ -654,7 +655,7 @@ const toPlatformError = (method, error, command) => {
|
|
|
654
655
|
}, "");
|
|
655
656
|
return handleErrnoException("ChildProcess", method)(error, [commandStr]);
|
|
656
657
|
};
|
|
657
|
-
const make$
|
|
658
|
+
const make$17 = /* @__PURE__ */ gen(function* () {
|
|
658
659
|
const fs = yield* FileSystem;
|
|
659
660
|
const path = yield* Path$1;
|
|
660
661
|
const resolveWorkingDirectory = fnUntraced(function* (options) {
|
|
@@ -904,7 +905,7 @@ const make$18 = /* @__PURE__ */ gen(function* () {
|
|
|
904
905
|
const stdinConfig = resolveStdinOption(command.options);
|
|
905
906
|
const sourceStream = unwrap(map$3(handle, (h) => getSourceStream(h, options.from)));
|
|
906
907
|
const toOption = options.to ?? "stdin";
|
|
907
|
-
if (toOption === "stdin") handle = spawnCommand(make$
|
|
908
|
+
if (toOption === "stdin") handle = spawnCommand(make$18(command.command, command.args, {
|
|
908
909
|
...command.options,
|
|
909
910
|
stdin: {
|
|
910
911
|
...stdinConfig,
|
|
@@ -916,7 +917,7 @@ const make$18 = /* @__PURE__ */ gen(function* () {
|
|
|
916
917
|
if (isNotUndefined(fd)) {
|
|
917
918
|
const fdName$1 = fdName(fd);
|
|
918
919
|
const existingFds = command.options.additionalFds ?? {};
|
|
919
|
-
handle = spawnCommand(make$
|
|
920
|
+
handle = spawnCommand(make$18(command.command, command.args, {
|
|
920
921
|
...command.options,
|
|
921
922
|
additionalFds: {
|
|
922
923
|
...existingFds,
|
|
@@ -926,7 +927,7 @@ const make$18 = /* @__PURE__ */ gen(function* () {
|
|
|
926
927
|
}
|
|
927
928
|
}
|
|
928
929
|
}));
|
|
929
|
-
} else handle = spawnCommand(make$
|
|
930
|
+
} else handle = spawnCommand(make$18(command.command, command.args, {
|
|
930
931
|
...command.options,
|
|
931
932
|
stdin: {
|
|
932
933
|
...stdinConfig,
|
|
@@ -939,7 +940,7 @@ const make$18 = /* @__PURE__ */ gen(function* () {
|
|
|
939
940
|
}
|
|
940
941
|
}
|
|
941
942
|
});
|
|
942
|
-
return make$
|
|
943
|
+
return make$19(spawnCommand);
|
|
943
944
|
});
|
|
944
945
|
/**
|
|
945
946
|
* Layer providing the `NodeChildProcessSpawner` implementation.
|
|
@@ -947,7 +948,7 @@ const make$18 = /* @__PURE__ */ gen(function* () {
|
|
|
947
948
|
* @since 4.0.0
|
|
948
949
|
* @category Layers
|
|
949
950
|
*/
|
|
950
|
-
const layer$11 = /* @__PURE__ */ effect(ChildProcessSpawner, make$
|
|
951
|
+
const layer$11 = /* @__PURE__ */ effect(ChildProcessSpawner, make$17);
|
|
951
952
|
/**
|
|
952
953
|
* Flattens a `Command` into an array of `StandardCommand`s along with pipe
|
|
953
954
|
* options for each connection.
|
|
@@ -1294,7 +1295,7 @@ const writeFile$1 = (path, data, options) => callback((resume, signal) => {
|
|
|
1294
1295
|
resume(fail$1(handleBadArgument("writeFile")(err)));
|
|
1295
1296
|
}
|
|
1296
1297
|
});
|
|
1297
|
-
const makeFileSystem = /* @__PURE__ */ map$3(/* @__PURE__ */ serviceOption(WatchBackend), (backend) => make$
|
|
1298
|
+
const makeFileSystem = /* @__PURE__ */ map$3(/* @__PURE__ */ serviceOption(WatchBackend), (backend) => make$21({
|
|
1298
1299
|
access,
|
|
1299
1300
|
chmod,
|
|
1300
1301
|
chown,
|
|
@@ -1363,7 +1364,7 @@ const toFileUrl = (path) => try_({
|
|
|
1363
1364
|
* @category Layers
|
|
1364
1365
|
*/
|
|
1365
1366
|
const layerPosix$1 = /* @__PURE__ */ succeed$2(Path$1)({
|
|
1366
|
-
[TypeId$
|
|
1367
|
+
[TypeId$16]: TypeId$16,
|
|
1367
1368
|
...Path.posix,
|
|
1368
1369
|
fromFileUrl,
|
|
1369
1370
|
toFileUrl
|
|
@@ -1373,7 +1374,7 @@ const layerPosix$1 = /* @__PURE__ */ succeed$2(Path$1)({
|
|
|
1373
1374
|
* @category Layers
|
|
1374
1375
|
*/
|
|
1375
1376
|
const layerWin32$1 = /* @__PURE__ */ succeed$2(Path$1)({
|
|
1376
|
-
[TypeId$
|
|
1377
|
+
[TypeId$16]: TypeId$16,
|
|
1377
1378
|
...Path.win32,
|
|
1378
1379
|
fromFileUrl,
|
|
1379
1380
|
toFileUrl
|
|
@@ -1383,7 +1384,7 @@ const layerWin32$1 = /* @__PURE__ */ succeed$2(Path$1)({
|
|
|
1383
1384
|
* @category Layers
|
|
1384
1385
|
*/
|
|
1385
1386
|
const layer$8 = /* @__PURE__ */ succeed$2(Path$1)({
|
|
1386
|
-
[TypeId$
|
|
1387
|
+
[TypeId$16]: TypeId$16,
|
|
1387
1388
|
...Path,
|
|
1388
1389
|
fromFileUrl,
|
|
1389
1390
|
toFileUrl
|
|
@@ -1414,18 +1415,18 @@ const layerWin32 = layerWin32$1;
|
|
|
1414
1415
|
* @since 4.0.0
|
|
1415
1416
|
* @category Type IDs
|
|
1416
1417
|
*/
|
|
1417
|
-
const TypeId$
|
|
1418
|
+
const TypeId$14 = "~effect/Stdio";
|
|
1418
1419
|
/**
|
|
1419
1420
|
* @since 4.0.0
|
|
1420
1421
|
* @category Services
|
|
1421
1422
|
*/
|
|
1422
|
-
const Stdio = /* @__PURE__ */ Service(TypeId$
|
|
1423
|
+
const Stdio = /* @__PURE__ */ Service(TypeId$14);
|
|
1423
1424
|
/**
|
|
1424
1425
|
* @since 4.0.0
|
|
1425
1426
|
* @category Constructors
|
|
1426
1427
|
*/
|
|
1427
|
-
const make$
|
|
1428
|
-
[TypeId$
|
|
1428
|
+
const make$16 = (options) => ({
|
|
1429
|
+
[TypeId$14]: TypeId$14,
|
|
1429
1430
|
...options
|
|
1430
1431
|
});
|
|
1431
1432
|
//#endregion
|
|
@@ -1437,7 +1438,7 @@ const make$17 = (options) => ({
|
|
|
1437
1438
|
* @category Layers
|
|
1438
1439
|
* @since 1.0.0
|
|
1439
1440
|
*/
|
|
1440
|
-
const layer$6 = /* @__PURE__ */ succeed$2(Stdio, /* @__PURE__ */ make$
|
|
1441
|
+
const layer$6 = /* @__PURE__ */ succeed$2(Stdio, /* @__PURE__ */ make$16({
|
|
1441
1442
|
stdout: /* @__PURE__ */ fromWritable({
|
|
1442
1443
|
evaluate: () => process.stdout,
|
|
1443
1444
|
onError: (cause) => systemError({
|
|
@@ -1479,7 +1480,7 @@ const layer$6 = /* @__PURE__ */ succeed$2(Stdio, /* @__PURE__ */ make$17({
|
|
|
1479
1480
|
const layer$5 = layer$6;
|
|
1480
1481
|
//#endregion
|
|
1481
1482
|
//#region ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@8881a9b/node_modules/effect/dist/Terminal.js
|
|
1482
|
-
const TypeId$
|
|
1483
|
+
const TypeId$13 = "~effect/platform/Terminal";
|
|
1483
1484
|
const QuitErrorTypeId = "effect/platform/Terminal/QuitError";
|
|
1484
1485
|
/**
|
|
1485
1486
|
* A `QuitError` represents an error that occurs when a user attempts to
|
|
@@ -1510,9 +1511,9 @@ const Terminal = /* @__PURE__ */ Service("effect/platform/Terminal");
|
|
|
1510
1511
|
* @since 4.0.0
|
|
1511
1512
|
* @category Constructors
|
|
1512
1513
|
*/
|
|
1513
|
-
const make$
|
|
1514
|
+
const make$15 = (impl) => Terminal.of({
|
|
1514
1515
|
...impl,
|
|
1515
|
-
[TypeId$
|
|
1516
|
+
[TypeId$13]: TypeId$13
|
|
1516
1517
|
});
|
|
1517
1518
|
//#endregion
|
|
1518
1519
|
//#region ../../node_modules/.bun/@effect+platform-node-shared@https+++pkg.pr.new+Effect-TS+effect-smol+@effect+platform-node-shared@8881a9b606d84a6f5eb6615279138322984f5368+eecd35a1726d7096/node_modules/@effect/platform-node-shared/dist/NodeTerminal.js
|
|
@@ -1520,10 +1521,10 @@ const make$16 = (impl) => Terminal.of({
|
|
|
1520
1521
|
* @since 1.0.0
|
|
1521
1522
|
* @category constructors
|
|
1522
1523
|
*/
|
|
1523
|
-
const make$
|
|
1524
|
+
const make$14 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit) {
|
|
1524
1525
|
const stdin = process.stdin;
|
|
1525
1526
|
const stdout = process.stdout;
|
|
1526
|
-
const rlRef = yield* make$
|
|
1527
|
+
const rlRef = yield* make$22({ acquire: acquireRelease(sync(() => {
|
|
1527
1528
|
const rl = readline$1.createInterface({
|
|
1528
1529
|
input: stdin,
|
|
1529
1530
|
escapeCodeTimeout: 50
|
|
@@ -1537,8 +1538,8 @@ const make$15 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShould
|
|
|
1537
1538
|
})) });
|
|
1538
1539
|
const columns = sync(() => stdout.columns ?? 0);
|
|
1539
1540
|
const readInput = gen(function* () {
|
|
1540
|
-
yield* get$
|
|
1541
|
-
const queue = yield* make$
|
|
1541
|
+
yield* get$1(rlRef);
|
|
1542
|
+
const queue = yield* make$23();
|
|
1542
1543
|
const handleKeypress = (s, k) => {
|
|
1543
1544
|
const userInput = {
|
|
1544
1545
|
input: s,
|
|
@@ -1556,7 +1557,7 @@ const make$15 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShould
|
|
|
1556
1557
|
stdin.on("keypress", handleKeypress);
|
|
1557
1558
|
return queue;
|
|
1558
1559
|
});
|
|
1559
|
-
const readLine = scoped(flatMap(get$
|
|
1560
|
+
const readLine = scoped(flatMap(get$1(rlRef), (readlineInterface) => callback((resume) => {
|
|
1560
1561
|
const onLine = (line) => resume(succeed(line));
|
|
1561
1562
|
readlineInterface.once("line", onLine);
|
|
1562
1563
|
return sync(() => readlineInterface.off("line", onLine));
|
|
@@ -1569,7 +1570,7 @@ const make$15 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShould
|
|
|
1569
1570
|
cause: err
|
|
1570
1571
|
}))));
|
|
1571
1572
|
}));
|
|
1572
|
-
return make$
|
|
1573
|
+
return make$15({
|
|
1573
1574
|
columns,
|
|
1574
1575
|
readInput,
|
|
1575
1576
|
readLine,
|
|
@@ -1580,7 +1581,7 @@ const make$15 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShould
|
|
|
1580
1581
|
* @since 1.0.0
|
|
1581
1582
|
* @category layers
|
|
1582
1583
|
*/
|
|
1583
|
-
const layer$4 = /* @__PURE__ */ effect(Terminal, /* @__PURE__ */ make$
|
|
1584
|
+
const layer$4 = /* @__PURE__ */ effect(Terminal, /* @__PURE__ */ make$14(defaultShouldQuit));
|
|
1584
1585
|
function defaultShouldQuit(input) {
|
|
1585
1586
|
return input.key.ctrl && (input.key.name === "c" || input.key.name === "d");
|
|
1586
1587
|
}
|
|
@@ -1593,7 +1594,7 @@ function defaultShouldQuit(input) {
|
|
|
1593
1594
|
* @since 1.0.0
|
|
1594
1595
|
* @category constructors
|
|
1595
1596
|
*/
|
|
1596
|
-
const make$
|
|
1597
|
+
const make$13 = make$14;
|
|
1597
1598
|
/**
|
|
1598
1599
|
* @since 1.0.0
|
|
1599
1600
|
* @category layers
|
|
@@ -1607,567 +1608,6 @@ const layer$3 = layer$4;
|
|
|
1607
1608
|
*/
|
|
1608
1609
|
const layer$2 = /* @__PURE__ */ provideMerge(layer$11, /* @__PURE__ */ mergeAll(layer$9, layer$7, layer$5, layer$3));
|
|
1609
1610
|
//#endregion
|
|
1610
|
-
//#region ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@8881a9b/node_modules/effect/dist/Cache.js
|
|
1611
|
-
/**
|
|
1612
|
-
* @since 4.0.0
|
|
1613
|
-
*/
|
|
1614
|
-
const TypeId$13 = "~effect/Cache";
|
|
1615
|
-
/**
|
|
1616
|
-
* Creates a cache with dynamic time-to-live based on the result and key.
|
|
1617
|
-
*
|
|
1618
|
-
* The timeToLive function receives both the exit result and the key, allowing
|
|
1619
|
-
* for flexible TTL policies based on success/failure state and key characteristics.
|
|
1620
|
-
*
|
|
1621
|
-
* @example
|
|
1622
|
-
* ```ts
|
|
1623
|
-
* import { Cache, Effect, Exit } from "effect"
|
|
1624
|
-
*
|
|
1625
|
-
* // Cache with different TTL for success vs failure
|
|
1626
|
-
* const program = Effect.gen(function*() {
|
|
1627
|
-
* const cache = yield* Cache.makeWith<string, number, string>({
|
|
1628
|
-
* capacity: 100,
|
|
1629
|
-
* lookup: (key) =>
|
|
1630
|
-
* key === "fail"
|
|
1631
|
-
* ? Effect.fail("error")
|
|
1632
|
-
* : Effect.succeed(key.length),
|
|
1633
|
-
* timeToLive: (exit, key) => {
|
|
1634
|
-
* if (Exit.isFailure(exit)) return "1 minute" // Short TTL for errors
|
|
1635
|
-
* return key.startsWith("temp") ? "5 minutes" : "1 hour"
|
|
1636
|
-
* }
|
|
1637
|
-
* })
|
|
1638
|
-
*
|
|
1639
|
-
* // Get values with different TTL policies
|
|
1640
|
-
* const result1 = yield* Cache.get(cache, "hello")
|
|
1641
|
-
* const result2 = yield* Cache.get(cache, "temp_data")
|
|
1642
|
-
* console.log({ result1, result2 }) // { result1: 5, result2: 9 }
|
|
1643
|
-
* })
|
|
1644
|
-
* ```
|
|
1645
|
-
*
|
|
1646
|
-
* @example
|
|
1647
|
-
* ```ts
|
|
1648
|
-
* import { Cache, Effect, Exit } from "effect"
|
|
1649
|
-
*
|
|
1650
|
-
* // Cache with TTL based on computed value
|
|
1651
|
-
* const userCache = Effect.gen(function*() {
|
|
1652
|
-
* const cache = yield* Cache.makeWith<
|
|
1653
|
-
* number,
|
|
1654
|
-
* { id: number; active: boolean },
|
|
1655
|
-
* never
|
|
1656
|
-
* >({
|
|
1657
|
-
* capacity: 1000,
|
|
1658
|
-
* lookup: (id) => Effect.succeed({ id, active: id % 2 === 0 }),
|
|
1659
|
-
* timeToLive: (exit) => {
|
|
1660
|
-
* if (Exit.isSuccess(exit)) {
|
|
1661
|
-
* const user = exit.value
|
|
1662
|
-
* return user.active ? "1 hour" : "5 minutes"
|
|
1663
|
-
* }
|
|
1664
|
-
* return "30 seconds"
|
|
1665
|
-
* }
|
|
1666
|
-
* })
|
|
1667
|
-
*
|
|
1668
|
-
* return cache
|
|
1669
|
-
* })
|
|
1670
|
-
* ```
|
|
1671
|
-
*
|
|
1672
|
-
* @since 4.0.0
|
|
1673
|
-
* @category Constructors
|
|
1674
|
-
*/
|
|
1675
|
-
const makeWith$1 = (options) => servicesWith((services) => {
|
|
1676
|
-
const self = Object.create(Proto$9);
|
|
1677
|
-
self.lookup = (key) => updateServices(options.lookup(key), (input) => merge$2(services, input));
|
|
1678
|
-
self.map = make$25();
|
|
1679
|
-
self.capacity = options.capacity;
|
|
1680
|
-
self.timeToLive = options.timeToLive ? (exit, key) => fromInputUnsafe(options.timeToLive(exit, key)) : defaultTimeToLive;
|
|
1681
|
-
return succeed$3(self);
|
|
1682
|
-
});
|
|
1683
|
-
/**
|
|
1684
|
-
* Creates a cache with a fixed time-to-live for all entries.
|
|
1685
|
-
*
|
|
1686
|
-
* This is the basic cache constructor where all entries share the same TTL.
|
|
1687
|
-
* The lookup function will be called when a key is not found or has expired.
|
|
1688
|
-
*
|
|
1689
|
-
* @example
|
|
1690
|
-
* ```ts
|
|
1691
|
-
* import { Cache, Effect } from "effect"
|
|
1692
|
-
*
|
|
1693
|
-
* // Basic cache with string keys
|
|
1694
|
-
* const program = Effect.gen(function*() {
|
|
1695
|
-
* const cache = yield* Cache.make<string, number>({
|
|
1696
|
-
* capacity: 100,
|
|
1697
|
-
* lookup: (key) => Effect.succeed(key.length)
|
|
1698
|
-
* })
|
|
1699
|
-
*
|
|
1700
|
-
* const result1 = yield* Cache.get(cache, "hello")
|
|
1701
|
-
* const result2 = yield* Cache.get(cache, "world")
|
|
1702
|
-
* console.log({ result1, result2 }) // { result1: 5, result2: 5 }
|
|
1703
|
-
* })
|
|
1704
|
-
* ```
|
|
1705
|
-
*
|
|
1706
|
-
* @example
|
|
1707
|
-
* ```ts
|
|
1708
|
-
* import { Cache, Effect } from "effect"
|
|
1709
|
-
*
|
|
1710
|
-
* // Cache with TTL and async lookup
|
|
1711
|
-
* const fetchUserCache = Effect.gen(function*() {
|
|
1712
|
-
* const cache = yield* Cache.make<
|
|
1713
|
-
* number,
|
|
1714
|
-
* { name: string; email: string },
|
|
1715
|
-
* string
|
|
1716
|
-
* >({
|
|
1717
|
-
* capacity: 500,
|
|
1718
|
-
* lookup: (userId) =>
|
|
1719
|
-
* Effect.tryPromise({
|
|
1720
|
-
* try: () => fetch(`/api/users/${userId}`).then((r) => r.json()),
|
|
1721
|
-
* catch: () => "Failed to fetch user"
|
|
1722
|
-
* }),
|
|
1723
|
-
* timeToLive: "15 minutes"
|
|
1724
|
-
* })
|
|
1725
|
-
*
|
|
1726
|
-
* // First call fetches from API, second call returns cached result
|
|
1727
|
-
* const user1 = yield* Cache.get(cache, 123)
|
|
1728
|
-
* const user2 = yield* Cache.get(cache, 123) // From cache
|
|
1729
|
-
* return { user1, user2 }
|
|
1730
|
-
* })
|
|
1731
|
-
* ```
|
|
1732
|
-
*
|
|
1733
|
-
* @since 4.0.0
|
|
1734
|
-
* @category Constructors
|
|
1735
|
-
*/
|
|
1736
|
-
const make$13 = (options) => makeWith$1({
|
|
1737
|
-
...options,
|
|
1738
|
-
timeToLive: options.timeToLive ? () => options.timeToLive : defaultTimeToLive
|
|
1739
|
-
});
|
|
1740
|
-
const Proto$9 = {
|
|
1741
|
-
...PipeInspectableProto,
|
|
1742
|
-
[TypeId$13]: TypeId$13,
|
|
1743
|
-
toJSON() {
|
|
1744
|
-
return {
|
|
1745
|
-
_id: "Cache",
|
|
1746
|
-
capacity: this.capacity,
|
|
1747
|
-
map: this.map
|
|
1748
|
-
};
|
|
1749
|
-
}
|
|
1750
|
-
};
|
|
1751
|
-
const defaultTimeToLive = (_, _key) => infinity;
|
|
1752
|
-
/**
|
|
1753
|
-
* Retrieves the value associated with the specified key from the cache.
|
|
1754
|
-
*
|
|
1755
|
-
* If the key is not present or has expired, it will invoke the lookup function
|
|
1756
|
-
* to construct the value, store it in the cache, and return it.
|
|
1757
|
-
*
|
|
1758
|
-
* @example
|
|
1759
|
-
* ```ts
|
|
1760
|
-
* import { Cache, Effect } from "effect"
|
|
1761
|
-
*
|
|
1762
|
-
* const program = Effect.gen(function*() {
|
|
1763
|
-
* const cache = yield* Cache.make({
|
|
1764
|
-
* capacity: 10,
|
|
1765
|
-
* lookup: (key: string) => Effect.succeed(key.length)
|
|
1766
|
-
* })
|
|
1767
|
-
*
|
|
1768
|
-
* // Cache miss - triggers lookup function
|
|
1769
|
-
* const result1 = yield* Cache.get(cache, "hello")
|
|
1770
|
-
* console.log(result1) // 5
|
|
1771
|
-
*
|
|
1772
|
-
* // Cache hit - returns cached value without lookup
|
|
1773
|
-
* const result2 = yield* Cache.get(cache, "hello")
|
|
1774
|
-
* console.log(result2) // 5 (from cache)
|
|
1775
|
-
*
|
|
1776
|
-
* return { result1, result2 }
|
|
1777
|
-
* })
|
|
1778
|
-
* ```
|
|
1779
|
-
*
|
|
1780
|
-
* @example
|
|
1781
|
-
* ```ts
|
|
1782
|
-
* import { Cache, Effect } from "effect"
|
|
1783
|
-
*
|
|
1784
|
-
* // Error handling when lookup fails
|
|
1785
|
-
* const program = Effect.gen(function*() {
|
|
1786
|
-
* const cache = yield* Cache.make<string, number, string>({
|
|
1787
|
-
* capacity: 10,
|
|
1788
|
-
* lookup: (key: string) =>
|
|
1789
|
-
* key === "error"
|
|
1790
|
-
* ? Effect.fail("Lookup failed")
|
|
1791
|
-
* : Effect.succeed(key.length)
|
|
1792
|
-
* })
|
|
1793
|
-
*
|
|
1794
|
-
* // Successful lookup
|
|
1795
|
-
* const success = yield* Cache.get(cache, "hello")
|
|
1796
|
-
* console.log(success) // 5
|
|
1797
|
-
*
|
|
1798
|
-
* // Failed lookup - returns error
|
|
1799
|
-
* const failure = yield* Effect.exit(Cache.get(cache, "error"))
|
|
1800
|
-
* console.log(failure) // Exit.fail("Lookup failed")
|
|
1801
|
-
* })
|
|
1802
|
-
* ```
|
|
1803
|
-
*
|
|
1804
|
-
* @example
|
|
1805
|
-
* ```ts
|
|
1806
|
-
* import { Cache, Effect } from "effect"
|
|
1807
|
-
*
|
|
1808
|
-
* // Concurrent access - multiple gets of same key only invoke lookup once
|
|
1809
|
-
* const program = Effect.gen(function*() {
|
|
1810
|
-
* let lookupCount = 0
|
|
1811
|
-
* const cache = yield* Cache.make({
|
|
1812
|
-
* capacity: 10,
|
|
1813
|
-
* lookup: (key: string) =>
|
|
1814
|
-
* Effect.sync(() => {
|
|
1815
|
-
* lookupCount++
|
|
1816
|
-
* return key.length
|
|
1817
|
-
* })
|
|
1818
|
-
* })
|
|
1819
|
-
*
|
|
1820
|
-
* // Multiple concurrent gets
|
|
1821
|
-
* const results = yield* Effect.all([
|
|
1822
|
-
* Cache.get(cache, "hello"),
|
|
1823
|
-
* Cache.get(cache, "hello"),
|
|
1824
|
-
* Cache.get(cache, "hello")
|
|
1825
|
-
* ], { concurrency: "unbounded" })
|
|
1826
|
-
*
|
|
1827
|
-
* console.log(results) // [5, 5, 5]
|
|
1828
|
-
* console.log(lookupCount) // 1 (lookup called only once)
|
|
1829
|
-
* })
|
|
1830
|
-
* ```
|
|
1831
|
-
*
|
|
1832
|
-
* @since 4.0.0
|
|
1833
|
-
* @category Combinators
|
|
1834
|
-
*/
|
|
1835
|
-
const get$1 = /* @__PURE__ */ dual(2, (self, key) => withFiber((fiber) => {
|
|
1836
|
-
const oentry = get$3(self.map, key);
|
|
1837
|
-
if (isSome(oentry) && !hasExpired(oentry.value, fiber)) {
|
|
1838
|
-
remove$2(self.map, key);
|
|
1839
|
-
set$3(self.map, key, oentry.value);
|
|
1840
|
-
return _await(oentry.value.deferred);
|
|
1841
|
-
}
|
|
1842
|
-
const deferred = makeUnsafe$2();
|
|
1843
|
-
const entry = {
|
|
1844
|
-
expiresAt: void 0,
|
|
1845
|
-
deferred
|
|
1846
|
-
};
|
|
1847
|
-
set$3(self.map, key, entry);
|
|
1848
|
-
if (Number.isFinite(self.capacity)) checkCapacity(self);
|
|
1849
|
-
return onExit(self.lookup(key), (exit) => {
|
|
1850
|
-
doneUnsafe(deferred, exit);
|
|
1851
|
-
const ttl = self.timeToLive(exit, key);
|
|
1852
|
-
if (isFinite$1(ttl)) entry.expiresAt = fiber.getRef(ClockRef).currentTimeMillisUnsafe() + toMillis(ttl);
|
|
1853
|
-
else if (isZero(ttl)) remove$2(self.map, key);
|
|
1854
|
-
return void_$2;
|
|
1855
|
-
});
|
|
1856
|
-
}));
|
|
1857
|
-
const hasExpired = (entry, fiber) => {
|
|
1858
|
-
if (entry.expiresAt === void 0) return false;
|
|
1859
|
-
return fiber.getRef(ClockRef).currentTimeMillisUnsafe() >= entry.expiresAt;
|
|
1860
|
-
};
|
|
1861
|
-
const checkCapacity = (self) => {
|
|
1862
|
-
let diff = size(self.map) - self.capacity;
|
|
1863
|
-
if (diff <= 0) return;
|
|
1864
|
-
for (const [key] of self.map) {
|
|
1865
|
-
remove$2(self.map, key);
|
|
1866
|
-
diff--;
|
|
1867
|
-
if (diff === 0) return;
|
|
1868
|
-
}
|
|
1869
|
-
};
|
|
1870
|
-
/**
|
|
1871
|
-
* Retrieves the value associated with the specified key from the cache,
|
|
1872
|
-
* returning an `Option` that is `Some` if the key exists and has not expired,
|
|
1873
|
-
* or `None` if the key does not exist or has expired.
|
|
1874
|
-
*
|
|
1875
|
-
* Unlike `get`, this function will not invoke the lookup function if the key
|
|
1876
|
-
* is missing or expired.
|
|
1877
|
-
*
|
|
1878
|
-
* @example
|
|
1879
|
-
* ```ts
|
|
1880
|
-
* import { Cache, Effect } from "effect"
|
|
1881
|
-
*
|
|
1882
|
-
* const program = Effect.gen(function*() {
|
|
1883
|
-
* const cache = yield* Cache.make({
|
|
1884
|
-
* capacity: 10,
|
|
1885
|
-
* lookup: (key: string) => Effect.succeed(key.length)
|
|
1886
|
-
* })
|
|
1887
|
-
*
|
|
1888
|
-
* // No value in cache yet - returns None without lookup
|
|
1889
|
-
* const empty = yield* Cache.getOption(cache, "hello")
|
|
1890
|
-
* console.log(empty) // Option.none()
|
|
1891
|
-
*
|
|
1892
|
-
* // Populate cache using get
|
|
1893
|
-
* yield* Cache.get(cache, "hello")
|
|
1894
|
-
*
|
|
1895
|
-
* // Now getOption returns the cached value
|
|
1896
|
-
* const cached = yield* Cache.getOption(cache, "hello")
|
|
1897
|
-
* console.log(cached) // Option.some(5)
|
|
1898
|
-
*
|
|
1899
|
-
* return { empty, cached }
|
|
1900
|
-
* })
|
|
1901
|
-
* ```
|
|
1902
|
-
*
|
|
1903
|
-
* @example
|
|
1904
|
-
* ```ts
|
|
1905
|
-
* import { Cache, Effect } from "effect"
|
|
1906
|
-
* import { TestClock } from "effect/testing"
|
|
1907
|
-
*
|
|
1908
|
-
* // Expired entries return None
|
|
1909
|
-
* const program = Effect.gen(function*() {
|
|
1910
|
-
* const cache = yield* Cache.make({
|
|
1911
|
-
* capacity: 10,
|
|
1912
|
-
* lookup: (key: string) => Effect.succeed(key.length),
|
|
1913
|
-
* timeToLive: "1 hour"
|
|
1914
|
-
* })
|
|
1915
|
-
*
|
|
1916
|
-
* // Add value to cache
|
|
1917
|
-
* yield* Cache.get(cache, "hello")
|
|
1918
|
-
*
|
|
1919
|
-
* // Value exists before expiration
|
|
1920
|
-
* const beforeExpiry = yield* Cache.getOption(cache, "hello")
|
|
1921
|
-
* console.log(beforeExpiry) // Option.some(5)
|
|
1922
|
-
*
|
|
1923
|
-
* // Simulate time passing
|
|
1924
|
-
* yield* TestClock.adjust("2 hours")
|
|
1925
|
-
*
|
|
1926
|
-
* // Value expired - returns None
|
|
1927
|
-
* const afterExpiry = yield* Cache.getOption(cache, "hello")
|
|
1928
|
-
* console.log(afterExpiry) // Option.none()
|
|
1929
|
-
* })
|
|
1930
|
-
* ```
|
|
1931
|
-
*
|
|
1932
|
-
* @example
|
|
1933
|
-
* ```ts
|
|
1934
|
-
* import { Cache, Deferred, Effect, Fiber } from "effect"
|
|
1935
|
-
*
|
|
1936
|
-
* // Waits for ongoing computation to complete
|
|
1937
|
-
* const program = Effect.gen(function*() {
|
|
1938
|
-
* const deferred = yield* Deferred.make<void>()
|
|
1939
|
-
* const cache = yield* Cache.make({
|
|
1940
|
-
* capacity: 10,
|
|
1941
|
-
* lookup: (_key: string) => Deferred.await(deferred).pipe(Effect.as(42))
|
|
1942
|
-
* })
|
|
1943
|
-
*
|
|
1944
|
-
* // Start lookup in background
|
|
1945
|
-
* const getFiber = yield* Effect.forkChild(Cache.get(cache, "key"))
|
|
1946
|
-
*
|
|
1947
|
-
* // getOption waits for ongoing computation
|
|
1948
|
-
* const optionFiber = yield* Effect.forkChild(Cache.getOption(cache, "key"))
|
|
1949
|
-
*
|
|
1950
|
-
* // Complete the computation
|
|
1951
|
-
* yield* Deferred.succeed(deferred, void 0)
|
|
1952
|
-
*
|
|
1953
|
-
* const result = yield* Fiber.join(optionFiber)
|
|
1954
|
-
* console.log(result) // Option.some(42)
|
|
1955
|
-
* })
|
|
1956
|
-
* ```
|
|
1957
|
-
*
|
|
1958
|
-
* @since 4.0.0
|
|
1959
|
-
* @category Combinators
|
|
1960
|
-
*/
|
|
1961
|
-
const getOption = /* @__PURE__ */ dual(2, (self, key) => withFiber((fiber) => {
|
|
1962
|
-
const entry = getImpl(self, key, fiber);
|
|
1963
|
-
return entry ? asSome(_await(entry.deferred)) : succeedNone;
|
|
1964
|
-
}));
|
|
1965
|
-
const getImpl = (self, key, fiber, isRead = true) => {
|
|
1966
|
-
const oentry = get$3(self.map, key);
|
|
1967
|
-
if (isNone(oentry)) return;
|
|
1968
|
-
else if (hasExpired(oentry.value, fiber)) {
|
|
1969
|
-
remove$2(self.map, key);
|
|
1970
|
-
return;
|
|
1971
|
-
} else if (isRead) {
|
|
1972
|
-
remove$2(self.map, key);
|
|
1973
|
-
set$3(self.map, key, oentry.value);
|
|
1974
|
-
}
|
|
1975
|
-
return oentry.value;
|
|
1976
|
-
};
|
|
1977
|
-
/**
|
|
1978
|
-
* Sets the value associated with the specified key in the cache. This will
|
|
1979
|
-
* overwrite any existing value for that key, skipping the lookup function.
|
|
1980
|
-
*
|
|
1981
|
-
* @example
|
|
1982
|
-
* ```ts
|
|
1983
|
-
* import { Cache, Effect } from "effect"
|
|
1984
|
-
*
|
|
1985
|
-
* const program = Effect.gen(function*() {
|
|
1986
|
-
* const cache = yield* Cache.make({
|
|
1987
|
-
* capacity: 100,
|
|
1988
|
-
* lookup: (key: string) => Effect.succeed(key.length)
|
|
1989
|
-
* })
|
|
1990
|
-
*
|
|
1991
|
-
* // Set a value directly without invoking lookup
|
|
1992
|
-
* yield* Cache.set(cache, "hello", 42)
|
|
1993
|
-
* const result = yield* Cache.get(cache, "hello")
|
|
1994
|
-
* console.log(result) // 42 (not 5 from lookup)
|
|
1995
|
-
* })
|
|
1996
|
-
* ```
|
|
1997
|
-
*
|
|
1998
|
-
* @example
|
|
1999
|
-
* ```ts
|
|
2000
|
-
* import { Cache, Effect } from "effect"
|
|
2001
|
-
*
|
|
2002
|
-
* // Overwriting existing cached values
|
|
2003
|
-
* const program = Effect.gen(function*() {
|
|
2004
|
-
* const cache = yield* Cache.make({
|
|
2005
|
-
* capacity: 100,
|
|
2006
|
-
* lookup: (key: string) => Effect.succeed(key.length)
|
|
2007
|
-
* })
|
|
2008
|
-
*
|
|
2009
|
-
* // First get populates via lookup
|
|
2010
|
-
* const original = yield* Cache.get(cache, "test") // 4
|
|
2011
|
-
*
|
|
2012
|
-
* // Set overwrites the cached value
|
|
2013
|
-
* yield* Cache.set(cache, "test", 999)
|
|
2014
|
-
* const updated = yield* Cache.get(cache, "test") // 999
|
|
2015
|
-
*
|
|
2016
|
-
* console.log({ original, updated })
|
|
2017
|
-
* })
|
|
2018
|
-
* ```
|
|
2019
|
-
*
|
|
2020
|
-
* @example
|
|
2021
|
-
* ```ts
|
|
2022
|
-
* import { Cache, Effect } from "effect"
|
|
2023
|
-
* import { TestClock } from "effect/testing"
|
|
2024
|
-
*
|
|
2025
|
-
* // TTL behavior with set operations
|
|
2026
|
-
* const program = Effect.gen(function*() {
|
|
2027
|
-
* const cache = yield* Cache.make({
|
|
2028
|
-
* capacity: 100,
|
|
2029
|
-
* lookup: (key: string) => Effect.succeed(key.length),
|
|
2030
|
-
* timeToLive: "1 hour"
|
|
2031
|
-
* })
|
|
2032
|
-
*
|
|
2033
|
-
* // Set value with TTL applied
|
|
2034
|
-
* yield* Cache.set(cache, "temporary", 123)
|
|
2035
|
-
* console.log(yield* Cache.has(cache, "temporary")) // true
|
|
2036
|
-
*
|
|
2037
|
-
* // Advance time past TTL
|
|
2038
|
-
* yield* TestClock.adjust("2 hours")
|
|
2039
|
-
* console.log(yield* Cache.has(cache, "temporary")) // false
|
|
2040
|
-
* })
|
|
2041
|
-
* ```
|
|
2042
|
-
*
|
|
2043
|
-
* @example
|
|
2044
|
-
* ```ts
|
|
2045
|
-
* import { Cache, Effect } from "effect"
|
|
2046
|
-
*
|
|
2047
|
-
* // Capacity enforcement with set operations
|
|
2048
|
-
* const program = Effect.gen(function*() {
|
|
2049
|
-
* const cache = yield* Cache.make({
|
|
2050
|
-
* capacity: 2,
|
|
2051
|
-
* lookup: (key: string) => Effect.succeed(key.length)
|
|
2052
|
-
* })
|
|
2053
|
-
*
|
|
2054
|
-
* // Fill cache to capacity
|
|
2055
|
-
* yield* Cache.set(cache, "a", 1)
|
|
2056
|
-
* yield* Cache.set(cache, "b", 2)
|
|
2057
|
-
* console.log(yield* Cache.size(cache)) // 2
|
|
2058
|
-
*
|
|
2059
|
-
* // Adding another entry evicts oldest
|
|
2060
|
-
* yield* Cache.set(cache, "c", 3)
|
|
2061
|
-
* console.log(yield* Cache.size(cache)) // 2
|
|
2062
|
-
* console.log(yield* Cache.has(cache, "a")) // false (evicted)
|
|
2063
|
-
* console.log(yield* Cache.has(cache, "c")) // true
|
|
2064
|
-
* })
|
|
2065
|
-
* ```
|
|
2066
|
-
*
|
|
2067
|
-
* @since 4.0.0
|
|
2068
|
-
* @category Combinators
|
|
2069
|
-
*/
|
|
2070
|
-
const set$2 = /* @__PURE__ */ dual(3, (self, key, value) => withFiber((fiber) => {
|
|
2071
|
-
const exit = exitSucceed(value);
|
|
2072
|
-
const deferred = makeUnsafe$2();
|
|
2073
|
-
doneUnsafe(deferred, exit);
|
|
2074
|
-
const ttl = self.timeToLive(exit, key);
|
|
2075
|
-
if (isZero(ttl)) {
|
|
2076
|
-
remove$2(self.map, key);
|
|
2077
|
-
return void_$2;
|
|
2078
|
-
}
|
|
2079
|
-
set$3(self.map, key, {
|
|
2080
|
-
deferred,
|
|
2081
|
-
expiresAt: isFinite$1(ttl) ? fiber.getRef(ClockRef).currentTimeMillisUnsafe() + toMillis(ttl) : void 0
|
|
2082
|
-
});
|
|
2083
|
-
checkCapacity(self);
|
|
2084
|
-
return void_$2;
|
|
2085
|
-
}));
|
|
2086
|
-
/**
|
|
2087
|
-
* Invalidates the entry associated with the specified key in the cache.
|
|
2088
|
-
*
|
|
2089
|
-
* @example
|
|
2090
|
-
* ```ts
|
|
2091
|
-
* import { Cache, Effect } from "effect"
|
|
2092
|
-
*
|
|
2093
|
-
* const program = Effect.gen(function*() {
|
|
2094
|
-
* const cache = yield* Cache.make({
|
|
2095
|
-
* capacity: 10,
|
|
2096
|
-
* lookup: (key: string) => Effect.succeed(key.length)
|
|
2097
|
-
* })
|
|
2098
|
-
*
|
|
2099
|
-
* // Add a value to the cache
|
|
2100
|
-
* yield* Cache.get(cache, "hello")
|
|
2101
|
-
* console.log(yield* Cache.has(cache, "hello")) // true
|
|
2102
|
-
*
|
|
2103
|
-
* // Invalidate the entry
|
|
2104
|
-
* yield* Cache.invalidate(cache, "hello")
|
|
2105
|
-
* console.log(yield* Cache.has(cache, "hello")) // false
|
|
2106
|
-
*
|
|
2107
|
-
* // Invalidating non-existent keys doesn't error
|
|
2108
|
-
* yield* Cache.invalidate(cache, "nonexistent")
|
|
2109
|
-
*
|
|
2110
|
-
* // Get after invalidation will invoke lookup again
|
|
2111
|
-
* let lookupCount = 0
|
|
2112
|
-
* const cache2 = yield* Cache.make({
|
|
2113
|
-
* capacity: 10,
|
|
2114
|
-
* lookup: (key: string) =>
|
|
2115
|
-
* Effect.sync(() => {
|
|
2116
|
-
* lookupCount++
|
|
2117
|
-
* return key.length
|
|
2118
|
-
* })
|
|
2119
|
-
* })
|
|
2120
|
-
*
|
|
2121
|
-
* yield* Cache.get(cache2, "test") // lookupCount = 1
|
|
2122
|
-
* yield* Cache.invalidate(cache2, "test")
|
|
2123
|
-
* yield* Cache.get(cache2, "test") // lookupCount = 2 (lookup called again)
|
|
2124
|
-
* })
|
|
2125
|
-
* ```
|
|
2126
|
-
*
|
|
2127
|
-
* @since 4.0.0
|
|
2128
|
-
* @category Combinators
|
|
2129
|
-
*/
|
|
2130
|
-
const invalidate = /* @__PURE__ */ dual(2, (self, key) => sync$1(() => {
|
|
2131
|
-
remove$2(self.map, key);
|
|
2132
|
-
}));
|
|
2133
|
-
/**
|
|
2134
|
-
* Retrieves all active keys from the cache, automatically filtering out expired entries.
|
|
2135
|
-
*
|
|
2136
|
-
* @example
|
|
2137
|
-
* ```ts
|
|
2138
|
-
* import { Cache, Effect } from "effect"
|
|
2139
|
-
*
|
|
2140
|
-
* // Basic key enumeration
|
|
2141
|
-
* const program = Effect.gen(function*() {
|
|
2142
|
-
* const cache = yield* Cache.make({
|
|
2143
|
-
* capacity: 10,
|
|
2144
|
-
* lookup: (key: string) => Effect.succeed(key.length)
|
|
2145
|
-
* })
|
|
2146
|
-
*
|
|
2147
|
-
* // Add some entries to the cache
|
|
2148
|
-
* yield* Cache.get(cache, "hello")
|
|
2149
|
-
* yield* Cache.get(cache, "world")
|
|
2150
|
-
* yield* Cache.get(cache, "cache")
|
|
2151
|
-
*
|
|
2152
|
-
* // Retrieve all active keys
|
|
2153
|
-
* const keys = yield* Cache.keys(cache)
|
|
2154
|
-
*
|
|
2155
|
-
* console.log(Array.from(keys)) // ["hello", "world", "cache"]
|
|
2156
|
-
* })
|
|
2157
|
-
* ```
|
|
2158
|
-
*
|
|
2159
|
-
* @since 4.0.0
|
|
2160
|
-
* @category Combinators
|
|
2161
|
-
*/
|
|
2162
|
-
const keys = (self) => withFiber((fiber) => {
|
|
2163
|
-
const now = fiber.getRef(ClockRef).currentTimeMillisUnsafe();
|
|
2164
|
-
return succeed$3(filterMap(self.map, ([key, entry]) => {
|
|
2165
|
-
if (entry.expiresAt === void 0 || entry.expiresAt > now) return succeed$4(key);
|
|
2166
|
-
remove$2(self.map, key);
|
|
2167
|
-
return failVoid;
|
|
2168
|
-
}));
|
|
2169
|
-
});
|
|
2170
|
-
//#endregion
|
|
2171
1611
|
//#region ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@8881a9b/node_modules/effect/dist/Console.js
|
|
2172
1612
|
/**
|
|
2173
1613
|
* A reference to the current console service in the Effect system.
|
|
@@ -3065,7 +2505,7 @@ const RefProto = {
|
|
|
3065
2505
|
*/
|
|
3066
2506
|
const makeUnsafe = (value) => {
|
|
3067
2507
|
const self = Object.create(RefProto);
|
|
3068
|
-
self.ref = make$
|
|
2508
|
+
self.ref = make$20(value);
|
|
3069
2509
|
return self;
|
|
3070
2510
|
};
|
|
3071
2511
|
/**
|
|
@@ -3133,7 +2573,7 @@ const get = (self) => sync(() => self.ref.current);
|
|
|
3133
2573
|
* @since 2.0.0
|
|
3134
2574
|
* @category setters
|
|
3135
2575
|
*/
|
|
3136
|
-
const set$1 = /* @__PURE__ */ dual(2, (self, value) => sync(() => set$
|
|
2576
|
+
const set$1 = /* @__PURE__ */ dual(2, (self, value) => sync(() => set$2(self.ref, value)));
|
|
3137
2577
|
/**
|
|
3138
2578
|
* Atomically modifies the value of the Ref using the given function.
|
|
3139
2579
|
*
|
|
@@ -11465,6 +10905,7 @@ var require_resolve_block_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11465
10905
|
onError(token, "UNEXPECTED_TOKEN", token.message);
|
|
11466
10906
|
length += token.source.length;
|
|
11467
10907
|
break;
|
|
10908
|
+
/* istanbul ignore next should not happen */
|
|
11468
10909
|
default: {
|
|
11469
10910
|
onError(token, "UNEXPECTED_TOKEN", `Unexpected token in block scalar header: ${token.type}`);
|
|
11470
10911
|
const ts = token.source;
|
|
@@ -11514,6 +10955,7 @@ var require_resolve_flow_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11514
10955
|
_type = Scalar.Scalar.QUOTE_DOUBLE;
|
|
11515
10956
|
value = doubleQuotedValue(source, _onError);
|
|
11516
10957
|
break;
|
|
10958
|
+
/* istanbul ignore next should not happen */
|
|
11517
10959
|
default:
|
|
11518
10960
|
onError(scalar, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${type}`);
|
|
11519
10961
|
return {
|
|
@@ -11543,6 +10985,7 @@ var require_resolve_flow_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11543
10985
|
function plainValue(source, onError) {
|
|
11544
10986
|
let badChar = "";
|
|
11545
10987
|
switch (source[0]) {
|
|
10988
|
+
/* istanbul ignore next should not happen */
|
|
11546
10989
|
case " ":
|
|
11547
10990
|
badChar = "a tab character";
|
|
11548
10991
|
break;
|
|
@@ -13199,6 +12642,7 @@ var require_parser$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13199
12642
|
return it.sep ?? it.start;
|
|
13200
12643
|
}
|
|
13201
12644
|
case "block-seq": return parent.items[parent.items.length - 1].start;
|
|
12645
|
+
/* istanbul ignore next should not happen */
|
|
13202
12646
|
default: return [];
|
|
13203
12647
|
}
|
|
13204
12648
|
}
|
|
@@ -13451,6 +12895,7 @@ var require_parser$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13451
12895
|
});
|
|
13452
12896
|
return;
|
|
13453
12897
|
}
|
|
12898
|
+
/* istanbul ignore next should not happen */
|
|
13454
12899
|
default:
|
|
13455
12900
|
yield* this.pop();
|
|
13456
12901
|
yield* this.pop(token);
|
|
@@ -13568,6 +13013,7 @@ var require_parser$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13568
13013
|
}
|
|
13569
13014
|
yield* this.pop();
|
|
13570
13015
|
break;
|
|
13016
|
+
/* istanbul ignore next should not happen */
|
|
13571
13017
|
default:
|
|
13572
13018
|
yield* this.pop();
|
|
13573
13019
|
yield* this.step();
|
|
@@ -17115,10 +16561,10 @@ const runWith = (command, config) => {
|
|
|
17115
16561
|
program = provideService(program, LogLevel, logLevel);
|
|
17116
16562
|
const services = match(logLevel, {
|
|
17117
16563
|
onNone: () => empty$5(),
|
|
17118
|
-
onSome: (level) => make$
|
|
16564
|
+
onSome: (level) => make$24(MinimumLogLevel, level)
|
|
17119
16565
|
});
|
|
17120
16566
|
yield* provideServices(program, services);
|
|
17121
|
-
}, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed$
|
|
16567
|
+
}, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed$3(error) : fail$3(error), (error) => showHelp(command, error.commandPath)), catchFilter((e) => isQuitError(e) ? succeed$3(e) : fail$3(e), (_) => interrupt));
|
|
17122
16568
|
};
|
|
17123
16569
|
//#endregion
|
|
17124
16570
|
//#region ../../packages/t3-shared/src/Net.ts
|
|
@@ -20095,7 +19541,7 @@ const launchDetached = (launch) => gen(function* () {
|
|
|
20095
19541
|
});
|
|
20096
19542
|
const make$9 = gen(function* () {
|
|
20097
19543
|
const open = yield* tryPromise({
|
|
20098
|
-
try: () => import("./open-
|
|
19544
|
+
try: () => import("./open-Cm7F9p66.mjs"),
|
|
20099
19545
|
catch: (cause) => new OpenError({
|
|
20100
19546
|
message: "failed to load browser opener",
|
|
20101
19547
|
cause
|
|
@@ -20222,7 +19668,7 @@ const make$8 = ({ dumpSchema = () => void_$1 }) => ({ loader, schemaDirectory, t
|
|
|
20222
19668
|
if (schemaDirectory && completed.length > 0) yield* dumpSchema(`${schemaDirectory}/_schema.sql`, table).pipe(catchCause((cause) => logInfo$1("Could not dump schema", cause)));
|
|
20223
19669
|
return completed;
|
|
20224
19670
|
});
|
|
20225
|
-
const migrationOrder = /* @__PURE__ */ make$
|
|
19671
|
+
const migrationOrder = /* @__PURE__ */ make$25(([a], [b]) => Number$2(a, b));
|
|
20226
19672
|
/**
|
|
20227
19673
|
* @since 4.0.0
|
|
20228
19674
|
* @category loaders
|
|
@@ -20924,8 +20370,8 @@ const runMigrations = gen(function* () {
|
|
|
20924
20370
|
//#endregion
|
|
20925
20371
|
//#region src/persistence/Layers/Sqlite.ts
|
|
20926
20372
|
const defaultSqliteClientLoaders = {
|
|
20927
|
-
bun: () => import("./SqliteClient-
|
|
20928
|
-
node: () => import("./NodeSqliteClient-
|
|
20373
|
+
bun: () => import("./SqliteClient-BBxZHTRF.mjs"),
|
|
20374
|
+
node: () => import("./NodeSqliteClient-BPzkJKIG.mjs")
|
|
20929
20375
|
};
|
|
20930
20376
|
const makeRuntimeSqliteLayer = (config) => gen(function* () {
|
|
20931
20377
|
const loader = defaultSqliteClientLoaders[process.versions.bun !== void 0 ? "bun" : "node"];
|
|
@@ -21254,7 +20700,7 @@ const makeGitService = gen(function* () {
|
|
|
21254
20700
|
const timeoutMs = input.timeoutMs ?? DEFAULT_TIMEOUT_MS$2;
|
|
21255
20701
|
const maxOutputBytes = input.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES;
|
|
21256
20702
|
return yield* gen(function* () {
|
|
21257
|
-
const child = yield* commandSpawner.spawn(make$
|
|
20703
|
+
const child = yield* commandSpawner.spawn(make$18("git", commandInput.args, {
|
|
21258
20704
|
cwd: commandInput.cwd,
|
|
21259
20705
|
...input.env ? { env: input.env } : {}
|
|
21260
20706
|
})).pipe(mapError(toGitCommandError(commandInput, "failed to spawn.")));
|
|
@@ -21604,7 +21050,7 @@ const findOne = (options) => {
|
|
|
21604
21050
|
const findOneOption = (options) => {
|
|
21605
21051
|
const encodeRequest = encodeEffect(options.Request);
|
|
21606
21052
|
const decode = decodeUnknownEffect(options.Result);
|
|
21607
|
-
return (request) => flatMap(flatMap(encodeRequest(request), options.execute), (arr) => isReadonlyArrayNonEmpty(arr) ? asSome
|
|
21053
|
+
return (request) => flatMap(flatMap(encodeRequest(request), options.execute), (arr) => isReadonlyArrayNonEmpty(arr) ? asSome(decode(arr[0])) : succeedNone);
|
|
21608
21054
|
};
|
|
21609
21055
|
//#endregion
|
|
21610
21056
|
//#region src/persistence/Errors.ts
|
|
@@ -24777,7 +24223,7 @@ const makeOrchestrationEngine = gen(function* () {
|
|
|
24777
24223
|
const existingReceipt = yield* commandReceiptRepository.getByCommandId({ commandId: envelope.command.commandId });
|
|
24778
24224
|
if (isSome(existingReceipt)) {
|
|
24779
24225
|
if (existingReceipt.value.status === "accepted") {
|
|
24780
|
-
yield* succeed$
|
|
24226
|
+
yield* succeed$4(envelope.result, { sequence: existingReceipt.value.resultSequence });
|
|
24781
24227
|
return;
|
|
24782
24228
|
}
|
|
24783
24229
|
yield* fail$4(envelope.result, new OrchestrationCommandPreviouslyRejectedError({
|
|
@@ -24822,7 +24268,7 @@ const makeOrchestrationEngine = gen(function* () {
|
|
|
24822
24268
|
})).pipe(catchTag("SqlError", (sqlError) => fail$1(toPersistenceSqlError("OrchestrationEngine.processEnvelope:transaction")(sqlError))));
|
|
24823
24269
|
readModel = committedCommand.nextReadModel;
|
|
24824
24270
|
for (const event of committedCommand.committedEvents) yield* publish(eventPubSub, event);
|
|
24825
|
-
yield* succeed$
|
|
24271
|
+
yield* succeed$4(envelope.result, { sequence: committedCommand.lastSequence });
|
|
24826
24272
|
}).pipe(catch_((error) => gen(function* () {
|
|
24827
24273
|
yield* reconcileReadModelAfterDispatchFailure.pipe(catch_(() => logWarning$1("failed to reconcile orchestration read model after dispatch failure").pipe(annotateLogs({
|
|
24828
24274
|
commandId: envelope.command.commandId,
|
|
@@ -24867,7 +24313,7 @@ const makeOrchestrationEngine = gen(function* () {
|
|
|
24867
24313
|
const getReadModel = () => sync(() => readModel);
|
|
24868
24314
|
const readEvents = (fromSequenceExclusive) => eventStore.readFromSequence(fromSequenceExclusive);
|
|
24869
24315
|
const dispatch = (command) => gen(function* () {
|
|
24870
|
-
const result = yield* make$
|
|
24316
|
+
const result = yield* make$26();
|
|
24871
24317
|
yield* offer$1(commandQueue, {
|
|
24872
24318
|
command,
|
|
24873
24319
|
result
|
|
@@ -24907,8 +24353,8 @@ const OrchestrationEngineLive = effect(OrchestrationEngineService, makeOrchestra
|
|
|
24907
24353
|
*/
|
|
24908
24354
|
const makeDrainableWorker = (process) => gen(function* () {
|
|
24909
24355
|
const queue = yield* unbounded();
|
|
24910
|
-
const initialIdle = yield* make$
|
|
24911
|
-
yield* succeed$
|
|
24356
|
+
const initialIdle = yield* make$26();
|
|
24357
|
+
yield* succeed$4(initialIdle, void 0).pipe(orDie);
|
|
24912
24358
|
const state = yield* make$11({
|
|
24913
24359
|
outstanding: 0,
|
|
24914
24360
|
idle: initialIdle
|
|
@@ -24920,10 +24366,10 @@ const makeDrainableWorker = (process) => gen(function* () {
|
|
|
24920
24366
|
outstanding: remaining,
|
|
24921
24367
|
idle: current.idle
|
|
24922
24368
|
}];
|
|
24923
|
-
}).pipe(flatMap((idle) => idle === null ? void_$1 : succeed$
|
|
24369
|
+
}).pipe(flatMap((idle) => idle === null ? void_$1 : succeed$4(idle, void 0).pipe(orDie)));
|
|
24924
24370
|
yield* forkScoped(forever(take(queue).pipe(flatMap((item) => process(item).pipe(ensuring(finishOne))))));
|
|
24925
24371
|
const enqueue = (item) => gen(function* () {
|
|
24926
|
-
const nextIdle = yield* make$
|
|
24372
|
+
const nextIdle = yield* make$26();
|
|
24927
24373
|
yield* update(state, (current) => current.outstanding === 0 ? {
|
|
24928
24374
|
outstanding: 1,
|
|
24929
24375
|
idle: nextIdle
|
|
@@ -26223,12 +25669,12 @@ const make$5 = gen(function* () {
|
|
|
26223
25669
|
const providerService = yield* ProviderService;
|
|
26224
25670
|
const git = yield* GitCore;
|
|
26225
25671
|
const textGeneration = yield* TextGeneration;
|
|
26226
|
-
const handledTurnStartKeys = yield* make$
|
|
25672
|
+
const handledTurnStartKeys = yield* make$32({
|
|
26227
25673
|
capacity: HANDLED_TURN_START_KEY_MAX,
|
|
26228
25674
|
timeToLive: HANDLED_TURN_START_KEY_TTL,
|
|
26229
25675
|
lookup: () => succeed(true)
|
|
26230
25676
|
});
|
|
26231
|
-
const hasHandledTurnStartRecently = (key) => getOption(handledTurnStartKeys, key).pipe(flatMap((cached) => set$
|
|
25677
|
+
const hasHandledTurnStartRecently = (key) => getOption(handledTurnStartKeys, key).pipe(flatMap((cached) => set$3(handledTurnStartKeys, key, true).pipe(as(isSome(cached)))));
|
|
26232
25678
|
const threadProviderOptions = /* @__PURE__ */ new Map();
|
|
26233
25679
|
const threadModelSelections = /* @__PURE__ */ new Map();
|
|
26234
25680
|
const appendProviderFailureActivity = (input) => orchestrationEngine.dispatch({
|
|
@@ -33843,17 +33289,17 @@ const make$4 = gen(function* () {
|
|
|
33843
33289
|
const assistantDeliveryModeRef = yield* make$11(DEFAULT_ASSISTANT_DELIVERY_MODE);
|
|
33844
33290
|
const passiveImportedThreadRecoveryLastStartedAtMs = /* @__PURE__ */ new Map();
|
|
33845
33291
|
const passiveImportedThreadRecoveryInFlight = /* @__PURE__ */ new Map();
|
|
33846
|
-
const turnMessageIdsByTurnKey = yield* make$
|
|
33292
|
+
const turnMessageIdsByTurnKey = yield* make$32({
|
|
33847
33293
|
capacity: TURN_MESSAGE_IDS_BY_TURN_CACHE_CAPACITY,
|
|
33848
33294
|
timeToLive: TURN_MESSAGE_IDS_BY_TURN_TTL,
|
|
33849
33295
|
lookup: () => succeed(/* @__PURE__ */ new Set())
|
|
33850
33296
|
});
|
|
33851
|
-
const bufferedAssistantTextByMessageId = yield* make$
|
|
33297
|
+
const bufferedAssistantTextByMessageId = yield* make$32({
|
|
33852
33298
|
capacity: BUFFERED_MESSAGE_TEXT_BY_MESSAGE_ID_CACHE_CAPACITY,
|
|
33853
33299
|
timeToLive: BUFFERED_MESSAGE_TEXT_BY_MESSAGE_ID_TTL,
|
|
33854
33300
|
lookup: () => succeed("")
|
|
33855
33301
|
});
|
|
33856
|
-
const bufferedProposedPlanById = yield* make$
|
|
33302
|
+
const bufferedProposedPlanById = yield* make$32({
|
|
33857
33303
|
capacity: BUFFERED_PROPOSED_PLAN_BY_ID_CACHE_CAPACITY,
|
|
33858
33304
|
timeToLive: BUFFERED_PROPOSED_PLAN_BY_ID_TTL,
|
|
33859
33305
|
lookup: () => succeed({
|
|
@@ -33872,7 +33318,7 @@ const make$4 = gen(function* () {
|
|
|
33872
33318
|
if (!workspaceCwd) return false;
|
|
33873
33319
|
return isGitRepository(workspaceCwd);
|
|
33874
33320
|
});
|
|
33875
|
-
const rememberAssistantMessageId = (threadId, turnId, messageId) => getOption(turnMessageIdsByTurnKey, providerTurnKey(threadId, turnId)).pipe(flatMap((existingIds) => set$
|
|
33321
|
+
const rememberAssistantMessageId = (threadId, turnId, messageId) => getOption(turnMessageIdsByTurnKey, providerTurnKey(threadId, turnId)).pipe(flatMap((existingIds) => set$3(turnMessageIdsByTurnKey, providerTurnKey(threadId, turnId), match(existingIds, {
|
|
33876
33322
|
onNone: () => new Set([messageId]),
|
|
33877
33323
|
onSome: (ids) => {
|
|
33878
33324
|
const nextIds = new Set(ids);
|
|
@@ -33886,7 +33332,7 @@ const make$4 = gen(function* () {
|
|
|
33886
33332
|
const nextIds = new Set(ids);
|
|
33887
33333
|
nextIds.delete(messageId);
|
|
33888
33334
|
if (nextIds.size === 0) return invalidate(turnMessageIdsByTurnKey, providerTurnKey(threadId, turnId));
|
|
33889
|
-
return set$
|
|
33335
|
+
return set$3(turnMessageIdsByTurnKey, providerTurnKey(threadId, turnId), nextIds);
|
|
33890
33336
|
}
|
|
33891
33337
|
})));
|
|
33892
33338
|
const getAssistantMessageIdsForTurn = (threadId, turnId) => getOption(turnMessageIdsByTurnKey, providerTurnKey(threadId, turnId)).pipe(map$3((existingIds) => getOrElse(existingIds, () => /* @__PURE__ */ new Set())));
|
|
@@ -33897,7 +33343,7 @@ const make$4 = gen(function* () {
|
|
|
33897
33343
|
onSome: (text) => `${text}${delta}`
|
|
33898
33344
|
});
|
|
33899
33345
|
if (nextText.length <= MAX_BUFFERED_ASSISTANT_CHARS) {
|
|
33900
|
-
yield* set$
|
|
33346
|
+
yield* set$3(bufferedAssistantTextByMessageId, messageId, nextText);
|
|
33901
33347
|
return "";
|
|
33902
33348
|
}
|
|
33903
33349
|
yield* invalidate(bufferedAssistantTextByMessageId, messageId);
|
|
@@ -33907,7 +33353,7 @@ const make$4 = gen(function* () {
|
|
|
33907
33353
|
const clearBufferedAssistantText = (messageId) => invalidate(bufferedAssistantTextByMessageId, messageId);
|
|
33908
33354
|
const appendBufferedProposedPlan = (planId, delta, createdAt) => getOption(bufferedProposedPlanById, planId).pipe(flatMap((existingEntry) => {
|
|
33909
33355
|
const existing = getOrUndefined(existingEntry);
|
|
33910
|
-
return set$
|
|
33356
|
+
return set$3(bufferedProposedPlanById, planId, {
|
|
33911
33357
|
text: `${existing?.text ?? ""}${delta}`,
|
|
33912
33358
|
createdAt: existing?.createdAt && existing.createdAt.length > 0 ? existing.createdAt : createdAt
|
|
33913
33359
|
});
|
|
@@ -35754,7 +35200,7 @@ function makeThreadWriter(input) {
|
|
|
35754
35200
|
return;
|
|
35755
35201
|
}
|
|
35756
35202
|
const sink = sinkResult.sink;
|
|
35757
|
-
const scope = yield* make$
|
|
35203
|
+
const scope = yield* make$27();
|
|
35758
35204
|
const loggerLayer = layer$1([yield* batched(makeLineLogger(input.streamLabel), {
|
|
35759
35205
|
window: input.batchWindowMs,
|
|
35760
35206
|
flush: (messages) => gen(function* () {
|
|
@@ -38588,11 +38034,11 @@ const makeKeybindings = gen(function* () {
|
|
|
38588
38034
|
const { keybindingsConfigPath, stateDir } = yield* ServerConfig$1;
|
|
38589
38035
|
const fs = yield* FileSystem;
|
|
38590
38036
|
const path = yield* Path$1;
|
|
38591
|
-
const upsertSemaphore = yield* make$
|
|
38037
|
+
const upsertSemaphore = yield* make$28(1);
|
|
38592
38038
|
const resolvedConfigCacheKey = "resolved";
|
|
38593
38039
|
const changesPubSub = yield* unbounded$1();
|
|
38594
38040
|
const startedRef = yield* make$11(false);
|
|
38595
|
-
const startedDeferred = yield* make$
|
|
38041
|
+
const startedDeferred = yield* make$26();
|
|
38596
38042
|
const keybindingsDbPath = path.join(stateDir, SQLITE_DB_FILE);
|
|
38597
38043
|
const emitChange = (configState) => publish(changesPubSub, configState).pipe(asVoid);
|
|
38598
38044
|
const readStoredRawConfig = tryPromise({
|
|
@@ -38712,11 +38158,11 @@ const makeKeybindings = gen(function* () {
|
|
|
38712
38158
|
keybindings: mergeWithDefaultKeybindings(compileResolvedKeybindingsConfig(keybindings)),
|
|
38713
38159
|
issues
|
|
38714
38160
|
})));
|
|
38715
|
-
const resolvedConfigCache = yield* make$
|
|
38161
|
+
const resolvedConfigCache = yield* make$32({
|
|
38716
38162
|
capacity: 1,
|
|
38717
38163
|
lookup: () => loadConfigStateFromDisk
|
|
38718
38164
|
});
|
|
38719
|
-
const loadConfigStateFromCacheOrDisk = get$
|
|
38165
|
+
const loadConfigStateFromCacheOrDisk = get$3(resolvedConfigCache, resolvedConfigCacheKey);
|
|
38720
38166
|
upsertSemaphore.withPermits(1)(gen(function* () {
|
|
38721
38167
|
yield* invalidate(resolvedConfigCache, resolvedConfigCacheKey);
|
|
38722
38168
|
yield* emitChange(yield* loadConfigStateFromCacheOrDisk);
|
|
@@ -38777,7 +38223,7 @@ const makeKeybindings = gen(function* () {
|
|
|
38777
38223
|
yield* failCause$1(startedDeferred, startupExit.cause).pipe(orDie);
|
|
38778
38224
|
return yield* failCause(startupExit.cause);
|
|
38779
38225
|
}
|
|
38780
|
-
yield* succeed$
|
|
38226
|
+
yield* succeed$4(startedDeferred, void 0).pipe(orDie);
|
|
38781
38227
|
}),
|
|
38782
38228
|
ready: _await(startedDeferred),
|
|
38783
38229
|
syncDefaultKeybindingsOnStartup,
|
|
@@ -38795,7 +38241,7 @@ const makeKeybindings = gen(function* () {
|
|
|
38795
38241
|
});
|
|
38796
38242
|
yield* writeConfigAtomically(cappedConfig);
|
|
38797
38243
|
const nextResolved = mergeWithDefaultKeybindings(compileResolvedKeybindingsConfig(cappedConfig));
|
|
38798
|
-
yield* set$
|
|
38244
|
+
yield* set$3(resolvedConfigCache, resolvedConfigCacheKey, {
|
|
38799
38245
|
keybindings: nextResolved,
|
|
38800
38246
|
issues: []
|
|
38801
38247
|
});
|
|
@@ -39822,7 +39268,7 @@ const makeGitCore = gen(function* () {
|
|
|
39822
39268
|
const refreshStatusUpstreamIfStale = (cwd) => gen(function* () {
|
|
39823
39269
|
const upstream = yield* resolveCurrentUpstream(cwd);
|
|
39824
39270
|
if (!upstream) return;
|
|
39825
|
-
yield* get$
|
|
39271
|
+
yield* get$3(statusUpstreamRefreshCache, new StatusUpstreamRefreshCacheKey({
|
|
39826
39272
|
cwd,
|
|
39827
39273
|
upstreamRef: upstream.upstreamRef,
|
|
39828
39274
|
remoteName: upstream.remoteName,
|
|
@@ -40743,7 +40189,7 @@ const makeCodexTextGeneration = gen(function* () {
|
|
|
40743
40189
|
const schemaPath = yield* writeTempFile(operation, "codex-schema", JSON.stringify(toCodexOutputJsonSchema(outputSchemaJson)));
|
|
40744
40190
|
const outputPath = yield* writeTempFile(operation, "codex-output", "");
|
|
40745
40191
|
const runCodexCommand = gen(function* () {
|
|
40746
|
-
const command = make$
|
|
40192
|
+
const command = make$18("codex", [
|
|
40747
40193
|
"exec",
|
|
40748
40194
|
"--ephemeral",
|
|
40749
40195
|
"-s",
|
|
@@ -40761,7 +40207,7 @@ const makeCodexTextGeneration = gen(function* () {
|
|
|
40761
40207
|
], {
|
|
40762
40208
|
cwd,
|
|
40763
40209
|
shell: process.platform === "win32",
|
|
40764
|
-
stdin: { stream: make$
|
|
40210
|
+
stdin: { stream: make$29(new TextEncoder().encode(prompt)) }
|
|
40765
40211
|
});
|
|
40766
40212
|
const child = yield* commandSpawner.spawn(command).pipe(mapError((cause) => normalizeCodexError(operation, cause, "Failed to spawn Codex CLI process")));
|
|
40767
40213
|
const [stdout, stderr, exitCode] = yield* all([
|
|
@@ -41291,7 +40737,7 @@ const hasCustomModelProvider = map$3(readCodexConfigModelProvider, (provider) =>
|
|
|
41291
40737
|
const collectStreamAsString = (stream) => runFold(stream, () => "", (acc, chunk) => acc + new TextDecoder().decode(chunk));
|
|
41292
40738
|
const runCodexCommand$1 = (args, env) => gen(function* () {
|
|
41293
40739
|
const spawner = yield* ChildProcessSpawner;
|
|
41294
|
-
const command = make$
|
|
40740
|
+
const command = make$18("codex", [...args], {
|
|
41295
40741
|
shell: process.platform === "win32",
|
|
41296
40742
|
...env ? { env } : {}
|
|
41297
40743
|
});
|
|
@@ -41925,7 +41371,9 @@ var require_toml_parser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
41925
41371
|
if (_type in value) switch (value[_type]) {
|
|
41926
41372
|
case INLINE_TABLE: return "inline-table";
|
|
41927
41373
|
case INLINE_LIST: return "inline-list";
|
|
41374
|
+
/* istanbul ignore next */
|
|
41928
41375
|
case TABLE: return "table";
|
|
41376
|
+
/* istanbul ignore next */
|
|
41929
41377
|
case LIST: return "list";
|
|
41930
41378
|
case FLOAT: return "float";
|
|
41931
41379
|
case INTEGER: return "integer";
|
|
@@ -42864,6 +42312,7 @@ var require_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
42864
42312
|
case "datetime": return true;
|
|
42865
42313
|
case "array": return value.length === 0 || tomlType(value[0]) !== "table";
|
|
42866
42314
|
case "table": return Object.keys(value).length === 0;
|
|
42315
|
+
/* istanbul ignore next */
|
|
42867
42316
|
default: return false;
|
|
42868
42317
|
}
|
|
42869
42318
|
}
|
|
@@ -42924,6 +42373,7 @@ var require_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
42924
42373
|
case "datetime": return stringifyDatetime(value);
|
|
42925
42374
|
case "array": return stringifyInlineArray(value.filter((_) => tomlType(_) !== "null" && tomlType(_) !== "undefined" && tomlType(_) !== "nan"));
|
|
42926
42375
|
case "table": return stringifyInlineTable(value);
|
|
42376
|
+
/* istanbul ignore next */
|
|
42927
42377
|
default: throw typeError(type);
|
|
42928
42378
|
}
|
|
42929
42379
|
}
|
|
@@ -48434,7 +47884,7 @@ const makeServerPushBus = (input) => gen(function* () {
|
|
|
48434
47884
|
const nextSequence = yield* make$11(0);
|
|
48435
47885
|
const queue = yield* unbounded();
|
|
48436
47886
|
const encodePush = encodeUnknownEffect(fromJsonString(WsPush));
|
|
48437
|
-
const settleDelivery = (job, delivered) => job.delivered === null ? void_$1 : succeed$
|
|
47887
|
+
const settleDelivery = (job, delivered) => job.delivered === null ? void_$1 : succeed$4(job.delivered, delivered).pipe(orDie);
|
|
48438
47888
|
const send = fnUntraced(function* (job) {
|
|
48439
47889
|
const push = {
|
|
48440
47890
|
type: "push",
|
|
@@ -48464,7 +47914,7 @@ const makeServerPushBus = (input) => gen(function* () {
|
|
|
48464
47914
|
return {
|
|
48465
47915
|
publishAll: publish({ kind: "all" }),
|
|
48466
47916
|
publishClient: (client, channel, data) => gen(function* () {
|
|
48467
|
-
const delivered = yield* make$
|
|
47917
|
+
const delivered = yield* make$26();
|
|
48468
47918
|
yield* offer$1(queue, {
|
|
48469
47919
|
channel,
|
|
48470
47920
|
data,
|
|
@@ -48481,12 +47931,12 @@ const makeServerPushBus = (input) => gen(function* () {
|
|
|
48481
47931
|
//#endregion
|
|
48482
47932
|
//#region src/wsServer/readiness.ts
|
|
48483
47933
|
const makeServerReadiness = gen(function* () {
|
|
48484
|
-
const httpListening = yield* make$
|
|
48485
|
-
const pushBusReady = yield* make$
|
|
48486
|
-
const keybindingsReady = yield* make$
|
|
48487
|
-
const terminalSubscriptionsReady = yield* make$
|
|
48488
|
-
const orchestrationSubscriptionsReady = yield* make$
|
|
48489
|
-
const complete = (deferred) => succeed$
|
|
47934
|
+
const httpListening = yield* make$26();
|
|
47935
|
+
const pushBusReady = yield* make$26();
|
|
47936
|
+
const keybindingsReady = yield* make$26();
|
|
47937
|
+
const terminalSubscriptionsReady = yield* make$26();
|
|
47938
|
+
const orchestrationSubscriptionsReady = yield* make$26();
|
|
47939
|
+
const complete = (deferred) => succeed$4(deferred, void 0).pipe(orDie);
|
|
48490
47940
|
return {
|
|
48491
47941
|
awaitServerReady: all([
|
|
48492
47942
|
_await(httpListening),
|
|
@@ -48543,7 +47993,7 @@ const decodeJsonResult = (schema) => {
|
|
|
48543
47993
|
return (input) => {
|
|
48544
47994
|
const result = decode(input);
|
|
48545
47995
|
if (isFailure(result)) return fail$3(result.cause);
|
|
48546
|
-
return succeed$
|
|
47996
|
+
return succeed$3(result.value);
|
|
48547
47997
|
};
|
|
48548
47998
|
};
|
|
48549
47999
|
const formatSchemaError = (cause) => {
|
|
@@ -53362,7 +52812,7 @@ const createServer = fn(function* () {
|
|
|
53362
52812
|
const checkpointDiffQuery = yield* CheckpointDiffQuery;
|
|
53363
52813
|
const orchestrationReactor = yield* OrchestrationReactor;
|
|
53364
52814
|
const { openInEditor } = yield* Open;
|
|
53365
|
-
const subscriptionsScope = yield* make$
|
|
52815
|
+
const subscriptionsScope = yield* make$27("sequential");
|
|
53366
52816
|
yield* addFinalizer$1(() => close(subscriptionsScope, void_$3));
|
|
53367
52817
|
yield* runForEach(orchestrationEngine.streamDomainEvents, (event) => gen(function* () {
|
|
53368
52818
|
yield* pushBus.publishAll(ORCHESTRATION_WS_CHANNELS.domainEvent, event);
|
|
@@ -54773,7 +54223,7 @@ function makeCookie(name, value, options) {
|
|
|
54773
54223
|
if (options.path !== void 0 && !fieldContentRegExp.test(options.path)) return fail$3(CookiesError.fromReason("InvalidCookiePath"));
|
|
54774
54224
|
if (options.maxAge !== void 0 && !isFinite$1(fromInputUnsafe(options.maxAge))) return fail$3(CookiesError.fromReason("CookieInfinityMaxAge"));
|
|
54775
54225
|
}
|
|
54776
|
-
return succeed$
|
|
54226
|
+
return succeed$3(Object.assign(Object.create(CookieProto), {
|
|
54777
54227
|
name,
|
|
54778
54228
|
value,
|
|
54779
54229
|
valueEncoded: encodedValue,
|
|
@@ -54884,7 +54334,7 @@ const Proto$4 = /* @__PURE__ */ Object.create(null);
|
|
|
54884
54334
|
Object.defineProperties(Proto$4, {
|
|
54885
54335
|
[TypeId$7]: { value: TypeId$7 },
|
|
54886
54336
|
[symbolRedactable]: { value(context) {
|
|
54887
|
-
return redact(this, get$
|
|
54337
|
+
return redact(this, get$2(context, CurrentRedactedNames));
|
|
54888
54338
|
} },
|
|
54889
54339
|
toJSON: { value() {
|
|
54890
54340
|
return redact$1(this);
|
|
@@ -54974,8 +54424,8 @@ const redact = /* @__PURE__ */ dual(2, (self, key) => {
|
|
|
54974
54424
|
const modify = (key) => {
|
|
54975
54425
|
if (typeof key === "string") {
|
|
54976
54426
|
const k = key.toLowerCase();
|
|
54977
|
-
if (k in self) out[k] = make$
|
|
54978
|
-
} else for (const name in self) if (key.test(name)) out[name] = make$
|
|
54427
|
+
if (k in self) out[k] = make$30(self[k]);
|
|
54428
|
+
} else for (const name in self) if (key.test(name)) out[name] = make$30(self[name]);
|
|
54979
54429
|
};
|
|
54980
54430
|
if (Array.isArray(key)) for (let i = 0; i < key.length; i++) modify(key[i]);
|
|
54981
54431
|
else modify(key);
|
|
@@ -55236,7 +54686,7 @@ const fromInputNested = (input) => {
|
|
|
55236
54686
|
* @since 4.0.0
|
|
55237
54687
|
* @category Equivalence
|
|
55238
54688
|
*/
|
|
55239
|
-
const Equivalence = /* @__PURE__ */ make$
|
|
54689
|
+
const Equivalence = /* @__PURE__ */ make$31((a, b) => arrayEquivalence(a.params, b.params));
|
|
55240
54690
|
const arrayEquivalence = /* @__PURE__ */ makeEquivalence$1(/* @__PURE__ */ makeEquivalence$2([/* @__PURE__ */ strictEqual(), /* @__PURE__ */ strictEqual()]));
|
|
55241
54691
|
/**
|
|
55242
54692
|
* @since 4.0.0
|
|
@@ -55294,7 +54744,7 @@ const makeUrl = (url, params, hash) => {
|
|
|
55294
54744
|
if (value !== void 0) urlInstance.searchParams.append(key, value);
|
|
55295
54745
|
}
|
|
55296
54746
|
if (hash !== void 0) urlInstance.hash = hash;
|
|
55297
|
-
return succeed$
|
|
54747
|
+
return succeed$3(urlInstance);
|
|
55298
54748
|
} catch (e) {
|
|
55299
54749
|
return fail$3(new UrlParamsError({ cause: e }));
|
|
55300
54750
|
}
|
|
@@ -55843,7 +55293,7 @@ const SpanNameGenerator = /* @__PURE__ */ Reference("effect/http/HttpClient/Span
|
|
|
55843
55293
|
/**
|
|
55844
55294
|
* @since 4.0.0
|
|
55845
55295
|
*/
|
|
55846
|
-
const layerMergedServices = (effect$1) => effect(HttpClient)(servicesWith
|
|
55296
|
+
const layerMergedServices = (effect$1) => effect(HttpClient)(servicesWith((services) => map$3(effect$1, (client) => transformResponse(client, updateServices((input) => merge$2(services, input))))));
|
|
55847
55297
|
const responseRegistry = /* @__PURE__ */ (() => {
|
|
55848
55298
|
if ("FinalizationRegistry" in globalThis && globalThis.FinalizationRegistry) {
|
|
55849
55299
|
const registry = /* @__PURE__ */ new FinalizationRegistry((controller) => {
|
|
@@ -55922,7 +55372,7 @@ var InterruptibleResponse = class {
|
|
|
55922
55372
|
get stream() {
|
|
55923
55373
|
return suspend$3(() => {
|
|
55924
55374
|
responseRegistry.unregister(this.original);
|
|
55925
|
-
return onExit
|
|
55375
|
+
return onExit(this.original.stream, (exit) => {
|
|
55926
55376
|
if (hasInterrupts$1(exit)) this.controller.abort();
|
|
55927
55377
|
return void_$1;
|
|
55928
55378
|
});
|
|
@@ -55986,6 +55436,6 @@ const layer = /* @__PURE__ */ layerMergedServices(/* @__PURE__ */ succeed(fetch$
|
|
|
55986
55436
|
const RuntimeLayer = empty$6.pipe(provideMerge(CliConfig.layer), provideMerge(ServerLive), provideMerge(OpenLive), provideMerge(NetService.layer), provideMerge(layer$2), provideMerge(layer));
|
|
55987
55437
|
run$1(t3Cli, { version }).pipe(provide(RuntimeLayer), runMain);
|
|
55988
55438
|
//#endregion
|
|
55989
|
-
export {
|
|
55439
|
+
export {};
|
|
55990
55440
|
|
|
55991
55441
|
//# sourceMappingURL=index.mjs.map
|