@deslop/deploy 0.1.1267 → 0.1.1270
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/client/assets/(home)-DIbhgeKX.js +1 -0
- package/dist/client/assets/-expose-CaBLYX-o.js +1 -0
- package/dist/client/assets/effect-CHi49DOw.js +16 -0
- package/dist/client/assets/index-B4aNXwr6.css +2 -0
- package/dist/client/assets/index-B5t_XXry.js +2 -0
- package/dist/client/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/client/assets/{react-COyt-gOi.js → react-CYMlNKV3.js} +3 -3
- package/dist/client/assets/route-9_-C5HUC.js +1 -0
- package/dist/client/assets/schema-CKc7QdS-.js +2 -0
- package/dist/client/index.html +6 -6
- package/dist/server.js +539 -237
- package/package.json +2 -2
- package/dist/client/assets/(home)-BRBR9qdq.js +0 -41
- package/dist/client/assets/-expose-Bh9ChY6U.js +0 -1
- package/dist/client/assets/effect-BYxovlWD.js +0 -16
- package/dist/client/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/client/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/client/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/client/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/client/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/dist/client/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/dist/client/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/dist/client/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/client/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/dist/client/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/dist/client/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/client/assets/index-CMMy8g5j.css +0 -2
- package/dist/client/assets/index-CUoncAk5.js +0 -2
- package/dist/client/assets/route-CavKqo_R.js +0 -1
- package/dist/client/assets/schema-Dt7oxOOd.js +0 -2
package/dist/server.js
CHANGED
|
@@ -6664,6 +6664,26 @@ const isArrayNonEmpty = isArrayNonEmpty$1;
|
|
|
6664
6664
|
*/
|
|
6665
6665
|
const isReadonlyArrayNonEmpty = isArrayNonEmpty$1;
|
|
6666
6666
|
/**
|
|
6667
|
+
* Returns the number of elements in a `ReadonlyArray`.
|
|
6668
|
+
*
|
|
6669
|
+
* **When to use**
|
|
6670
|
+
*
|
|
6671
|
+
* Use when you need length as a composable function rather than a property access.
|
|
6672
|
+
*
|
|
6673
|
+
* **Example** (Getting the length)
|
|
6674
|
+
*
|
|
6675
|
+
* ```ts import.meta.vitest
|
|
6676
|
+
* import { Array } from "effect"
|
|
6677
|
+
*
|
|
6678
|
+
* Array.length([1, 2, 3]) // => 3
|
|
6679
|
+
* ```
|
|
6680
|
+
*
|
|
6681
|
+
* @stability stable
|
|
6682
|
+
* @category getters
|
|
6683
|
+
* @since 2.0.0
|
|
6684
|
+
*/
|
|
6685
|
+
const length$2 = (self) => self.length;
|
|
6686
|
+
/**
|
|
6667
6687
|
* Checks whether a string represents a JavaScript array index: a non-negative
|
|
6668
6688
|
* integer below `2 ** 32 - 1`, written without leading zeroes, a sign, or
|
|
6669
6689
|
* exponent notation.
|
|
@@ -6910,6 +6930,41 @@ const drop$1 = /*#__PURE__*/ dual(2, (self, n) => {
|
|
|
6910
6930
|
return input.slice(clampCount(n, input.length), input.length);
|
|
6911
6931
|
});
|
|
6912
6932
|
/**
|
|
6933
|
+
* Drops elements from the start while the predicate holds, returning the rest.
|
|
6934
|
+
*
|
|
6935
|
+
* **When to use**
|
|
6936
|
+
*
|
|
6937
|
+
* Use to remove a leading prefix of elements that satisfy a predicate.
|
|
6938
|
+
*
|
|
6939
|
+
* **Details**
|
|
6940
|
+
*
|
|
6941
|
+
* The predicate receives `(element, index)`.
|
|
6942
|
+
*
|
|
6943
|
+
* **Example** (Dropping while condition holds)
|
|
6944
|
+
*
|
|
6945
|
+
* ```ts import.meta.vitest
|
|
6946
|
+
* import { Array } from "effect"
|
|
6947
|
+
*
|
|
6948
|
+
* Array.dropWhile([1, 2, 3, 4, 5], (x) => x < 4) // => [4, 5]
|
|
6949
|
+
* ```
|
|
6950
|
+
*
|
|
6951
|
+
* @see {@link takeWhile} — keep the matching prefix instead
|
|
6952
|
+
* @see {@link drop} — drop a fixed count
|
|
6953
|
+
*
|
|
6954
|
+
* @stability stable
|
|
6955
|
+
* @category getters
|
|
6956
|
+
* @since 2.0.0
|
|
6957
|
+
*/
|
|
6958
|
+
const dropWhile = /*#__PURE__*/ dual(2, (self, predicate) => {
|
|
6959
|
+
const input = fromIterable$7(self);
|
|
6960
|
+
let i = 0;
|
|
6961
|
+
while (i < input.length) {
|
|
6962
|
+
if (!predicate(input[i], i)) break;
|
|
6963
|
+
i++;
|
|
6964
|
+
}
|
|
6965
|
+
return input.slice(i);
|
|
6966
|
+
});
|
|
6967
|
+
/**
|
|
6913
6968
|
* Returns the index of the first element matching the predicate, wrapped in an
|
|
6914
6969
|
* `Option`.
|
|
6915
6970
|
*
|
|
@@ -14617,7 +14672,7 @@ const unwrapKey = /*#__PURE__*/ Service$1("effect/Layer/unwrap");
|
|
|
14617
14672
|
* @category converting
|
|
14618
14673
|
* @since 4.0.0
|
|
14619
14674
|
*/
|
|
14620
|
-
const unwrap$
|
|
14675
|
+
const unwrap$8 = (self) => flatMap$3(effect(unwrapKey)(self), get$12(unwrapKey));
|
|
14621
14676
|
const mergeAllEffect = (layers, memoMap, scope) => {
|
|
14622
14677
|
const parentScope = forkUnsafe(scope, "parallel");
|
|
14623
14678
|
return forEach$2(layers, (layer) => layer.build(memoMap, forkUnsafe(parentScope, "sequential")), { concurrency: layers.length }).pipe(map$7((context) => mergeAll$2(...context)));
|
|
@@ -15946,6 +16001,22 @@ const slice$1 = (start, end) => (self) => self.slice(start, end);
|
|
|
15946
16001
|
*/
|
|
15947
16002
|
const isNonEmpty$1 = (self) => self.length > 0;
|
|
15948
16003
|
/**
|
|
16004
|
+
* Returns the JavaScript string length, measured in UTF-16 code units.
|
|
16005
|
+
*
|
|
16006
|
+
* **Example** (Getting string length)
|
|
16007
|
+
*
|
|
16008
|
+
* ```ts import.meta.vitest
|
|
16009
|
+
* import { String } from "effect"
|
|
16010
|
+
*
|
|
16011
|
+
* String.length("abc") // => 3
|
|
16012
|
+
* ```
|
|
16013
|
+
*
|
|
16014
|
+
* @stability stable
|
|
16015
|
+
* @category getters
|
|
16016
|
+
* @since 2.0.0
|
|
16017
|
+
*/
|
|
16018
|
+
const length$1 = (self) => self.length;
|
|
16019
|
+
/**
|
|
15949
16020
|
* Splits a string into an array of substrings using a separator.
|
|
15950
16021
|
*
|
|
15951
16022
|
* **Example** (Splitting strings)
|
|
@@ -16019,6 +16090,23 @@ const startsWith = (searchString, position) => (self) => self.startsWith(searchS
|
|
|
16019
16090
|
*/
|
|
16020
16091
|
const endsWith = (searchString, position) => (self) => self.endsWith(searchString, position);
|
|
16021
16092
|
/**
|
|
16093
|
+
* Returns the index of the first occurrence of a substring safely, or `None` if not found.
|
|
16094
|
+
*
|
|
16095
|
+
* **Example** (Finding the first substring index)
|
|
16096
|
+
*
|
|
16097
|
+
* ```ts import.meta.vitest
|
|
16098
|
+
* import { Option, pipe, String } from "effect"
|
|
16099
|
+
*
|
|
16100
|
+
* pipe("abbbc", String.indexOf("b")) // => Option.some(1)
|
|
16101
|
+
* pipe("abbbc", String.indexOf("z")) // => Option.none()
|
|
16102
|
+
* ```
|
|
16103
|
+
*
|
|
16104
|
+
* @stability stable
|
|
16105
|
+
* @category searching
|
|
16106
|
+
* @since 2.0.0
|
|
16107
|
+
*/
|
|
16108
|
+
const indexOf = (searchString) => (self) => filter$5(some$1(self.indexOf(searchString)), isGreaterThanOrEqualTo$2(0));
|
|
16109
|
+
/**
|
|
16022
16110
|
* Returns the index of the last occurrence of a substring safely, or `None` if not found.
|
|
16023
16111
|
*
|
|
16024
16112
|
* **Example** (Finding the last substring index)
|
|
@@ -30886,7 +30974,7 @@ const parseRetryAfter$1 = (input) => {
|
|
|
30886
30974
|
const retryAfterDelay$1 = (self, now) => self._tag === "Duration" ? self.duration : millis$1(Math.max(0, toEpochMillis(self.dateTime) - now));
|
|
30887
30975
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/http/internal/urlParams.js
|
|
30888
30976
|
/** @internal */
|
|
30889
|
-
const unwrap$
|
|
30977
|
+
const unwrap$7 = (value) => typeof value === "string" ? value : value$2(value);
|
|
30890
30978
|
/** @internal */
|
|
30891
30979
|
const stripSearchAndHash = (url) => {
|
|
30892
30980
|
const queryIndex = url.indexOf("?");
|
|
@@ -31057,7 +31145,7 @@ const setAll = /*#__PURE__*/ dual(2, (self, input) => {
|
|
|
31057
31145
|
* @category converting
|
|
31058
31146
|
* @since 4.0.0
|
|
31059
31147
|
*/
|
|
31060
|
-
const toString$1 = (input) => new URLSearchParams(fromInput(input).params.map(([key, value]) => [key, unwrap$
|
|
31148
|
+
const toString$1 = (input) => new URLSearchParams(fromInput(input).params.map(([key, value]) => [key, unwrap$7(value)])).toString();
|
|
31061
31149
|
/**
|
|
31062
31150
|
* Returns the parameter pairs with selected values wrapped in `Redacted`.
|
|
31063
31151
|
*
|
|
@@ -43483,7 +43571,7 @@ const fromQueueArray = (queue) => fromPull$1(succeed$5(takeAll(queue)));
|
|
|
43483
43571
|
* @category constructors
|
|
43484
43572
|
* @since 4.0.0
|
|
43485
43573
|
*/
|
|
43486
|
-
const fromPubSubTake$1 = (pubsub) => unwrap$
|
|
43574
|
+
const fromPubSubTake$1 = (pubsub) => unwrap$6(map$5(subscribe(pubsub), (sub) => fromEffectTake(take(sub))));
|
|
43487
43575
|
/**
|
|
43488
43576
|
* Creates a channel from a lazily supplied Web `ReadableStream`.
|
|
43489
43577
|
*
|
|
@@ -44343,7 +44431,7 @@ const restoreUpstreamFailure = (effect) => catchCause$2(effect, (cause) => failC
|
|
|
44343
44431
|
* @category constructors
|
|
44344
44432
|
* @since 2.0.0
|
|
44345
44433
|
*/
|
|
44346
|
-
const unwrap$
|
|
44434
|
+
const unwrap$6 = (channel) => fromTransform$1((upstream, scope) => {
|
|
44347
44435
|
let pull;
|
|
44348
44436
|
return succeed$5(suspend$2(() => {
|
|
44349
44437
|
if (pull) return pull;
|
|
@@ -45592,7 +45680,7 @@ const forEachArray = (f) => fromTransform((upstream) => upstream.pipe(flatMap$2(
|
|
|
45592
45680
|
* @category constructors
|
|
45593
45681
|
* @since 2.0.0
|
|
45594
45682
|
*/
|
|
45595
|
-
const unwrap$
|
|
45683
|
+
const unwrap$5 = (effect) => fromChannel$1(unwrap$6(map$5(effect, toChannel$1)));
|
|
45596
45684
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/RcMap.js
|
|
45597
45685
|
/**
|
|
45598
45686
|
* Shares scoped resources by key and releases them when no one is using them.
|
|
@@ -46567,7 +46655,7 @@ const fromReadableStream = (options) => fromChannel(fromReadableStream$1(options
|
|
|
46567
46655
|
* @category constructors
|
|
46568
46656
|
* @since 2.0.0
|
|
46569
46657
|
*/
|
|
46570
|
-
const unwrap$
|
|
46658
|
+
const unwrap$4 = (effect) => fromChannel(unwrap$6(map$5(effect, toChannel)));
|
|
46571
46659
|
/**
|
|
46572
46660
|
* Transforms the elements of this stream using the supplied function.
|
|
46573
46661
|
*
|
|
@@ -47077,7 +47165,7 @@ const broadcast = /*#__PURE__*/ dual(2, (self, options) => map$5(toPubSubTake(se
|
|
|
47077
47165
|
const share = /*#__PURE__*/ dual(2, (self, options) => map$5(make$52({
|
|
47078
47166
|
acquire: broadcast(self, options),
|
|
47079
47167
|
idleTimeToLive: options.idleTimeToLive
|
|
47080
|
-
}), (ref) => unwrap$
|
|
47168
|
+
}), (ref) => unwrap$4(get$2(ref))));
|
|
47081
47169
|
/**
|
|
47082
47170
|
* Pipes values through the provided channel while preserving this stream's
|
|
47083
47171
|
* failures alongside any channel failures.
|
|
@@ -47787,11 +47875,11 @@ const make$50 = (impl) => FileSystem.of({
|
|
|
47787
47875
|
return succeed$5(of(buf));
|
|
47788
47876
|
}
|
|
47789
47877
|
}))));
|
|
47790
|
-
}, unwrap$
|
|
47878
|
+
}, unwrap$4),
|
|
47791
47879
|
sink: (path, options) => pipe(impl.open(path, {
|
|
47792
47880
|
...options,
|
|
47793
47881
|
flag: options?.flag ?? "w"
|
|
47794
|
-
}), map$5((file) => forEach((_) => file.writeAll(_))), unwrap$
|
|
47882
|
+
}), map$5((file) => forEach((_) => file.writeAll(_))), unwrap$5),
|
|
47795
47883
|
writeFileString: (path, data, options) => flatMap$2(try_({
|
|
47796
47884
|
try: () => new TextEncoder().encode(data),
|
|
47797
47885
|
catch: (cause) => badArgument({
|
|
@@ -48782,9 +48870,9 @@ const option = (self) => self.pipe(map$2(some$1), withDefault$2(none()));
|
|
|
48782
48870
|
* @category converting
|
|
48783
48871
|
* @since 2.0.0
|
|
48784
48872
|
*/
|
|
48785
|
-
const unwrap$
|
|
48873
|
+
const unwrap$3 = (wrapped) => {
|
|
48786
48874
|
if (isConfig(wrapped)) return wrapped;
|
|
48787
|
-
return all(map$9(wrapped, (config) => unwrap$
|
|
48875
|
+
return all(map$9(wrapped, (config) => unwrap$3(config)));
|
|
48788
48876
|
};
|
|
48789
48877
|
const isSourceError = (u) => isTagged(u, "SourceError");
|
|
48790
48878
|
const cursorToString = () => "<configuration>";
|
|
@@ -54284,7 +54372,7 @@ const make$36 = (url, params, hash) => try_$2({
|
|
|
54284
54372
|
const urlInstance = new URL(url, baseUrl());
|
|
54285
54373
|
for (let i = 0; i < params.params.length; i++) {
|
|
54286
54374
|
const [key, value] = params.params[i];
|
|
54287
|
-
if (value !== void 0) urlInstance.searchParams.append(key, unwrap$
|
|
54375
|
+
if (value !== void 0) urlInstance.searchParams.append(key, unwrap$7(value));
|
|
54288
54376
|
}
|
|
54289
54377
|
if (hash !== void 0) urlInstance.hash = hash;
|
|
54290
54378
|
return urlInstance;
|
|
@@ -55562,7 +55650,7 @@ const makeHandle = (params) => Object.setPrototypeOf({ ...params }, HandleProto)
|
|
|
55562
55650
|
* @since 4.0.0
|
|
55563
55651
|
*/
|
|
55564
55652
|
const make$33 = (spawn) => {
|
|
55565
|
-
const streamString = (command, options) => spawn(command).pipe(map$5((handle) => decodeText$1(options?.includeStderr === true ? handle.all : drainFork(handle.stdout, handle.stderr))), unwrap$
|
|
55653
|
+
const streamString = (command, options) => spawn(command).pipe(map$5((handle) => decodeText$1(options?.includeStderr === true ? handle.all : drainFork(handle.stdout, handle.stderr))), unwrap$4);
|
|
55566
55654
|
const streamLines = (command, options) => splitLines(streamString(command, options));
|
|
55567
55655
|
return ChildProcessSpawner.of({
|
|
55568
55656
|
spawn,
|
|
@@ -60860,7 +60948,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
60860
60948
|
}
|
|
60861
60949
|
const queue = onStreamRequest(rpc, middleware, rpc.payloadSchema.make(payload), headers, opts?.streamBufferSize ?? 16, context);
|
|
60862
60950
|
if (opts?.asQueue) return queue;
|
|
60863
|
-
return unwrap$
|
|
60951
|
+
return unwrap$4(map$5(queue, fromQueue));
|
|
60864
60952
|
};
|
|
60865
60953
|
};
|
|
60866
60954
|
const onEffectRequest = (rpc, middleware, span, payload, headers, context, discard) => withFiber((parentFiber) => {
|
|
@@ -71768,7 +71856,7 @@ const serve = (appLayer, options) => {
|
|
|
71768
71856
|
}).pipe(map$5((context) => {
|
|
71769
71857
|
const handler = get$12(context, HttpRouter).asHttpEffect();
|
|
71770
71858
|
return merge$4(middleware ? serve$1(handler, middleware) : serve$1(handler), succeedContext(context));
|
|
71771
|
-
}), unwrap$
|
|
71859
|
+
}), unwrap$8, options?.disableListenLog ? identity : withLogAddress);
|
|
71772
71860
|
};
|
|
71773
71861
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/rpc/RpcServer.js
|
|
71774
71862
|
/**
|
|
@@ -73809,7 +73897,7 @@ const registerToolkit = /*#__PURE__*/ fnUntraced(function* (toolkit) {
|
|
|
73809
73897
|
tool: mcpTool,
|
|
73810
73898
|
annotations,
|
|
73811
73899
|
handle(payload) {
|
|
73812
|
-
return built.handle(tool.name, payload ?? {}, void 0, decodeOptions).pipe(unwrap$
|
|
73900
|
+
return built.handle(tool.name, payload ?? {}, void 0, decodeOptions).pipe(unwrap$4, runLast, flatMap$2(fromOption), flatMap$2((result) => {
|
|
73813
73901
|
if (!result.isFailure) return result.encodedResult === void 0 ? succeed$5(new CallToolResult$5({
|
|
73814
73902
|
isError: false,
|
|
73815
73903
|
content: []
|
|
@@ -74029,7 +74117,7 @@ const template = (strings, ...expressions) => {
|
|
|
74029
74117
|
}));
|
|
74030
74118
|
return parseTemplate$1(strings, expressions);
|
|
74031
74119
|
};
|
|
74032
|
-
const unwrap$
|
|
74120
|
+
const unwrap$2 = (item) => isRedacted(item) ? value$2(item) : String(item);
|
|
74033
74121
|
const toWord = (item) => isRedacted(item) ? item : String(item);
|
|
74034
74122
|
const reservedWords = /*#__PURE__*/ new Set([
|
|
74035
74123
|
"!",
|
|
@@ -74126,7 +74214,7 @@ const parseTemplate$1 = (texts, values) => {
|
|
|
74126
74214
|
}));
|
|
74127
74215
|
const endWord = () => {
|
|
74128
74216
|
if (word.length === 0) return;
|
|
74129
|
-
const value = word.map(unwrap$
|
|
74217
|
+
const value = word.map(unwrap$2).join("");
|
|
74130
74218
|
words.push(word.length === 1 && isRedacted(word[0]) ? word[0] : word.some(isRedacted) ? make$65(value) : value);
|
|
74131
74219
|
word = [];
|
|
74132
74220
|
plain = true;
|
|
@@ -74747,12 +74835,12 @@ const toPlatformError = (method, error, command) => {
|
|
|
74747
74835
|
const commandStr = commands.map((cmd) => display([cmd.command, ...cmd.args], { format })).join(" | ");
|
|
74748
74836
|
return handleErrnoException("ChildProcess", method)(error, [commandStr]);
|
|
74749
74837
|
};
|
|
74750
|
-
const unwrap = (value) => isRedacted(value) ? value$2(value) : value;
|
|
74838
|
+
const unwrap$1 = (value) => isRedacted(value) ? value$2(value) : value;
|
|
74751
74839
|
const findNulCharacter = (command) => {
|
|
74752
74840
|
if (command.command.includes("\0")) return "The command contains a NUL character";
|
|
74753
|
-
const index = command.args.findIndex((arg) => unwrap(arg).includes("\0"));
|
|
74841
|
+
const index = command.args.findIndex((arg) => unwrap$1(arg).includes("\0"));
|
|
74754
74842
|
if (index !== -1) return `Argument ${index + 1} contains a NUL character`;
|
|
74755
|
-
for (const [name, value] of Object.entries(command.options.env ?? {})) if (value !== void 0 && unwrap(value).includes("\0")) return `The environment variable ${name} contains a NUL character`;
|
|
74843
|
+
for (const [name, value] of Object.entries(command.options.env ?? {})) if (value !== void 0 && unwrap$1(value).includes("\0")) return `The environment variable ${name} contains a NUL character`;
|
|
74756
74844
|
};
|
|
74757
74845
|
const processGroupGraceMillis = 1e3;
|
|
74758
74846
|
const processGroupPollIntervalMillis = 10;
|
|
@@ -74815,7 +74903,7 @@ const layer$16 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
74815
74903
|
if (options.env === void 0) return void 0;
|
|
74816
74904
|
const env = options.extendEnv === true ? { ...globalThis.process.env } : {};
|
|
74817
74905
|
for (const [key, value] of Object.entries(options.env)) if (value === void 0) delete env[key];
|
|
74818
|
-
else env[key] = unwrap(value);
|
|
74906
|
+
else env[key] = unwrap$1(value);
|
|
74819
74907
|
return env;
|
|
74820
74908
|
};
|
|
74821
74909
|
const inputToStdioOption = (input) => isStream(input) ? "pipe" : input;
|
|
@@ -74978,7 +75066,7 @@ const layer$16 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
74978
75066
|
};
|
|
74979
75067
|
const spawn = (command, spawnOptions) => callback$1((resume) => {
|
|
74980
75068
|
const deferred = makeUnsafe$8();
|
|
74981
|
-
const handle = NodeChildProcess.spawn(command.command, command.args.map(unwrap), spawnOptions);
|
|
75069
|
+
const handle = NodeChildProcess.spawn(command.command, command.args.map(unwrap$1), spawnOptions);
|
|
74982
75070
|
handle.on("error", (error) => {
|
|
74983
75071
|
if (command.args.some(isRedacted)) Object.assign(error, { spawnargs: [command.command, ...command.args.map((arg) => isRedacted(arg) ? "<redacted>" : arg)] });
|
|
74984
75072
|
resume(fail$7(toPlatformError("spawn", error, command)));
|
|
@@ -75163,7 +75251,7 @@ const layer$16 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
75163
75251
|
const command = pipeline[i];
|
|
75164
75252
|
const options = pipeOptions[i] ?? {};
|
|
75165
75253
|
const stdinConfig = resolveStdinOption(command.options);
|
|
75166
|
-
const sourceStream = unwrap$
|
|
75254
|
+
const sourceStream = unwrap$4(succeed$5(getSourceStream(handles[handles.length - 1], options.from)));
|
|
75167
75255
|
const toOption = options.to ?? "stdin";
|
|
75168
75256
|
if (toOption === "stdin") handles.push(yield* spawnCommand(make$12(command.command, command.args, {
|
|
75169
75257
|
...command.options,
|
|
@@ -79776,7 +79864,7 @@ const watchNode = (path, info, options) => callback((queue) => acquireRelease(sy
|
|
|
79776
79864
|
});
|
|
79777
79865
|
return watcher;
|
|
79778
79866
|
}), (watcher) => sync(() => watcher.close())).pipe(tap$1(() => sync(() => options?.onReady?.()))));
|
|
79779
|
-
const watch = (backend, path, options) => all$1([stat(path), serviceOption(WatchBackend)]).pipe(map$5(([stat, callerBackend]) => orElse$3(callerBackend, () => backend).pipe(flatMap$7((_) => _.register(path, stat, options)), getOrElse(() => watchNode(path, stat, options)))), unwrap$
|
|
79867
|
+
const watch = (backend, path, options) => all$1([stat(path), serviceOption(WatchBackend)]).pipe(map$5(([stat, callerBackend]) => orElse$3(callerBackend, () => backend).pipe(flatMap$7((_) => _.register(path, stat, options)), getOrElse(() => watchNode(path, stat, options)))), unwrap$4);
|
|
79780
79868
|
const writeFile = (path, data, options) => callback$1((resume, signal) => {
|
|
79781
79869
|
try {
|
|
79782
79870
|
NFS.writeFile(path, data, {
|
|
@@ -80634,7 +80722,7 @@ const stream = (source, headers) => makeConfig(headers).pipe(map$5((config) => f
|
|
|
80634
80722
|
return parser;
|
|
80635
80723
|
},
|
|
80636
80724
|
onError: (error) => convertError(error)
|
|
80637
|
-
})), unwrap$
|
|
80725
|
+
})), unwrap$4, map$3(convertPart));
|
|
80638
80726
|
/**
|
|
80639
80727
|
* Parses multipart data from a Node readable request body and persists file
|
|
80640
80728
|
* parts using the current `FileSystem`, `Path`, and `Scope` services.
|
|
@@ -81448,7 +81536,7 @@ const layerHttpServices = /*#__PURE__*/ mergeAll$1(layer$11, layerWeak, layer$4)
|
|
|
81448
81536
|
* @category layers
|
|
81449
81537
|
* @since 4.0.0
|
|
81450
81538
|
*/
|
|
81451
|
-
const layerConfig = (evaluate, options) => mergeAll$1(effect(HttpServer)(flatMap$2(unwrap$
|
|
81539
|
+
const layerConfig = (evaluate, options) => mergeAll$1(effect(HttpServer)(flatMap$2(unwrap$3(options), (options) => make$6(evaluate, options))), layerHttpServices);
|
|
81452
81540
|
http.createServer;
|
|
81453
81541
|
const closeCode = (exit) => isSuccess(exit) ? 1e3 : hasInterruptsOnly(exit.cause) ? 1001 : 1011;
|
|
81454
81542
|
const upgradedResponse = /*#__PURE__*/ empty({ status: 101 });
|
|
@@ -89287,7 +89375,6 @@ var AuthError = class extends TaggedError()("AuthError", {
|
|
|
89287
89375
|
"invalid_client_metadata",
|
|
89288
89376
|
"invalid_redirect_uri",
|
|
89289
89377
|
"invalid_grant",
|
|
89290
|
-
"invalid_target",
|
|
89291
89378
|
"invalid_scope",
|
|
89292
89379
|
"unsupported_grant_type",
|
|
89293
89380
|
"unsupported_response_type",
|
|
@@ -90040,7 +90127,7 @@ const SpanKind = {
|
|
|
90040
90127
|
};
|
|
90041
90128
|
// ../../packages/runtime/src/telemetry.ts
|
|
90042
90129
|
function layerOtlp(serviceName, url, runtime, version) {
|
|
90043
|
-
return pipe(unwrap$
|
|
90130
|
+
return pipe(unwrap$8(gen(function* () {
|
|
90044
90131
|
const start = `${yield* currentTimeNanos}`;
|
|
90045
90132
|
const redacted = yield* CurrentRedactedNames;
|
|
90046
90133
|
const resource = {
|
|
@@ -90080,6 +90167,12 @@ function layerOtlp(serviceName, url, runtime, version) {
|
|
|
90080
90167
|
// ../../packages/runtime/src/auth/lib/utils.ts
|
|
90081
90168
|
const ISSUER_PATH = "/api/auth";
|
|
90082
90169
|
const APPS_PATH = "/api/apps";
|
|
90170
|
+
const COOKIE = {
|
|
90171
|
+
httpOnly: true,
|
|
90172
|
+
path: "/",
|
|
90173
|
+
sameSite: "lax",
|
|
90174
|
+
secure: true
|
|
90175
|
+
};
|
|
90083
90176
|
const SESSION_COOKIE = "__Host-session";
|
|
90084
90177
|
function matchingSessions(saved, userId) {
|
|
90085
90178
|
return sort(filter$3(getSomes(saved), (session) => session.value.user.id === userId), mapInput(flip$1(Number$6), (session) => session.value.expiresAt));
|
|
@@ -91206,7 +91299,7 @@ var Auth = class Auth extends Service$1()("@deslop/runtime/auth/service/Auth") {
|
|
|
91206
91299
|
if (isStreamSchema(request.rpc.successSchema)) return annotateCurrentSpan("rpc.stream", true);
|
|
91207
91300
|
return void_$1;
|
|
91208
91301
|
}), flatMap$2((user) => raceFirst(provideService(effect, CurrentUser, user), pipe(delay(auth.user(request.headers), "5 minutes"), retry({ while: (error) => error.error === "temporarily_unavailable" }), forever)))))));
|
|
91209
|
-
static layer = unwrap$
|
|
91302
|
+
static layer = unwrap$8(gen(function* () {
|
|
91210
91303
|
if (yield* localAuth) return succeedContext(Auth.makeContext(Auth.of({
|
|
91211
91304
|
token: () => fail$7(AuthError.make({ message: "There is no sign-in without --auth" })),
|
|
91212
91305
|
user: () => succeed$5(DEVELOPER)
|
|
@@ -91300,13 +91393,6 @@ function layerMcpAuth(resource) {
|
|
|
91300
91393
|
// ../../packages/runtime/src/server.ts
|
|
91301
91394
|
const LOOPBACK = /^(?:localhost|\d{1,3}(?:\.\d{1,3}){3}|\[[\da-f:.]+\])$/iu;
|
|
91302
91395
|
const OTLP = ["/v1/traces", "/v1/logs"];
|
|
91303
|
-
const COOKIE = {
|
|
91304
|
-
httpOnly: true,
|
|
91305
|
-
path: "/",
|
|
91306
|
-
sameSite: "lax",
|
|
91307
|
-
secure: true
|
|
91308
|
-
};
|
|
91309
|
-
const SIGN_IN_COOKIE = "__Host-sign-in";
|
|
91310
91396
|
const packageRoot = match$1(endsWith(".ts")(import.meta.url), {
|
|
91311
91397
|
onFalse: () => fileURLToPath(new URL("..", import.meta.url)),
|
|
91312
91398
|
onTrue: cwd
|
|
@@ -91398,7 +91484,7 @@ function layerKeyValueStore(directory) {
|
|
|
91398
91484
|
});
|
|
91399
91485
|
})), provide$2(layerFileSystem(directory)));
|
|
91400
91486
|
}
|
|
91401
|
-
const layerDataStore = unwrap$
|
|
91487
|
+
const layerDataStore = unwrap$8(map$5(dataDirectory, layerKeyValueStore));
|
|
91402
91488
|
const layerProtocol = mergeAll$1(layerSchemaBinary(), succeed$6(MaxBodySize)(mebibytes(10)), effect(TracerDisabledWhen, map$5(TracerDisabledWhen, (previous) => (request) => {
|
|
91403
91489
|
const path = headNonEmpty(split$2(request.url, "?"));
|
|
91404
91490
|
return previous(request) || path === "/api/rpc" && toLowerCase(request.headers["upgrade"] ?? "") === "websocket" || startsWith("/assets/")(path) || contains([
|
|
@@ -91408,7 +91494,7 @@ const layerProtocol = mergeAll$1(layerSchemaBinary(), succeed$6(MaxBodySize)(meb
|
|
|
91408
91494
|
"/manifest.webmanifest"
|
|
91409
91495
|
], path);
|
|
91410
91496
|
})));
|
|
91411
|
-
const layerTelemetry = unwrap$
|
|
91497
|
+
const layerTelemetry = unwrap$8(gen(function* () {
|
|
91412
91498
|
const metadata = yield* packageMetadata;
|
|
91413
91499
|
return match$8(yield* option(String$5("OTEL_URL")), {
|
|
91414
91500
|
onNone: () => empty$10,
|
|
@@ -91441,112 +91527,6 @@ const layerRoutes = use((router) => gen(function* () {
|
|
|
91441
91527
|
}, { headers: { "cache-control": "no-store" } });
|
|
91442
91528
|
}));
|
|
91443
91529
|
}));
|
|
91444
|
-
const SignInState = fromJsonString(Struct({
|
|
91445
|
-
next: String$6,
|
|
91446
|
-
state: String$6,
|
|
91447
|
-
verifier: String$6
|
|
91448
|
-
}));
|
|
91449
|
-
const CallbackParams = Struct({
|
|
91450
|
-
code: optionalKey(String$6),
|
|
91451
|
-
error: optionalKey(String$6),
|
|
91452
|
-
iss: optionalKey(String$6),
|
|
91453
|
-
state: optionalKey(String$6)
|
|
91454
|
-
});
|
|
91455
|
-
function signedOut(next, cause) {
|
|
91456
|
-
return as(logWarning("The sign-in did not complete", cause), expireCookieUnsafe(redirect(next), SIGN_IN_COOKIE, COOKIE));
|
|
91457
|
-
}
|
|
91458
|
-
function layerSignIn(issuer) {
|
|
91459
|
-
return use((router) => gen(function* () {
|
|
91460
|
-
const sessions = yield* Sessions;
|
|
91461
|
-
const random = yield* SecureRandom;
|
|
91462
|
-
const digest = yield* Digest;
|
|
91463
|
-
const canonical = new URL(yield* String$5("APP_URL")).origin;
|
|
91464
|
-
const callback = new URL(CALLBACK_PATH, canonical).href;
|
|
91465
|
-
const clientId = yield* cached(map$5(appName, (name) => clientIdOf({
|
|
91466
|
-
name: capitalize(name),
|
|
91467
|
-
redirects: [callback]
|
|
91468
|
-
})));
|
|
91469
|
-
function ended(headers) {
|
|
91470
|
-
return match$8(sessionIdOf(headers), {
|
|
91471
|
-
onNone: () => void_$1,
|
|
91472
|
-
onSome: (id) => ignore$1(sessions.end(id), {
|
|
91473
|
-
log: "Warn",
|
|
91474
|
-
message: "The session could not be ended"
|
|
91475
|
-
})
|
|
91476
|
-
});
|
|
91477
|
-
}
|
|
91478
|
-
function toNext(handle) {
|
|
91479
|
-
return flatMap$2(HttpServerRequest, (request) => match$8(filter$5(liftThrowable(() => new URL(new URL(request.url, canonical).searchParams.get("next") ?? canonical, canonical))(), (next) => next.origin === canonical), {
|
|
91480
|
-
onNone: () => succeed$5(empty({ status: 400 })),
|
|
91481
|
-
onSome: (next) => handle(request, next)
|
|
91482
|
-
}));
|
|
91483
|
-
}
|
|
91484
|
-
yield* router.add("GET", "/auth/sign-in", toNext(fnUntraced(function* (_, next) {
|
|
91485
|
-
const verifier = encode$1(yield* random.randomBytes(32));
|
|
91486
|
-
const state = encode$1(yield* random.randomBytes(16));
|
|
91487
|
-
const authorize = new URL(AUTHORIZE_PATH, issuer);
|
|
91488
|
-
authorize.search = `${new URLSearchParams({
|
|
91489
|
-
client_id: yield* clientId,
|
|
91490
|
-
code_challenge: encode$1(yield* digest.digest(sha256, new TextEncoder().encode(verifier))),
|
|
91491
|
-
code_challenge_method: "S256",
|
|
91492
|
-
redirect_uri: callback,
|
|
91493
|
-
response_type: "code",
|
|
91494
|
-
scope: "deslop offline_access",
|
|
91495
|
-
state
|
|
91496
|
-
})}`;
|
|
91497
|
-
return setCookieUnsafe(redirect(authorize.href), SIGN_IN_COOKIE, yield* encodeEffect(SignInState)({
|
|
91498
|
-
next: next.href,
|
|
91499
|
-
state,
|
|
91500
|
-
verifier
|
|
91501
|
-
}), {
|
|
91502
|
-
...COOKIE,
|
|
91503
|
-
maxAge: "10 minutes"
|
|
91504
|
-
});
|
|
91505
|
-
})));
|
|
91506
|
-
yield* router.add("GET", CALLBACK_PATH, gen(function* () {
|
|
91507
|
-
const request = yield* HttpServerRequest;
|
|
91508
|
-
return yield* match$8(yield* option$1(decodeUnknownEffect(SignInState)(request.cookies[SIGN_IN_COOKIE])), {
|
|
91509
|
-
onNone: () => signedOut(canonical, "The sign-in expired or began in another browser"),
|
|
91510
|
-
onSome: fnUntraced(function* (saved) {
|
|
91511
|
-
const started = yield* result$1(gen(function* () {
|
|
91512
|
-
const params = yield* schemaSearchParams(CallbackParams);
|
|
91513
|
-
if (params.state !== saved.state) return yield* AuthError.make({ message: "The sign-in began in another browser" });
|
|
91514
|
-
if (params.error !== void 0 || params.code === void 0) return yield* AuthError.make({ message: `Auth answered ${params.error ?? "without a code"}` });
|
|
91515
|
-
if (params.iss !== new URL("/api/auth", issuer).href) return yield* AuthError.make({ message: "The answer came from another issuer" });
|
|
91516
|
-
return yield* sessions.start({
|
|
91517
|
-
client_id: yield* clientId,
|
|
91518
|
-
code: params.code,
|
|
91519
|
-
code_verifier: saved.verifier,
|
|
91520
|
-
redirect_uri: callback
|
|
91521
|
-
});
|
|
91522
|
-
}));
|
|
91523
|
-
if (isFailure$1(started)) return yield* signedOut(saved.next, started.failure);
|
|
91524
|
-
return pipe(redirect(saved.next), expireCookieUnsafe(SIGN_IN_COOKIE, COOKIE), setCookieUnsafe(SESSION_COOKIE, started.success, {
|
|
91525
|
-
...COOKIE,
|
|
91526
|
-
maxAge: "365 days"
|
|
91527
|
-
}));
|
|
91528
|
-
})
|
|
91529
|
-
});
|
|
91530
|
-
}));
|
|
91531
|
-
yield* router.add("POST", "/auth/session", gen(function* () {
|
|
91532
|
-
const started = yield* result$1(pipe(schemaBodyJson(CodeGrant), rejected("The sign-in request is invalid"), flatMap$2(sessions.start)));
|
|
91533
|
-
if (isFailure$1(started)) return text(started.failure.message, failureOptions(started.failure, 400));
|
|
91534
|
-
return yield* schemaJson(SessionHandle)({ session: started.success }, { headers: { "cache-control": "no-store" } });
|
|
91535
|
-
}));
|
|
91536
|
-
yield* router.add("GET", "/auth/sign-out", toNext((request, next) => as(ended(request.headers), expireCookieUnsafe(redirect(`${new URL("/", issuer).href}?${new URLSearchParams({
|
|
91537
|
-
next: next.href,
|
|
91538
|
-
"sign-out": ""
|
|
91539
|
-
})}`), SESSION_COOKIE, COOKIE))));
|
|
91540
|
-
yield* router.add("POST", "/auth/sign-out", as(flatMap$2(HttpServerRequest, (request) => ended(request.headers)), empty({ status: 204 })));
|
|
91541
|
-
}));
|
|
91542
|
-
}
|
|
91543
|
-
const notConfigured = text("Sign-in is not configured for this app", { status: 503 });
|
|
91544
|
-
const layerSessionRoutes = unwrap$7(gen(function* () {
|
|
91545
|
-
return match$8(yield* option(String$5("AUTH_URL")), {
|
|
91546
|
-
onNone: () => mergeAll$1(add("GET", "/auth/sign-in", notConfigured), add("GET", "/auth/sign-out", notConfigured)),
|
|
91547
|
-
onSome: layerSignIn
|
|
91548
|
-
});
|
|
91549
|
-
}));
|
|
91550
91530
|
const layerAnnounce = effectDiscard(gen(function* () {
|
|
91551
91531
|
const origin = new URL(yield* String$5("APP_URL")).origin;
|
|
91552
91532
|
const client = pipe(yield* HttpClient, filterStatusOk, timeout("10 seconds"), retryTransient({
|
|
@@ -91570,7 +91550,7 @@ function layerIcon(icon) {
|
|
|
91570
91550
|
}));
|
|
91571
91551
|
return mergeAll$1(add("GET", "/icon", response), add("GET", "/favicon.ico", response));
|
|
91572
91552
|
}
|
|
91573
|
-
const layerWeb = unwrap$
|
|
91553
|
+
const layerWeb = unwrap$8(gen(function* () {
|
|
91574
91554
|
const client = fileURLToPath(new URL("./client", import.meta.url));
|
|
91575
91555
|
if (!(yield* (yield* FileSystem).exists((yield* Path$1).join(client, "index.html")))) return empty$10;
|
|
91576
91556
|
const name = capitalize(yield* appName);
|
|
@@ -91611,7 +91591,7 @@ function layerRpc(options) {
|
|
|
91611
91591
|
}), provide$2(options.handlers));
|
|
91612
91592
|
}
|
|
91613
91593
|
function layerMcp(options) {
|
|
91614
|
-
return unwrap$
|
|
91594
|
+
return unwrap$8(gen(function* () {
|
|
91615
91595
|
const metadata = yield* packageMetadata;
|
|
91616
91596
|
const canonical = yield* String$5("APP_URL");
|
|
91617
91597
|
const issuer = yield* option(String$5("AUTH_URL"));
|
|
@@ -91676,6 +91656,113 @@ var AiGateway = class AiGateway extends Service$1()("@deslop/runtime/ai/service/
|
|
|
91676
91656
|
});
|
|
91677
91657
|
}));
|
|
91678
91658
|
};
|
|
91659
|
+
// ../../packages/runtime/src/auth/routes.ts
|
|
91660
|
+
const SIGN_IN_COOKIE = "__Host-sign-in";
|
|
91661
|
+
const SignInState = fromJsonString(Struct({
|
|
91662
|
+
next: String$6,
|
|
91663
|
+
state: String$6,
|
|
91664
|
+
verifier: String$6
|
|
91665
|
+
}));
|
|
91666
|
+
const CallbackParams = Struct({
|
|
91667
|
+
code: optionalKey(String$6),
|
|
91668
|
+
error: optionalKey(String$6),
|
|
91669
|
+
iss: optionalKey(String$6),
|
|
91670
|
+
state: optionalKey(String$6)
|
|
91671
|
+
});
|
|
91672
|
+
function signedOut(next, cause) {
|
|
91673
|
+
return as(logWarning("The sign-in did not complete", cause), expireCookieUnsafe(redirect(next), SIGN_IN_COOKIE, COOKIE));
|
|
91674
|
+
}
|
|
91675
|
+
function layerSignIn(issuer) {
|
|
91676
|
+
return use((router) => gen(function* () {
|
|
91677
|
+
const sessions = yield* Sessions;
|
|
91678
|
+
const random = yield* SecureRandom;
|
|
91679
|
+
const digest = yield* Digest;
|
|
91680
|
+
const canonical = new URL(yield* String$5("APP_URL")).origin;
|
|
91681
|
+
const callback = new URL(CALLBACK_PATH, canonical).href;
|
|
91682
|
+
const clientId = yield* cached(map$5(appName, (name) => clientIdOf({
|
|
91683
|
+
name: capitalize(name),
|
|
91684
|
+
redirects: [callback]
|
|
91685
|
+
})));
|
|
91686
|
+
function ended(headers) {
|
|
91687
|
+
return match$8(sessionIdOf(headers), {
|
|
91688
|
+
onNone: () => void_$1,
|
|
91689
|
+
onSome: (id) => ignore$1(sessions.end(id), {
|
|
91690
|
+
log: "Warn",
|
|
91691
|
+
message: "The session could not be ended"
|
|
91692
|
+
})
|
|
91693
|
+
});
|
|
91694
|
+
}
|
|
91695
|
+
function toNext(handle) {
|
|
91696
|
+
return flatMap$2(HttpServerRequest, (request) => match$8(filter$5(liftThrowable(() => new URL(new URL(request.url, canonical).searchParams.get("next") ?? canonical, canonical))(), (next) => next.origin === canonical), {
|
|
91697
|
+
onNone: () => succeed$5(empty({ status: 400 })),
|
|
91698
|
+
onSome: (next) => handle(request, next)
|
|
91699
|
+
}));
|
|
91700
|
+
}
|
|
91701
|
+
yield* router.add("GET", "/auth/sign-in", toNext(fnUntraced(function* (_, next) {
|
|
91702
|
+
const verifier = encode$1(yield* random.randomBytes(32));
|
|
91703
|
+
const state = encode$1(yield* random.randomBytes(16));
|
|
91704
|
+
const authorize = new URL(AUTHORIZE_PATH, issuer);
|
|
91705
|
+
authorize.search = `${new URLSearchParams({
|
|
91706
|
+
client_id: yield* clientId,
|
|
91707
|
+
code_challenge: encode$1(yield* digest.digest(sha256, new TextEncoder().encode(verifier))),
|
|
91708
|
+
code_challenge_method: "S256",
|
|
91709
|
+
redirect_uri: callback,
|
|
91710
|
+
response_type: "code",
|
|
91711
|
+
scope: "deslop offline_access",
|
|
91712
|
+
state
|
|
91713
|
+
})}`;
|
|
91714
|
+
return setCookieUnsafe(redirect(authorize.href), SIGN_IN_COOKIE, yield* encodeEffect(SignInState)({
|
|
91715
|
+
next: next.href,
|
|
91716
|
+
state,
|
|
91717
|
+
verifier
|
|
91718
|
+
}), {
|
|
91719
|
+
...COOKIE,
|
|
91720
|
+
maxAge: "10 minutes"
|
|
91721
|
+
});
|
|
91722
|
+
})));
|
|
91723
|
+
yield* router.add("GET", CALLBACK_PATH, gen(function* () {
|
|
91724
|
+
const request = yield* HttpServerRequest;
|
|
91725
|
+
return yield* match$8(yield* option$1(decodeUnknownEffect(SignInState)(request.cookies[SIGN_IN_COOKIE])), {
|
|
91726
|
+
onNone: () => signedOut(canonical, "The sign-in expired or began in another browser"),
|
|
91727
|
+
onSome: fnUntraced(function* (saved) {
|
|
91728
|
+
const started = yield* result$1(gen(function* () {
|
|
91729
|
+
const params = yield* schemaSearchParams(CallbackParams);
|
|
91730
|
+
if (params.state !== saved.state) return yield* AuthError.make({ message: "The sign-in began in another browser" });
|
|
91731
|
+
if (params.error !== void 0 || params.code === void 0) return yield* AuthError.make({ message: `Auth answered ${params.error ?? "without a code"}` });
|
|
91732
|
+
if (params.iss !== new URL("/api/auth", issuer).href) return yield* AuthError.make({ message: "The answer came from another issuer" });
|
|
91733
|
+
return yield* sessions.start({
|
|
91734
|
+
client_id: yield* clientId,
|
|
91735
|
+
code: params.code,
|
|
91736
|
+
code_verifier: saved.verifier,
|
|
91737
|
+
redirect_uri: callback
|
|
91738
|
+
});
|
|
91739
|
+
}));
|
|
91740
|
+
if (isFailure$1(started)) return yield* signedOut(saved.next, started.failure);
|
|
91741
|
+
return pipe(redirect(saved.next), expireCookieUnsafe(SIGN_IN_COOKIE, COOKIE), setCookieUnsafe(SESSION_COOKIE, started.success, {
|
|
91742
|
+
...COOKIE,
|
|
91743
|
+
maxAge: "365 days"
|
|
91744
|
+
}));
|
|
91745
|
+
})
|
|
91746
|
+
});
|
|
91747
|
+
}));
|
|
91748
|
+
yield* router.add("POST", "/auth/session", gen(function* () {
|
|
91749
|
+
const started = yield* result$1(pipe(schemaBodyJson(CodeGrant), rejected("The sign-in request is invalid"), flatMap$2(sessions.start)));
|
|
91750
|
+
if (isFailure$1(started)) return text(started.failure.message, failureOptions(started.failure, 400));
|
|
91751
|
+
return yield* schemaJson(SessionHandle)({ session: started.success }, { headers: { "cache-control": "no-store" } });
|
|
91752
|
+
}));
|
|
91753
|
+
yield* router.add("GET", "/auth/sign-out", toNext((request, next) => as(ended(request.headers), expireCookieUnsafe(redirect(`${new URL("/", issuer).href}?${new URLSearchParams({
|
|
91754
|
+
next: next.href,
|
|
91755
|
+
"sign-out": ""
|
|
91756
|
+
})}`), SESSION_COOKIE, COOKIE))));
|
|
91757
|
+
yield* router.add("POST", "/auth/sign-out", as(flatMap$2(HttpServerRequest, (request) => ended(request.headers)), empty({ status: 204 })));
|
|
91758
|
+
}));
|
|
91759
|
+
}
|
|
91760
|
+
const layerSessionRoutes = unwrap$8(gen(function* () {
|
|
91761
|
+
return match$8(yield* option(String$5("AUTH_URL")), {
|
|
91762
|
+
onNone: () => empty$10,
|
|
91763
|
+
onSome: layerSignIn
|
|
91764
|
+
});
|
|
91765
|
+
}));
|
|
91679
91766
|
// ../../packages/runtime/src/cli/schema.ts
|
|
91680
91767
|
var AppError = class extends TaggedError()("AppError", {
|
|
91681
91768
|
cause: optional$8(Defect()),
|
|
@@ -91909,9 +91996,14 @@ var DeployError = class extends TaggedError()("DeployError", {
|
|
|
91909
91996
|
cause: optional$8(Defect()),
|
|
91910
91997
|
message: String$6
|
|
91911
91998
|
}) {};
|
|
91999
|
+
const ProcessLabel = Struct({
|
|
92000
|
+
detail: String$6,
|
|
92001
|
+
name: String$6
|
|
92002
|
+
});
|
|
91912
92003
|
const Process = Struct({
|
|
91913
92004
|
command: optionalKey(ArraySchema(String$6)),
|
|
91914
92005
|
cpu: optionalKey(Finite),
|
|
92006
|
+
label: ProcessLabel,
|
|
91915
92007
|
memory: Finite,
|
|
91916
92008
|
name: String$6,
|
|
91917
92009
|
parent: Int$1,
|
|
@@ -92289,7 +92381,7 @@ var Exposures = class Exposures extends Service$1()("@deslop/deploy/services/exp
|
|
|
92289
92381
|
});
|
|
92290
92382
|
}));
|
|
92291
92383
|
};
|
|
92292
|
-
// src/services/inventory/lib/
|
|
92384
|
+
// src/services/inventory/lib/failures.ts
|
|
92293
92385
|
const SIGNALS = {
|
|
92294
92386
|
1: "SIGHUP",
|
|
92295
92387
|
2: "SIGINT",
|
|
@@ -92298,33 +92390,6 @@ const SIGNALS = {
|
|
|
92298
92390
|
11: "SIGSEGV",
|
|
92299
92391
|
15: "SIGTERM"
|
|
92300
92392
|
};
|
|
92301
|
-
function socketLine(line) {
|
|
92302
|
-
const fields = split$2(trim(line), /\s+/u);
|
|
92303
|
-
const address = fields[4] ?? "";
|
|
92304
|
-
return map$11(parse$3(getOrElse(last(split$2(address, ":")), () => "")), (port) => ({
|
|
92305
|
-
address,
|
|
92306
|
-
pid: map$11(match$3(/pid=([0-9]+)/u)(line), (match) => match[1]),
|
|
92307
|
-
port,
|
|
92308
|
-
process: map$11(match$3(/users:\(\("([^"]+)",pid=([0-9]+)/u)(line), (match) => ({
|
|
92309
|
-
name: match[1] ?? "",
|
|
92310
|
-
pid: match[2]
|
|
92311
|
-
})),
|
|
92312
|
-
protocol: fields[0],
|
|
92313
|
-
state: fields[1] ?? "listening"
|
|
92314
|
-
}));
|
|
92315
|
-
}
|
|
92316
|
-
function socketUnit(cgroup) {
|
|
92317
|
-
return getOrElse(map$11(findLast$1(matchAll(/\/([^/]+\.service)(?=\/|\n|$)/gu)(cgroup), () => true), (match) => match[1] ?? ""), () => "");
|
|
92318
|
-
}
|
|
92319
|
-
function socketProcess(name, cwd) {
|
|
92320
|
-
return match$8(match$3(/\/apps\/([^/]+)(?:\/|$)/u)(cwd), {
|
|
92321
|
-
onNone: () => name,
|
|
92322
|
-
onSome: (app) => app[1] ?? ""
|
|
92323
|
-
});
|
|
92324
|
-
}
|
|
92325
|
-
function probeSocket(listener, process) {
|
|
92326
|
-
return listener.protocol === "tcp" && listener.port >= 1024 && isSome(match$3(/^(?:127\.0\.0\.1|0\.0\.0\.0):/u)(listener.address)) && isNone(match$3(/^(?:postgres|redis|ssh|cloudflared|tailscaled|caddy)$/u)(process));
|
|
92327
|
-
}
|
|
92328
92393
|
function failureReason(result, status, ran) {
|
|
92329
92394
|
if (result === "exit-code" && !ran) return "Failed before starting";
|
|
92330
92395
|
const signal = SIGNALS[status] ?? `signal ${status}`;
|
|
@@ -92348,6 +92413,194 @@ function unitFailures(text) {
|
|
|
92348
92413
|
}];
|
|
92349
92414
|
}));
|
|
92350
92415
|
}
|
|
92416
|
+
// src/services/inventory/lib/command.ts
|
|
92417
|
+
const WRAPPERS = [
|
|
92418
|
+
"env",
|
|
92419
|
+
"nice",
|
|
92420
|
+
"nohup",
|
|
92421
|
+
"setsid",
|
|
92422
|
+
"exec",
|
|
92423
|
+
"timeout",
|
|
92424
|
+
"sudo",
|
|
92425
|
+
"stdbuf",
|
|
92426
|
+
"systemd-run"
|
|
92427
|
+
];
|
|
92428
|
+
const RUNTIMES = [
|
|
92429
|
+
"node",
|
|
92430
|
+
"bun",
|
|
92431
|
+
"deno",
|
|
92432
|
+
"python",
|
|
92433
|
+
"python3"
|
|
92434
|
+
];
|
|
92435
|
+
const SHELLS = [
|
|
92436
|
+
"sh",
|
|
92437
|
+
"bash",
|
|
92438
|
+
"zsh",
|
|
92439
|
+
"dash"
|
|
92440
|
+
];
|
|
92441
|
+
const SETUP = [
|
|
92442
|
+
"source",
|
|
92443
|
+
".",
|
|
92444
|
+
"shopt",
|
|
92445
|
+
"set",
|
|
92446
|
+
"export",
|
|
92447
|
+
"cd",
|
|
92448
|
+
"true",
|
|
92449
|
+
"unset",
|
|
92450
|
+
"alias",
|
|
92451
|
+
"pwd",
|
|
92452
|
+
"{",
|
|
92453
|
+
"}",
|
|
92454
|
+
"\\builtin"
|
|
92455
|
+
];
|
|
92456
|
+
const SUBJECT = {
|
|
92457
|
+
"chrome-headless-shell": ["type"],
|
|
92458
|
+
claude: [
|
|
92459
|
+
"model",
|
|
92460
|
+
"effort",
|
|
92461
|
+
"resume"
|
|
92462
|
+
],
|
|
92463
|
+
codex: ["model"],
|
|
92464
|
+
vp: ["filter"]
|
|
92465
|
+
};
|
|
92466
|
+
function basename(value) {
|
|
92467
|
+
return getOrElse(last(filter$3(split$2(value, "/"), isNonEmpty$1)), () => value);
|
|
92468
|
+
}
|
|
92469
|
+
function isFlag(token) {
|
|
92470
|
+
return startsWith("-")(token) && token !== "-" && token !== "--";
|
|
92471
|
+
}
|
|
92472
|
+
function assignment(token) {
|
|
92473
|
+
return isSome(match$3(/^\w+=/u)(token));
|
|
92474
|
+
}
|
|
92475
|
+
function capture(pattern, value) {
|
|
92476
|
+
return flatMap$7(match$3(pattern)(value), (match) => fromUndefinedOr(match[1]));
|
|
92477
|
+
}
|
|
92478
|
+
function flagParts(token) {
|
|
92479
|
+
return match$8(match$3(/^([^=]*)(?:=(.*))?$/su)(replace(/^-+/u, "")(token)), {
|
|
92480
|
+
onNone: () => ({
|
|
92481
|
+
flag: "",
|
|
92482
|
+
inline: none()
|
|
92483
|
+
}),
|
|
92484
|
+
onSome: (match) => ({
|
|
92485
|
+
flag: getOrElse(fromUndefinedOr(match[1]), () => ""),
|
|
92486
|
+
inline: fromUndefinedOr(match[2])
|
|
92487
|
+
})
|
|
92488
|
+
});
|
|
92489
|
+
}
|
|
92490
|
+
function alias(value$4) {
|
|
92491
|
+
return pipe(value(value$4), when("vite-plus", () => "vp"), orElse(() => value$4));
|
|
92492
|
+
}
|
|
92493
|
+
function shellRest(tokens) {
|
|
92494
|
+
const script = getOrElse(get$10(tokens, 2), () => "");
|
|
92495
|
+
const shifts = match$8(match$3(/\bshift\b/gu)(script), {
|
|
92496
|
+
onNone: () => 0,
|
|
92497
|
+
onSome: (matches) => matches.length
|
|
92498
|
+
});
|
|
92499
|
+
if (includes("exec \"$@\"")(script)) return drop$1(tokens, 4 + shifts);
|
|
92500
|
+
const segments = filter$3(map$8(split$2(replaceAll(/\d*[<>]+\|?\s*\S+/gu, "")(replaceAll(/['"]/gu, "")(script)), /\s*(?:\|\|?|;|&&)\s*/u), (segment) => dropWhile(split$2(replace(/^eval\s+/u, "")(trim(segment)), /\s+/u), assignment)), (words) => isNonEmpty$1(words[0] ?? ""));
|
|
92501
|
+
return pipe(findFirst(segments, (words) => words[0] === "exec"), map$11((words) => drop$1(words, 1)), orElse$3(() => findFirst(segments, (words) => !contains(SETUP, words[0] ?? ""))), getOrElse(() => take$3(tokens, 1)));
|
|
92502
|
+
}
|
|
92503
|
+
function unwrapTokens(tokens, cwd) {
|
|
92504
|
+
const name = basename(getOrElse(head(tokens), () => ""));
|
|
92505
|
+
if (contains(WRAPPERS, name)) return unwrapTokens(pipe(findFirstIndex(tokens, (token) => token === "--"), filter$5((index) => index > 0), match$8({
|
|
92506
|
+
onNone: () => {
|
|
92507
|
+
const tail = drop$1(tokens, 1);
|
|
92508
|
+
return pipe(findFirstIndex(tail, (token) => !isFlag(token) && !assignment(token)), match$8({
|
|
92509
|
+
onNone: () => empty$11(),
|
|
92510
|
+
onSome: (start) => filter$3(tail, (token, index) => index >= start && !isFlag(token) && !assignment(token))
|
|
92511
|
+
}));
|
|
92512
|
+
},
|
|
92513
|
+
onSome: (index) => drop$1(tokens, index + 1)
|
|
92514
|
+
})), cwd);
|
|
92515
|
+
if (contains(SHELLS, name) && getOrElse(get$10(tokens, 1), () => "") === "-c") return unwrapTokens(shellRest(tokens), cwd);
|
|
92516
|
+
if (contains(RUNTIMES, name)) return pipe(findFirstIndex(tokens, (token, index) => index > 0 && !isFlag(token)), match$8({
|
|
92517
|
+
onNone: () => tokens,
|
|
92518
|
+
onSome: (index) => {
|
|
92519
|
+
const script = getOrElse(get$10(tokens, index), () => "");
|
|
92520
|
+
const pkg = capture(/.*node_modules\/((?:@[^/]+\/)?[^/.][^/]*)\//u, script);
|
|
92521
|
+
const app = pipe(capture(/\.deslop\/([^/]+)\//u, script), orElse$3(() => flatMap$7(cwd, (value) => capture(/\/apps\/([^/]+)$/u, value))));
|
|
92522
|
+
return [getOrElse(pipe(pkg, orElse$3(() => app)), () => basename(script)), ...drop$1(tokens, index + 1)];
|
|
92523
|
+
}
|
|
92524
|
+
}));
|
|
92525
|
+
return tokens;
|
|
92526
|
+
}
|
|
92527
|
+
function unwrap(argv, cwd) {
|
|
92528
|
+
const tokens = match$1(length$2(argv) === 1, {
|
|
92529
|
+
onFalse: () => argv,
|
|
92530
|
+
onTrue: () => filter$3(split$2(getOrElse(head(argv), () => ""), /\s+/u), isNonEmpty$1)
|
|
92531
|
+
});
|
|
92532
|
+
return unwrapTokens([replace(/:$/u, "")(getOrElse(head(tokens), () => "")), ...drop$1(tokens, 1)], cwd);
|
|
92533
|
+
}
|
|
92534
|
+
function scan(name, subject, args, words, values) {
|
|
92535
|
+
return match$8(head(args), {
|
|
92536
|
+
onNone: () => ({
|
|
92537
|
+
ssh: none(),
|
|
92538
|
+
values,
|
|
92539
|
+
words
|
|
92540
|
+
}),
|
|
92541
|
+
onSome: (token) => {
|
|
92542
|
+
if (isFlag(token)) {
|
|
92543
|
+
const parsed = flagParts(token);
|
|
92544
|
+
const next = filter$5(get$10(args, 1), (value) => !isFlag(value));
|
|
92545
|
+
const value = pipe(parsed.inline, orElse$3(() => next));
|
|
92546
|
+
return scan(name, subject, match$1(isNone(parsed.inline) && isSome(next), {
|
|
92547
|
+
onFalse: () => drop$1(args, 1),
|
|
92548
|
+
onTrue: () => drop$1(args, 2)
|
|
92549
|
+
}), words, match$1(contains(subject, parsed.flag), {
|
|
92550
|
+
onFalse: () => values,
|
|
92551
|
+
onTrue: () => match$1(parsed.flag === "resume", {
|
|
92552
|
+
onFalse: () => match$8(value, {
|
|
92553
|
+
onNone: () => values,
|
|
92554
|
+
onSome: (given) => set$6(values, parsed.flag, given)
|
|
92555
|
+
}),
|
|
92556
|
+
onTrue: () => set$6(values, parsed.flag, "resumed")
|
|
92557
|
+
})
|
|
92558
|
+
}));
|
|
92559
|
+
}
|
|
92560
|
+
if (name === "ssh") return {
|
|
92561
|
+
ssh: some$1({
|
|
92562
|
+
host: getOrElse(last(split$2(token, "@")), () => token),
|
|
92563
|
+
remote: drop$1(args, 1)
|
|
92564
|
+
}),
|
|
92565
|
+
values,
|
|
92566
|
+
words
|
|
92567
|
+
};
|
|
92568
|
+
if (token === "…" || length$1(token) > 40 || isSome(match$3(/^[0-9a-f-]{16,}$/iu)(token)) || includes("=")(token)) return scan(name, subject, drop$1(args, 1), words, values);
|
|
92569
|
+
const word = match$1(includes("/")(token), {
|
|
92570
|
+
onFalse: () => token,
|
|
92571
|
+
onTrue: () => basename(token)
|
|
92572
|
+
});
|
|
92573
|
+
return scan(name, subject, drop$1(args, 1), [...words, word], values);
|
|
92574
|
+
}
|
|
92575
|
+
});
|
|
92576
|
+
}
|
|
92577
|
+
function commandLabel(argv, cwd) {
|
|
92578
|
+
const [head = "", ...args] = unwrap(argv, cwd);
|
|
92579
|
+
const name = alias(basename(head));
|
|
92580
|
+
const subject = getOrElse(get$11(SUBJECT, name), () => empty$11());
|
|
92581
|
+
const scanned = scan(name, subject, args, [], {});
|
|
92582
|
+
if (contains(SHELLS, name) && isReadonlyArrayEmpty(scanned.words)) return {
|
|
92583
|
+
detail: getOrElse(map$11(cwd, basename), () => ""),
|
|
92584
|
+
name
|
|
92585
|
+
};
|
|
92586
|
+
return match$8(scanned.ssh, {
|
|
92587
|
+
onNone: () => ({
|
|
92588
|
+
detail: join$2([...take$3(scanned.words, 2), ...filter$3(getSomes(map$8(subject, (flag) => get$11(scanned.values, flag))), isNonEmpty$1)], " "),
|
|
92589
|
+
name
|
|
92590
|
+
}),
|
|
92591
|
+
onSome: (ssh) => {
|
|
92592
|
+
const remote = commandLabel(ssh.remote, none());
|
|
92593
|
+
return {
|
|
92594
|
+
detail: join$2(filter$3([ssh.host, match$1(isNonEmpty$1(remote.name), {
|
|
92595
|
+
onFalse: () => "",
|
|
92596
|
+
onTrue: () => `→ ${remote.name}`
|
|
92597
|
+
})], isNonEmpty$1), " "),
|
|
92598
|
+
name
|
|
92599
|
+
};
|
|
92600
|
+
}
|
|
92601
|
+
});
|
|
92602
|
+
}
|
|
92603
|
+
// src/services/inventory/lib/owners.ts
|
|
92351
92604
|
function processOwner(cgroup) {
|
|
92352
92605
|
const container = getOrUndefined$1(match$3(/\/(?:docker-|docker\/)([a-f0-9]{12,64})(?:\.scope)?(?:\/|\n|$)/u)(cgroup))?.[1];
|
|
92353
92606
|
if (container !== void 0) return `container:${slice$1(0, 12)(container)}`;
|
|
@@ -92362,6 +92615,7 @@ function processOwner(cgroup) {
|
|
|
92362
92615
|
onSome: (match) => `service:user:${match[1]}.service`
|
|
92363
92616
|
});
|
|
92364
92617
|
}
|
|
92618
|
+
// src/services/inventory/lib/utils.ts
|
|
92365
92619
|
function itemOwner(item) {
|
|
92366
92620
|
if (item.kind === "container") return `container:${slice$1(0, 12)(getOrElse(last(split$2(item.id, ":docker:")), () => ""))}`;
|
|
92367
92621
|
return `service:${item.scope ?? "system"}:${item.name}`;
|
|
@@ -92370,22 +92624,25 @@ function itemOwner(item) {
|
|
|
92370
92624
|
const PROCESS_INTERVAL = 2e3;
|
|
92371
92625
|
const SECRET = /(?:token|secret|passw(?:or)?d|key|auth|credential|cookie|session)/iu;
|
|
92372
92626
|
function processStatus(status) {
|
|
92373
|
-
|
|
92374
|
-
|
|
92375
|
-
|
|
92627
|
+
const values = fromEntries(map$8(split$2(trim(status), "\n"), (line) => {
|
|
92628
|
+
const at = getOrElse(indexOf(":")(line), () => -1);
|
|
92629
|
+
return [slice$1(0, at)(line), trim(slice$1(at + 1)(line))];
|
|
92630
|
+
}));
|
|
92376
92631
|
return {
|
|
92377
|
-
memory: decodeSync(FiniteFromString)(split$2(
|
|
92378
|
-
name:
|
|
92379
|
-
parent: decodeSync(FiniteFromString.check(isInt()))(
|
|
92380
|
-
pid: decodeSync(FiniteFromString.check(isInt()))(
|
|
92632
|
+
memory: decodeSync(FiniteFromString)(split$2(values["VmRSS"] ?? "", /\s+/u)[0] || "0") * 1024,
|
|
92633
|
+
name: values["Name"] ?? "",
|
|
92634
|
+
parent: decodeSync(FiniteFromString.check(isInt()))(values["PPid"] ?? ""),
|
|
92635
|
+
pid: decodeSync(FiniteFromString.check(isInt()))(values["Pid"] ?? "")
|
|
92381
92636
|
};
|
|
92382
92637
|
}
|
|
92383
92638
|
function commandArgs(cmdline) {
|
|
92384
92639
|
const args = take$3(filter$3(split$2(cmdline, "\0"), isNonEmpty$1), 40);
|
|
92385
92640
|
return map$8(args, (arg, index) => {
|
|
92386
92641
|
if (isSome(match$3(/^-{0,2}[\w.-]+=/u)(arg)) && SECRET.test(split$2(arg, "=")[0])) return `${split$2(arg, "=")[0]}=…`;
|
|
92387
|
-
|
|
92388
|
-
|
|
92642
|
+
const previous = args[index - 1] ?? "";
|
|
92643
|
+
const secretValue = startsWith("-")(previous) && !includes("=")(previous) && SECRET.test(previous);
|
|
92644
|
+
const opaque = !startsWith("/")(arg) && isSome(match$3(/^[\w+/=-]{32,}$/u)(arg));
|
|
92645
|
+
if (index > 0 && (secretValue || !startsWith("-")(arg) && opaque)) return "…";
|
|
92389
92646
|
return slice$1(0, 200)(replaceAll(/:\/\/[^/@\s]+@/gu, "://…@")(arg));
|
|
92390
92647
|
});
|
|
92391
92648
|
}
|
|
@@ -92397,20 +92654,30 @@ const processes = gen(function* () {
|
|
|
92397
92654
|
records: yield* pipe(forEach$1(filter$3(yield* fs.readDirectory("/proc"), (name) => isSome(match$3(/^[0-9]+$/u)(name))), (pid) => pipe(gen(function* () {
|
|
92398
92655
|
const status = yield* fs.readFileString(`/proc/${pid}/status`);
|
|
92399
92656
|
const stat = yield* fs.readFileString(`/proc/${pid}/stat`);
|
|
92657
|
+
const cwd = yield* option$1(fs.readLink(`/proc/${pid}/cwd`));
|
|
92658
|
+
const command = map$11(yield* option$1(fs.readFileString(`/proc/${pid}/cmdline`)), commandArgs);
|
|
92400
92659
|
const fields = split$2(slice$1(getOrElse(lastIndexOf(")")(stat), () => -1) + 2)(stat), /\s+/u);
|
|
92660
|
+
const parsed = yield* try_({
|
|
92661
|
+
catch: (cause) => DeployError.make({
|
|
92662
|
+
cause,
|
|
92663
|
+
message: `Process ${pid} has an unreadable status.`
|
|
92664
|
+
}),
|
|
92665
|
+
try: () => processStatus(status)
|
|
92666
|
+
});
|
|
92401
92667
|
return {
|
|
92402
92668
|
cgroup: yield* fs.readFileString(`/proc/${pid}/cgroup`),
|
|
92403
92669
|
process: {
|
|
92404
|
-
...
|
|
92405
|
-
|
|
92406
|
-
cause,
|
|
92407
|
-
message: `Process ${pid} has an unreadable status.`
|
|
92408
|
-
}),
|
|
92409
|
-
try: () => processStatus(status)
|
|
92410
|
-
}),
|
|
92411
|
-
...match$8(yield* option$1(fs.readFileString(`/proc/${pid}/cmdline`)), {
|
|
92670
|
+
...parsed,
|
|
92671
|
+
...match$8(command, {
|
|
92412
92672
|
onNone: () => ({}),
|
|
92413
|
-
onSome: (
|
|
92673
|
+
onSome: (args) => ({ command: args })
|
|
92674
|
+
}),
|
|
92675
|
+
label: match$8(filter$5(command, isReadonlyArrayNonEmpty), {
|
|
92676
|
+
onNone: () => ({
|
|
92677
|
+
detail: "",
|
|
92678
|
+
name: parsed.name
|
|
92679
|
+
}),
|
|
92680
|
+
onSome: (args) => commandLabel(args, cwd)
|
|
92414
92681
|
})
|
|
92415
92682
|
},
|
|
92416
92683
|
start: yield* decodeEffect(FiniteFromString)(fields[19] ?? ""),
|
|
@@ -92471,13 +92738,40 @@ function attachProcesses(items, records) {
|
|
|
92471
92738
|
}), (record) => record.process)
|
|
92472
92739
|
}));
|
|
92473
92740
|
}
|
|
92741
|
+
// src/services/inventory/lib/sockets.ts
|
|
92742
|
+
function socketLine(line) {
|
|
92743
|
+
const fields = split$2(trim(line), /\s+/u);
|
|
92744
|
+
const address = fields[4] ?? "";
|
|
92745
|
+
return map$11(parse$3(getOrElse(last(split$2(address, ":")), () => "")), (port) => ({
|
|
92746
|
+
address,
|
|
92747
|
+
port,
|
|
92748
|
+
process: map$11(match$3(/users:\(\("([^"]+)",pid=([0-9]+)/u)(line), (match) => ({
|
|
92749
|
+
name: match[1] ?? "",
|
|
92750
|
+
pid: match[2]
|
|
92751
|
+
})),
|
|
92752
|
+
protocol: fields[0],
|
|
92753
|
+
state: fields[1] ?? "listening"
|
|
92754
|
+
}));
|
|
92755
|
+
}
|
|
92756
|
+
function socketUnit(cgroup) {
|
|
92757
|
+
return getOrElse(map$11(findLast$1(matchAll(/\/([^/]+\.service)(?=\/|\n|$)/gu)(cgroup), () => true), (match) => match[1] ?? ""), () => "");
|
|
92758
|
+
}
|
|
92759
|
+
function socketProcess(name, cwd) {
|
|
92760
|
+
return match$8(match$3(/\/apps\/([^/]+)(?:\/|$)/u)(cwd), {
|
|
92761
|
+
onNone: () => name,
|
|
92762
|
+
onSome: (app) => app[1] ?? ""
|
|
92763
|
+
});
|
|
92764
|
+
}
|
|
92765
|
+
function probeSocket(listener, process) {
|
|
92766
|
+
return listener.protocol === "tcp" && listener.port >= 1024 && isSome(match$3(/^(?:127\.0\.0\.1|0\.0\.0\.0):/u)(listener.address)) && isNone(match$3(/^(?:postgres|redis|ssh|cloudflared|tailscaled|caddy)$/u)(process));
|
|
92767
|
+
}
|
|
92474
92768
|
// src/services/inventory/service.ts
|
|
92475
92769
|
function portItems(text, worker, fs, http) {
|
|
92476
92770
|
return forEach$1(getSomes(map$8(split$2(trim(text), "\n"), socketLine)), fnUntraced(function* (socket) {
|
|
92477
|
-
const unit = socketUnit(yield* match$8(socket.
|
|
92771
|
+
const unit = socketUnit(yield* match$8(socket.process, {
|
|
92478
92772
|
onNone: () => succeed$5(""),
|
|
92479
|
-
onSome: fnUntraced(function* (
|
|
92480
|
-
return getOrElse(yield* option$1(fs.readFileString(`/proc/${pid}/cgroup`)), () => "");
|
|
92773
|
+
onSome: fnUntraced(function* (match) {
|
|
92774
|
+
return getOrElse(yield* option$1(fs.readFileString(`/proc/${match.pid}/cgroup`)), () => "");
|
|
92481
92775
|
})
|
|
92482
92776
|
}));
|
|
92483
92777
|
const process = yield* match$8(socket.process, {
|
|
@@ -92814,10 +93108,19 @@ function sample(current, memory, disk, previous, load) {
|
|
|
92814
93108
|
const fields = split$2(line, /\s+/u);
|
|
92815
93109
|
return [fields[0], decodeSync(FiniteFromString)(fields[1] ?? "") * 1024];
|
|
92816
93110
|
}));
|
|
93111
|
+
const disks = pipe(disk, trim, split$2("\n"), drop$1(1), filter$3(isNonEmpty$1), map$8((line) => {
|
|
93112
|
+
const fields = split$2(trim(line), /\s+/u);
|
|
93113
|
+
return {
|
|
93114
|
+
mount: fields[0],
|
|
93115
|
+
total: decodeSync(FiniteFromString)(fields[1] ?? ""),
|
|
93116
|
+
used: decodeSync(FiniteFromString)(fields[2] ?? "")
|
|
93117
|
+
};
|
|
93118
|
+
}));
|
|
93119
|
+
const used = reduce(disks, 0, (sum, entry) => sum + entry.used);
|
|
92817
93120
|
const seconds = (current.time - (previous?.time ?? current.time)) / 1e3;
|
|
92818
93121
|
const baseline = filter$5(fromUndefinedOr(previous), (old) => old.uptime < current.uptime);
|
|
92819
93122
|
const old = getOrUndefined$1(baseline);
|
|
92820
|
-
|
|
93123
|
+
const reading = {
|
|
92821
93124
|
cores: coreUsages(current, seconds, old),
|
|
92822
93125
|
...getSomes$1({
|
|
92823
93126
|
cpu: cpuUsage({
|
|
@@ -92832,14 +93135,7 @@ function sample(current, memory, disk, previous, load) {
|
|
|
92832
93135
|
networkReceive: rate(current.networkReceive, seconds, old?.networkReceive),
|
|
92833
93136
|
networkSend: rate(current.networkSend, seconds, old?.networkSend)
|
|
92834
93137
|
}),
|
|
92835
|
-
disks
|
|
92836
|
-
const fields = split$2(trim(line), /\s+/u);
|
|
92837
|
-
return {
|
|
92838
|
-
mount: fields[0],
|
|
92839
|
-
total: decodeSync(FiniteFromString)(fields[1] ?? ""),
|
|
92840
|
-
used: decodeSync(FiniteFromString)(fields[2] ?? "")
|
|
92841
|
-
};
|
|
92842
|
-
})),
|
|
93138
|
+
disks,
|
|
92843
93139
|
load: decodeSync(ArraySchema(FiniteFromString))(take$3(filter$3(split$2(trim(load ?? ""), /\s+/u), isNonEmpty$1), 3)),
|
|
92844
93140
|
memoryAvailable: values["MemAvailable:"] ?? 0,
|
|
92845
93141
|
memoryBuffers: values["Buffers:"] ?? 0,
|
|
@@ -92851,6 +93147,13 @@ function sample(current, memory, disk, previous, load) {
|
|
|
92851
93147
|
time: current.time,
|
|
92852
93148
|
uptime: current.uptime
|
|
92853
93149
|
};
|
|
93150
|
+
return match$6(disks, {
|
|
93151
|
+
onEmpty: () => reading,
|
|
93152
|
+
onNonEmpty: () => ({
|
|
93153
|
+
...reading,
|
|
93154
|
+
storageUsed: used
|
|
93155
|
+
})
|
|
93156
|
+
});
|
|
92854
93157
|
}
|
|
92855
93158
|
function resolution(minutes) {
|
|
92856
93159
|
return minutes * 1e3;
|
|
@@ -92905,6 +93208,7 @@ function merge(bucket) {
|
|
|
92905
93208
|
networkSend: mean(bucket, (point) => point.networkSend)
|
|
92906
93209
|
}),
|
|
92907
93210
|
memoryUsed: getOrElse(mean(bucket, (point) => point.memoryUsed), () => last.memoryUsed),
|
|
93211
|
+
...getSomes$1({ storageUsed: mean(bucket, (point) => point.storageUsed) }),
|
|
92908
93212
|
since: bucket[0].since ?? bucket[0].time
|
|
92909
93213
|
};
|
|
92910
93214
|
}
|
|
@@ -92914,8 +93218,13 @@ function compact(samples, now) {
|
|
|
92914
93218
|
return `${tier.every}:${Math.floor(value.time / tier.every)}`;
|
|
92915
93219
|
}), values, map$8(merge), sort(mapInput(Number$6, (value) => value.time)));
|
|
92916
93220
|
}
|
|
93221
|
+
function usedStorage(point) {
|
|
93222
|
+
return getOrElse(fromUndefinedOr(point.storageUsed), () => reduce(point.disks, 0, (sum, disk) => sum + disk.used));
|
|
93223
|
+
}
|
|
92917
93224
|
function history(samples, minutes, now) {
|
|
92918
|
-
const
|
|
93225
|
+
const window = chartWindow(minutes, now);
|
|
93226
|
+
const slot = resolution(minutes);
|
|
93227
|
+
const selected = pipe(filter$3(samples, (value) => value.time > window.start && value.time <= now), groupBy((value) => `${clamp(Math.ceil((value.time - window.start) / slot) - 1, {
|
|
92919
93228
|
maximum: 59,
|
|
92920
93229
|
minimum: 0
|
|
92921
93230
|
})}`), values, map$8(merge));
|
|
@@ -92924,7 +93233,7 @@ function history(samples, minutes, now) {
|
|
|
92924
93233
|
return {
|
|
92925
93234
|
...pipe(value, omit(["load", "uptime"])),
|
|
92926
93235
|
disks: [],
|
|
92927
|
-
storageUsed:
|
|
93236
|
+
storageUsed: usedStorage(value)
|
|
92928
93237
|
};
|
|
92929
93238
|
});
|
|
92930
93239
|
}
|
|
@@ -92942,7 +93251,7 @@ function compactHistory(machine, minutes) {
|
|
|
92942
93251
|
memoryUsed: map$8(machine.samples, (value) => value.memoryUsed),
|
|
92943
93252
|
networkReceive: map$8(machine.samples, (value) => map$11(fromUndefinedOr(value.networkReceive), round(0))),
|
|
92944
93253
|
networkSend: map$8(machine.samples, (value) => map$11(fromUndefinedOr(value.networkSend), round(0))),
|
|
92945
|
-
storageUsed: map$8(machine.samples,
|
|
93254
|
+
storageUsed: map$8(machine.samples, usedStorage),
|
|
92946
93255
|
swapUsed: map$8(machine.samples, (value) => value.swapUsed),
|
|
92947
93256
|
time: map$8(machine.samples, (value) => value.time)
|
|
92948
93257
|
},
|
|
@@ -93010,25 +93319,17 @@ var Metrics = class Metrics extends Service$1()("@deslop/deploy/services/metrics
|
|
|
93010
93319
|
const dirty = yield* make$44(empty$11());
|
|
93011
93320
|
const collectError = yield* make$44("");
|
|
93012
93321
|
const persistError = yield* make$44("");
|
|
93013
|
-
|
|
93014
|
-
|
|
93015
|
-
|
|
93016
|
-
|
|
93322
|
+
function walk(pending, found) {
|
|
93323
|
+
if (isReadonlyArrayEmpty(pending)) return succeed$5(found);
|
|
93324
|
+
return flatMap$2(forEach$1(pending, (path) => option$1(map$5(fs.readDirectory(`${CGROUP}${path}`), (names) => map$8(filter$3(names, (name) => isSome(match$3(/\.(?:slice|scope|service)$/u)(name))), (name) => ({
|
|
93325
|
+
app: appCgroup(`${path}/${name}`, names),
|
|
93326
|
+
path: `${path}/${name}`
|
|
93327
|
+
})))), { concurrency: "unbounded" }), (levels) => {
|
|
93328
|
+
const children = flatten$3(getSomes(levels));
|
|
93329
|
+
return walk(map$8(filter$3(children, (child) => !child.app && isSome(match$3(/(?:\.slice|\/user@[0-9]+\.service)$/u)(child.path))), (child) => child.path), [...found, ...map$8(filter$3(children, (child) => child.app), (child) => child.path)]);
|
|
93017
93330
|
});
|
|
93018
|
-
|
|
93019
|
-
|
|
93020
|
-
const children = flatMap$5(getSomes(yield* forEach$1(level.pending, (path) => option$1(map$5(fs.readDirectory(`${CGROUP}${path}`), (names) => map$8(filter$3(names, (name) => isSome(match$3(/\.(?:slice|scope|service)$/u)(name))), (name) => ({
|
|
93021
|
-
app: appCgroup(`${path}/${name}`, names),
|
|
93022
|
-
path: `${path}/${name}`
|
|
93023
|
-
})))), { concurrency: "unbounded" })), identity);
|
|
93024
|
-
const next = {
|
|
93025
|
-
found: [...level.found, ...map$8(filter$3(children, (child) => child.app), (child) => child.path)],
|
|
93026
|
-
pending: map$8(filter$3(children, (child) => !child.app && isSome(match$3(/(?:\.slice|\/user@[0-9]+\.service)$/u)(child.path))), (child) => child.path)
|
|
93027
|
-
};
|
|
93028
|
-
yield* set$1(walk, next);
|
|
93029
|
-
return next;
|
|
93030
|
-
}), { until: (next) => isReadonlyArrayEmpty(next.pending) })).found;
|
|
93031
|
-
});
|
|
93331
|
+
}
|
|
93332
|
+
const appCgroups = walk([""], []);
|
|
93032
93333
|
const apps = gen(function* () {
|
|
93033
93334
|
const readings = yield* forEach$1(yield* appCgroups, (path) => pipe(all$1({
|
|
93034
93335
|
cpu: fs.readFileString(`${CGROUP}${path}/cpu.stat`),
|
|
@@ -93182,6 +93483,13 @@ function changeFailed(effect) {
|
|
|
93182
93483
|
});
|
|
93183
93484
|
});
|
|
93184
93485
|
}
|
|
93486
|
+
function cachedHistory(query, time, saved) {
|
|
93487
|
+
return {
|
|
93488
|
+
...getSomes$1({ cpuModel: fromUndefinedOr(saved?.cpuModel) }),
|
|
93489
|
+
samples: history(saved?.samples ?? [], query.minutes, time),
|
|
93490
|
+
time
|
|
93491
|
+
};
|
|
93492
|
+
}
|
|
93185
93493
|
var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/service/Fleet") {
|
|
93186
93494
|
static layer = effect(this, gen(function* () {
|
|
93187
93495
|
const inventory = yield* Inventory;
|
|
@@ -93228,11 +93536,9 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
|
|
|
93228
93536
|
return [own, ...map$8(workers, (worker) => {
|
|
93229
93537
|
const saved = cached[`${worker.name}:${query.minutes}`];
|
|
93230
93538
|
return {
|
|
93231
|
-
...
|
|
93539
|
+
...cachedHistory(query, time, saved),
|
|
93232
93540
|
error: saved?.error ?? "Waiting for worker",
|
|
93233
|
-
samples: history(saved?.samples ?? [], query.minutes, time),
|
|
93234
93541
|
stale: saved === void 0 || saved.stale || time - saved.time > 9e4,
|
|
93235
|
-
time,
|
|
93236
93542
|
worker: worker.name
|
|
93237
93543
|
};
|
|
93238
93544
|
})];
|
|
@@ -93252,14 +93558,10 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
|
|
|
93252
93558
|
...value,
|
|
93253
93559
|
worker: worker.name
|
|
93254
93560
|
})), catch_$2(fnUntraced(function* (cause) {
|
|
93255
|
-
const time = yield* currentTimeMillis;
|
|
93256
|
-
const all = yield* get$1(lastMetrics);
|
|
93257
93561
|
return {
|
|
93258
|
-
...
|
|
93562
|
+
...cachedHistory(query, yield* currentTimeMillis, (yield* get$1(lastMetrics))[`${worker.name}:${query.minutes}`]),
|
|
93259
93563
|
error: cause.message,
|
|
93260
|
-
samples: history(all[`${worker.name}:${query.minutes}`]?.samples ?? [], query.minutes, time),
|
|
93261
93564
|
stale: true,
|
|
93262
|
-
time,
|
|
93263
93565
|
worker: worker.name
|
|
93264
93566
|
};
|
|
93265
93567
|
})), tap$1((value) => update$1(lastMetrics, (all) => set$6(all, `${worker.name}:${query.minutes}`, value)))), { concurrency: "unbounded" })];
|
|
@@ -93340,7 +93642,7 @@ const RpcHandlers = RpcContracts.toLayer(gen(function* () {
|
|
|
93340
93642
|
"deploy.hide": fleet.hide,
|
|
93341
93643
|
"deploy.history": fleet.history,
|
|
93342
93644
|
"deploy.inventory": () => inventory,
|
|
93343
|
-
"deploy.metrics": (query) => unwrap$
|
|
93645
|
+
"deploy.metrics": (query) => unwrap$4(get$6(metrics, query.minutes)),
|
|
93344
93646
|
"deploy.run": fleet.run,
|
|
93345
93647
|
"deploy.snapshot": () => fleet.local
|
|
93346
93648
|
});
|
|
@@ -93375,7 +93677,7 @@ const ToolHandlers = Tools.toLayer(map$5(Fleet, (fleet) => Tools.of({
|
|
|
93375
93677
|
})
|
|
93376
93678
|
})));
|
|
93377
93679
|
// src/main.server.ts
|
|
93378
|
-
const layerServices = pipe(Fleet.layer, provideMerge(
|
|
93680
|
+
const layerServices = pipe(Fleet.layer, provideMerge(mergeAll$1(Inventory.layer, Metrics.layer, unwrap$8(map$5(dataDirectory, Exposures.layer)))), provide$2(ToolPath.layer));
|
|
93379
93681
|
runApp({
|
|
93380
93682
|
icon: icon_default,
|
|
93381
93683
|
routes: pipe(mergeAll$1(layerRpc({
|