@deslop/deploy 0.1.1309 → 0.1.1312
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)-Bn_w6sT-.js +2 -0
- package/dist/client/assets/-marks-85l0QyR4.js +1 -0
- package/dist/client/assets/{classes-j-xsSMVh.js → classes-DCKI_hSj.js} +1 -1
- package/dist/client/assets/{dropdown-menu-7mXUvASL.js → dropdown-menu-BpWCBGwG.js} +1 -1
- package/dist/client/assets/effect-DYDjqHnU.js +17 -0
- package/dist/client/assets/index-DBxUm3wt.css +2 -0
- package/dist/client/assets/index-ZRJ5RRL4.js +2 -0
- package/dist/client/assets/route-Bbqw_-PU.js +1 -0
- package/dist/client/assets/schema-CBkHoum9.js +2 -0
- package/dist/client/index.html +5 -5
- package/dist/server.js +275 -109
- package/package.json +2 -2
- package/dist/client/assets/(home)--V6jxIBa.js +0 -2
- package/dist/client/assets/-marks-wE_hCSaJ.js +0 -1
- package/dist/client/assets/effect-Cv60lT7W.js +0 -17
- package/dist/client/assets/index-BZPCy_rb.js +0 -2
- package/dist/client/assets/index-_wKIBpRP.css +0 -2
- package/dist/client/assets/route-BTuejcTF.js +0 -1
- package/dist/client/assets/schema-5_QlJhNT.js +0 -2
package/dist/server.js
CHANGED
|
@@ -6389,6 +6389,54 @@ const empty$16 = () => ({});
|
|
|
6389
6389
|
*/
|
|
6390
6390
|
const isEmptyRecord = (self) => Object.keys(self).length === 0;
|
|
6391
6391
|
/**
|
|
6392
|
+
* Takes an iterable and a projection function and returns a record.
|
|
6393
|
+
* The projection function maps each value of the iterable to a tuple of a key and a value, which is then added to the resulting record.
|
|
6394
|
+
*
|
|
6395
|
+
* **Example** (Building a record from mapped iterable values)
|
|
6396
|
+
*
|
|
6397
|
+
* ```ts import.meta.vitest
|
|
6398
|
+
* import { Record } from "effect"
|
|
6399
|
+
*
|
|
6400
|
+
* Record.fromIterableWith([1, 2, 3, 4], (a) => [String(a), a * 2]) // => { "1": 2, "2": 4, "3": 6, "4": 8 }
|
|
6401
|
+
* ```
|
|
6402
|
+
*
|
|
6403
|
+
* @stability stable
|
|
6404
|
+
* @category constructors
|
|
6405
|
+
* @since 2.0.0
|
|
6406
|
+
*/
|
|
6407
|
+
const fromIterableWith = /*#__PURE__*/ dual(2, (self, f) => {
|
|
6408
|
+
const out = empty$16();
|
|
6409
|
+
for (const a of self) {
|
|
6410
|
+
const [k, b] = f(a);
|
|
6411
|
+
assignProperty(out, k, b);
|
|
6412
|
+
}
|
|
6413
|
+
return out;
|
|
6414
|
+
});
|
|
6415
|
+
/**
|
|
6416
|
+
* Creates a new record from an iterable, utilizing the provided function to determine the key for each element.
|
|
6417
|
+
*
|
|
6418
|
+
* **Example** (Building a record keyed by iterable values)
|
|
6419
|
+
*
|
|
6420
|
+
* ```ts import.meta.vitest
|
|
6421
|
+
* import { Record } from "effect"
|
|
6422
|
+
*
|
|
6423
|
+
* const users = [
|
|
6424
|
+
* { id: "2", name: "name2" },
|
|
6425
|
+
* { id: "1", name: "name1" }
|
|
6426
|
+
* ]
|
|
6427
|
+
*
|
|
6428
|
+
* Record.fromIterableBy(
|
|
6429
|
+
* users,
|
|
6430
|
+
* (user) => user.id
|
|
6431
|
+
* ) // => { "1": { id: "1", name: "name1" }, "2": { id: "2", name: "name2" } }
|
|
6432
|
+
* ```
|
|
6433
|
+
*
|
|
6434
|
+
* @stability stable
|
|
6435
|
+
* @category constructors
|
|
6436
|
+
* @since 2.0.0
|
|
6437
|
+
*/
|
|
6438
|
+
const fromIterableBy = /*#__PURE__*/ dual(2, (items, f) => fromIterableWith(items, (a) => [f(a), a]));
|
|
6439
|
+
/**
|
|
6392
6440
|
* Builds a record from an iterable of key-value pairs.
|
|
6393
6441
|
*
|
|
6394
6442
|
* **Details**
|
|
@@ -7892,6 +7940,47 @@ const filter$5 = /*#__PURE__*/ dual(2, (self, predicate) => {
|
|
|
7892
7940
|
return out;
|
|
7893
7941
|
});
|
|
7894
7942
|
/**
|
|
7943
|
+
* Splits an iterable using a `Filter` into successes and failures.
|
|
7944
|
+
*
|
|
7945
|
+
* **When to use**
|
|
7946
|
+
*
|
|
7947
|
+
* Use to partition an iterable by evaluating each element with a
|
|
7948
|
+
* `Result`-returning filter and keeping both success and failure values.
|
|
7949
|
+
*
|
|
7950
|
+
* **Details**
|
|
7951
|
+
*
|
|
7952
|
+
* Returns `[passes, fails]`. The filter receives `(element, index)`.
|
|
7953
|
+
*
|
|
7954
|
+
* **Example** (Partitioning with a filter)
|
|
7955
|
+
*
|
|
7956
|
+
* ```ts import.meta.vitest
|
|
7957
|
+
* import { Array, Result } from "effect"
|
|
7958
|
+
*
|
|
7959
|
+
* Array.partition([1, -2, 3], (n, i) =>
|
|
7960
|
+
* n > 0 ? Result.succeed(n + i) : Result.fail(`negative:${n}`)
|
|
7961
|
+
* ) // => [[1, 5], ["negative:-2"]]
|
|
7962
|
+
* ```
|
|
7963
|
+
*
|
|
7964
|
+
* @see {@link filter} — keep only matching elements
|
|
7965
|
+
* @see {@link filterMap} for discarding failures
|
|
7966
|
+
* @see {@link separate} — split an iterable of `Result` values
|
|
7967
|
+
*
|
|
7968
|
+
* @stability stable
|
|
7969
|
+
* @category filtering
|
|
7970
|
+
* @since 2.0.0
|
|
7971
|
+
*/
|
|
7972
|
+
const partition = /*#__PURE__*/ dual(2, (self, f) => {
|
|
7973
|
+
const passes = [];
|
|
7974
|
+
const fails = [];
|
|
7975
|
+
let i = 0;
|
|
7976
|
+
for (const a of self) {
|
|
7977
|
+
const result = f(a, i++);
|
|
7978
|
+
if (isSuccess$1(result)) passes.push(result.success);
|
|
7979
|
+
else fails.push(result.failure);
|
|
7980
|
+
}
|
|
7981
|
+
return [passes, fails];
|
|
7982
|
+
});
|
|
7983
|
+
/**
|
|
7895
7984
|
* Folds an iterable from left to right into a single value.
|
|
7896
7985
|
*
|
|
7897
7986
|
* **When to use**
|
|
@@ -9251,6 +9340,38 @@ const format$1 = (self) => {
|
|
|
9251
9340
|
};
|
|
9252
9341
|
// ../../node_modules/.pnpm/effect@4.1.4/node_modules/effect/dist/Filter.js
|
|
9253
9342
|
/**
|
|
9343
|
+
* Creates a Filter from a predicate or refinement function.
|
|
9344
|
+
*
|
|
9345
|
+
* **Details**
|
|
9346
|
+
*
|
|
9347
|
+
* This is a convenient way to create filters from boolean-returning functions.
|
|
9348
|
+
* When the predicate returns true, the input value is passed through unchanged.
|
|
9349
|
+
* When it returns false, the `fail` type is returned.
|
|
9350
|
+
*
|
|
9351
|
+
* **Example** (Creating filters from predicates)
|
|
9352
|
+
*
|
|
9353
|
+
* ```ts import.meta.vitest
|
|
9354
|
+
* import { Filter, Result } from "effect"
|
|
9355
|
+
*
|
|
9356
|
+
* // Create filter from predicate
|
|
9357
|
+
* const positiveNumbers = Filter.fromPredicate((n: number) => n > 0)
|
|
9358
|
+
* const nonEmptyStrings = Filter.fromPredicate((s: string) => s.length > 0)
|
|
9359
|
+
*
|
|
9360
|
+
* // Type refinement
|
|
9361
|
+
* const isString = Filter.fromPredicate((x: unknown): x is string =>
|
|
9362
|
+
* typeof x === "string"
|
|
9363
|
+
* )
|
|
9364
|
+
* positiveNumbers(1) // => Result.succeed(1)
|
|
9365
|
+
* nonEmptyStrings("") // => Result.fail("")
|
|
9366
|
+
* isString("ok") // => Result.succeed("ok")
|
|
9367
|
+
* ```
|
|
9368
|
+
*
|
|
9369
|
+
* @stability stable
|
|
9370
|
+
* @category constructors
|
|
9371
|
+
* @since 4.0.0
|
|
9372
|
+
*/
|
|
9373
|
+
const fromPredicate = (predicate) => (input) => predicate(input) ? succeed$10(input) : fail$12(input);
|
|
9374
|
+
/**
|
|
9254
9375
|
* Converts a Filter into a predicate function.
|
|
9255
9376
|
*
|
|
9256
9377
|
* **When to use**
|
|
@@ -16781,7 +16902,27 @@ const round = /*#__PURE__*/ dual(2, (self, precision) => {
|
|
|
16781
16902
|
const factor = Math.pow(10, precision);
|
|
16782
16903
|
return Math.round(self * factor) / factor;
|
|
16783
16904
|
});
|
|
16784
|
-
|
|
16905
|
+
// ../../node_modules/.pnpm/effect@4.1.4/node_modules/effect/dist/String.js
|
|
16906
|
+
/**
|
|
16907
|
+
* Exposes the global string constructor.
|
|
16908
|
+
*
|
|
16909
|
+
* **When to use**
|
|
16910
|
+
*
|
|
16911
|
+
* Use to access native JavaScript string coercion or constructor behavior from
|
|
16912
|
+
* the Effect module namespace.
|
|
16913
|
+
*
|
|
16914
|
+
* **Gotchas**
|
|
16915
|
+
*
|
|
16916
|
+
* Calling `String(value)` returns a primitive string. Calling
|
|
16917
|
+
* `new String(value)` creates a boxed `String` object.
|
|
16918
|
+
*
|
|
16919
|
+
* @see {@link isString} for checking whether a value is a primitive string
|
|
16920
|
+
*
|
|
16921
|
+
* @stability stable
|
|
16922
|
+
* @category constructors
|
|
16923
|
+
* @since 4.0.0
|
|
16924
|
+
*/
|
|
16925
|
+
const String$9 = globalThis.String;
|
|
16785
16926
|
/**
|
|
16786
16927
|
* Checks whether a value is a `string`.
|
|
16787
16928
|
*
|
|
@@ -109096,7 +109237,7 @@ var Sessions = class Sessions extends Service$1()("@deslop/runtime/server/sessio
|
|
|
109096
109237
|
});
|
|
109097
109238
|
const granted = fnUntraced(function* (params) {
|
|
109098
109239
|
const response = yield* post$1(TOKEN_PATH, params);
|
|
109099
|
-
if (response.status === 400 || response.status === 401) return yield* RefusedError.make({ message: pipe(yield* option$1(schemaBodyJson$1(Refusal$1)(response)), flatMap$8((body) => body.error_description), getOrElse$1((
|
|
109240
|
+
if (response.status === 400 || response.status === 401) return yield* RefusedError.make({ message: pipe(yield* option$1(schemaBodyJson$1(Refusal$1)(response)), flatMap$8((body) => body.error_description), getOrElse$1(constant("Auth refused the sign-in"))) });
|
|
109100
109241
|
return yield* schemaBodyJson$1(TokenResponse)(yield* filterStatusOk$1(response));
|
|
109101
109242
|
});
|
|
109102
109243
|
const sessionOf = fnUntraced(function* (tokens, clientId, idHash) {
|
|
@@ -109180,7 +109321,7 @@ var Sessions = class Sessions extends Service$1()("@deslop/runtime/server/sessio
|
|
|
109180
109321
|
for (const session of yield* findSessionsOf(userId)) {
|
|
109181
109322
|
if (yield* fresh(session)) return value$2(session.access);
|
|
109182
109323
|
const renewed = yield* result$1(asAuthError("AI access is temporarily unavailable")(refreshed(session.idHash)));
|
|
109183
|
-
if (renewed
|
|
109324
|
+
if (isSuccess$1(renewed)) return value$2(renewed.success.access);
|
|
109184
109325
|
if (is$2(AuthError)(renewed.failure) && renewed.failure.error === "temporarily_unavailable") return yield* renewed.failure;
|
|
109185
109326
|
}
|
|
109186
109327
|
const now$3 = yield* now;
|
|
@@ -109254,7 +109395,7 @@ var Auth = class Auth extends Service$1()("@deslop/runtime/server/auth") {
|
|
|
109254
109395
|
issuer: new URL(ISSUER_PATH, issuer).href,
|
|
109255
109396
|
typ: "at+jwt"
|
|
109256
109397
|
}), provideService$2(Jwks, jwks), provideService$2(Signature, signature), mapError$2((cause) => {
|
|
109257
|
-
if (isJoseError(cause) && cause.reason
|
|
109398
|
+
if (isJoseError(cause) && cause.reason instanceof KeySetUnavailable) return AuthError.make({
|
|
109258
109399
|
cause,
|
|
109259
109400
|
error: "temporarily_unavailable",
|
|
109260
109401
|
message: "The authorization service is temporarily unavailable"
|
|
@@ -110103,6 +110244,11 @@ const SpanKind = {
|
|
|
110103
110244
|
consumer: 5
|
|
110104
110245
|
};
|
|
110105
110246
|
// ../../packages/runtime/src/shared/telemetry.ts
|
|
110247
|
+
Literals([
|
|
110248
|
+
"web",
|
|
110249
|
+
"mobile",
|
|
110250
|
+
"server"
|
|
110251
|
+
]);
|
|
110106
110252
|
function layerOtlp(serviceName, url, runtime, version) {
|
|
110107
110253
|
return catchCause$3(unwrap$8(gen(function* () {
|
|
110108
110254
|
const start = `${yield* currentTimeNanos}`;
|
|
@@ -110494,7 +110640,7 @@ const setLoadExtensionEnabled = (db, enabled) => {
|
|
|
110494
110640
|
// ../../packages/runtime/src/server/store.ts
|
|
110495
110641
|
const checkoutRoot = fnUntraced(function* (directory) {
|
|
110496
110642
|
const path = yield* Path$1;
|
|
110497
|
-
if (yield*
|
|
110643
|
+
if (getOrElse$1(yield* option$1((yield* FileSystem).exists(path.join(directory, "pnpm-workspace.yaml"))), constFalse$1)) return some$1(directory);
|
|
110498
110644
|
if (path.dirname(directory) === directory) return none();
|
|
110499
110645
|
return yield* checkoutRoot(path.dirname(directory));
|
|
110500
110646
|
});
|
|
@@ -110684,8 +110830,8 @@ const installService = fnUntraced(function* (name, command, options) {
|
|
|
110684
110830
|
yield* systemctl("daemon-reload");
|
|
110685
110831
|
yield* systemctl("enable", unit);
|
|
110686
110832
|
yield* systemctl(match(options?.restart === false, {
|
|
110687
|
-
onFalse: (
|
|
110688
|
-
onTrue: (
|
|
110833
|
+
onFalse: constant("restart"),
|
|
110834
|
+
onTrue: constant("start")
|
|
110689
110835
|
}), unit);
|
|
110690
110836
|
return `${unit} installed\n`;
|
|
110691
110837
|
});
|
|
@@ -110758,10 +110904,10 @@ function layerSignIn(issuer) {
|
|
|
110758
110904
|
})
|
|
110759
110905
|
});
|
|
110760
110906
|
}
|
|
110761
|
-
function withRedirect(
|
|
110907
|
+
function withRedirect(route) {
|
|
110762
110908
|
return flatMap$3(HttpServerRequest, (request) => pipe(liftThrowable(() => new URL(new URL(request.url, canonical).searchParams.get("next") ?? canonical, canonical))(), filter$7((next) => next.origin === canonical), match$7({
|
|
110763
110909
|
onNone: () => succeed$5(empty$1({ status: 400 })),
|
|
110764
|
-
onSome: (next) =>
|
|
110910
|
+
onSome: (next) => route(request, next)
|
|
110765
110911
|
})));
|
|
110766
110912
|
}
|
|
110767
110913
|
yield* router.add("GET", "/auth/sign-in", withRedirect(fnUntraced(function* (_, next) {
|
|
@@ -110794,7 +110940,7 @@ function layerSignIn(issuer) {
|
|
|
110794
110940
|
const started = yield* result$1(gen(function* () {
|
|
110795
110941
|
const params = yield* schemaSearchParams(CallbackParams);
|
|
110796
110942
|
if (!contains$1(params.state, saved.state)) return yield* AuthError.make({ message: "The sign-in began in another browser" });
|
|
110797
|
-
if (isSome(params.error) || isNone(params.code)) return yield* AuthError.make({ message: `Auth answered ${getOrElse$1(params.error, (
|
|
110943
|
+
if (isSome(params.error) || isNone(params.code)) return yield* AuthError.make({ message: `Auth answered ${getOrElse$1(params.error, constant("without a code"))}` });
|
|
110798
110944
|
if (!contains$1(params.iss, new URL("/api/auth", issuer).href)) return yield* AuthError.make({ message: "The answer came from another issuer" });
|
|
110799
110945
|
return yield* sessions.start({
|
|
110800
110946
|
client_id: yield* clientId,
|
|
@@ -110918,6 +111064,8 @@ const configProvider = fnUntraced(function* (given, defaultPort) {
|
|
|
110918
111064
|
}), fromEnv());
|
|
110919
111065
|
});
|
|
110920
111066
|
const layerPlatform = mergeAll$2(layer$5, layer$17, layer$15);
|
|
111067
|
+
Literals(["Error", "GlobalError"]);
|
|
111068
|
+
Literals(["Requires", "GlobalRequires"]);
|
|
110921
111069
|
function server(app) {
|
|
110922
111070
|
const routes = provide$2(mergeAll$2(app.routes, layerRoutes, layerIcon(app.icon), layerWeb), match$7(fromUndefinedOr(app.middleware), {
|
|
110923
111071
|
onNone: () => empty$14,
|
|
@@ -110996,14 +111144,14 @@ const ResidentMemoryFromKiB = pipe(FiniteFromString, decodeTo(Finite, {
|
|
|
110996
111144
|
decode: transform$4((value) => value * 1024),
|
|
110997
111145
|
encode: transform$4((value) => value / 1024)
|
|
110998
111146
|
}));
|
|
110999
|
-
const CpuTime = Struct$2({
|
|
111147
|
+
const CpuTime$1 = Struct$2({
|
|
111000
111148
|
1: OptionFromOptional(FiniteFromString),
|
|
111001
111149
|
2: FiniteFromString,
|
|
111002
111150
|
3: FiniteFromString
|
|
111003
111151
|
});
|
|
111004
111152
|
const TextFromEmpty = pipe(String$6, decodeTo(Option(String$6), {
|
|
111005
111153
|
decode: transform$4((value) => liftPredicate(value, isNonEmpty$1)),
|
|
111006
|
-
encode: transform$4((value) => getOrElse$1(value, (
|
|
111154
|
+
encode: transform$4((value) => getOrElse$1(value, constant("")))
|
|
111007
111155
|
}));
|
|
111008
111156
|
const OptionalTextFromEmpty = pipe(OptionFromOptionalKey(String$6), decodeTo(Option(String$6), {
|
|
111009
111157
|
decode: transform$4((value) => filter$7(value, isNonEmpty$1)),
|
|
@@ -111098,6 +111246,16 @@ const PortItem = InventoryFields.mapFields((fields) => ({
|
|
|
111098
111246
|
}), withConstructorDefault(succeedNone))
|
|
111099
111247
|
}));
|
|
111100
111248
|
const InventoryItem = Union$2([...NonPortItem.members, PortItem]);
|
|
111249
|
+
Struct$2({
|
|
111250
|
+
address: String$6,
|
|
111251
|
+
port: Finite,
|
|
111252
|
+
protocol: Literals(["tcp", "udp"])
|
|
111253
|
+
});
|
|
111254
|
+
Struct$2(pick(InventoryFields.fields, [
|
|
111255
|
+
"address",
|
|
111256
|
+
"port",
|
|
111257
|
+
"protocol"
|
|
111258
|
+
]));
|
|
111101
111259
|
const Snapshot = Struct$2({
|
|
111102
111260
|
items: ArraySchema(Union$2([...NonPortItem.members, PortItem.mapFields((fields) => ({
|
|
111103
111261
|
...fields,
|
|
@@ -111233,7 +111391,14 @@ const HideRequest = Struct$2({
|
|
|
111233
111391
|
name: ExposureName,
|
|
111234
111392
|
worker: WorkerId
|
|
111235
111393
|
});
|
|
111236
|
-
|
|
111394
|
+
Union$2([AppId, Literals(["other", "system"])]);
|
|
111395
|
+
Literals([
|
|
111396
|
+
"idle",
|
|
111397
|
+
"irq",
|
|
111398
|
+
"nice",
|
|
111399
|
+
"sys",
|
|
111400
|
+
"user"
|
|
111401
|
+
]);
|
|
111237
111402
|
const CpuCounters = ArraySchema(FiniteFromString).check(isMinLength(5));
|
|
111238
111403
|
const LoadAverages = ArraySchema(FiniteFromString);
|
|
111239
111404
|
const CgroupPath = brand("DeployCgroupPath")(String$6);
|
|
@@ -111302,6 +111467,7 @@ var Sample = class extends Class("Sample")({
|
|
|
111302
111467
|
}) {
|
|
111303
111468
|
static table = "samples";
|
|
111304
111469
|
};
|
|
111470
|
+
Struct$2(omit(Sample.fields, ["since", "step"]));
|
|
111305
111471
|
const MachineHistory = Struct$2({
|
|
111306
111472
|
disks: ArraySchema(Struct$2({
|
|
111307
111473
|
mount: String$6,
|
|
@@ -111561,23 +111727,23 @@ function failureReason(result, status, ran) {
|
|
|
111561
111727
|
return pipe(value(result), when("exit-code", () => match$7(fromUndefinedOr(SIGNALS[status - 128]), {
|
|
111562
111728
|
onNone: () => `Exited with code ${status}`,
|
|
111563
111729
|
onSome: (name) => `Exited with code ${status} (${name})`
|
|
111564
|
-
})), when("signal", () => `Killed by ${signal}`), when("core-dump", () => `Crashed with ${signal}`), when("oom-kill", (
|
|
111730
|
+
})), when("signal", () => `Killed by ${signal}`), when("core-dump", () => `Crashed with ${signal}`), when("oom-kill", constant("Killed for running out of memory")), when("timeout", constant("Timed out")), when("watchdog", constant("Stopped answering its watchdog")), when("start-limit-hit", constant("Restarted too often")), orElse(() => `Failed: ${result}`));
|
|
111565
111731
|
}
|
|
111566
111732
|
function exitFailure(status) {
|
|
111567
111733
|
if (status < 0) return failureReason("signal", -status, true);
|
|
111568
111734
|
return failureReason("exit-code", status, true);
|
|
111569
111735
|
}
|
|
111570
111736
|
function unitFailures(text) {
|
|
111571
|
-
return
|
|
111572
|
-
const fields =
|
|
111737
|
+
return pipe(trim(text), split$2(/\n\s*\n/u), filter$5(isNonEmpty$1), fromIterableWith((block) => {
|
|
111738
|
+
const fields = pipe(block, split$2("\n"), filter$5(includes("=")), fromIterableWith((line) => {
|
|
111573
111739
|
const [key, ...value] = split$2(line, "=");
|
|
111574
111740
|
return [key, join$4(value, "=")];
|
|
111575
|
-
}))
|
|
111741
|
+
}));
|
|
111576
111742
|
return [UnitId.make(fields["Id"] ?? ""), {
|
|
111577
111743
|
at: map$13(parse$3(replace(/^@/u, "")(fields["StateChangeTimestamp"] ?? "")), (seconds) => mapEpochMillis(makeUnsafe$5(0), () => seconds * 1e3)),
|
|
111578
|
-
reason: failureReason(fields["Result"] ?? "", getOrElse$1(parse$3(fields["ExecMainStatus"] ?? ""), (
|
|
111744
|
+
reason: failureReason(fields["Result"] ?? "", getOrElse$1(parse$3(fields["ExecMainStatus"] ?? ""), constant(0)), fields["ExecMainCode"] !== "0")
|
|
111579
111745
|
}];
|
|
111580
|
-
}))
|
|
111746
|
+
}));
|
|
111581
111747
|
}
|
|
111582
111748
|
// src/services/inventory/lib/launchd.ts
|
|
111583
111749
|
const launchAgents = fnUntraced(function* (text) {
|
|
@@ -111668,12 +111834,12 @@ function flagParts(token) {
|
|
|
111668
111834
|
});
|
|
111669
111835
|
}
|
|
111670
111836
|
function alias(value$4) {
|
|
111671
|
-
return pipe(value(value$4), when("vite-plus", (
|
|
111837
|
+
return pipe(value(value$4), when("vite-plus", constant("vp")), orElse(() => value$4));
|
|
111672
111838
|
}
|
|
111673
111839
|
function shellRest(tokens) {
|
|
111674
|
-
const script = pipe(tokens, get$11(2), getOrElse$1((
|
|
111840
|
+
const script = pipe(tokens, get$11(2), getOrElse$1(constant("")));
|
|
111675
111841
|
const shifts = match$7(match$2(/\bshift\b/gu)(script), {
|
|
111676
|
-
onNone: ()
|
|
111842
|
+
onNone: constant(0),
|
|
111677
111843
|
onSome: (matches) => matches.length
|
|
111678
111844
|
});
|
|
111679
111845
|
if (includes("exec \"$@\"")(script)) return drop$1(tokens, 4 + shifts);
|
|
@@ -111681,7 +111847,7 @@ function shellRest(tokens) {
|
|
|
111681
111847
|
return pipe(findFirst(segments, (words) => words[0] === "exec"), map$13((words) => drop$1(words, 1)), orElse$3(() => findFirst(segments, (words) => !contains(SETUP, words[0] ?? ""))), getOrElse$1(() => take$3(tokens, 1)));
|
|
111682
111848
|
}
|
|
111683
111849
|
function unwrapTokens(tokens, cwd) {
|
|
111684
|
-
const name = basename(getOrElse$1(head(tokens), (
|
|
111850
|
+
const name = basename(getOrElse$1(head(tokens), constant("")));
|
|
111685
111851
|
if (contains(WRAPPERS, name)) return unwrapTokens(pipe(findFirstIndex(tokens, (token) => token === "--"), filter$7((index) => index > 0), match$7({
|
|
111686
111852
|
onNone: () => {
|
|
111687
111853
|
const tail = drop$1(tokens, 1);
|
|
@@ -111692,11 +111858,11 @@ function unwrapTokens(tokens, cwd) {
|
|
|
111692
111858
|
},
|
|
111693
111859
|
onSome: (index) => drop$1(tokens, index + 1)
|
|
111694
111860
|
})), cwd);
|
|
111695
|
-
if (contains(SHELLS, name) && pipe(tokens, get$11(1), getOrElse$1((
|
|
111861
|
+
if (contains(SHELLS, name) && pipe(tokens, get$11(1), getOrElse$1(constant(""))) === "-c") return unwrapTokens(shellRest(tokens), cwd);
|
|
111696
111862
|
if (contains(RUNTIMES, name)) return pipe(tokens, findFirstIndex((token, index) => index > 0 && !isFlag(token)), match$7({
|
|
111697
111863
|
onNone: () => tokens,
|
|
111698
111864
|
onSome: (index) => {
|
|
111699
|
-
const script = pipe(tokens, get$11(index), getOrElse$1((
|
|
111865
|
+
const script = pipe(tokens, get$11(index), getOrElse$1(constant("")));
|
|
111700
111866
|
const pkg = capture(/.*node_modules\/((?:@[^/]+\/)?[^/.][^/]*)\//u, script);
|
|
111701
111867
|
const app = orElse$3(capture(/\.deslop\/([^/]+)\//u, script), () => flatMap$8(cwd, (value) => capture(/\/apps\/([^/]+)$/u, value)));
|
|
111702
111868
|
return [pipe(pkg, orElse$3(() => app), getOrElse$1(() => basename(script))), ...drop$1(tokens, index + 1)];
|
|
@@ -111707,9 +111873,9 @@ function unwrapTokens(tokens, cwd) {
|
|
|
111707
111873
|
function unwrap(argv, cwd) {
|
|
111708
111874
|
const tokens = match(length$2(argv) === 1, {
|
|
111709
111875
|
onFalse: () => argv,
|
|
111710
|
-
onTrue: () => pipe(head(argv), getOrElse$1((
|
|
111876
|
+
onTrue: () => pipe(head(argv), getOrElse$1(constant("")), split$2(/\s+/u), filter$5(isNonEmpty$1))
|
|
111711
111877
|
});
|
|
111712
|
-
return unwrapTokens([replace(/:$/u, "")(getOrElse$1(head(tokens), (
|
|
111878
|
+
return unwrapTokens([replace(/:$/u, "")(getOrElse$1(head(tokens), constant(""))), ...drop$1(tokens, 1)], cwd);
|
|
111713
111879
|
}
|
|
111714
111880
|
function scan(name, subject, args, words, values) {
|
|
111715
111881
|
return match$7(head(args), {
|
|
@@ -111760,7 +111926,7 @@ function commandLabel(argv, cwd) {
|
|
|
111760
111926
|
const subject = pipe(SUBJECT, get$12(name), getOrElse$1(() => empty$15()));
|
|
111761
111927
|
const scanned = scan(name, subject, args, [], {});
|
|
111762
111928
|
if (contains(SHELLS, name) && isReadonlyArrayEmpty(scanned.words)) return {
|
|
111763
|
-
detail: pipe(cwd, map$13(basename), getOrElse$1((
|
|
111929
|
+
detail: pipe(cwd, map$13(basename), getOrElse$1(constant(""))),
|
|
111764
111930
|
name
|
|
111765
111931
|
};
|
|
111766
111932
|
return match$7(scanned.ssh, {
|
|
@@ -111772,7 +111938,7 @@ function commandLabel(argv, cwd) {
|
|
|
111772
111938
|
const remote = commandLabel(ssh.remote, none());
|
|
111773
111939
|
return {
|
|
111774
111940
|
detail: pipe([ssh.host, match(isNonEmpty$1(remote.name), {
|
|
111775
|
-
onFalse: (
|
|
111941
|
+
onFalse: constant(""),
|
|
111776
111942
|
onTrue: () => `→ ${remote.name}`
|
|
111777
111943
|
})], filter$5(isNonEmpty$1), join$4(" ")),
|
|
111778
111944
|
name
|
|
@@ -111789,10 +111955,10 @@ function processOwner(cgroup) {
|
|
|
111789
111955
|
if (isSome(container)) return map$13(container, (id) => AppId.make(`container:${slice$1(0, 12)(id)}`));
|
|
111790
111956
|
const segments = split$2(cgroup, /[/\n]/u);
|
|
111791
111957
|
const service = findLastIndex(segments, endsWith(".service"));
|
|
111792
|
-
const
|
|
111793
|
-
return pipe(
|
|
111794
|
-
onFalse: (
|
|
111795
|
-
onTrue: (
|
|
111958
|
+
const userService = findFirstIndex(segments, (segment) => isSome(match$2(/^user@[0-9]+\.service$/u)(segment)));
|
|
111959
|
+
return pipe(userService, filter$7((index) => !exists(service, (last) => last > index)), flatMap$8((index) => pipe(segments, drop$1(index + 1), findFirst((segment) => match$2(/^app-(.+)\.slice$/u)(segment)))), map$13((match) => AppId.make(`service:user:${match[1]}.service`)), orElse$3(() => map$13(service, (index) => AppId.make(`service:${pipe(userService, exists((first) => index > first), match({
|
|
111960
|
+
onFalse: constant("system"),
|
|
111961
|
+
onTrue: constant("user")
|
|
111796
111962
|
}))}:${segments[index]}`))));
|
|
111797
111963
|
}
|
|
111798
111964
|
function loopbackPort(item) {
|
|
@@ -111814,8 +111980,8 @@ function ports(items) {
|
|
|
111814
111980
|
return pipe(items, filter$5((item) => appPort(item) && contains$1(item.http, true)), sort(mapInput(String$10, (item) => `${item.worker}:${getOrUndefined$1(item.port)}:${getOrUndefined$1(item.address)}`)), dedupeWith((a, b) => a.worker === b.worker && makeEquivalence$5((x, y) => x === y)(a.port, b.port)));
|
|
111815
111981
|
}
|
|
111816
111982
|
function itemOwner(item) {
|
|
111817
|
-
if (item.kind === "container") return AppId.make(`container:${slice$1(0, 12)(getOrElse$1(last$1(split$2(item.id, ":docker:")), (
|
|
111818
|
-
return AppId.make(`service:${getOrElse$1(item.scope, (
|
|
111983
|
+
if (item.kind === "container") return AppId.make(`container:${slice$1(0, 12)(getOrElse$1(last$1(split$2(item.id, ":docker:")), constant("")))}`);
|
|
111984
|
+
return AppId.make(`service:${getOrElse$1(item.scope, constant("system"))}:${item.name}`);
|
|
111819
111985
|
}
|
|
111820
111986
|
function fullName(item) {
|
|
111821
111987
|
if (item.kind === "port") return getOrElse$1(item.process, () => item.name);
|
|
@@ -111845,7 +112011,7 @@ function socket(worker, binding) {
|
|
|
111845
112011
|
function workloads(items) {
|
|
111846
112012
|
const listeners = filter$5(items, (item) => item.kind === "port");
|
|
111847
112013
|
const byUnit = pipe(listeners, groupBy((listener) => listener.worker), map$11((worker) => groupBy(worker, (listener) => match$7(listener.unit, {
|
|
111848
|
-
onNone: (
|
|
112014
|
+
onNone: constant("none"),
|
|
111849
112015
|
onSome: (unit) => `unit:${unit}`
|
|
111850
112016
|
}))));
|
|
111851
112017
|
const bySocket = fromIterable$5(map$10(reverse(filter$5(listeners, (listener) => !contains$1(listener.address, "container"))), (listener) => [socket(listener.worker, listener), listener]));
|
|
@@ -111888,7 +112054,7 @@ function workloads(items) {
|
|
|
111888
112054
|
const exposuresBySocket = pipe(exposures, map$10((item, index) => ({
|
|
111889
112055
|
index,
|
|
111890
112056
|
item
|
|
111891
|
-
})), groupBy((entry) => `${entry.item.worker}:${getOrElse$1(entry.item.port, (
|
|
112057
|
+
})), groupBy((entry) => `${entry.item.worker}:${getOrElse$1(entry.item.port, constant(0))}`));
|
|
111892
112058
|
const linked = map$10(rows, (row) => {
|
|
111893
112059
|
const reachable = dedupe(pipe(row.listeners, filter$5((listener) => exists(listener.port, (port) => sameSocket(listener, {
|
|
111894
112060
|
address: `127.0.0.1:${port}`,
|
|
@@ -111957,9 +112123,9 @@ function sameLabel(first, second) {
|
|
|
111957
112123
|
return first.name === second.name && first.detail === second.detail;
|
|
111958
112124
|
}
|
|
111959
112125
|
function absorb(label, children) {
|
|
111960
|
-
const matching =
|
|
112126
|
+
const [matching, other] = partition(children, fromPredicate((child) => sameLabel(child.label, label)));
|
|
111961
112127
|
if (isArrayEmpty(matching)) return children;
|
|
111962
|
-
return [...
|
|
112128
|
+
return [...other, ...absorb(label, flatMap$6(matching, (child) => child.children))];
|
|
111963
112129
|
}
|
|
111964
112130
|
function fold(node) {
|
|
111965
112131
|
return {
|
|
@@ -111969,11 +112135,11 @@ function fold(node) {
|
|
|
111969
112135
|
}
|
|
111970
112136
|
function processTree(rows) {
|
|
111971
112137
|
const pids = fromIterable(map$10(rows, (row) => row.pid));
|
|
111972
|
-
const children =
|
|
112138
|
+
const children = groupBy(rows, (row) => String$9(row.parent));
|
|
111973
112139
|
const visited = empty$5();
|
|
111974
112140
|
function build(row) {
|
|
111975
112141
|
add$1(visited, row.pid);
|
|
111976
|
-
const below = pipe(children,
|
|
112142
|
+
const below = pipe(get$12(children, `${row.pid}`), getOrElse$1(empty$15), filter$5((child) => !has(visited, child.pid)), map$10(build));
|
|
111977
112143
|
const self = {
|
|
111978
112144
|
children: [],
|
|
111979
112145
|
command: row.command,
|
|
@@ -112053,8 +112219,8 @@ function appOf(row, withProcesses) {
|
|
|
112053
112219
|
function exposureOf(item) {
|
|
112054
112220
|
return {
|
|
112055
112221
|
access: pipe(item.publicAccess, contains$1(true), match({
|
|
112056
|
-
onFalse: (
|
|
112057
|
-
onTrue: (
|
|
112222
|
+
onFalse: constant("tailnet"),
|
|
112223
|
+
onTrue: constant("public")
|
|
112058
112224
|
})),
|
|
112059
112225
|
id: item.id,
|
|
112060
112226
|
name: ExposureName.make(item.name),
|
|
@@ -112106,12 +112272,12 @@ function listApps(snapshot, input) {
|
|
|
112106
112272
|
}
|
|
112107
112273
|
function ownerNames(snapshot) {
|
|
112108
112274
|
const byWorker = groupBy(snapshot.items, (item) => item.worker);
|
|
112109
|
-
return
|
|
112275
|
+
return fromIterableWith(workerNames(snapshot), (worker) => [worker, pipe(byWorker[worker] ?? empty$15(), filter$5((item) => item.kind === "service" || item.kind === "container"), fromIterableWith((item) => [itemOwner(item), workloadName(item)]))]);
|
|
112110
112276
|
}
|
|
112111
112277
|
function requestOf(item) {
|
|
112112
112278
|
return {
|
|
112113
112279
|
name: UnitId.make(item.name),
|
|
112114
|
-
scope: getOrElse$1(item.scope, (
|
|
112280
|
+
scope: getOrElse$1(item.scope, constant("system")),
|
|
112115
112281
|
worker: item.worker
|
|
112116
112282
|
};
|
|
112117
112283
|
}
|
|
@@ -112125,10 +112291,10 @@ const jobRequest = fnUntraced(function* (snapshot, input) {
|
|
|
112125
112291
|
const SECRET = /(?:token|secret|passw(?:or)?d|key|auth|credential|cookie|session)/iu;
|
|
112126
112292
|
const PROCESS_INTERVAL = seconds(2);
|
|
112127
112293
|
function processStatus(status) {
|
|
112128
|
-
const values =
|
|
112294
|
+
const values = pipe(trim(status), split$2("\n"), fromIterableWith((line) => {
|
|
112129
112295
|
const at = getOrThrow$1(indexOf(":")(line));
|
|
112130
112296
|
return [slice$1(0, at)(line), trim(slice$1(at + 1)(line))];
|
|
112131
|
-
}))
|
|
112297
|
+
}));
|
|
112132
112298
|
return {
|
|
112133
112299
|
memory: decodeSync(ResidentMemoryFromKiB)(split$2(values["VmRSS"] ?? "", /\s+/u)[0] || "0"),
|
|
112134
112300
|
name: values["Name"] ?? "",
|
|
@@ -112234,11 +112400,11 @@ function launchdProcesses(text, agents) {
|
|
|
112234
112400
|
}
|
|
112235
112401
|
return getSomes(map$10(rows, (row) => flatMap$8(agent(row.pid), (unit) => map$13(all$4({
|
|
112236
112402
|
start: make$76(row.start),
|
|
112237
|
-
ticks: pipe(match$2(/^(?:([0-9]+):)?([0-9]+):([0-9]+(?:\.[0-9]+)?)$/u)(row.cpu), flatMap$8((match) => decodeOption(CpuTime)({
|
|
112403
|
+
ticks: pipe(match$2(/^(?:([0-9]+):)?([0-9]+):([0-9]+(?:\.[0-9]+)?)$/u)(row.cpu), flatMap$8((match) => decodeOption(CpuTime$1)({
|
|
112238
112404
|
1: match[1],
|
|
112239
112405
|
2: match[2] ?? "",
|
|
112240
112406
|
3: match[3] ?? ""
|
|
112241
|
-
})), map$13((fields) => pipe(hours(getOrElse$1(fields[1], (
|
|
112407
|
+
})), map$13((fields) => pipe(hours(getOrElse$1(fields[1], constant(0))), sum(minutes(fields[2])), sum(seconds(fields[3])))), filter$7(isFinite$1))
|
|
112242
112408
|
}), (times) => {
|
|
112243
112409
|
const command = commandArgs(pipe(trim(row.args), split$2(/\s+/u), join$4("\0")));
|
|
112244
112410
|
return {
|
|
@@ -112248,7 +112414,7 @@ function launchdProcesses(text, agents) {
|
|
|
112248
112414
|
cpu: none(),
|
|
112249
112415
|
label: commandLabel(command, none()),
|
|
112250
112416
|
memory: row.memory,
|
|
112251
|
-
name: pipe(head(command), flatMap$8((head) => last$1(split$2(head, "/"))), getOrElse$1((
|
|
112417
|
+
name: pipe(head(command), flatMap$8((head) => last$1(split$2(head, "/"))), getOrElse$1(constant(""))),
|
|
112252
112418
|
parent: row.parent,
|
|
112253
112419
|
pid: row.pid
|
|
112254
112420
|
}),
|
|
@@ -112292,8 +112458,8 @@ function socketLine(line) {
|
|
|
112292
112458
|
function lsofSocket(file) {
|
|
112293
112459
|
if (includes("->")(file.address) || !contains(["TCP", "UDP"], file.protocol)) return none();
|
|
112294
112460
|
const address = replace(/^\*:/u, match(file.type === "IPv4", {
|
|
112295
|
-
onFalse: (
|
|
112296
|
-
onTrue: (
|
|
112461
|
+
onFalse: constant("*:"),
|
|
112462
|
+
onTrue: constant("0.0.0.0:")
|
|
112297
112463
|
}))(file.address);
|
|
112298
112464
|
return flatMap$8(file.pid, (pid) => map$13(portOf(address), (port) => ({
|
|
112299
112465
|
address,
|
|
@@ -112304,7 +112470,7 @@ function lsofSocket(file) {
|
|
|
112304
112470
|
}),
|
|
112305
112471
|
protocol: toLowerCase(file.protocol),
|
|
112306
112472
|
state: match(file.protocol === "TCP", {
|
|
112307
|
-
onFalse: (
|
|
112473
|
+
onFalse: constant("UNCONN"),
|
|
112308
112474
|
onTrue: () => replace(/^ST=/u, "")(file.state) || "LISTEN"
|
|
112309
112475
|
})
|
|
112310
112476
|
})));
|
|
@@ -112379,7 +112545,7 @@ function lsofSockets(text) {
|
|
|
112379
112545
|
return dedupeWith([...scanned.sockets, ...toArray$1(lsofSocket(scanned.file))], (a, b) => a.protocol === b.protocol && a.address === b.address);
|
|
112380
112546
|
}
|
|
112381
112547
|
function socketUnit(cgroup) {
|
|
112382
|
-
return map$13(findLast$1(matchAll(/\/([^/]+\.service)(?=\/|\n|$)/gu)(cgroup),
|
|
112548
|
+
return map$13(findLast$1(matchAll(/\/([^/]+\.service)(?=\/|\n|$)/gu)(cgroup), constTrue), (match) => UnitId.make(match[1] ?? ""));
|
|
112383
112549
|
}
|
|
112384
112550
|
function socketProcess(name, cwd) {
|
|
112385
112551
|
return match$7(match$2(/\/apps\/([^/]+)(?:\/|$)/u)(cwd), {
|
|
@@ -112407,7 +112573,7 @@ function portItems(sockets, worker, http, origin) {
|
|
|
112407
112573
|
}), liftPredicate(isNonEmpty$1));
|
|
112408
112574
|
})
|
|
112409
112575
|
});
|
|
112410
|
-
const response = yield* match(probeSocket(socket, getOrElse$1(process, (
|
|
112576
|
+
const response = yield* match(probeSocket(socket, getOrElse$1(process, constant(""))), {
|
|
112411
112577
|
onFalse: () => succeed$5(none()),
|
|
112412
112578
|
onTrue: fnUntraced(function* () {
|
|
112413
112579
|
return yield* pipe(http.head(`http://127.0.0.1:${socket.port}/`, { headers: toHeaders(new NativeSpan({
|
|
@@ -112421,12 +112587,12 @@ function portItems(sockets, worker, http, origin) {
|
|
|
112421
112587
|
})) }), map$7((value) => ({
|
|
112422
112588
|
http: true,
|
|
112423
112589
|
ui: value.status >= 200 && value.status < 400 && includes("text/html")(value.headers["content-type"] ?? "")
|
|
112424
|
-
})), provideService$2(RequestInit, { redirect: "manual" }), provideService$2(TracerDisabledWhen,
|
|
112590
|
+
})), provideService$2(RequestInit, { redirect: "manual" }), provideService$2(TracerDisabledWhen, constTrue), timeout(millis$1(700)), option$1);
|
|
112425
112591
|
})
|
|
112426
112592
|
});
|
|
112427
112593
|
return InventoryItem.make({
|
|
112428
112594
|
address: some$1(socket.address),
|
|
112429
|
-
detail: `${socket.address} · ${getOrElse$1(process, (
|
|
112595
|
+
detail: `${socket.address} · ${getOrElse$1(process, constant("process unavailable"))}`,
|
|
112430
112596
|
http: some$1(exists(response, (value) => value.http)),
|
|
112431
112597
|
id: ItemId.make(`${worker}:port:${socket.protocol}:${socket.address}`),
|
|
112432
112598
|
kind: "port",
|
|
@@ -112434,8 +112600,8 @@ function portItems(sockets, worker, http, origin) {
|
|
|
112434
112600
|
port: some$1(socket.port),
|
|
112435
112601
|
process,
|
|
112436
112602
|
protocol: some$1(match(socket.protocol === "udp", {
|
|
112437
|
-
onFalse: (
|
|
112438
|
-
onTrue: (
|
|
112603
|
+
onFalse: constant("tcp"),
|
|
112604
|
+
onTrue: constant("udp")
|
|
112439
112605
|
})),
|
|
112440
112606
|
state: socket.state,
|
|
112441
112607
|
ui: some$1(exists(response, (value) => value.ui)),
|
|
@@ -112479,22 +112645,22 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
112479
112645
|
const processState = yield* make$54(none());
|
|
112480
112646
|
const units = fnUntraced(function* (system) {
|
|
112481
112647
|
const scope = match(system, {
|
|
112482
|
-
onFalse: (
|
|
112483
|
-
onTrue: (
|
|
112648
|
+
onFalse: constant("user"),
|
|
112649
|
+
onTrue: constant("system")
|
|
112484
112650
|
});
|
|
112485
|
-
const
|
|
112651
|
+
const scopeFlags = match(system, {
|
|
112486
112652
|
onFalse: () => ["--user"],
|
|
112487
112653
|
onTrue: () => []
|
|
112488
112654
|
});
|
|
112489
112655
|
const scheduled = fromIterable$5(getSomes(map$10(yield* flatMap$3(command("systemctl", [
|
|
112490
|
-
...
|
|
112656
|
+
...scopeFlags,
|
|
112491
112657
|
"list-timers",
|
|
112492
112658
|
"--all",
|
|
112493
112659
|
"--output=json",
|
|
112494
112660
|
"--no-pager"
|
|
112495
112661
|
]), decodeUnknownEffect(fromJsonString(ArraySchema(Timer)))), (timer) => map$13(timer.activates, (unit) => [unit, map$13(timer.next, (next) => mapEpochMillis(next, Math.floor))]))));
|
|
112496
112662
|
const rows = yield* flatMap$3(command("systemctl", [
|
|
112497
|
-
...
|
|
112663
|
+
...scopeFlags,
|
|
112498
112664
|
"list-units",
|
|
112499
112665
|
"--all",
|
|
112500
112666
|
"--type=service",
|
|
@@ -112503,7 +112669,7 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
112503
112669
|
]), decodeUnknownEffect(fromJsonString(ArraySchema(Unit))));
|
|
112504
112670
|
const failed = pipe(rows, filter$5((row) => row.active === "failed"), map$10((row) => row.unit));
|
|
112505
112671
|
const failures = getOrElse$1(flatten$6(yield* pipe(command("systemctl", [
|
|
112506
|
-
...
|
|
112672
|
+
...scopeFlags,
|
|
112507
112673
|
"show",
|
|
112508
112674
|
...failed,
|
|
112509
112675
|
"-p",
|
|
@@ -112515,15 +112681,15 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
112515
112681
|
detail: `${scope} · ${row.description}`,
|
|
112516
112682
|
failure: get$12(failures, row.unit),
|
|
112517
112683
|
health: match(row.active === "failed", {
|
|
112518
|
-
onFalse: (
|
|
112519
|
-
onTrue: (
|
|
112684
|
+
onFalse: constant("quiet"),
|
|
112685
|
+
onTrue: constant("error")
|
|
112520
112686
|
}),
|
|
112521
112687
|
id: ItemId.make(`${worker}:${scope}:${row.unit}`),
|
|
112522
112688
|
kind: "service",
|
|
112523
112689
|
name: row.unit,
|
|
112524
112690
|
next: flatten$6(get$8(scheduled, row.unit)),
|
|
112525
112691
|
running: row.active === "activating" || row.active === "deactivating" || row.active === "active" && row.sub === "running",
|
|
112526
|
-
scheduled: pipe(scheduled, get$8(row.unit), map$13(
|
|
112692
|
+
scheduled: pipe(scheduled, get$8(row.unit), map$13(constTrue)),
|
|
112527
112693
|
scope: some$1(scope),
|
|
112528
112694
|
state: match(row.active === "active", {
|
|
112529
112695
|
onFalse: () => `${row.active} · ${row.sub}`,
|
|
@@ -112544,33 +112710,33 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
112544
112710
|
"restarting",
|
|
112545
112711
|
"paused"
|
|
112546
112712
|
], row.State),
|
|
112547
|
-
bindings: some$1([...map$10(fromIterable$8(matchAll(/traefik\.http\.services\.[^=,]+\.loadbalancer\.server\.port=([0-9]+)/gu)(getOrElse$1(row.Labels, (
|
|
112713
|
+
bindings: some$1([...map$10(fromIterable$8(matchAll(/traefik\.http\.services\.[^=,]+\.loadbalancer\.server\.port=([0-9]+)/gu)(getOrElse$1(row.Labels, constant("")))), (match) => ({
|
|
112548
112714
|
address: "container",
|
|
112549
|
-
port: getOrElse$1(parse$3(match[1] ?? ""), (
|
|
112715
|
+
port: getOrElse$1(parse$3(match[1] ?? ""), constant(0)),
|
|
112550
112716
|
protocol: "tcp"
|
|
112551
112717
|
})), ...map$10(fromIterable$8(matchAll(/((?:[0-9.]+|\[::\])):([0-9]+)->[0-9]+\/(tcp|udp)/gu)(row.Ports)), (match$8) => ({
|
|
112552
112718
|
address: `${match$8[1]}:${match$8[2]}`,
|
|
112553
|
-
port: getOrElse$1(parse$3(match$8[2] ?? ""), (
|
|
112719
|
+
port: getOrElse$1(parse$3(match$8[2] ?? ""), constant(0)),
|
|
112554
112720
|
protocol: match(match$8[3] === "udp", {
|
|
112555
|
-
onFalse: (
|
|
112556
|
-
onTrue: (
|
|
112721
|
+
onFalse: constant("tcp"),
|
|
112722
|
+
onTrue: constant("udp")
|
|
112557
112723
|
})
|
|
112558
112724
|
}))]),
|
|
112559
112725
|
detail: row.Status,
|
|
112560
112726
|
health: match(includes("unhealthy")(row.Status) || isSome(match$2(/Exited \([1-9]/u)(row.Status)), {
|
|
112561
112727
|
onFalse: () => match(row.State === "restarting", {
|
|
112562
|
-
onFalse: (
|
|
112563
|
-
onTrue: (
|
|
112728
|
+
onFalse: constant("quiet"),
|
|
112729
|
+
onTrue: constant("warning")
|
|
112564
112730
|
}),
|
|
112565
|
-
onTrue: (
|
|
112731
|
+
onTrue: constant("error")
|
|
112566
112732
|
}),
|
|
112567
112733
|
id: ItemId.make(`${worker}:docker:${row.ID}`),
|
|
112568
112734
|
kind: "container",
|
|
112569
|
-
links: some$1(dedupe(map$10(fromIterable$8(matchAll(/Host\(`([^`]+)`\)/gu)(getOrElse$1(row.Labels, (
|
|
112735
|
+
links: some$1(dedupe(map$10(fromIterable$8(matchAll(/Host\(`([^`]+)`\)/gu)(getOrElse$1(row.Labels, constant("")))), (match) => `https://${match[1]}`))),
|
|
112570
112736
|
name: row.Names,
|
|
112571
112737
|
state: match(includes("unhealthy")(row.Status), {
|
|
112572
112738
|
onFalse: () => row.State,
|
|
112573
|
-
onTrue: (
|
|
112739
|
+
onTrue: constant("unhealthy")
|
|
112574
112740
|
}),
|
|
112575
112741
|
url: none(),
|
|
112576
112742
|
worker
|
|
@@ -112586,7 +112752,7 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
112586
112752
|
collect("Docker", docker),
|
|
112587
112753
|
collect("Listening ports", flatMap$3(command("ss", ["-H", "-lntup"]), (text) => portItems(getSomes(pipe(trim(text), split$2("\n"), map$10(socketLine))), worker, http, {
|
|
112588
112754
|
cwd: (processId) => option$1(fs.readLink(`/proc/${processId}/cwd`)),
|
|
112589
|
-
unit: (processId) => map$7(option$1(fs.readFileString(`/proc/${processId}/cgroup`)), (cgroup) => socketUnit(getOrElse$1(cgroup, (
|
|
112755
|
+
unit: (processId) => map$7(option$1(fs.readFileString(`/proc/${processId}/cgroup`)), (cgroup) => socketUnit(getOrElse$1(cgroup, constant(""))))
|
|
112590
112756
|
})))
|
|
112591
112757
|
]
|
|
112592
112758
|
});
|
|
@@ -112622,8 +112788,8 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
112622
112788
|
reason: exitFailure(status)
|
|
112623
112789
|
}))),
|
|
112624
112790
|
health: match(isNone(agent.pid) && agent.status !== 0, {
|
|
112625
|
-
onFalse: (
|
|
112626
|
-
onTrue: (
|
|
112791
|
+
onFalse: constant("quiet"),
|
|
112792
|
+
onTrue: constant("error")
|
|
112627
112793
|
}),
|
|
112628
112794
|
id: ItemId.make(`${worker}:user:${agent.label}`),
|
|
112629
112795
|
kind: "service",
|
|
@@ -112632,10 +112798,10 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
112632
112798
|
scope: some$1("user"),
|
|
112633
112799
|
state: match$7(agent.pid, {
|
|
112634
112800
|
onNone: () => match(agent.status === 0, {
|
|
112635
|
-
onFalse: (
|
|
112636
|
-
onTrue: (
|
|
112801
|
+
onFalse: constant("failed · failed"),
|
|
112802
|
+
onTrue: constant("inactive · dead")
|
|
112637
112803
|
}),
|
|
112638
|
-
onSome: (
|
|
112804
|
+
onSome: constant("running")
|
|
112639
112805
|
}),
|
|
112640
112806
|
url: none(),
|
|
112641
112807
|
worker
|
|
@@ -112657,7 +112823,7 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
112657
112823
|
"-d",
|
|
112658
112824
|
"cwd",
|
|
112659
112825
|
"-Fn"
|
|
112660
|
-
])), getOrElse$1((
|
|
112826
|
+
])), getOrElse$1(constant("")), split$2("\n"), findFirst(startsWith("n")), map$13(slice$1(1)));
|
|
112661
112827
|
}),
|
|
112662
112828
|
unit: (processId) => succeed$5(pipe(owned, findFirst((record) => record.process.pid === processId), map$13((record) => record.unit)))
|
|
112663
112829
|
})))]
|
|
@@ -112717,8 +112883,8 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
112717
112883
|
name: peer.HostName,
|
|
112718
112884
|
self: some$1(true),
|
|
112719
112885
|
state: match(peer.Online, {
|
|
112720
|
-
onFalse: (
|
|
112721
|
-
onTrue: (
|
|
112886
|
+
onFalse: constant("offline"),
|
|
112887
|
+
onTrue: constant("online")
|
|
112722
112888
|
}),
|
|
112723
112889
|
url: none(),
|
|
112724
112890
|
worker
|
|
@@ -112729,12 +112895,12 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
112729
112895
|
"--json"
|
|
112730
112896
|
]), flatMap$3(decodeEffect(fromJsonString(Serve))), map$7((status) => flatMap$6(toEntries(getOrElse$1(status.Web, () => ({}))), (site) => map$10(toEntries(site[1].Handlers), (handler) => InventoryItem.make({
|
|
112731
112897
|
detail: `${pipe(status.AllowFunnel, exists((permissions) => permissions[site[0]] === true), match({
|
|
112732
|
-
onFalse: (
|
|
112733
|
-
onTrue: (
|
|
112734
|
-
}))} → ${getOrElse$1(handler[1].Proxy, (
|
|
112898
|
+
onFalse: constant("tailnet"),
|
|
112899
|
+
onTrue: constant("Funnel permitted (public)")
|
|
112900
|
+
}))} → ${getOrElse$1(handler[1].Proxy, constant("non-proxy handler"))}`,
|
|
112735
112901
|
health: pipe(status.AllowFunnel, exists((permissions) => permissions[site[0]] === true), match({
|
|
112736
|
-
onFalse: (
|
|
112737
|
-
onTrue: (
|
|
112902
|
+
onFalse: constant("quiet"),
|
|
112903
|
+
onTrue: constant("warning")
|
|
112738
112904
|
})),
|
|
112739
112905
|
id: ItemId.make(`${worker}:tailscale:${site[0]}:${handler[0]}`),
|
|
112740
112906
|
kind: "exposure",
|
|
@@ -112792,7 +112958,7 @@ const SERIES = {
|
|
|
112792
112958
|
10080: hours(1)
|
|
112793
112959
|
};
|
|
112794
112960
|
function counters(stat, uptime, time) {
|
|
112795
|
-
const values = decodeSync(CpuCounters)(pipe(stat, split$2("\n"), head, getOrElse$1((
|
|
112961
|
+
const values = decodeSync(CpuCounters)(pipe(stat, split$2("\n"), head, getOrElse$1(constant("")), trim, split$2(/\s+/u), drop$1(1), take$3(8)));
|
|
112796
112962
|
return {
|
|
112797
112963
|
cpuIdle: millis$1(((values[3] ?? 0) + (values[4] ?? 0)) * 10),
|
|
112798
112964
|
cpuTotal: millis$1(sumAll(values) * 10),
|
|
@@ -112821,7 +112987,7 @@ function cpuCounters(cpus, uptime, time) {
|
|
|
112821
112987
|
}
|
|
112822
112988
|
function vmStatMemory(text, total) {
|
|
112823
112989
|
const pages = fromEntries(getSomes(pipe(text, split$2("\n"), map$10((line) => map$13(match$2(/^"?([^":]+)"?:\s+([0-9]+)\.$/u)(trim(line)), (match) => [match[1] ?? "", match[2] ?? ""])))));
|
|
112824
|
-
const page = decodeSync(FiniteFromString)(pipe(match$2(/page size of ([0-9]+) bytes/u)(text), map$13((match) => match[1] ?? ""), getOrElse$1((
|
|
112990
|
+
const page = decodeSync(FiniteFromString)(pipe(match$2(/page size of ([0-9]+) bytes/u)(text), map$13((match) => match[1] ?? ""), getOrElse$1(constant(""))));
|
|
112825
112991
|
function count(name) {
|
|
112826
112992
|
return decodeSync(FiniteFromString)(pages[name] ?? "");
|
|
112827
112993
|
}
|
|
@@ -112874,10 +113040,10 @@ function reading(current, memory, disks, load, previous) {
|
|
|
112874
113040
|
};
|
|
112875
113041
|
}
|
|
112876
113042
|
function sample(current, memory, disk, previous, load) {
|
|
112877
|
-
const values =
|
|
113043
|
+
const values = pipe(trim(memory), split$2("\n"), fromIterableWith((line) => {
|
|
112878
113044
|
const fields = split$2(line, /\s+/u);
|
|
112879
113045
|
return [fields[0], decodeSync(FiniteFromString)(fields[1] ?? "") * 1024];
|
|
112880
|
-
}))
|
|
113046
|
+
}));
|
|
112881
113047
|
return reading(current, {
|
|
112882
113048
|
total: values["MemTotal:"] ?? 0,
|
|
112883
113049
|
used: (values["MemTotal:"] ?? 0) - (values["MemAvailable:"] ?? 0)
|
|
@@ -112888,7 +113054,7 @@ function sample(current, memory, disk, previous, load) {
|
|
|
112888
113054
|
mount: fields[0],
|
|
112889
113055
|
total: decodeSync(FiniteFromString)(fields[1] ?? ""),
|
|
112890
113056
|
used: decodeSync(FiniteFromString)(fields[2] ?? "")
|
|
112891
|
-
}))), decodeSync(LoadAverages)(pipe(getOrElse$1(load, (
|
|
113057
|
+
}))), decodeSync(LoadAverages)(pipe(getOrElse$1(load, constant("")), trim, split$2(/\s+/u), filter$5(isNonEmpty$1), take$3(3))), previous);
|
|
112892
113058
|
}
|
|
112893
113059
|
function resolution(range) {
|
|
112894
113060
|
return divideUnsafe(range, 60);
|
|
@@ -112912,7 +113078,7 @@ function mean(bucket, read) {
|
|
|
112912
113078
|
function merge(bucket) {
|
|
112913
113079
|
if (bucket.length === 1) return bucket[0];
|
|
112914
113080
|
const reported = filter$5(bucket, (point) => isSome(point.apps));
|
|
112915
|
-
const appsById = map$10(reported, (point) =>
|
|
113081
|
+
const appsById = map$10(reported, (point) => pipe(point.apps, getOrElse$1(empty$15), fromIterableBy((app) => app.id)));
|
|
112916
113082
|
function appMean(id, read) {
|
|
112917
113083
|
return mean(reported, (_point, index) => match$7(fromUndefinedOr(appsById[index]?.[id]), {
|
|
112918
113084
|
onNone: () => some$1(0),
|
|
@@ -112931,7 +113097,7 @@ function merge(bucket) {
|
|
|
112931
113097
|
onNonEmpty: () => some$1(map$10(dedupe(flatMap$6(reported, (point) => pipe(point.apps, getOrElse$1(empty$15), map$10((app) => app.id)))), (id) => ({
|
|
112932
113098
|
cpu: appMean(id, (app) => app.cpu),
|
|
112933
113099
|
id,
|
|
112934
|
-
memory: pipe(appMean(id, (app) => some$1(app.memory)), getOrElse$1((
|
|
113100
|
+
memory: pipe(appMean(id, (app) => some$1(app.memory)), getOrElse$1(constant(0)), round(0))
|
|
112935
113101
|
})))
|
|
112936
113102
|
}),
|
|
112937
113103
|
cpu: mean(bucket, (point) => point.cpu),
|
|
@@ -112973,7 +113139,7 @@ function bandName(id, labels) {
|
|
|
112973
113139
|
return pipe(labels, get$12(id), getOrElse$1(() => replaceAll(/^service:[a-z]+:(?:deslop-)?|\.service$/gu, "")(replace(/^container:/u, "container ")(id))));
|
|
112974
113140
|
}
|
|
112975
113141
|
function appCgroup(path, siblings) {
|
|
112976
|
-
const name = getOrElse$1(last$1(split$2(path, "/")), (
|
|
113142
|
+
const name = getOrElse$1(last$1(split$2(path, "/")), constant(""));
|
|
112977
113143
|
if (isSome(match$2(/^docker-[a-f0-9]{12,64}\.scope$/u)(name))) return true;
|
|
112978
113144
|
if (endsWith(".service")(name)) return isNone(match$2(/^user@[0-9]+\.service$/u)(name));
|
|
112979
113145
|
return exists(match$2(/\/user@[0-9]+\.service\/app\.slice\/app-([^/]+)\.slice$/u)(path), (match) => contains(siblings, `${match[1]}.service`));
|
|
@@ -113024,10 +113190,10 @@ function diskTotal(machine) {
|
|
|
113024
113190
|
function series(machine, minutes, read) {
|
|
113025
113191
|
const start = chartWindow(minutes, machine.time).start;
|
|
113026
113192
|
const slot = resolution(minutes);
|
|
113027
|
-
const bySlot =
|
|
113193
|
+
const bySlot = fromIterableWith(machine.samples, (point) => [`${clamp(Math.ceil(toMillis(distance(start, point.time)) / toMillis(slot)) - 1, {
|
|
113028
113194
|
maximum: 59,
|
|
113029
113195
|
minimum: 0
|
|
113030
|
-
})}`, point])
|
|
113196
|
+
})}`, point]);
|
|
113031
113197
|
return makeBy(60, (index) => pipe(fromUndefinedOr(bySlot[`${index}`]), flatMap$8(read), map$13((value) => round(value, 1))));
|
|
113032
113198
|
}
|
|
113033
113199
|
function appsOf(labels, latest) {
|
|
@@ -113153,7 +113319,7 @@ var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service
|
|
|
113153
113319
|
cpu: fs.readFileString(`${CGROUP}${path}/cpu.stat`),
|
|
113154
113320
|
memory: fs.readFileString(`${CGROUP}${path}/memory.stat`)
|
|
113155
113321
|
}, { concurrency: "unbounded" }), catchTag("PlatformError", (cause) => {
|
|
113156
|
-
if (cause.reason
|
|
113322
|
+
if (isTagged(cause.reason, "NotFound")) return undefined_$1;
|
|
113157
113323
|
return fail$7(cause);
|
|
113158
113324
|
}), flatMap$3((stats) => {
|
|
113159
113325
|
if (stats === void 0) return succeedNone;
|
|
@@ -113242,7 +113408,7 @@ var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service
|
|
|
113242
113408
|
load: measured.value.load
|
|
113243
113409
|
});
|
|
113244
113410
|
yield* set(failure, none());
|
|
113245
|
-
}), withSpan("Metrics.collect", { attributes: { worker } }), catch_$2((cause) => set(failure, some$1(cause.message))));
|
|
113411
|
+
}), withSpan("Metrics.collect", { attributes: { worker } }), tapError$3((cause) => logWarning("Metrics could not be sampled", cause)), catch_$2((cause) => set(failure, some$1(cause.message))));
|
|
113246
113412
|
const prune = pipe(now, flatMap$3(deleteExpired), asDeployError$1, withSpan("Metrics.prune", { attributes: { worker } }));
|
|
113247
113413
|
yield* prune;
|
|
113248
113414
|
yield* refreshStorage;
|
|
@@ -113271,7 +113437,7 @@ var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service
|
|
|
113271
113437
|
load: now$2.load,
|
|
113272
113438
|
samples: history(samples, query.minutes, time),
|
|
113273
113439
|
stale: match$7(last$1(samples), {
|
|
113274
|
-
onNone:
|
|
113440
|
+
onNone: constTrue,
|
|
113275
113441
|
onSome: (value) => pipe(value.time, distance(time), isGreaterThan$3(seconds(90)))
|
|
113276
113442
|
}),
|
|
113277
113443
|
time,
|
|
@@ -113372,8 +113538,8 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
|
|
|
113372
113538
|
const clients = yield* forEach$1(workers, (worker) => gen(function* () {
|
|
113373
113539
|
const url = new URL(RPC_PATH, worker.url);
|
|
113374
113540
|
url.protocol = match(new URL(worker.url).protocol === "http:", {
|
|
113375
|
-
onFalse: (
|
|
113376
|
-
onTrue: (
|
|
113541
|
+
onFalse: constant("wss:"),
|
|
113542
|
+
onTrue: constant("ws:")
|
|
113377
113543
|
});
|
|
113378
113544
|
const protocol = yield* build(pipe(layerProtocolSocket({ pingTimeout: seconds(15) }), provide$2(layerWebSocket(url.href)), provide$2(layerSchemaBinary()), provideMerge(layerRpcStreamClient)));
|
|
113379
113545
|
return [worker.name, yield* provideContext$2(makeRemoteClient, protocol)];
|
|
@@ -113430,7 +113596,7 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
|
|
|
113430
113596
|
onSome: (machine) => machine.error
|
|
113431
113597
|
}),
|
|
113432
113598
|
stale: match$7(saved, {
|
|
113433
|
-
onNone:
|
|
113599
|
+
onNone: constTrue,
|
|
113434
113600
|
onSome: (machine) => machine.stale || pipe(machine.time, distance(time), isGreaterThan$3(seconds(90)))
|
|
113435
113601
|
}),
|
|
113436
113602
|
worker: worker.name
|
|
@@ -113466,7 +113632,7 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
|
|
|
113466
113632
|
return [yield* metrics.read(query), ...yield* forEach$1(workers, (worker) => pipe(remote(worker, (client, headers) => client("metrics.history", query, { headers })), timeout(seconds(2)), map$7((value) => ({
|
|
113467
113633
|
...value,
|
|
113468
113634
|
worker: worker.name
|
|
113469
|
-
})), catch_$2(fnUntraced(function* (cause) {
|
|
113635
|
+
})), tapError$3((cause) => logWarning("A worker history could not be read", cause)), catch_$2(fnUntraced(function* (cause) {
|
|
113470
113636
|
return {
|
|
113471
113637
|
...cachedHistory(query, yield* now, get$8(yield* get$2(lastMetrics), [worker.name, query.minutes])),
|
|
113472
113638
|
error: some$1(cause.message),
|