@deslop/gateway 0.1.1247 → 0.1.1249
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/apple-touch-icon.png +0 -0
- package/dist/client/assets/(home)-CcYgj9q6.js +41 -0
- package/dist/client/assets/effect-vqsGZRUz.js +17 -0
- package/dist/client/assets/icon-CboSz0gI.svg +1 -0
- package/dist/client/assets/index-CHbcU5tn.css +2 -0
- package/dist/client/assets/index-NqpG0kja.js +3 -0
- package/dist/client/assets/{react-BUjtWCUj.js → react-COyt-gOi.js} +1 -1
- package/dist/client/index.html +5 -5
- package/dist/server.js +550 -241
- package/package.json +2 -2
- package/dist/client/assets/(home)-BI8XKvh4.js +0 -41
- package/dist/client/assets/effect-C_dSYsHy.js +0 -17
- package/dist/client/assets/icon-61pmFc-p.svg +0 -1
- package/dist/client/assets/index-BraGnsIF.css +0 -2
- package/dist/client/assets/index-JOdkABge.js +0 -4
package/dist/server.js
CHANGED
|
@@ -5027,7 +5027,7 @@ const serviceNotFoundError = (service) => {
|
|
|
5027
5027
|
* @category getters
|
|
5028
5028
|
* @since 2.0.0
|
|
5029
5029
|
*/
|
|
5030
|
-
const getOption = /*#__PURE__*/ dual(2, (self, service) => {
|
|
5030
|
+
const getOption$1 = /*#__PURE__*/ dual(2, (self, service) => {
|
|
5031
5031
|
const value = lookup$1(self, service.key);
|
|
5032
5032
|
if (value !== notFound$2) return some$1(value);
|
|
5033
5033
|
return isReference(service) ? some$1(getDefaultValue(service)) : none();
|
|
@@ -5120,41 +5120,6 @@ const mergeAll$2 = (...ctxs) => {
|
|
|
5120
5120
|
return makeUnsafe$9(map);
|
|
5121
5121
|
};
|
|
5122
5122
|
/**
|
|
5123
|
-
* Returns a new `Context` with the specified service keys removed.
|
|
5124
|
-
*
|
|
5125
|
-
* **When to use**
|
|
5126
|
-
*
|
|
5127
|
-
* Use when you want to remove a denylist of services from a `Context`.
|
|
5128
|
-
*
|
|
5129
|
-
* **Example** (Omitting services from a context)
|
|
5130
|
-
*
|
|
5131
|
-
* ```ts import.meta.vitest
|
|
5132
|
-
* import { Context, Option, pipe } from "effect"
|
|
5133
|
-
*
|
|
5134
|
-
* const Port = Context.Service<{ PORT: number }>("Port")
|
|
5135
|
-
* const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
|
|
5136
|
-
*
|
|
5137
|
-
* const someContext = pipe(
|
|
5138
|
-
* Context.make(Port, { PORT: 8080 }),
|
|
5139
|
-
* Context.add(Timeout, { TIMEOUT: 5000 })
|
|
5140
|
-
* )
|
|
5141
|
-
*
|
|
5142
|
-
* const context = pipe(someContext, Context.omit(Timeout))
|
|
5143
|
-
*
|
|
5144
|
-
* Context.getOption(context, Port) // => Option.some({ PORT: 8080 })
|
|
5145
|
-
* Context.getOption(context, Timeout) // => Option.none()
|
|
5146
|
-
* ```
|
|
5147
|
-
*
|
|
5148
|
-
* @see {@link pick} for keeping selected services
|
|
5149
|
-
*
|
|
5150
|
-
* @stability stable
|
|
5151
|
-
* @category filtering
|
|
5152
|
-
* @since 2.0.0
|
|
5153
|
-
*/
|
|
5154
|
-
const omit$3 = (...keys) => (self) => withFlat(self, (map) => {
|
|
5155
|
-
for (let i = 0; i < keys.length; i++) map.delete(keys[i].key);
|
|
5156
|
-
});
|
|
5157
|
-
/**
|
|
5158
5123
|
* Creates a context key with a default value.
|
|
5159
5124
|
*
|
|
5160
5125
|
* **When to use**
|
|
@@ -9916,7 +9881,7 @@ const exitAsVoidAll = (exits) => {
|
|
|
9916
9881
|
return failures.length === 0 ? exitVoid : exitFailCause(causeFromReasons(failures));
|
|
9917
9882
|
};
|
|
9918
9883
|
/** @internal */
|
|
9919
|
-
const serviceOption$1 = (service) => withFiber$1((fiber) => succeed$9(getOption(fiber.context, service)));
|
|
9884
|
+
const serviceOption$1 = (service) => withFiber$1((fiber) => succeed$9(getOption$1(fiber.context, service)));
|
|
9920
9885
|
/** @internal */
|
|
9921
9886
|
const updateContext$1 = /*#__PURE__*/ dual(2, (self, f) => withFiber$1((fiber) => {
|
|
9922
9887
|
const prevContext = fiber.context;
|
|
@@ -9962,7 +9927,7 @@ const forever$2 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, optio
|
|
|
9962
9927
|
step: constVoid
|
|
9963
9928
|
}));
|
|
9964
9929
|
/** @internal */
|
|
9965
|
-
const catchCause$
|
|
9930
|
+
const catchCause$4 = /*#__PURE__*/ dual(2, (self, f) => new OnFailureImpl(self, f.length !== 1 ? (cause) => f(cause) : f));
|
|
9966
9931
|
const OnFailureProto = /*#__PURE__*/ makePrimitiveProto({
|
|
9967
9932
|
op: "OnFailure",
|
|
9968
9933
|
[evaluate]: evaluateCont
|
|
@@ -9973,12 +9938,12 @@ const OnFailureImpl = function(self, f) {
|
|
|
9973
9938
|
};
|
|
9974
9939
|
OnFailureImpl.prototype = OnFailureProto;
|
|
9975
9940
|
/** @internal */
|
|
9976
|
-
const catchCauseIf$1 = /*#__PURE__*/ dual(3, (self, predicate, f) => catchCause$
|
|
9941
|
+
const catchCauseIf$1 = /*#__PURE__*/ dual(3, (self, predicate, f) => catchCause$4(self, (cause) => {
|
|
9977
9942
|
if (!predicate(cause)) return failCause$6(cause);
|
|
9978
9943
|
return f(cause);
|
|
9979
9944
|
}));
|
|
9980
9945
|
/** @internal */
|
|
9981
|
-
const catchCauseFilter$1 = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$
|
|
9946
|
+
const catchCauseFilter$1 = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$4(self, (cause) => {
|
|
9982
9947
|
const eb = filter(cause);
|
|
9983
9948
|
return isFailure$1(eb) ? failCause$6(eb.failure) : f(eb.success, cause);
|
|
9984
9949
|
}));
|
|
@@ -9987,9 +9952,9 @@ const catch_$3 = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter$1(self, fin
|
|
|
9987
9952
|
/** @internal */
|
|
9988
9953
|
const catchDefect$1 = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter$1(self, findDefect, f));
|
|
9989
9954
|
/** @internal */
|
|
9990
|
-
const tapCause$1 = /*#__PURE__*/ dual(2, (self, f) => catchCause$
|
|
9955
|
+
const tapCause$1 = /*#__PURE__*/ dual(2, (self, f) => catchCause$4(self, (cause) => andThen$1(f(cause), failCause$6(cause))));
|
|
9991
9956
|
/** @internal */
|
|
9992
|
-
const tapCauseFilter = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$
|
|
9957
|
+
const tapCauseFilter = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$4(self, (cause) => {
|
|
9993
9958
|
const result = filter(cause);
|
|
9994
9959
|
if (isFailure$1(result)) return failCause$6(cause);
|
|
9995
9960
|
return andThen$1(f(result.success, cause), failCause$6(cause));
|
|
@@ -10002,14 +9967,14 @@ const tapErrorTag$1 = /*#__PURE__*/ dual(3, (self, k, f) => {
|
|
|
10002
9967
|
return tapError$4(self, (error) => predicate(error) ? f(error) : void_$3);
|
|
10003
9968
|
});
|
|
10004
9969
|
/** @internal */
|
|
10005
|
-
const catchIf$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$
|
|
9970
|
+
const catchIf$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$4(self, (cause) => {
|
|
10006
9971
|
const error = findRecoverableError(cause);
|
|
10007
9972
|
if (isFailure$1(error)) return failCause$6(error.failure);
|
|
10008
9973
|
if (!predicate(error.success)) return orElse ? orElse(error.success) : failCause$6(cause);
|
|
10009
9974
|
return f(error.success);
|
|
10010
9975
|
}));
|
|
10011
9976
|
/** @internal */
|
|
10012
|
-
const catchFilter$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, filter, f, orElse) => catchCause$
|
|
9977
|
+
const catchFilter$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, filter, f, orElse) => catchCause$4(self, (cause) => {
|
|
10013
9978
|
const error = findRecoverableError(cause);
|
|
10014
9979
|
if (isFailure$1(error)) return failCause$6(error.failure);
|
|
10015
9980
|
const result = filter(error.success);
|
|
@@ -10036,7 +10001,7 @@ const catchReason$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, e
|
|
|
10036
10001
|
return orElse ? orElse(reason, e) : fail$10(e);
|
|
10037
10002
|
}));
|
|
10038
10003
|
/** @internal */
|
|
10039
|
-
const mapError$3 = /*#__PURE__*/ dual(2, (self, f) => catchCause$
|
|
10004
|
+
const mapError$3 = /*#__PURE__*/ dual(2, (self, f) => catchCause$4(self, (cause) => failCause$6(causeMap(cause, f))));
|
|
10040
10005
|
/** @internal */
|
|
10041
10006
|
const mapBoth$1 = /*#__PURE__*/ dual(2, (self, options) => matchCauseEffect$1(self, {
|
|
10042
10007
|
onFailure: (cause) => failCause$6(causeMap(cause, options.onFailure)),
|
|
@@ -10164,9 +10129,9 @@ const delay$1 = /*#__PURE__*/ dual(2, (self, duration) => andThen$1(sleep$2(dura
|
|
|
10164
10129
|
/** @internal */
|
|
10165
10130
|
const timeoutOrElse$1 = /*#__PURE__*/ dual(2, (self, options) => flatMap$4(timeoutOption$1(self, options.duration), (option) => isNone(option) ? options.orElse() : succeed$9(option.value)));
|
|
10166
10131
|
/** @internal */
|
|
10167
|
-
const timeoutErrorFromDuration = (duration) => new TimeoutError(`Operation timed out after '${format$3(duration)}'`);
|
|
10132
|
+
const timeoutErrorFromDuration = (duration) => new TimeoutError$1(`Operation timed out after '${format$3(duration)}'`);
|
|
10168
10133
|
/** @internal */
|
|
10169
|
-
const timeout$
|
|
10134
|
+
const timeout$2 = /*#__PURE__*/ dual(2, (self, duration) => {
|
|
10170
10135
|
const decoded = fromInputUnsafe$1(duration);
|
|
10171
10136
|
return timeoutOrElse$1(self, {
|
|
10172
10137
|
duration: decoded,
|
|
@@ -10208,7 +10173,7 @@ const runFinalizer = (finalizer, exit_) => {
|
|
|
10208
10173
|
return exitDie(defect);
|
|
10209
10174
|
}
|
|
10210
10175
|
};
|
|
10211
|
-
const combineFinalizerCause = (exit_, finalizer) => exitIsSuccess(exit_) ? finalizer : catchCause$
|
|
10176
|
+
const combineFinalizerCause = (exit_, finalizer) => exitIsSuccess(exit_) ? finalizer : catchCause$4(finalizer, (cause) => failCause$6(causeElectDefects(causeCombine(exit_.cause, cause))));
|
|
10212
10177
|
const scopeCloseFinalizers = /*#__PURE__*/ fnUntraced$1(function* (self, finalizers, exit_) {
|
|
10213
10178
|
let exits = [];
|
|
10214
10179
|
const fibers = [];
|
|
@@ -11048,7 +11013,7 @@ const TimeoutErrorTypeId = "~effect/Cause/TimeoutError";
|
|
|
11048
11013
|
/** @internal */
|
|
11049
11014
|
const isTimeoutError$1 = (u) => hasProperty(u, TimeoutErrorTypeId);
|
|
11050
11015
|
/** @internal */
|
|
11051
|
-
var TimeoutError = class extends (/*#__PURE__*/ TaggedError$2("TimeoutError")) {
|
|
11016
|
+
var TimeoutError$1 = class extends (/*#__PURE__*/ TaggedError$2("TimeoutError")) {
|
|
11052
11017
|
[TimeoutErrorTypeId] = TimeoutErrorTypeId;
|
|
11053
11018
|
constructor(message) {
|
|
11054
11019
|
super({ message });
|
|
@@ -11896,6 +11861,22 @@ const done$1 = done$2;
|
|
|
11896
11861
|
*/
|
|
11897
11862
|
const isTimeoutError = isTimeoutError$1;
|
|
11898
11863
|
/**
|
|
11864
|
+
* Constructs a `TimeoutError` with an optional message.
|
|
11865
|
+
*
|
|
11866
|
+
* **Example** (Creating a TimeoutError)
|
|
11867
|
+
*
|
|
11868
|
+
* ```ts import.meta.vitest
|
|
11869
|
+
* import { Cause } from "effect"
|
|
11870
|
+
*
|
|
11871
|
+
* new Cause.TimeoutError("Operation timed out").message // => "Operation timed out"
|
|
11872
|
+
* ```
|
|
11873
|
+
*
|
|
11874
|
+
* @stability stable
|
|
11875
|
+
* @category constructors
|
|
11876
|
+
* @since 4.0.0
|
|
11877
|
+
*/
|
|
11878
|
+
const TimeoutError = TimeoutError$1;
|
|
11879
|
+
/**
|
|
11899
11880
|
* Constructs an `IllegalArgumentError` with an optional message.
|
|
11900
11881
|
*
|
|
11901
11882
|
* **Example** (Creating an IllegalArgumentError)
|
|
@@ -14384,6 +14365,63 @@ const provideMerge = /*#__PURE__*/ dual(2, (self, that) => provideWith(self, tha
|
|
|
14384
14365
|
*/
|
|
14385
14366
|
const flatMap$3 = /*#__PURE__*/ dual(2, (self, f) => fromBuild((memoMap, scope) => flatMap$4(self.build(memoMap, scope), (context) => f(context).build(memoMap, scope))));
|
|
14386
14367
|
/**
|
|
14368
|
+
* Recovers from any failure cause by switching to another layer.
|
|
14369
|
+
*
|
|
14370
|
+
* **When to use**
|
|
14371
|
+
*
|
|
14372
|
+
* Use when you need `Layer` recovery to inspect more than the typed error,
|
|
14373
|
+
* such as defects or interruption information.
|
|
14374
|
+
*
|
|
14375
|
+
* **Details**
|
|
14376
|
+
*
|
|
14377
|
+
* The handler receives the full `Cause` of the failed layer, including typed
|
|
14378
|
+
* errors, unexpected defects, and interruption information, and returns the
|
|
14379
|
+
* fallback layer to build instead. Finalizers for resources acquired by the
|
|
14380
|
+
* failed layer are still run before the fallback layer is acquired.
|
|
14381
|
+
*
|
|
14382
|
+
* **Example** (Recovering from layer failures by cause)
|
|
14383
|
+
*
|
|
14384
|
+
* ```ts import.meta.vitest
|
|
14385
|
+
* import { Context, Data, Effect, Layer } from "effect"
|
|
14386
|
+
*
|
|
14387
|
+
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
|
14388
|
+
* message: string
|
|
14389
|
+
* }> {}
|
|
14390
|
+
*
|
|
14391
|
+
* class Database extends Context.Service<Database, {
|
|
14392
|
+
* readonly query: (sql: string) => Effect.Effect<string>
|
|
14393
|
+
* }>()("Database") {}
|
|
14394
|
+
*
|
|
14395
|
+
* const primaryDatabaseLayer = Layer.effect(Database,
|
|
14396
|
+
* Effect.fail(new DatabaseError({ message: "Primary DB unreachable" }))
|
|
14397
|
+
* )
|
|
14398
|
+
*
|
|
14399
|
+
* const databaseWithFallback = primaryDatabaseLayer.pipe(
|
|
14400
|
+
* Layer.catchCause(() => {
|
|
14401
|
+
* return Layer.succeed(Database, {
|
|
14402
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
|
|
14403
|
+
* })
|
|
14404
|
+
* })
|
|
14405
|
+
* )
|
|
14406
|
+
*
|
|
14407
|
+
* const program = Effect.gen(function*() {
|
|
14408
|
+
* const database = yield* Database
|
|
14409
|
+
* return yield* database.query("SELECT * FROM users")
|
|
14410
|
+
* }).pipe(
|
|
14411
|
+
* Effect.provide(databaseWithFallback)
|
|
14412
|
+
* )
|
|
14413
|
+
*
|
|
14414
|
+
* await Effect.runPromise(program) // => "Memory: SELECT * FROM users"
|
|
14415
|
+
* ```
|
|
14416
|
+
*
|
|
14417
|
+
* @see {@link catchTag} for recovering from specific tagged errors
|
|
14418
|
+
*
|
|
14419
|
+
* @stability stable
|
|
14420
|
+
* @category error handling
|
|
14421
|
+
* @since 4.0.0
|
|
14422
|
+
*/
|
|
14423
|
+
const catchCause$3 = /*#__PURE__*/ dual(2, (self, onError) => fromBuildUnsafe((memoMap, scope) => catchCause$4(self.build(memoMap, scope), (cause) => onError(cause).build(memoMap, scope))));
|
|
14424
|
+
/**
|
|
14387
14425
|
* Creates a fresh version of this layer that will not be shared.
|
|
14388
14426
|
*
|
|
14389
14427
|
* **When to use**
|
|
@@ -15184,6 +15222,23 @@ const capitalize = (self) => {
|
|
|
15184
15222
|
*/
|
|
15185
15223
|
const replace = (searchValue, replaceValue) => (self) => self.replace(searchValue, replaceValue);
|
|
15186
15224
|
/**
|
|
15225
|
+
* Removes whitespace from both ends of a string.
|
|
15226
|
+
*
|
|
15227
|
+
* **Example** (Trimming whitespace)
|
|
15228
|
+
*
|
|
15229
|
+
* ```ts import.meta.vitest
|
|
15230
|
+
* import { String } from "effect"
|
|
15231
|
+
*
|
|
15232
|
+
* String.trim(" a ") // => "a"
|
|
15233
|
+
* String.trim(" hello world ") // => "hello world"
|
|
15234
|
+
* ```
|
|
15235
|
+
*
|
|
15236
|
+
* @stability stable
|
|
15237
|
+
* @category transforming
|
|
15238
|
+
* @since 2.0.0
|
|
15239
|
+
*/
|
|
15240
|
+
const trim = (self) => self.trim();
|
|
15241
|
+
/**
|
|
15187
15242
|
* Extracts a section of a string and returns it as a new string.
|
|
15188
15243
|
*
|
|
15189
15244
|
* **Example** (Slicing strings)
|
|
@@ -15201,6 +15256,23 @@ const replace = (searchValue, replaceValue) => (self) => self.replace(searchValu
|
|
|
15201
15256
|
*/
|
|
15202
15257
|
const slice = (start, end) => (self) => self.slice(start, end);
|
|
15203
15258
|
/**
|
|
15259
|
+
* Checks whether a `string` is non-empty.
|
|
15260
|
+
*
|
|
15261
|
+
* **Example** (Checking for non-empty strings)
|
|
15262
|
+
*
|
|
15263
|
+
* ```ts import.meta.vitest
|
|
15264
|
+
* import { String } from "effect"
|
|
15265
|
+
*
|
|
15266
|
+
* String.isNonEmpty("") // => false
|
|
15267
|
+
* String.isNonEmpty("a") // => true
|
|
15268
|
+
* ```
|
|
15269
|
+
*
|
|
15270
|
+
* @stability stable
|
|
15271
|
+
* @category predicates
|
|
15272
|
+
* @since 2.0.0
|
|
15273
|
+
*/
|
|
15274
|
+
const isNonEmpty$1 = (self) => self.length > 0;
|
|
15275
|
+
/**
|
|
15204
15276
|
* Splits a string into an array of substrings using a separator.
|
|
15205
15277
|
*
|
|
15206
15278
|
* **Example** (Splitting strings)
|
|
@@ -15666,7 +15738,7 @@ const fromStepWithMetadata = (step) => fromStep(map$7(step, (f) => {
|
|
|
15666
15738
|
* @category destructors
|
|
15667
15739
|
* @since 4.0.0
|
|
15668
15740
|
*/
|
|
15669
|
-
const toStep = (schedule) => catchCause$
|
|
15741
|
+
const toStep = (schedule) => catchCause$4(schedule.step, (cause) => succeed$9(() => failCause$6(cause)));
|
|
15670
15742
|
/**
|
|
15671
15743
|
* Extracts a step function from a `Schedule` that sleeps for each computed
|
|
15672
15744
|
* delay and returns metadata for the completed step.
|
|
@@ -18020,7 +18092,7 @@ const catchReason = catchReason$1;
|
|
|
18020
18092
|
* @category error handling
|
|
18021
18093
|
* @since 4.0.0
|
|
18022
18094
|
*/
|
|
18023
|
-
const catchCause$2 = catchCause$
|
|
18095
|
+
const catchCause$2 = catchCause$4;
|
|
18024
18096
|
/**
|
|
18025
18097
|
* Recovers from defects using a provided recovery function.
|
|
18026
18098
|
*
|
|
@@ -18656,7 +18728,7 @@ const orElseSucceed = orElseSucceed$1;
|
|
|
18656
18728
|
* @category delays & timeouts
|
|
18657
18729
|
* @since 2.0.0
|
|
18658
18730
|
*/
|
|
18659
|
-
const timeout = timeout$
|
|
18731
|
+
const timeout$1 = timeout$2;
|
|
18660
18732
|
/**
|
|
18661
18733
|
* Runs an effect with a time limit and represents only the timeout case as
|
|
18662
18734
|
* `Option.none`.
|
|
@@ -30322,7 +30394,7 @@ const compose = /*#__PURE__*/ dual(2, (self, other) => {
|
|
|
30322
30394
|
if (other._tag === "Passthrough") return self;
|
|
30323
30395
|
switch (self._tag) {
|
|
30324
30396
|
case "Transform": switch (other._tag) {
|
|
30325
|
-
case "Transform": return transform$
|
|
30397
|
+
case "Transform": return transform$4((input) => other.transform(self.transform(input)));
|
|
30326
30398
|
case "TransformOptional": return transformOptional((input) => other.transform(map$11(input, self.transform)));
|
|
30327
30399
|
case "TransformEffect": return transformEffect$1((input, options) => other.transform(self.transform(input), options));
|
|
30328
30400
|
case "TransformOptionalEffect": return composeOptionalEffect(self, other);
|
|
@@ -30492,7 +30564,7 @@ function passthrough$1() {
|
|
|
30492
30564
|
* @category transforming
|
|
30493
30565
|
* @since 4.0.0
|
|
30494
30566
|
*/
|
|
30495
|
-
function transform$
|
|
30567
|
+
function transform$4(f) {
|
|
30496
30568
|
return makeGetter({
|
|
30497
30569
|
_tag: "Transform",
|
|
30498
30570
|
transform: f
|
|
@@ -30687,7 +30759,7 @@ function withDefault$4(defaultValue) {
|
|
|
30687
30759
|
* @since 4.0.0
|
|
30688
30760
|
*/
|
|
30689
30761
|
function String$8() {
|
|
30690
|
-
return transform$
|
|
30762
|
+
return transform$4(globalThis.String);
|
|
30691
30763
|
}
|
|
30692
30764
|
/**
|
|
30693
30765
|
* Coerces any value to a `number` using the global `Number()` constructor.
|
|
@@ -30718,7 +30790,7 @@ function String$8() {
|
|
|
30718
30790
|
* @since 4.0.0
|
|
30719
30791
|
*/
|
|
30720
30792
|
function Number$4() {
|
|
30721
|
-
return transform$
|
|
30793
|
+
return transform$4(globalThis.Number);
|
|
30722
30794
|
}
|
|
30723
30795
|
/**
|
|
30724
30796
|
* Coerces a value to `bigint` using the global `BigInt()` constructor.
|
|
@@ -30844,7 +30916,7 @@ function splitKeyValue$1(options) {
|
|
|
30844
30916
|
const keyValueSeparator = options?.keyValueSeparator ?? "=";
|
|
30845
30917
|
const trim = options?.trim ?? false;
|
|
30846
30918
|
const keepEmptyValues = options?.keepEmptyValues ?? false;
|
|
30847
|
-
return transform$
|
|
30919
|
+
return transform$4((input) => input.split(separator).reduce((acc, pair) => {
|
|
30848
30920
|
let key;
|
|
30849
30921
|
let value;
|
|
30850
30922
|
if (keyValueSeparator === "") {
|
|
@@ -30898,7 +30970,7 @@ function splitKeyValue$1(options) {
|
|
|
30898
30970
|
function joinKeyValue(options) {
|
|
30899
30971
|
const separator = options?.separator ?? ",";
|
|
30900
30972
|
const keyValueSeparator = options?.keyValueSeparator ?? "=";
|
|
30901
|
-
return transform$
|
|
30973
|
+
return transform$4((input) => Object.entries(input).map(([key, value]) => `${key}${keyValueSeparator}${value}`).join(separator));
|
|
30902
30974
|
}
|
|
30903
30975
|
/**
|
|
30904
30976
|
* Splits a string into an array of strings by a separator.
|
|
@@ -30931,7 +31003,7 @@ function joinKeyValue(options) {
|
|
|
30931
31003
|
*/
|
|
30932
31004
|
function split(options) {
|
|
30933
31005
|
const separator = options?.separator ?? ",";
|
|
30934
|
-
return transform$
|
|
31006
|
+
return transform$4((input) => input === "" ? [] : input.split(separator));
|
|
30935
31007
|
}
|
|
30936
31008
|
/**
|
|
30937
31009
|
* Encodes a `Uint8Array` or string to a Base64 string.
|
|
@@ -30959,7 +31031,7 @@ function split(options) {
|
|
|
30959
31031
|
* @since 4.0.0
|
|
30960
31032
|
*/
|
|
30961
31033
|
function encodeBase64() {
|
|
30962
|
-
return transform$
|
|
31034
|
+
return transform$4(encode$2);
|
|
30963
31035
|
}
|
|
30964
31036
|
/**
|
|
30965
31037
|
* Decodes a Base64 string to a `Uint8Array`.
|
|
@@ -31014,7 +31086,7 @@ function decodeBase64() {
|
|
|
31014
31086
|
* @since 4.0.0
|
|
31015
31087
|
*/
|
|
31016
31088
|
function encodeUriComponent() {
|
|
31017
|
-
return transform$
|
|
31089
|
+
return transform$4(encodeURIComponent);
|
|
31018
31090
|
}
|
|
31019
31091
|
/**
|
|
31020
31092
|
* Decodes a URI component encoded string using `decodeURIComponent`.
|
|
@@ -31259,8 +31331,8 @@ function transformEffect(options) {
|
|
|
31259
31331
|
* @category transforming
|
|
31260
31332
|
* @since 3.10.0
|
|
31261
31333
|
*/
|
|
31262
|
-
function transform$
|
|
31263
|
-
return new Transformation(transform$
|
|
31334
|
+
function transform$3(options) {
|
|
31335
|
+
return new Transformation(transform$4(options.decode), transform$4(options.encode));
|
|
31264
31336
|
}
|
|
31265
31337
|
/**
|
|
31266
31338
|
* Transforms a string into a record of key-value pairs and
|
|
@@ -31418,7 +31490,7 @@ const makeEncodeDefect = (options) => {
|
|
|
31418
31490
|
};
|
|
31419
31491
|
const decodeDefect = (input) => isJsonError(input) ? decodeJsonError(input) : input;
|
|
31420
31492
|
/** @internal */
|
|
31421
|
-
const defectFromJson = (options) => transform$
|
|
31493
|
+
const defectFromJson = (options) => transform$3({
|
|
31422
31494
|
decode: decodeDefect,
|
|
31423
31495
|
encode: makeEncodeDefect(options)
|
|
31424
31496
|
});
|
|
@@ -31791,7 +31863,7 @@ const Undefined$1 = class extends ASTNodeImpl {
|
|
|
31791
31863
|
return "undefined";
|
|
31792
31864
|
}
|
|
31793
31865
|
};
|
|
31794
|
-
const undefinedToNull = /*#__PURE__*/ new Link$1(null_, /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$
|
|
31866
|
+
const undefinedToNull = /*#__PURE__*/ new Link$1(null_, /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$4(() => void 0), /*#__PURE__*/ transform$4(() => null)));
|
|
31795
31867
|
const undefined_ = /*#__PURE__*/ new Undefined$1();
|
|
31796
31868
|
/**
|
|
31797
31869
|
* Constructs a {@link Void}.
|
|
@@ -32016,7 +32088,7 @@ function templateLiteralTransformation(template) {
|
|
|
32016
32088
|
const segments = segmentTemplateLiteralParts(template, s, options);
|
|
32017
32089
|
if (segments) return succeed$5(segments);
|
|
32018
32090
|
return fail$6(new InvalidValue$1({ expected: "a string matching template literal parts" }, s, options));
|
|
32019
|
-
}), transform$
|
|
32091
|
+
}), transform$4((parts) => parts.join("")));
|
|
32020
32092
|
}
|
|
32021
32093
|
/**
|
|
32022
32094
|
* Constructs a {@link Literal}.
|
|
@@ -32056,7 +32128,7 @@ const Literal$1 = class extends ASTNodeImpl {
|
|
|
32056
32128
|
};
|
|
32057
32129
|
function literalToString(ast) {
|
|
32058
32130
|
const literalAsString = globalThis.String(ast.literal);
|
|
32059
|
-
return replaceEncoding(ast, [new Link$1(new Literal$1(literalAsString), new Transformation(transform$
|
|
32131
|
+
return replaceEncoding(ast, [new Link$1(new Literal$1(literalAsString), new Transformation(transform$4(() => ast.literal), transform$4(() => literalAsString)))]);
|
|
32060
32132
|
}
|
|
32061
32133
|
/**
|
|
32062
32134
|
* Constructs a {@link String}.
|
|
@@ -33182,7 +33254,7 @@ function isFinite(annotations) {
|
|
|
33182
33254
|
}
|
|
33183
33255
|
/** @internal */
|
|
33184
33256
|
const finite = /*#__PURE__*/ appendChecks(number$4, [/*#__PURE__*/ isFinite()]);
|
|
33185
|
-
const numberToJson = /*#__PURE__*/ new Link$1(/*#__PURE__*/ new Union$1([finite, nonFiniteLiterals]), /*#__PURE__*/ new Transformation(/*#__PURE__*/ Number$4(), /*#__PURE__*/ transform$
|
|
33257
|
+
const numberToJson = /*#__PURE__*/ new Link$1(/*#__PURE__*/ new Union$1([finite, nonFiniteLiterals]), /*#__PURE__*/ new Transformation(/*#__PURE__*/ Number$4(), /*#__PURE__*/ transform$4((n) => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));
|
|
33186
33258
|
/**
|
|
33187
33259
|
* Creates a {@link Filter} that validates strings by running `RegExp.test`.
|
|
33188
33260
|
*
|
|
@@ -34750,9 +34822,9 @@ function toCodecStringTreeASTStep(ast, recur, onMissingAnnotation) {
|
|
|
34750
34822
|
}
|
|
34751
34823
|
return ast;
|
|
34752
34824
|
}
|
|
34753
|
-
const nullToString = /*#__PURE__*/ new Link$1(/*#__PURE__*/ new Literal$1("null"), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$
|
|
34754
|
-
const booleanToString = /*#__PURE__*/ new Link$1(/*#__PURE__*/ new Union$1([/*#__PURE__*/ new Literal$1("true"), /*#__PURE__*/ new Literal$1("false")]), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$
|
|
34755
|
-
const arrayFromSingleTransformation = /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$
|
|
34825
|
+
const nullToString = /*#__PURE__*/ new Link$1(/*#__PURE__*/ new Literal$1("null"), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$4(() => null), /*#__PURE__*/ transform$4(() => "null")));
|
|
34826
|
+
const booleanToString = /*#__PURE__*/ new Link$1(/*#__PURE__*/ new Union$1([/*#__PURE__*/ new Literal$1("true"), /*#__PURE__*/ new Literal$1("false")]), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$4((s) => s === "true"), /*#__PURE__*/ String$8()));
|
|
34827
|
+
const arrayFromSingleTransformation = /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$4((input) => typeof input === "string" ? [input] : input), /*#__PURE__*/ passthrough$1());
|
|
34756
34828
|
const isCodecArrayFromSingleLink = (link) => link.transformation === arrayFromSingleTransformation;
|
|
34757
34829
|
const toCodecStringTreeAST = /*#__PURE__*/ makeCodecDerivation((ast, recur) => toCodecStringTreeASTStep(ast, recur, (ast) => {
|
|
34758
34830
|
throw new globalThis.Error("Missing structural codec for StringTree", { cause: ast });
|
|
@@ -37374,8 +37446,8 @@ function Literal(literal) {
|
|
|
37374
37446
|
literal,
|
|
37375
37447
|
transform(to) {
|
|
37376
37448
|
return out.pipe(decodeTo(Literal(to), {
|
|
37377
|
-
decode: transform$
|
|
37378
|
-
encode: transform$
|
|
37449
|
+
decode: transform$4(() => to),
|
|
37450
|
+
encode: transform$4(() => literal)
|
|
37379
37451
|
}));
|
|
37380
37452
|
}
|
|
37381
37453
|
});
|
|
@@ -37862,7 +37934,7 @@ const FalseLiterals = /*#__PURE__*/ Literals([
|
|
|
37862
37934
|
"n"
|
|
37863
37935
|
]);
|
|
37864
37936
|
/** @internal */
|
|
37865
|
-
const BooleanLiterals = /*#__PURE__*/ Literals([...TrueLiterals.literals, ...FalseLiterals.literals]).pipe(/*#__PURE__*/ decodeTo(Boolean$5, /*#__PURE__*/ transform$
|
|
37937
|
+
const BooleanLiterals = /*#__PURE__*/ Literals([...TrueLiterals.literals, ...FalseLiterals.literals]).pipe(/*#__PURE__*/ decodeTo(Boolean$5, /*#__PURE__*/ transform$3({
|
|
37866
37938
|
decode: (value) => value === "true" || value === "yes" || value === "on" || value === "1" || value === "y",
|
|
37867
37939
|
encode: (value) => value ? "true" : "false"
|
|
37868
37940
|
})));
|
|
@@ -38963,7 +39035,7 @@ function CauseReason(error, defect) {
|
|
|
38963
39035
|
_tag: Literal("Interrupt"),
|
|
38964
39036
|
fiberId: UndefinedOr(Finite)
|
|
38965
39037
|
})
|
|
38966
|
-
]), transform$
|
|
39038
|
+
]), transform$3({
|
|
38967
39039
|
decode: (e) => {
|
|
38968
39040
|
switch (e._tag) {
|
|
38969
39041
|
case "Fail": return makeFailReason(e.error);
|
|
@@ -39037,7 +39109,7 @@ function Cause(error, defect) {
|
|
|
39037
39109
|
importDeclarations: [`import * as Cause from "effect/Cause"`]
|
|
39038
39110
|
}),
|
|
39039
39111
|
expected: "Cause",
|
|
39040
|
-
toCodec: ([error, defect]) => link$1()(ArraySchema(CauseReason(error, defect)), transform$
|
|
39112
|
+
toCodec: ([error, defect]) => link$1()(ArraySchema(CauseReason(error, defect)), transform$3({
|
|
39041
39113
|
decode: fromReasons,
|
|
39042
39114
|
encode: ({ reasons: failures }) => failures
|
|
39043
39115
|
}))
|
|
@@ -39104,7 +39176,7 @@ const DateTimeUtc = /*#__PURE__*/ declare((u) => isDateTime(u) && isUtc(u), {
|
|
|
39104
39176
|
expected: "DateTime.Utc",
|
|
39105
39177
|
toCodecArbitrary: ({ constraint }) => {
|
|
39106
39178
|
const [minimum, maximum] = dateTimeArbitraryBounds(constraint, arbitraryMinimumDateTimestamp, arbitraryMaximumDateTimestamp);
|
|
39107
|
-
return linkDecoding()(dateTimeArbitraryInteger(minimum, maximum), transform$
|
|
39179
|
+
return linkDecoding()(dateTimeArbitraryInteger(minimum, maximum), transform$4(makeUnsafe$4));
|
|
39108
39180
|
},
|
|
39109
39181
|
toCodecJson: () => link$1()(String$6, dateTimeUtcFromString),
|
|
39110
39182
|
toFormatter: () => (utc) => utc.toString()
|
|
@@ -39152,7 +39224,7 @@ const Duration = /*#__PURE__*/ declare(isDuration, {
|
|
|
39152
39224
|
_tag: Literal("Millis"),
|
|
39153
39225
|
value: Int$1
|
|
39154
39226
|
})
|
|
39155
|
-
]), transform$
|
|
39227
|
+
]), transform$3({
|
|
39156
39228
|
decode: (e) => {
|
|
39157
39229
|
switch (e._tag) {
|
|
39158
39230
|
case "Infinity": return infinity;
|
|
@@ -39227,7 +39299,7 @@ function Exit(value, error, defect) {
|
|
|
39227
39299
|
}), Struct({
|
|
39228
39300
|
_tag: Literal("Failure"),
|
|
39229
39301
|
cause: Cause(error, defect)
|
|
39230
|
-
})]), transform$
|
|
39302
|
+
})]), transform$3({
|
|
39231
39303
|
decode: (e) => e._tag === "Success" ? succeed$8(e.value) : failCause$5(e.cause),
|
|
39232
39304
|
encode: (exit) => isSuccess(exit) ? {
|
|
39233
39305
|
_tag: "Success",
|
|
@@ -39296,8 +39368,8 @@ function Redacted(value, options) {
|
|
|
39296
39368
|
}),
|
|
39297
39369
|
expected: "Redacted",
|
|
39298
39370
|
toCodecJson: ([value]) => link$1()(value, {
|
|
39299
|
-
decode: transform$
|
|
39300
|
-
encode: disallowJsonEncode ? forbidden((oe) => "Cannot serialize Redacted" + (isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : transform$
|
|
39371
|
+
decode: transform$4((e) => make$67(e, { label })),
|
|
39372
|
+
encode: disallowJsonEncode ? forbidden((oe) => "Cannot serialize Redacted" + (isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : transform$4(value$2)
|
|
39301
39373
|
}),
|
|
39302
39374
|
toEquivalence: ([value]) => makeEquivalence(value)
|
|
39303
39375
|
});
|
|
@@ -39386,7 +39458,7 @@ function makeClassTrusted(self, fields) {
|
|
|
39386
39458
|
} });
|
|
39387
39459
|
}
|
|
39388
39460
|
function getClassTransformation(self) {
|
|
39389
|
-
return new Transformation(transform$
|
|
39461
|
+
return new Transformation(transform$4((input) => makeClassTrusted(self, input)), passthrough$1());
|
|
39390
39462
|
}
|
|
39391
39463
|
function getClassTypeId(identifier) {
|
|
39392
39464
|
return `~effect/Schema/Class/${identifier}`;
|
|
@@ -40089,6 +40161,125 @@ const checkCapacity = (self) => {
|
|
|
40089
40161
|
}
|
|
40090
40162
|
};
|
|
40091
40163
|
/**
|
|
40164
|
+
* Reads an existing cache entry without invoking the lookup function.
|
|
40165
|
+
*
|
|
40166
|
+
* **Details**
|
|
40167
|
+
*
|
|
40168
|
+
* Returns `Option.none()` when the key is missing or expired, and `Option.some`
|
|
40169
|
+
* when a cached lookup has succeeded. If the entry is still pending, waits for
|
|
40170
|
+
* it to complete. If the cached or pending lookup fails, this effect fails with
|
|
40171
|
+
* the same error.
|
|
40172
|
+
*
|
|
40173
|
+
* **Example** (Reading cached values without lookup)
|
|
40174
|
+
*
|
|
40175
|
+
* ```ts import.meta.vitest
|
|
40176
|
+
* import { Cache, Effect, Option } from "effect"
|
|
40177
|
+
*
|
|
40178
|
+
* const program = Effect.gen(function*() {
|
|
40179
|
+
* const cache = yield* Cache.make({
|
|
40180
|
+
* capacity: 10,
|
|
40181
|
+
* lookup: (key: string) => Effect.succeed(key.length)
|
|
40182
|
+
* })
|
|
40183
|
+
*
|
|
40184
|
+
* // No value in cache yet - returns None without lookup
|
|
40185
|
+
* const empty = yield* Cache.getOption(cache, "hello")
|
|
40186
|
+
*
|
|
40187
|
+
* // Populate cache using get
|
|
40188
|
+
* yield* Cache.get(cache, "hello")
|
|
40189
|
+
*
|
|
40190
|
+
* // Now getOption returns the cached value
|
|
40191
|
+
* const cached = yield* Cache.getOption(cache, "hello")
|
|
40192
|
+
* return [empty, cached] as const
|
|
40193
|
+
* })
|
|
40194
|
+
*
|
|
40195
|
+
* const actual = await Effect.runPromise(program)
|
|
40196
|
+
* actual // => [Option.none(), Option.some(5)]
|
|
40197
|
+
* ```
|
|
40198
|
+
*
|
|
40199
|
+
* **Example** (Skipping expired entries)
|
|
40200
|
+
*
|
|
40201
|
+
* ```ts import.meta.vitest
|
|
40202
|
+
* import { Cache, Effect, Option } from "effect"
|
|
40203
|
+
* import { TestClock } from "effect/testing"
|
|
40204
|
+
*
|
|
40205
|
+
* // Expired entries return None
|
|
40206
|
+
* const program = Effect.gen(function*() {
|
|
40207
|
+
* const cache = yield* Cache.make({
|
|
40208
|
+
* capacity: 10,
|
|
40209
|
+
* lookup: (key: string) => Effect.succeed(key.length),
|
|
40210
|
+
* timeToLive: "1 hour"
|
|
40211
|
+
* })
|
|
40212
|
+
*
|
|
40213
|
+
* // Add value to cache
|
|
40214
|
+
* yield* Cache.get(cache, "hello")
|
|
40215
|
+
*
|
|
40216
|
+
* // Value exists before expiration
|
|
40217
|
+
* const beforeExpiry = yield* Cache.getOption(cache, "hello")
|
|
40218
|
+
*
|
|
40219
|
+
* // Simulate time passing
|
|
40220
|
+
* yield* TestClock.adjust("2 hours")
|
|
40221
|
+
*
|
|
40222
|
+
* // Value expired - returns None
|
|
40223
|
+
* const afterExpiry = yield* Cache.getOption(cache, "hello")
|
|
40224
|
+
* return [beforeExpiry, afterExpiry] as const
|
|
40225
|
+
* })
|
|
40226
|
+
*
|
|
40227
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
40228
|
+
* actual // => [Option.some(5), Option.none()]
|
|
40229
|
+
* ```
|
|
40230
|
+
*
|
|
40231
|
+
* **Example** (Waiting for pending lookups)
|
|
40232
|
+
*
|
|
40233
|
+
* ```ts import.meta.vitest
|
|
40234
|
+
* import { Cache, Deferred, Effect, Fiber, Option } from "effect"
|
|
40235
|
+
*
|
|
40236
|
+
* // Waits for ongoing computation to complete
|
|
40237
|
+
* const program = Effect.gen(function*() {
|
|
40238
|
+
* const deferred = yield* Deferred.make<void>()
|
|
40239
|
+
* const cache = yield* Cache.make({
|
|
40240
|
+
* capacity: 10,
|
|
40241
|
+
* lookup: (_key: string) => Deferred.await(deferred).pipe(Effect.as(42))
|
|
40242
|
+
* })
|
|
40243
|
+
*
|
|
40244
|
+
* // Start lookup in background
|
|
40245
|
+
* const getFiber = yield* Effect.forkChild(Cache.get(cache, "key"))
|
|
40246
|
+
*
|
|
40247
|
+
* // getOption waits for ongoing computation
|
|
40248
|
+
* const optionFiber = yield* Effect.forkChild(Cache.getOption(cache, "key"))
|
|
40249
|
+
*
|
|
40250
|
+
* // Complete the computation
|
|
40251
|
+
* yield* Deferred.succeed(deferred, void 0)
|
|
40252
|
+
*
|
|
40253
|
+
* const result = yield* Fiber.join(optionFiber)
|
|
40254
|
+
* const value = yield* Fiber.join(getFiber)
|
|
40255
|
+
* return [result, value] as const
|
|
40256
|
+
* })
|
|
40257
|
+
*
|
|
40258
|
+
* const actual = await Effect.runPromise(program)
|
|
40259
|
+
* actual // => [Option.some(42), 42]
|
|
40260
|
+
* ```
|
|
40261
|
+
*
|
|
40262
|
+
* @stability stable
|
|
40263
|
+
* @category combinators
|
|
40264
|
+
* @since 4.0.0
|
|
40265
|
+
*/
|
|
40266
|
+
const getOption = /*#__PURE__*/ dual(2, (self, key) => withFiber$1((fiber) => {
|
|
40267
|
+
const entry = getImpl(self, key, fiber);
|
|
40268
|
+
return entry ? asSome$1(entry.await(fiber)) : succeedNone$1;
|
|
40269
|
+
}));
|
|
40270
|
+
const getImpl = (self, key, fiber, isRead = true) => {
|
|
40271
|
+
const oentry = get$8(self.map, key);
|
|
40272
|
+
if (isNone(oentry)) return;
|
|
40273
|
+
else if (hasExpired(oentry.value, fiber)) {
|
|
40274
|
+
remove$6(self.map, key);
|
|
40275
|
+
return;
|
|
40276
|
+
} else if (isRead) {
|
|
40277
|
+
remove$6(self.map, key);
|
|
40278
|
+
set$4(self.map, key, oentry.value);
|
|
40279
|
+
}
|
|
40280
|
+
return oentry.value;
|
|
40281
|
+
};
|
|
40282
|
+
/**
|
|
40092
40283
|
* Sets the value associated with the specified key in the cache. This will
|
|
40093
40284
|
* overwrite any existing value for that key, skipping the lookup function.
|
|
40094
40285
|
*
|
|
@@ -47690,7 +47881,7 @@ function Array$1(value, pathOrOptions, options) {
|
|
|
47690
47881
|
const separator = resolvedOptions?.separator ?? ",";
|
|
47691
47882
|
return schema$1(Union([String$6.pipe(decodeTo(toCodecStringTree(array), {
|
|
47692
47883
|
decode: split(resolvedOptions),
|
|
47693
|
-
encode: compose(passthrough$1({ strict: false }), transform$
|
|
47884
|
+
encode: compose(passthrough$1({ strict: false }), transform$4((input) => input.join(separator)))
|
|
47694
47885
|
})), array]), hasPath ? pathOrOptions : void 0);
|
|
47695
47886
|
}
|
|
47696
47887
|
function Record(key, value, pathOrOptions, options) {
|
|
@@ -49943,11 +50134,10 @@ const setUnsafe = (self, value) => {
|
|
|
49943
50134
|
publishUnsafe(self.pubsub, value);
|
|
49944
50135
|
};
|
|
49945
50136
|
/**
|
|
49946
|
-
*
|
|
49947
|
-
*
|
|
49948
|
-
* change.
|
|
50137
|
+
* Updates the value of the `SubscriptionRef` with the result of applying an
|
|
50138
|
+
* effectful function, notifying subscribers of the change.
|
|
49949
50139
|
*
|
|
49950
|
-
* **Example** (
|
|
50140
|
+
* **Example** (Updating with an effect)
|
|
49951
50141
|
*
|
|
49952
50142
|
* ```ts import.meta.vitest
|
|
49953
50143
|
* import { Effect, SubscriptionRef } from "effect"
|
|
@@ -49955,25 +50145,19 @@ const setUnsafe = (self, value) => {
|
|
|
49955
50145
|
* const program = Effect.gen(function*() {
|
|
49956
50146
|
* const ref = yield* SubscriptionRef.make(10)
|
|
49957
50147
|
*
|
|
49958
|
-
*
|
|
49959
|
-
*
|
|
49960
|
-
*
|
|
49961
|
-
* )
|
|
49962
|
-
* const newValue = yield* SubscriptionRef.get(ref)
|
|
49963
|
-
* return [result, newValue]
|
|
50148
|
+
* yield* SubscriptionRef.updateEffect(ref, (n) => Effect.succeed(n + 5))
|
|
50149
|
+
*
|
|
50150
|
+
* return yield* SubscriptionRef.get(ref)
|
|
49964
50151
|
* })
|
|
49965
50152
|
*
|
|
49966
|
-
* await Effect.runPromise(program) // =>
|
|
50153
|
+
* await Effect.runPromise(program) // => 15
|
|
49967
50154
|
* ```
|
|
49968
50155
|
*
|
|
49969
50156
|
* @stability stable
|
|
49970
50157
|
* @category mutations
|
|
49971
50158
|
* @since 2.0.0
|
|
49972
50159
|
*/
|
|
49973
|
-
const
|
|
49974
|
-
setUnsafe(self, newValue);
|
|
49975
|
-
return b;
|
|
49976
|
-
}))));
|
|
50160
|
+
const updateEffect = /*#__PURE__*/ dual(2, (self, update) => self.semaphore.withPermit(suspend$2(() => map$5(update(self.value), (newValue) => setUnsafe(self, newValue)))));
|
|
49977
50161
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Terminal.js
|
|
49978
50162
|
const TypeId$22 = "~effect/Terminal";
|
|
49979
50163
|
const QuitErrorTypeId = "~effect/Terminal/QuitError";
|
|
@@ -53564,6 +53748,18 @@ const TypeId$13 = "~effect/http/HttpClient";
|
|
|
53564
53748
|
*/
|
|
53565
53749
|
const HttpClient = /*#__PURE__*/ Service$1("effect/HttpClient");
|
|
53566
53750
|
/**
|
|
53751
|
+
* Transforms a client by wrapping the response effect for each request.
|
|
53752
|
+
*
|
|
53753
|
+
* **Details**
|
|
53754
|
+
*
|
|
53755
|
+
* The transformation receives both the response effect and the original request, allowing it to change success, error, and environment behavior.
|
|
53756
|
+
*
|
|
53757
|
+
* @stability unstable
|
|
53758
|
+
* @category mapping
|
|
53759
|
+
* @since 4.0.0
|
|
53760
|
+
*/
|
|
53761
|
+
const transform$2 = /*#__PURE__*/ dual(2, (self, f) => makeWith(flatMap$2((request) => f(self.postprocess(succeed$5(request)), request)), self.preprocess));
|
|
53762
|
+
/**
|
|
53567
53763
|
* Transforms a client by applying an effectful transformation to each response effect.
|
|
53568
53764
|
*
|
|
53569
53765
|
* @stability unstable
|
|
@@ -53717,6 +53913,77 @@ const retryTransient = /*#__PURE__*/ dual(2, (self, options) => {
|
|
|
53717
53913
|
times
|
|
53718
53914
|
})));
|
|
53719
53915
|
});
|
|
53916
|
+
/**
|
|
53917
|
+
* Fails requests that do not receive a response within the given duration.
|
|
53918
|
+
*
|
|
53919
|
+
* **When to use**
|
|
53920
|
+
*
|
|
53921
|
+
* Use to configure a timeout once on the client, for example when providing
|
|
53922
|
+
* the `HttpClient` service, while keeping the standard `HttpClientError` error
|
|
53923
|
+
* model.
|
|
53924
|
+
*
|
|
53925
|
+
* **Details**
|
|
53926
|
+
*
|
|
53927
|
+
* A timed out request is interrupted and fails with an `HttpClientError` whose
|
|
53928
|
+
* reason is a `TransportError` with a `Cause.TimeoutError` cause.
|
|
53929
|
+
* `retryTransient` treats it as transient. Interrupting a request aborts the
|
|
53930
|
+
* underlying transport, unless the request is attached to a scope with
|
|
53931
|
+
* `withScope`, in which case it stays open until the scope closes.
|
|
53932
|
+
*
|
|
53933
|
+
* The timer starts after request preprocessing and covers everything the
|
|
53934
|
+
* wrapped client does to produce a response. For a plain client this ends when
|
|
53935
|
+
* the response headers arrive, but response middleware applied before
|
|
53936
|
+
* `timeout`, such as `tap` or `retryTransient`, runs inside the budget,
|
|
53937
|
+
* including any body reads it performs. Composition order therefore decides
|
|
53938
|
+
* how it interacts with retries: applying `timeout` before `retryTransient`
|
|
53939
|
+
* gives each attempt its own budget, while applying it after bounds the whole
|
|
53940
|
+
* retry loop.
|
|
53941
|
+
*
|
|
53942
|
+
* **Gotchas**
|
|
53943
|
+
*
|
|
53944
|
+
* Body reads outside the timed client are not covered, including those made
|
|
53945
|
+
* by response middleware applied after `timeout` and by consumers of the
|
|
53946
|
+
* `HttpClient` service. Apply a separate timeout to body reads such as
|
|
53947
|
+
* `response.json` or `response.stream` when needed.
|
|
53948
|
+
*
|
|
53949
|
+
* **Example** (Timing out each attempt)
|
|
53950
|
+
*
|
|
53951
|
+
* ```ts
|
|
53952
|
+
* import { Effect, Layer } from "effect"
|
|
53953
|
+
* import { FetchHttpClient, HttpClient } from "effect/http"
|
|
53954
|
+
*
|
|
53955
|
+
* const TimedHttpClient = Layer.effect(
|
|
53956
|
+
* HttpClient.HttpClient,
|
|
53957
|
+
* Effect.map(
|
|
53958
|
+
* HttpClient.HttpClient,
|
|
53959
|
+
* HttpClient.timeout("5 seconds")
|
|
53960
|
+
* )
|
|
53961
|
+
* ).pipe(Layer.provide(FetchHttpClient.layer))
|
|
53962
|
+
*
|
|
53963
|
+
* const program = Effect.gen(function*() {
|
|
53964
|
+
* const client = (yield* HttpClient.HttpClient).pipe(
|
|
53965
|
+
* HttpClient.retryTransient({ times: 3 })
|
|
53966
|
+
* )
|
|
53967
|
+
* return yield* client.get("https://example.com")
|
|
53968
|
+
* }).pipe(Effect.provide(TimedHttpClient))
|
|
53969
|
+
* ```
|
|
53970
|
+
*
|
|
53971
|
+
* @stability unstable
|
|
53972
|
+
* @category error handling
|
|
53973
|
+
* @since 4.1.0
|
|
53974
|
+
*/
|
|
53975
|
+
const timeout = /*#__PURE__*/ dual(2, (self, duration) => {
|
|
53976
|
+
const decoded = fromInputUnsafe$1(duration);
|
|
53977
|
+
const description = `timed out after ${format$3(decoded)}`;
|
|
53978
|
+
return transform$2(self, (effect, request) => timeoutOrElse(effect, {
|
|
53979
|
+
duration: decoded,
|
|
53980
|
+
orElse: () => fail$6(new HttpClientError({ reason: new TransportError({
|
|
53981
|
+
request,
|
|
53982
|
+
cause: new TimeoutError(`Operation ${description}`),
|
|
53983
|
+
description
|
|
53984
|
+
}) }))
|
|
53985
|
+
}));
|
|
53986
|
+
});
|
|
53720
53987
|
const parseRetryAfter = (nowMillis, value) => {
|
|
53721
53988
|
if (value === void 0) return;
|
|
53722
53989
|
const retryAfter = parseRetryAfter$1(value);
|
|
@@ -58756,7 +59023,7 @@ function withCycleGuard(target) {
|
|
|
58756
59023
|
return decodeTo(declareConstructor()([type], ([type]) => (input, ast, options) => {
|
|
58757
59024
|
if (isObjectOrArray(input) && decoded.delete(input)) return succeed$5(input);
|
|
58758
59025
|
return isCyclic(input) ? fail$6(new InvalidType(ast, input, options)) : decodeUnknownEffect$1(type)(input, options);
|
|
58759
|
-
}, { identifier: "acyclic value" }), transform$
|
|
59026
|
+
}, { identifier: "acyclic value" }), transform$3({
|
|
58760
59027
|
decode: (value) => {
|
|
58761
59028
|
if (isObjectOrArray(value)) decoded.add(value);
|
|
58762
59029
|
return value;
|
|
@@ -59304,7 +59571,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
59304
59571
|
interruptors
|
|
59305
59572
|
},
|
|
59306
59573
|
context
|
|
59307
|
-
}).pipe(timeout(1e3), runForkWith(parentFiber.context)).addObserver(() => {
|
|
59574
|
+
}).pipe(timeout$1(1e3), runForkWith(parentFiber.context)).addObserver(() => {
|
|
59308
59575
|
resume(void_$1);
|
|
59309
59576
|
});
|
|
59310
59577
|
});
|
|
@@ -59741,20 +60008,6 @@ const Service = () => (id, options) => {
|
|
|
59741
60008
|
ServiceClass_.requiredForClient = options?.requiredForClient ?? false;
|
|
59742
60009
|
return ServiceClass;
|
|
59743
60010
|
};
|
|
59744
|
-
/**
|
|
59745
|
-
* Provides the client-side implementation for an RPC middleware service,
|
|
59746
|
-
* capturing the layer's environment and merging it into each middleware
|
|
59747
|
-
* invocation.
|
|
59748
|
-
*
|
|
59749
|
-
* @stability unstable
|
|
59750
|
-
* @category layers
|
|
59751
|
-
* @since 4.0.0
|
|
59752
|
-
*/
|
|
59753
|
-
const layerClient = (tag, service) => effectContext(gen(function* () {
|
|
59754
|
-
const services = (yield* context()).pipe(omit$3(Scope));
|
|
59755
|
-
const middleware = isEffect(service) ? yield* service : service;
|
|
59756
|
-
return makeUnsafe$9(/* @__PURE__ */ new Map([[`${tag.key}/Client`, (options) => updateContext(middleware(options), (requestContext) => merge$5(services, requestContext))]]));
|
|
59757
|
-
}));
|
|
59758
60011
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/ai/McpSchema.js
|
|
59759
60012
|
/**
|
|
59760
60013
|
* Defines schemas for Model Context Protocol messages.
|
|
@@ -72048,7 +72301,7 @@ const registerToolkit = /*#__PURE__*/ fnUntraced(function* (toolkit) {
|
|
|
72048
72301
|
inputSchema,
|
|
72049
72302
|
outputSchema,
|
|
72050
72303
|
annotations: {
|
|
72051
|
-
...getOption(tool.annotations, Title).pipe(map$11((title) => ({ title })), getOrUndefined$1),
|
|
72304
|
+
...getOption$1(tool.annotations, Title).pipe(map$11((title) => ({ title })), getOrUndefined$1),
|
|
72052
72305
|
readOnlyHint: get$10(tool.annotations, Readonly),
|
|
72053
72306
|
destructiveHint: get$10(tool.annotations, Destructive),
|
|
72054
72307
|
idempotentHint: get$10(tool.annotations, Idempotent),
|
|
@@ -87550,7 +87803,7 @@ const Port = String$6.check(isPattern(/^\d{1,5}$/u), makeFilter((value) => exist
|
|
|
87550
87803
|
const AppVersion = String$6.check(isPattern(/^0\.1\.\d+$/u));
|
|
87551
87804
|
const RUNTIME_PATH = "/api/runtime";
|
|
87552
87805
|
const RuntimeConfig = Struct({
|
|
87553
|
-
auth: optionalKey(
|
|
87806
|
+
auth: optionalKey(Origin),
|
|
87554
87807
|
name: String$6,
|
|
87555
87808
|
traces: String$6,
|
|
87556
87809
|
version: AppVersion
|
|
@@ -88252,8 +88505,9 @@ const SpanKind = {
|
|
|
88252
88505
|
};
|
|
88253
88506
|
// ../../packages/runtime/src/telemetry.ts
|
|
88254
88507
|
function layerOtlp(serviceName, url, runtime, version) {
|
|
88255
|
-
return unwrap$7(gen(function* () {
|
|
88508
|
+
return pipe$1(unwrap$7(gen(function* () {
|
|
88256
88509
|
const start = `${yield* currentTimeNanos}`;
|
|
88510
|
+
const redacted = yield* CurrentRedactedNames;
|
|
88257
88511
|
const resource = {
|
|
88258
88512
|
attributes: {
|
|
88259
88513
|
"scope.run.started_unix_nano": start,
|
|
@@ -88264,14 +88518,28 @@ function layerOtlp(serviceName, url, runtime, version) {
|
|
|
88264
88518
|
serviceVersion: getOrUndefined$1(liftPredicate(version, (current) => current !== "0.1.0"))
|
|
88265
88519
|
};
|
|
88266
88520
|
return pipe$1(mergeAll$1(layer({
|
|
88267
|
-
exportInterval: "250 millis",
|
|
88268
88521
|
resource,
|
|
88269
88522
|
url: new URL("/v1/traces", url).href
|
|
88270
88523
|
}), layer$1({
|
|
88271
|
-
exportInterval: "250 millis",
|
|
88272
88524
|
resource,
|
|
88273
88525
|
url: new URL("/v1/logs", url).href
|
|
88274
|
-
})
|
|
88526
|
+
}), succeed$6(CurrentRedactedNames)([
|
|
88527
|
+
...redacted,
|
|
88528
|
+
"code",
|
|
88529
|
+
"state",
|
|
88530
|
+
"request",
|
|
88531
|
+
"access_token",
|
|
88532
|
+
"refresh_token",
|
|
88533
|
+
"id_token",
|
|
88534
|
+
"client_secret",
|
|
88535
|
+
"client_assertion",
|
|
88536
|
+
"code_verifier",
|
|
88537
|
+
"session",
|
|
88538
|
+
"token"
|
|
88539
|
+
])), provide$2([layerJson, layer$12]));
|
|
88540
|
+
})), catchCause$3((cause) => {
|
|
88541
|
+
if (hasInterrupts$1(cause)) return effectDiscard(interrupt$1);
|
|
88542
|
+
return effectDiscard(logWarning("Telemetry is unavailable"));
|
|
88275
88543
|
}));
|
|
88276
88544
|
}
|
|
88277
88545
|
// ../../packages/runtime/src/auth/lib/utils.ts
|
|
@@ -88295,15 +88563,15 @@ function isAdmin(admins, id) {
|
|
|
88295
88563
|
function signInUrl(next) {
|
|
88296
88564
|
return `${new URL(next).origin}/auth/sign-in?${new URLSearchParams({ next })}`;
|
|
88297
88565
|
}
|
|
88566
|
+
function failureOptions(error, status) {
|
|
88567
|
+
if (is$2(AuthError)(error) && error.error === "temporarily_unavailable") return {
|
|
88568
|
+
headers: { "retry-after": "5" },
|
|
88569
|
+
status: 503
|
|
88570
|
+
};
|
|
88571
|
+
return { status };
|
|
88572
|
+
}
|
|
88298
88573
|
var CurrentUser = class extends Service$1()("@deslop/runtime/auth/lib/utils/CurrentUser") {};
|
|
88299
|
-
var RpcAuth = class
|
|
88300
|
-
static layerClient = (token) => layerClient(RpcAuth, (options) => gen(function* () {
|
|
88301
|
-
return yield* options.next({
|
|
88302
|
-
...options.request,
|
|
88303
|
-
headers: set$2(options.request.headers, "authorization", `Bearer ${yield* token}`)
|
|
88304
|
-
});
|
|
88305
|
-
}));
|
|
88306
|
-
};
|
|
88574
|
+
var RpcAuth = class extends Service()("@deslop/runtime/auth/lib/utils/RpcAuth", { error: AuthError }) {};
|
|
88307
88575
|
// ../../packages/runtime/src/auth/service.ts
|
|
88308
88576
|
function rejected$1(message) {
|
|
88309
88577
|
return mapError$2((cause) => {
|
|
@@ -88327,7 +88595,10 @@ const unavailable = text("The authorization service is temporarily unavailable;
|
|
|
88327
88595
|
status: 503
|
|
88328
88596
|
});
|
|
88329
88597
|
var Auth = class Auth extends Service$1()("@deslop/runtime/auth/service/Auth") {
|
|
88330
|
-
static makeContext = (auth) => pipe$1(make$82(Auth, auth), add$1(RpcAuth, RpcAuth.of((effect, request) => pipe$1(auth.user(request.headers),
|
|
88598
|
+
static makeContext = (auth) => pipe$1(make$82(Auth, auth), add$1(RpcAuth, RpcAuth.of((effect, request) => pipe$1(auth.user(request.headers), tap$1(() => {
|
|
88599
|
+
if (isStreamSchema(request.rpc.successSchema)) return annotateCurrentSpan("rpc.stream", true);
|
|
88600
|
+
return void_$1;
|
|
88601
|
+
}), flatMap$2((user) => raceFirst(provideService(effect, CurrentUser, user), pipe$1(delay(auth.user(request.headers), "5 minutes"), retry({ while: (error) => error.error === "temporarily_unavailable" }), forever)))))));
|
|
88331
88602
|
static layer = effectContext(gen(function* () {
|
|
88332
88603
|
if (yield* localAuth) return Auth.makeContext(Auth.of({
|
|
88333
88604
|
access: developer,
|
|
@@ -88340,13 +88611,13 @@ var Auth = class Auth extends Service$1()("@deslop/runtime/auth/service/Auth") {
|
|
|
88340
88611
|
return yield* pipe$1(client.get(new URL(VERIFY_PATH, issuer).href, {
|
|
88341
88612
|
headers: { authorization: headers["authorization"] ?? "" },
|
|
88342
88613
|
urlParams: { resource: audience }
|
|
88343
|
-
}), flatMap$2(schemaBodyJson(User)), timeout("10 seconds"));
|
|
88614
|
+
}), flatMap$2(schemaBodyJson(User)), timeout$1("10 seconds"));
|
|
88344
88615
|
}, rejected$1("Sign in first"));
|
|
88345
88616
|
return Auth.makeContext(Auth.of({
|
|
88346
88617
|
access,
|
|
88347
88618
|
user: fn("Auth.user")(function* (headers) {
|
|
88348
88619
|
if (isSome(get$6(headers, "authorization"))) return yield* access(headers, canonical);
|
|
88349
|
-
return yield* pipe$1(client.get(new URL(SESSION_PATH, issuer).href, { headers: { cookie: headers["cookie"] ?? "" } }), flatMap$2(schemaBodyJson(User)), timeout("10 seconds"));
|
|
88620
|
+
return yield* pipe$1(client.get(new URL(SESSION_PATH, issuer).href, { headers: { cookie: headers["cookie"] ?? "" } }), flatMap$2(schemaBodyJson(User)), timeout$1("10 seconds"));
|
|
88350
88621
|
}, rejected$1("Sign in first"))
|
|
88351
88622
|
}));
|
|
88352
88623
|
}));
|
|
@@ -88416,7 +88687,7 @@ const dataDirectory = gen(function* () {
|
|
|
88416
88687
|
});
|
|
88417
88688
|
return directory;
|
|
88418
88689
|
});
|
|
88419
|
-
fnUntraced(function* (name) {
|
|
88690
|
+
const tool = fnUntraced(function* (name) {
|
|
88420
88691
|
const fs = yield* FileSystem;
|
|
88421
88692
|
const path = yield* Path$1;
|
|
88422
88693
|
const version = (yield* packageMetadata).version;
|
|
@@ -88433,6 +88704,9 @@ fnUntraced(function* (name) {
|
|
|
88433
88704
|
yield* forEach$1(filter$5(yield* fs.readDirectory(tools), (entry) => entry !== version), (entry) => fs.remove(path.join(tools, entry), { recursive: true }), { concurrency: 1 });
|
|
88434
88705
|
return target;
|
|
88435
88706
|
});
|
|
88707
|
+
var ToolPath = class extends Service$1()("@deslop/runtime/server/ToolPath") {
|
|
88708
|
+
static layer = succeed$6(this, tool);
|
|
88709
|
+
};
|
|
88436
88710
|
const guard = make$21((app) => gen(function* () {
|
|
88437
88711
|
const request = yield* HttpServerRequest;
|
|
88438
88712
|
const host = request.headers["host"] ?? "";
|
|
@@ -88466,7 +88740,7 @@ function layerKeyValueStore(directory) {
|
|
|
88466
88740
|
return pipe$1(gen(function* () {
|
|
88467
88741
|
if (isString$1(value)) yield* fs.writeFileString(`${target}.tmp`, value, { mode: 384 });
|
|
88468
88742
|
else yield* fs.writeFile(`${target}.tmp`, value, { mode: 384 });
|
|
88469
|
-
}), andThen(fs.rename(`${target}.tmp`, target)), withPermit(writes),
|
|
88743
|
+
}), andThen(fs.rename(`${target}.tmp`, target)), uninterruptible, withPermit(writes), mapError$2((cause) => new KeyValueStoreError({
|
|
88470
88744
|
cause,
|
|
88471
88745
|
key,
|
|
88472
88746
|
message: "Cannot save the value",
|
|
@@ -88477,7 +88751,15 @@ function layerKeyValueStore(directory) {
|
|
|
88477
88751
|
})), provide$2(layerFileSystem(directory)));
|
|
88478
88752
|
}
|
|
88479
88753
|
const layerDataStore = unwrap$7(map$5(dataDirectory, layerKeyValueStore));
|
|
88480
|
-
const layerProtocol = mergeAll$1(layerSchemaBinary(), succeed$6(MaxBodySize)(mebibytes(10)))
|
|
88754
|
+
const layerProtocol = mergeAll$1(layerSchemaBinary(), succeed$6(MaxBodySize)(mebibytes(10)), effect(TracerDisabledWhen, map$5(TracerDisabledWhen, (previous) => (request) => {
|
|
88755
|
+
const path = headNonEmpty(split$1(request.url, "?"));
|
|
88756
|
+
return previous(request) || path === "/api/rpc" && toLowerCase(request.headers["upgrade"] ?? "") === "websocket" || startsWith("/assets/")(path) || contains$1([
|
|
88757
|
+
"/icon",
|
|
88758
|
+
"/favicon.ico",
|
|
88759
|
+
"/apple-touch-icon.png",
|
|
88760
|
+
"/manifest.webmanifest"
|
|
88761
|
+
], path);
|
|
88762
|
+
})));
|
|
88481
88763
|
const layerTelemetry = unwrap$7(gen(function* () {
|
|
88482
88764
|
const metadata = yield* packageMetadata;
|
|
88483
88765
|
return match$8(yield* option(String$5("OTEL_URL")), {
|
|
@@ -88490,6 +88772,7 @@ const layerRoutes = use((router) => gen(function* () {
|
|
|
88490
88772
|
const canonical = new URL(yield* String$5("APP_URL")).origin;
|
|
88491
88773
|
const issuer = yield* option(String$5("AUTH_URL"));
|
|
88492
88774
|
const traces = yield* pipe$1(String$5("OTEL_URL"), withDefault$2(""));
|
|
88775
|
+
const metadata = yield* cached$1(packageMetadata);
|
|
88493
88776
|
const toIssuer = fnUntraced(function* (search) {
|
|
88494
88777
|
const request = yield* HttpServerRequest;
|
|
88495
88778
|
const next = filter$7(liftThrowable(() => new URL(new URL(request.url, canonical).searchParams.get("next") ?? canonical, canonical))(), (url) => url.origin === canonical);
|
|
@@ -88505,21 +88788,22 @@ const layerRoutes = use((router) => gen(function* () {
|
|
|
88505
88788
|
});
|
|
88506
88789
|
});
|
|
88507
88790
|
yield* router.add("GET", RUNTIME_PATH, gen(function* () {
|
|
88791
|
+
const release = yield* metadata;
|
|
88508
88792
|
return yield* schemaJson(RuntimeConfig)({
|
|
88509
88793
|
...match$8(issuer, {
|
|
88510
88794
|
onNone: () => ({}),
|
|
88511
88795
|
onSome: (origin) => ({ auth: origin })
|
|
88512
88796
|
}),
|
|
88513
|
-
name:
|
|
88797
|
+
name: replace("@deslop/", "")(release.name),
|
|
88514
88798
|
traces,
|
|
88515
|
-
version:
|
|
88799
|
+
version: release.version
|
|
88516
88800
|
});
|
|
88517
88801
|
}));
|
|
88518
88802
|
yield* router.add("GET", "/auth/sign-in", toIssuer({}));
|
|
88519
88803
|
yield* router.add("GET", "/auth/sign-out", toIssuer({ "sign-out": "" }));
|
|
88520
88804
|
yield* router.add("GET", "/auth/user", gen(function* () {
|
|
88521
88805
|
const user = yield* result$1(auth.user((yield* HttpServerRequest).headers));
|
|
88522
|
-
if (isFailure$1(user)) return empty(
|
|
88806
|
+
if (isFailure$1(user)) return empty(failureOptions(user.failure, 401));
|
|
88523
88807
|
return yield* schemaJson(Account)({
|
|
88524
88808
|
...user.success,
|
|
88525
88809
|
signOut: isSome(issuer)
|
|
@@ -88528,14 +88812,14 @@ const layerRoutes = use((router) => gen(function* () {
|
|
|
88528
88812
|
}));
|
|
88529
88813
|
const layerAnnounce = effectDiscard(gen(function* () {
|
|
88530
88814
|
const origin = new URL(yield* String$5("APP_URL")).origin;
|
|
88531
|
-
const client =
|
|
88815
|
+
const client = pipe$1(yield* HttpClient, filterStatusOk, timeout("10 seconds"), retryTransient({
|
|
88816
|
+
schedule: spaced("1 minute"),
|
|
88817
|
+
times: 60
|
|
88818
|
+
}));
|
|
88532
88819
|
yield* match$8(yield* option(String$5("AUTH_URL")), {
|
|
88533
88820
|
onNone: () => void_$1,
|
|
88534
88821
|
onSome: fnUntraced(function* (issuer) {
|
|
88535
|
-
yield* pipe$1(post(new URL(APPS_PATH, issuer).href), bodyJsonUnsafe({ origin }), client.execute, delay("2 seconds"),
|
|
88536
|
-
schedule: spaced("1 minute"),
|
|
88537
|
-
times: 60
|
|
88538
|
-
}), ignore$1({
|
|
88822
|
+
yield* pipe$1(post(new URL(APPS_PATH, issuer).href), bodyJsonUnsafe({ origin }), client.execute, delay("2 seconds"), ignore$1({
|
|
88539
88823
|
log: "Warn",
|
|
88540
88824
|
message: "Auth did not list this app"
|
|
88541
88825
|
}), forkScoped);
|
|
@@ -88554,11 +88838,10 @@ const layerWeb = unwrap$7(gen(function* () {
|
|
|
88554
88838
|
if (!(yield* (yield* FileSystem).exists((yield* Path$1).join(client, "index.html")))) return empty$12;
|
|
88555
88839
|
const name = capitalize(yield* appName);
|
|
88556
88840
|
return mergeAll$1(add("GET", MANIFEST_PATH, succeed$5(jsonUnsafe({
|
|
88557
|
-
background_color: "#
|
|
88841
|
+
background_color: "#0d0c0c",
|
|
88558
88842
|
display: "standalone",
|
|
88559
88843
|
icons: [{
|
|
88560
88844
|
purpose: "any",
|
|
88561
|
-
sizes: "512x512",
|
|
88562
88845
|
src: "/apple-touch-icon.png",
|
|
88563
88846
|
type: "image/png"
|
|
88564
88847
|
}],
|
|
@@ -88567,7 +88850,7 @@ const layerWeb = unwrap$7(gen(function* () {
|
|
|
88567
88850
|
scope: "/",
|
|
88568
88851
|
short_name: name,
|
|
88569
88852
|
start_url: "/",
|
|
88570
|
-
theme_color: "#
|
|
88853
|
+
theme_color: "#0d0c0c"
|
|
88571
88854
|
}, {
|
|
88572
88855
|
contentType: "application/manifest+json",
|
|
88573
88856
|
headers: { "cache-control": "no-cache" }
|
|
@@ -88607,7 +88890,7 @@ function layerMcp(options) {
|
|
|
88607
88890
|
v2025_11_25,
|
|
88608
88891
|
v2025_06_18
|
|
88609
88892
|
],
|
|
88610
|
-
registrations:
|
|
88893
|
+
registrations: options.registrations,
|
|
88611
88894
|
version: metadata.version
|
|
88612
88895
|
}), provide$2(layerMcpAuth(resource)));
|
|
88613
88896
|
return match$8(issuer, {
|
|
@@ -88647,7 +88930,7 @@ const execute = fnUntraced(function* (command, args) {
|
|
|
88647
88930
|
}, { concurrency: "unbounded" });
|
|
88648
88931
|
if (result.code !== 0) return yield* AppError.make({ message: `${command} failed: ${result.stderr}` });
|
|
88649
88932
|
return result.stdout;
|
|
88650
|
-
});
|
|
88933
|
+
}, scoped);
|
|
88651
88934
|
function systemctl(...args) {
|
|
88652
88935
|
return execute("systemctl", ["--user", ...args]);
|
|
88653
88936
|
}
|
|
@@ -88697,7 +88980,7 @@ function status(name) {
|
|
|
88697
88980
|
return systemctl("show", `deslop-${name}.service`, "--property=LoadState,ActiveState,SubState,MainPID");
|
|
88698
88981
|
}
|
|
88699
88982
|
function restart(name) {
|
|
88700
|
-
return pipe$1(systemctl("restart", `deslop-${name}.service`), timeout("30 seconds"));
|
|
88983
|
+
return pipe$1(systemctl("restart", `deslop-${name}.service`), timeout$1("30 seconds"));
|
|
88701
88984
|
}
|
|
88702
88985
|
// ../../packages/runtime/src/cli/update.ts
|
|
88703
88986
|
const serviceDirectory = fnUntraced(function* (name) {
|
|
@@ -88721,7 +89004,7 @@ const update = fnUntraced(function* (name) {
|
|
|
88721
89004
|
const path = yield* Path$1;
|
|
88722
89005
|
const root = yield* serviceDirectory(name);
|
|
88723
89006
|
const running = (yield* decodeEffect(fromJsonString(Struct({ version: AppVersion })))(yield* fs.readFileString(path.join(root, "current", "package.json")))).version;
|
|
88724
|
-
const latest = (yield* pipe$1(filterStatusOk(yield* HttpClient).get(`https://registry.npmjs.org/@deslop%2f${name}/latest`), flatMap$2(schemaBodyJson(Struct({ version: AppVersion }))), timeout("15 seconds"))).version;
|
|
89007
|
+
const latest = (yield* pipe$1(filterStatusOk(yield* HttpClient).get(`https://registry.npmjs.org/@deslop%2f${name}/latest`), flatMap$2(schemaBodyJson(Struct({ version: AppVersion }))), timeout$1("15 seconds"))).version;
|
|
88725
89008
|
if (latest === running) return `${name} ${running} is current\n`;
|
|
88726
89009
|
const npm = path.resolve(path.dirname(execPath), "../lib/node_modules/npm/bin/npm-cli.js");
|
|
88727
89010
|
if (!(yield* fs.exists(npm))) return yield* AppError.make({ message: "This Node runtime does not include npm; install Node with Vite+" });
|
|
@@ -88738,7 +89021,7 @@ const update = fnUntraced(function* (name) {
|
|
|
88738
89021
|
"--prefer-online",
|
|
88739
89022
|
"--registry=https://registry.npmjs.org",
|
|
88740
89023
|
`@deslop/${name}@${latest}`
|
|
88741
|
-
]), timeout("5 minutes"));
|
|
89024
|
+
]), timeout$1("5 minutes"));
|
|
88742
89025
|
const previous = yield* option$1(fs.readLink(path.join(root, "current")));
|
|
88743
89026
|
yield* activate(name, path.join(directory, "node_modules", "@deslop", name));
|
|
88744
89027
|
yield* restart(name);
|
|
@@ -88747,6 +89030,7 @@ const update = fnUntraced(function* (name) {
|
|
|
88747
89030
|
return `Updated ${name} from ${running} to ${latest}\n`;
|
|
88748
89031
|
});
|
|
88749
89032
|
// ../../packages/runtime/src/cli.ts
|
|
89033
|
+
const DEFAULT_HOST = "127.0.0.1";
|
|
88750
89034
|
const SETTINGS = {
|
|
88751
89035
|
APP_URL: {
|
|
88752
89036
|
description: "Canonical origin, such as the HTTPS name a proxy serves",
|
|
@@ -88759,7 +89043,7 @@ const SETTINGS = {
|
|
|
88759
89043
|
schema: SecureOrigin
|
|
88760
89044
|
},
|
|
88761
89045
|
HOST: {
|
|
88762
|
-
description:
|
|
89046
|
+
description: `Listen address; defaults to ${DEFAULT_HOST}`,
|
|
88763
89047
|
flag: "host",
|
|
88764
89048
|
schema: NonEmptyString
|
|
88765
89049
|
},
|
|
@@ -88767,11 +89051,6 @@ const SETTINGS = {
|
|
|
88767
89051
|
description: "Scope origin to export traces and logs to",
|
|
88768
89052
|
flag: "traces",
|
|
88769
89053
|
schema: Origin
|
|
88770
|
-
},
|
|
88771
|
-
PORT: {
|
|
88772
|
-
description: "Listen port; defaults to the package's config.port",
|
|
88773
|
-
flag: "port",
|
|
88774
|
-
schema: Port
|
|
88775
89054
|
}
|
|
88776
89055
|
};
|
|
88777
89056
|
const ADMINS = {
|
|
@@ -88780,14 +89059,14 @@ const ADMINS = {
|
|
|
88780
89059
|
schema: String$6.check(isPattern(/^\d+(?:,\d+)*$/u))
|
|
88781
89060
|
};
|
|
88782
89061
|
function flagsOf(settings) {
|
|
88783
|
-
return map$9(settings, (setting, key) => pipe$1(String$1(setting.flag), withSchema(setting.schema), withFallbackConfig(schema$1(setting.schema, key)), withDescription(setting.description), optional$1));
|
|
89062
|
+
return map$9(settings, (setting, key) => pipe$1(String$1(setting.flag), withSchema(setting.schema), withFallbackConfig(schema$1(setting.schema, key)), withDescription(`${setting.description} [${key}]`), optional$1));
|
|
88784
89063
|
}
|
|
88785
|
-
const provider = fnUntraced(function* (given) {
|
|
88786
|
-
const port = given["PORT"] ?? `${
|
|
89064
|
+
const provider = fnUntraced(function* (given, defaultPort) {
|
|
89065
|
+
const port = given["PORT"] ?? `${defaultPort}`;
|
|
88787
89066
|
const url = given["APP_URL"] ?? `http://localhost:${port}`;
|
|
88788
89067
|
if (given["AUTH_URL"] !== void 0 && new URL(url).protocol !== "https:") return yield* AppError.make({ message: "With --auth, set --url to the app's HTTPS origin" });
|
|
88789
89068
|
return orElse$2(fromUnknown({
|
|
88790
|
-
HOST:
|
|
89069
|
+
HOST: DEFAULT_HOST,
|
|
88791
89070
|
...given,
|
|
88792
89071
|
APP_URL: url,
|
|
88793
89072
|
PORT: port
|
|
@@ -88795,9 +89074,12 @@ const provider = fnUntraced(function* (given) {
|
|
|
88795
89074
|
});
|
|
88796
89075
|
const layerPlatform = mergeAll$1(layer$4, layer$12, layer$15);
|
|
88797
89076
|
function server(app) {
|
|
88798
|
-
return pipe$1(serve(pipe$1(mergeAll$1(app.routes, layerRoutes, layerIcon(app.icon), layerWeb, layerAnnounce), provide$2(
|
|
89077
|
+
return pipe$1(serve(pipe$1(mergeAll$1(app.routes, layerRoutes, layerIcon(app.icon), layerWeb, layerAnnounce), provide$2(match$8(fromUndefinedOr(app.middleware), {
|
|
89078
|
+
onNone: () => empty$12,
|
|
89079
|
+
onSome: (middleware$1) => middleware()(middleware$1).layer
|
|
89080
|
+
})), provide$2(Auth.layer)), {
|
|
88799
89081
|
disableLogger: true,
|
|
88800
|
-
middleware:
|
|
89082
|
+
middleware: guard
|
|
88801
89083
|
}), provide$2(mergeAll$1(layerProtocol, match$1(app.telemetry === false, {
|
|
88802
89084
|
onFalse: () => layerTelemetry,
|
|
88803
89085
|
onTrue: () => empty$12
|
|
@@ -88807,21 +89089,26 @@ function output(text) {
|
|
|
88807
89089
|
return flatMap$2(Stdio, (stdio) => run$4(make$51(text), stdio.stdout()));
|
|
88808
89090
|
}
|
|
88809
89091
|
function runApp(app) {
|
|
88810
|
-
const settings = {
|
|
88811
|
-
...SETTINGS,
|
|
88812
|
-
...app.settings
|
|
88813
|
-
};
|
|
88814
89092
|
const program = gen(function* () {
|
|
88815
89093
|
const metadata = yield* packageMetadata;
|
|
88816
89094
|
const name = yield* appName;
|
|
89095
|
+
const settings = {
|
|
89096
|
+
...SETTINGS,
|
|
89097
|
+
PORT: {
|
|
89098
|
+
description: `Listen port; defaults to ${metadata.config.port}`,
|
|
89099
|
+
flag: "port",
|
|
89100
|
+
schema: Port
|
|
89101
|
+
},
|
|
89102
|
+
...app.settings
|
|
89103
|
+
};
|
|
88817
89104
|
const root = pipe$1(make$5(name), withSharedFlags(flagsOf(settings)));
|
|
88818
89105
|
const given = map$5(root, (input) => getSomes$1(input));
|
|
88819
|
-
return yield* pipe$1(root, withHandler((input) => flatMap$2(provider(getSomes$1(input)), (values) => provideService(server(app), ConfigProvider, values))), withSubcommands([pipe$1(make$5("service"), withSubcommands([
|
|
89106
|
+
return yield* pipe$1(root, withHandler((input) => flatMap$2(provider(getSomes$1(input), metadata.config.port), (values) => provideService(server(app), ConfigProvider, values))), withSubcommands([pipe$1(make$5("service"), withSubcommands([
|
|
88820
89107
|
make$5("install", {}, fnUntraced(function* () {
|
|
88821
89108
|
const fs = yield* FileSystem;
|
|
88822
89109
|
const path = yield* Path$1;
|
|
88823
89110
|
const flags = yield* given;
|
|
88824
|
-
yield* provider(flags);
|
|
89111
|
+
yield* provider(flags, metadata.config.port);
|
|
88825
89112
|
const entry = path.join(yield* activate(name, yield* fs.realPath(packageRoot)), "dist", "server.js");
|
|
88826
89113
|
const args = flatten$3(collect$1(flags, (key, value) => [`--${settings[key]?.flag ?? key}`, value]));
|
|
88827
89114
|
yield* output(yield* install(name, [
|
|
@@ -115416,12 +115703,14 @@ const ServerUrl = NonEmptyString.check(isMaxLength(2048), makeFilter((value) =>
|
|
|
115416
115703
|
const AddServer = Struct({ url: ServerUrl });
|
|
115417
115704
|
const ServerParams = Struct({ id: ServerId });
|
|
115418
115705
|
const Metadata = Struct({
|
|
115419
|
-
authorization_endpoint:
|
|
115706
|
+
authorization_endpoint: ServerUrl,
|
|
115420
115707
|
authorization_response_iss_parameter_supported: optionalKey(Boolean$5),
|
|
115421
115708
|
client_id_metadata_document_supported: optionalKey(Boolean$5),
|
|
115422
|
-
|
|
115423
|
-
|
|
115424
|
-
|
|
115709
|
+
code_challenge_methods_supported: optionalKey(ArraySchema(String$6)),
|
|
115710
|
+
issuer: ServerUrl,
|
|
115711
|
+
registration_endpoint: optionalKey(ServerUrl),
|
|
115712
|
+
response_types_supported: optionalKey(ArraySchema(String$6)),
|
|
115713
|
+
token_endpoint: ServerUrl
|
|
115425
115714
|
});
|
|
115426
115715
|
const Registration = Struct({ client_id: NonEmptyString });
|
|
115427
115716
|
const Token = Struct({
|
|
@@ -115508,7 +115797,7 @@ function endSession(transport, client, fail, kind) {
|
|
|
115508
115797
|
return pipe$1(tryPromise({
|
|
115509
115798
|
catch: fail,
|
|
115510
115799
|
try: () => transport.terminateSession()
|
|
115511
|
-
}), timeout("3 seconds"), ignore$1({
|
|
115800
|
+
}), timeout$1("3 seconds"), ignore$1({
|
|
115512
115801
|
log: "Warn",
|
|
115513
115802
|
message: `Cannot terminate the ${kind} MCP session`
|
|
115514
115803
|
}), andThen(tryPromise({
|
|
@@ -115594,14 +115883,6 @@ function failed(message) {
|
|
|
115594
115883
|
});
|
|
115595
115884
|
});
|
|
115596
115885
|
}
|
|
115597
|
-
function validMetadata(metadata) {
|
|
115598
|
-
return every$1([
|
|
115599
|
-
metadata.issuer,
|
|
115600
|
-
metadata.authorization_endpoint,
|
|
115601
|
-
metadata.token_endpoint,
|
|
115602
|
-
...toArray$1(fromUndefinedOr(metadata.registration_endpoint))
|
|
115603
|
-
], (endpoint) => is$2(ServerUrl)(endpoint));
|
|
115604
|
-
}
|
|
115605
115886
|
var Connections = class Connections extends Service$1()("@deslop/gateway/services/connections/service/Connections") {
|
|
115606
115887
|
static make = gen(function* () {
|
|
115607
115888
|
const origin = yield* gatewayUrl;
|
|
@@ -115624,27 +115905,27 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
|
|
|
115624
115905
|
const client = filterStatusOk(yield* HttpClient);
|
|
115625
115906
|
const fetch = yield* Fetch;
|
|
115626
115907
|
const random = yield* SecureRandom;
|
|
115627
|
-
const digest = yield* Digest;
|
|
115628
115908
|
const pending = yield* make$59({
|
|
115629
115909
|
capacity: 64,
|
|
115630
115910
|
lookup: () => fail$6(AuthError.make({ message: "The connection expired; connect it again" })),
|
|
115631
115911
|
timeToLive: "10 minutes"
|
|
115632
115912
|
});
|
|
115913
|
+
const callbacks = yield* make$72(1);
|
|
115633
115914
|
const nonce = map$5(random.randomBytes(32), encode$1);
|
|
115634
115915
|
const change = fnUntraced(function* (update) {
|
|
115635
|
-
return yield*
|
|
115916
|
+
return yield* updateEffect(state, (current) => tap$1(update(current), (next) => store.set("servers", next)));
|
|
115636
115917
|
}, uninterruptible);
|
|
115637
115918
|
const get$11 = fnUntraced(function* (id) {
|
|
115638
115919
|
return yield* pipe$1(get$9(yield* get(state), id), fromOption, mapError$2(() => AuthError.make({ message: "This MCP was removed. Add it again on the MCP page." })));
|
|
115639
115920
|
});
|
|
115640
115921
|
const update = fnUntraced(function* (id, generation, next) {
|
|
115641
|
-
yield* change((current) => succeed$5(
|
|
115922
|
+
yield* change((current) => succeed$5(match$8(filter$7(get$9(current, id), (found) => found.generation === generation), {
|
|
115642
115923
|
onNone: () => current,
|
|
115643
115924
|
onSome: (found) => ({
|
|
115644
115925
|
...current,
|
|
115645
115926
|
[id]: next(found)
|
|
115646
115927
|
})
|
|
115647
|
-
})
|
|
115928
|
+
})));
|
|
115648
115929
|
});
|
|
115649
115930
|
const list = gen(function* () {
|
|
115650
115931
|
const now = yield* currentTimeMillis;
|
|
@@ -115686,7 +115967,7 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
|
|
|
115686
115967
|
}), (request) => client.execute(request), flatMap$2(schemaBodyJson(Token)), tapErrorTag("HttpClientError", (cause) => {
|
|
115687
115968
|
if (cause.reason._tag !== "StatusCodeError" || !contains$1([400, 401], cause.reason.response.status)) return void_$1;
|
|
115688
115969
|
return ended();
|
|
115689
|
-
}), timeout("20 seconds"));
|
|
115970
|
+
}), timeout$1("20 seconds"));
|
|
115690
115971
|
const now = yield* currentTimeMillis;
|
|
115691
115972
|
const next = {
|
|
115692
115973
|
...token,
|
|
@@ -115731,7 +116012,7 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
|
|
|
115731
116012
|
Connected: () => fail$6(notConnected),
|
|
115732
116013
|
Disconnected: () => fail$6(notConnected)
|
|
115733
116014
|
});
|
|
115734
|
-
}), timeout("20 seconds")));
|
|
116015
|
+
}), timeout$1("20 seconds")));
|
|
115735
116016
|
}, failed("Cannot refresh this MCP; reconnect it from the MCP page"));
|
|
115736
116017
|
const discover = fnUntraced(function* (initial) {
|
|
115737
116018
|
const probe = yield* encodeEffect(fromJsonString(Unknown))({
|
|
@@ -115797,7 +116078,7 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
|
|
|
115797
116078
|
icons: serverIcons(anonymous.getServerVersion()),
|
|
115798
116079
|
link: { _tag: "Connected" },
|
|
115799
116080
|
mode: "public",
|
|
115800
|
-
name: anonymous.getServerVersion()?.name
|
|
116081
|
+
name: pipe$1(fromUndefinedOr(anonymous.getServerVersion()?.name), map$11(trim), filter$7(isNonEmpty$1), getOrElse(() => initial.name)),
|
|
115801
116082
|
toolDescriptions: fromEntries(flatMap$5(tools.tools, (tool) => match$8(fromUndefinedOr(tool.description), {
|
|
115802
116083
|
onNone: () => [],
|
|
115803
116084
|
onSome: (description) => [[tool.name, description]]
|
|
@@ -115806,12 +116087,11 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
|
|
|
115806
116087
|
};
|
|
115807
116088
|
}
|
|
115808
116089
|
const metadata = yield* decodeEffect(Metadata)(discovery.authorizationServerMetadata);
|
|
115809
|
-
if (!validMetadata(metadata)) return yield* AuthError.make({ message: "The MCP returned unsafe authorization endpoints." });
|
|
115810
116090
|
return {
|
|
115811
116091
|
...initial,
|
|
115812
116092
|
link: { _tag: "Disconnected" },
|
|
115813
116093
|
mode: "oauth",
|
|
115814
|
-
name: discovery.resourceMetadata?.resource_name
|
|
116094
|
+
name: pipe$1(fromUndefinedOr(discovery.resourceMetadata?.resource_name), map$11(trim), filter$7(isNonEmpty$1), getOrElse(() => initial.name)),
|
|
115815
116095
|
oauth: {
|
|
115816
116096
|
client: yield* register(metadata, initial.id),
|
|
115817
116097
|
metadata,
|
|
@@ -115834,19 +116114,19 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
|
|
|
115834
116114
|
yield* admin(user);
|
|
115835
116115
|
yield* change((current) => gen(function* () {
|
|
115836
116116
|
const found = yield* mapError$2(fromOption(get$9(current, id)), () => AuthError.make({ message: "This MCP was removed. Add it again on the MCP page." }));
|
|
115837
|
-
return
|
|
116117
|
+
return match$8(next(found), {
|
|
115838
116118
|
onNone: () => remove$7(current, id),
|
|
115839
116119
|
onSome: (row) => ({
|
|
115840
116120
|
...current,
|
|
115841
116121
|
[id]: row
|
|
115842
116122
|
})
|
|
115843
|
-
})
|
|
116123
|
+
});
|
|
115844
116124
|
}));
|
|
115845
116125
|
}, failed("Cannot change this MCP connection"));
|
|
115846
116126
|
return Connections.of({
|
|
115847
116127
|
add: fn("Connections.add")(function* (input, user) {
|
|
115848
116128
|
yield* admin(user);
|
|
115849
|
-
const url = new URL(
|
|
116129
|
+
const url = new URL(input).href;
|
|
115850
116130
|
if (new URL(url).origin === origin) return yield* AuthError.make({ message: "The gateway cannot connect to itself" });
|
|
115851
116131
|
const current = yield* get(state);
|
|
115852
116132
|
if (some(values(current), (row) => row.url === url)) return yield* AuthError.make({ message: "This MCP has already been added." });
|
|
@@ -115865,17 +116145,18 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
|
|
|
115865
116145
|
});
|
|
115866
116146
|
yield* change((latest) => {
|
|
115867
116147
|
if (has$4(latest, id) || some(values(latest), (row) => row.url === url)) return fail$6(AuthError.make({ message: "This MCP has already been added." }));
|
|
115868
|
-
return succeed$5(
|
|
116148
|
+
return succeed$5({
|
|
115869
116149
|
...latest,
|
|
115870
116150
|
[id]: connection
|
|
115871
|
-
}
|
|
116151
|
+
});
|
|
115872
116152
|
});
|
|
115873
116153
|
return connectionInfo(connection, yield* currentTimeMillis);
|
|
115874
|
-
}, scoped, timeout("20 seconds"), failed("Cannot add this MCP. Check its public HTTPS URL and OAuth discovery support")),
|
|
116154
|
+
}, scoped, timeout$1("20 seconds"), failed("Cannot add this MCP. Check its public HTTPS URL and OAuth discovery support")),
|
|
115875
116155
|
begin: fn("Connections.begin")(function* (id, user) {
|
|
115876
116156
|
yield* admin(user);
|
|
115877
116157
|
const connection = yield* get$11(id);
|
|
115878
|
-
|
|
116158
|
+
const oauth = connection.oauth;
|
|
116159
|
+
if (oauth === void 0) {
|
|
115879
116160
|
yield* update(id, connection.generation, (found) => ({
|
|
115880
116161
|
...omit$1(found, ["error"]),
|
|
115881
116162
|
link: { _tag: "Connected" }
|
|
@@ -115885,56 +116166,84 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
|
|
|
115885
116166
|
url: "/"
|
|
115886
116167
|
};
|
|
115887
116168
|
}
|
|
115888
|
-
|
|
115889
|
-
|
|
115890
|
-
|
|
115891
|
-
|
|
115892
|
-
|
|
115893
|
-
|
|
115894
|
-
|
|
115895
|
-
|
|
115896
|
-
|
|
115897
|
-
|
|
115898
|
-
|
|
115899
|
-
|
|
115900
|
-
|
|
115901
|
-
|
|
115902
|
-
|
|
115903
|
-
|
|
115904
|
-
|
|
115905
|
-
|
|
115906
|
-
|
|
115907
|
-
|
|
115908
|
-
|
|
115909
|
-
|
|
115910
|
-
|
|
115911
|
-
|
|
115912
|
-
|
|
115913
|
-
|
|
115914
|
-
|
|
115915
|
-
|
|
115916
|
-
|
|
115917
|
-
|
|
115918
|
-
|
|
116169
|
+
return yield* pipe$1(gen(function* () {
|
|
116170
|
+
const metadata = yield* decodeUnknownEffect(Metadata)(yield* tryPromise({
|
|
116171
|
+
catch: (cause) => UpstreamError.make({ cause }),
|
|
116172
|
+
try: (signal) => discoverAuthorizationServerMetadata(oauth.metadata.issuer, { fetchFn: (target, init) => fetch(target, {
|
|
116173
|
+
...init,
|
|
116174
|
+
signal: AbortSignal.any([signal, ...toArray$1(fromNullishOr(init?.signal))])
|
|
116175
|
+
}) })
|
|
116176
|
+
}));
|
|
116177
|
+
if (!contains$1(metadata.code_challenge_methods_supported ?? [], "S256")) return yield* AuthError.make({ message: "The provider must advertise S256 PKCE and safe authorization endpoints." });
|
|
116178
|
+
const registered = yield* register(metadata, id);
|
|
116179
|
+
const stateId = yield* nonce;
|
|
116180
|
+
const authorization = yield* tryPromise({
|
|
116181
|
+
catch: (cause) => UpstreamError.make({ cause }),
|
|
116182
|
+
try: () => startAuthorization(metadata.issuer, {
|
|
116183
|
+
clientInformation: { client_id: valueTags(registered, {
|
|
116184
|
+
Document: () => clientInfo.client_id,
|
|
116185
|
+
Registered: (found) => found.clientId
|
|
116186
|
+
}) },
|
|
116187
|
+
metadata: {
|
|
116188
|
+
...metadata,
|
|
116189
|
+
code_challenge_methods_supported: [...metadata.code_challenge_methods_supported ?? []],
|
|
116190
|
+
response_types_supported: [...metadata.response_types_supported ?? []]
|
|
116191
|
+
},
|
|
116192
|
+
redirectUrl: valueTags(registered, {
|
|
116193
|
+
Document: () => callback,
|
|
116194
|
+
Registered: () => `${callback}/${id}`
|
|
116195
|
+
}),
|
|
116196
|
+
resource: connection.url,
|
|
116197
|
+
scope: oauth.scope,
|
|
116198
|
+
state: stateId
|
|
116199
|
+
})
|
|
116200
|
+
});
|
|
116201
|
+
yield* set$1(pending, stateId, {
|
|
116202
|
+
client: registered,
|
|
116203
|
+
generation: connection.generation,
|
|
116204
|
+
id,
|
|
116205
|
+
metadata,
|
|
116206
|
+
userId: user.id,
|
|
116207
|
+
verifier: authorization.codeVerifier
|
|
116208
|
+
});
|
|
116209
|
+
return {
|
|
116210
|
+
state: some$1(stateId),
|
|
116211
|
+
url: authorization.authorizationUrl.href
|
|
116212
|
+
};
|
|
116213
|
+
}), timeout$1("20 seconds"), catch_$2((cause) => fail(connection, cause)));
|
|
115919
116214
|
}, failed("Cannot connect this MCP")),
|
|
115920
116215
|
called: (id) => asVoid(publish(traffic, id)),
|
|
115921
116216
|
calls: (user) => unwrap$3(as(admin(user), fromPubSub(traffic))),
|
|
115922
116217
|
complete: fn("Connections.complete")(function* (params, route, user) {
|
|
115923
116218
|
yield* admin(user);
|
|
115924
|
-
const flow = yield*
|
|
115925
|
-
|
|
116219
|
+
const flow = yield* pipe$1(getOption(pending, params.state), tap$1(() => invalidate(pending, params.state)), flatMap$2(match$8({
|
|
116220
|
+
onNone: () => AuthError.make({ message: "The connection expired; connect it again" }),
|
|
116221
|
+
onSome: succeed$5
|
|
116222
|
+
})), uninterruptible, withPermit(callbacks));
|
|
115926
116223
|
const connection = yield* get$11(flow.id);
|
|
115927
116224
|
if (flow.userId !== user.id || flow.generation !== connection.generation || connection.oauth === void 0) return yield* AuthError.make({ message: "The connection expired; connect it again" });
|
|
115928
116225
|
const oauth = {
|
|
115929
116226
|
...connection.oauth,
|
|
115930
|
-
client: flow.client
|
|
116227
|
+
client: flow.client,
|
|
116228
|
+
metadata: flow.metadata
|
|
115931
116229
|
};
|
|
115932
116230
|
yield* pipe$1(gen(function* () {
|
|
115933
116231
|
if (params.error !== void 0 || params.code === void 0) return yield* AuthError.make({ message: `The provider declined the connection (${params.error ?? "no code"})` });
|
|
115934
116232
|
if (!valueTags(oauth.client, {
|
|
115935
|
-
Document: () =>
|
|
115936
|
-
Registered: () => contains$2(route, connection.id)
|
|
116233
|
+
Document: () => isNone(route),
|
|
116234
|
+
Registered: () => contains$2(route, connection.id)
|
|
115937
116235
|
})) return yield* AuthError.make({ message: "The answer came from another authorization server" });
|
|
116236
|
+
yield* try_({
|
|
116237
|
+
catch: (cause) => AuthError.make({
|
|
116238
|
+
cause,
|
|
116239
|
+
message: "The answer came from another authorization server"
|
|
116240
|
+
}),
|
|
116241
|
+
try: () => validateAuthorizationResponseIssuer({
|
|
116242
|
+
expectedIssuer: oauth.metadata.issuer,
|
|
116243
|
+
iss: params.iss,
|
|
116244
|
+
issParameterSupported: oauth.client._tag === "Document" || oauth.metadata.authorization_response_iss_parameter_supported === true
|
|
116245
|
+
})
|
|
116246
|
+
});
|
|
115938
116247
|
yield* exchange(connection, oauth, {
|
|
115939
116248
|
code: params.code,
|
|
115940
116249
|
code_verifier: flow.verifier,
|
|
@@ -115944,7 +116253,7 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
|
|
|
115944
116253
|
Registered: () => `${callback}/${connection.id}`
|
|
115945
116254
|
})
|
|
115946
116255
|
});
|
|
115947
|
-
}), timeout("30 seconds"), catch_$2((cause) => fail(connection, cause)));
|
|
116256
|
+
}), timeout$1("30 seconds"), catch_$2((cause) => fail(connection, cause)));
|
|
115948
116257
|
}, failed("Cannot finish the connection")),
|
|
115949
116258
|
definitions: map$5(get(state), values),
|
|
115950
116259
|
get: get$11,
|
|
@@ -116089,8 +116398,10 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
|
|
|
116089
116398
|
}), mapError$2(rejected(server)), scoped);
|
|
116090
116399
|
}
|
|
116091
116400
|
const call = fn("Gateway.call")(function* (server, tool, input) {
|
|
116092
|
-
|
|
116093
|
-
|
|
116401
|
+
if (isNone(yield* serviceOption(CurrentUser))) {
|
|
116402
|
+
const request = yield* flatMap$2(serviceOption(HttpServerRequest), fromOption);
|
|
116403
|
+
yield* auth.access(request.headers, `${url}/mcp`);
|
|
116404
|
+
}
|
|
116094
116405
|
yield* connections.called(server.id);
|
|
116095
116406
|
const args = yield* decodeUnknownEffect(ToolArguments)(input ?? {});
|
|
116096
116407
|
return yield* withClient(server, (client) => pipe$1(tryPromise({
|
|
@@ -116119,7 +116430,7 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
|
|
|
116119
116430
|
instructions: client.getInstructions(),
|
|
116120
116431
|
tools
|
|
116121
116432
|
})
|
|
116122
|
-
}))), timeout("20 seconds"));
|
|
116433
|
+
}))), timeout$1("20 seconds"));
|
|
116123
116434
|
const latest = yield* connections.get(server.id);
|
|
116124
116435
|
if (latest.generation !== server.generation || latest.link._tag === "Disconnected") return yield* AuthError.make({ message: `${server.name} changed while its tools were read` });
|
|
116125
116436
|
const reference = pick$1(server, [
|
|
@@ -116133,7 +116444,6 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
|
|
|
116133
116444
|
const upstreamName = tool.name;
|
|
116134
116445
|
const name = yield* namespaced(`${server.id}__${tool.name}`);
|
|
116135
116446
|
const fingerprint = yield* encodeEffect(fromJsonString(Tool$5))(tool);
|
|
116136
|
-
if (isNone(match$3(/^[a-zA-Z0-9_-]{1,64}$/u)(name))) return yield* AuthError.make({ message: `${server.name} has a tool name that cannot be namespaced: ${tool.name}` });
|
|
116137
116447
|
if ((yield* get$1(installed))[name]?.fingerprint !== `${server.generation}:${fingerprint}`) {
|
|
116138
116448
|
yield* registry.addTool({
|
|
116139
116449
|
annotations: empty$16(),
|
|
@@ -116244,7 +116554,7 @@ const HttpHandlers = use((router) => gen(function* () {
|
|
|
116244
116554
|
yield* router.add("GET", "/oauth/callback/:id", flatMap$2(params, (params) => callback(fromUndefinedOr(params["id"]))));
|
|
116245
116555
|
}));
|
|
116246
116556
|
// src/routes/icon.svg
|
|
116247
|
-
var icon_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\" shape-rendering=\"crispEdges\"><path fill=\"#
|
|
116557
|
+
var icon_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\" shape-rendering=\"crispEdges\"><path fill=\"#000\" fill-opacity=\".18\" d=\"M12 38h1v1h-1zM27 38h1v1h-1zM10 39h3v1h-3zM27 39h3v1h-3zM8 40h4v1h-4zM28 40h4v1h-4zM10 41h4v1h-4zM26 41h4v1h-4zM12 42h4v1h-4zM24 42h4v1h-4zM14 43h4v1h-4zM22 43h4v1h-4zM16 44h8v1h-8zM18 45h4v1h-4zM36 50h1v1h-1zM51 50h1v1h-1zM34 51h3v1h-3zM51 51h3v1h-3zM32 52h4v1h-4zM52 52h4v1h-4zM34 53h4v1h-4zM50 53h4v1h-4zM36 54h4v1h-4zM48 54h4v1h-4zM38 55h4v1h-4zM46 55h4v1h-4zM40 56h8v1h-8zM42 57h4v1h-4z\"/><path fill=\"#000\" fill-opacity=\".38\" d=\"M12 40h2v1h-2zM26 40h2v1h-2zM14 41h1v1h-1zM25 41h1v1h-1zM16 42h1v1h-1zM23 42h1v1h-1zM18 43h1v1h-1zM21 43h1v1h-1zM36 52h2v1h-2zM50 52h2v1h-2zM38 53h1v1h-1zM49 53h1v1h-1zM40 54h1v1h-1zM47 54h1v1h-1zM42 55h1v1h-1zM45 55h1v1h-1z\"/><path fill=\"#1e1e2b\" d=\"M13 8h4v1h-4zM11 9h2v1h-2zM17 9h1v1h-1zM9 10h2v1h-2zM17 10h1v1h-1zM8 11h1v1h-1zM17 11h2v1h-2zM8 12h1v1h-1zM19 12h2v1h-2zM8 13h1v1h-1zM21 13h2v1h-2zM8 14h1v1h-1zM23 14h2v1h-2zM9 15h2v1h-2zM25 15h2v1h-2zM10 16h1v1h-1zM27 16h2v1h-2zM11 17h2v1h-2zM29 17h2v1h-2zM13 18h1v1h-1zM31 18h2v1h-2zM33 19h2v1h-2zM35 20h2v1h-2zM37 21h2v1h-2zM39 22h2v1h-2zM41 23h2v1h-2zM43 24h2v1h-2zM45 25h2v1h-2zM47 26h2v1h-2zM49 27h6v1h-6zM55 28h1v1h-1zM55 29h1v1h-1zM55 30h1v1h-1zM55 31h1v1h-1zM53 32h2v1h-2zM51 33h2v1h-2zM48 34h3v1h-3zM15 36h1v1h-1zM24 36h1v1h-1zM14 37h1v1h-1zM25 37h1v1h-1zM13 38h1v1h-1zM26 38h1v1h-1zM13 39h1v1h-1zM25 39h2v1h-2zM14 40h1v1h-1zM23 40h3v1h-3zM15 41h2v1h-2zM21 41h4v1h-4zM17 42h2v1h-2zM20 42h3v1h-3zM19 43h2v1h-2zM39 48h1v1h-1zM48 48h1v1h-1zM38 49h1v1h-1zM49 49h1v1h-1zM37 50h1v1h-1zM50 50h1v1h-1zM37 51h1v1h-1zM49 51h2v1h-2zM38 52h1v1h-1zM47 52h3v1h-3zM39 53h2v1h-2zM45 53h4v1h-4zM41 54h2v1h-2zM44 54h3v1h-3zM43 55h2v1h-2z\"/><path fill=\"#5b5b6c\" d=\"M13 9h2v1h-2zM11 10h2v1h-2zM10 12h1v1h-1zM15 12h4v1h-4zM10 13h1v1h-1zM13 13h8v1h-8zM13 14h10v1h-10zM15 15h10v1h-10zM17 16h10v1h-10zM19 17h10v1h-10zM21 18h10v1h-10zM23 19h10v1h-10zM25 20h10v1h-10zM27 21h10v1h-10zM29 22h10v1h-10zM31 23h10v1h-10zM33 24h10v1h-10zM35 25h10v1h-10zM37 26h10v1h-10zM39 27h10v1h-10zM41 28h12v1h-12zM43 29h8v1h-8zM45 30h2v1h-2zM48 31h1v1h-1zM48 32h1v1h-1zM48 33h1v1h-1zM15 37h1v1h-1zM24 37h1v1h-1zM19 41h1v1h-1zM39 49h1v1h-1zM48 49h1v1h-1zM43 53h1v1h-1z\"/><path fill=\"#6d6c79\" d=\"M15 9h2v1h-2zM13 10h2v1h-2zM9 11h4v1h-4zM11 14h2v1h-2zM13 15h2v1h-2zM15 16h2v1h-2zM17 17h2v1h-2zM19 18h2v1h-2zM21 19h2v1h-2zM23 20h2v1h-2zM25 21h2v1h-2zM27 22h2v1h-2zM29 23h2v1h-2zM31 24h2v1h-2zM33 25h2v1h-2zM35 26h2v1h-2zM37 27h2v1h-2zM39 28h2v1h-2zM53 28h2v1h-2zM41 29h2v1h-2zM51 29h2v1h-2zM43 30h2v1h-2zM47 30h4v1h-4zM45 31h2v1h-2zM15 38h2v1h-2zM23 38h2v1h-2zM17 39h2v1h-2zM21 39h2v1h-2zM19 40h2v1h-2zM39 50h2v1h-2zM47 50h2v1h-2zM41 51h2v1h-2zM45 51h2v1h-2zM43 52h2v1h-2z\"/><path fill=\"#242435\" d=\"M15 10h2v1h-2zM13 11h4v1h-4zM11 12h4v1h-4zM11 13h2v1h-2zM53 29h2v1h-2zM51 30h4v1h-4zM49 31h6v1h-6zM49 32h4v1h-4zM49 33h2v1h-2zM25 38h1v1h-1zM23 39h2v1h-2zM21 40h2v1h-2zM20 41h1v1h-1zM49 50h1v1h-1zM47 51h2v1h-2zM45 52h2v1h-2zM44 53h1v1h-1z\"/><path fill=\"#4A4A5E\" d=\"M9 12h1v1h-1zM9 13h1v1h-1zM9 14h2v1h-2zM11 15h2v1h-2zM11 16h4v1h-4zM13 17h4v1h-4zM15 18h4v1h-4zM17 19h4v1h-4zM19 20h4v1h-4zM21 21h4v1h-4zM23 22h4v1h-4zM25 23h4v1h-4zM27 24h4v1h-4zM29 25h4v1h-4zM31 26h4v1h-4zM33 27h4v1h-4zM35 28h4v1h-4zM37 29h4v1h-4zM39 30h4v1h-4zM41 31h4v1h-4zM47 31h1v1h-1zM43 32h5v1h-5zM45 33h3v1h-3zM14 38h1v1h-1zM15 39h2v1h-2zM17 40h2v1h-2zM38 50h1v1h-1zM39 51h2v1h-2zM41 52h2v1h-2z\"/><path fill=\"#D27E99\" d=\"M14 18h1v1h-1zM15 19h2v1h-2zM16 20h3v1h-3zM16 21h5v1h-5zM16 22h3v1h-3zM21 22h2v1h-2zM16 23h3v1h-3zM23 23h2v1h-2zM16 24h3v1h-3zM25 24h2v1h-2zM16 25h3v1h-3zM27 25h2v1h-2zM16 26h3v1h-3zM29 26h2v1h-2zM16 27h5v1h-5zM31 27h2v1h-2zM16 28h7v1h-7zM33 28h2v1h-2zM16 29h3v1h-3zM21 29h4v1h-4zM35 29h2v1h-2zM16 30h3v1h-3zM23 30h4v1h-4zM37 30h2v1h-2zM16 31h3v1h-3zM25 31h4v1h-4zM39 31h2v1h-2zM16 32h3v1h-3zM27 32h4v1h-4zM40 32h3v1h-3zM16 33h3v1h-3zM29 33h4v1h-4zM40 33h5v1h-5zM16 34h3v1h-3zM31 34h4v1h-4zM40 34h3v1h-3zM16 35h3v1h-3zM33 35h4v1h-4zM40 35h3v1h-3zM16 36h3v1h-3zM35 36h4v1h-4zM40 36h3v1h-3zM16 37h3v1h-3zM37 37h6v1h-6zM17 38h2v1h-2zM39 38h4v1h-4zM40 39h3v1h-3zM40 40h3v1h-3zM40 41h3v1h-3zM40 42h3v1h-3zM40 43h3v1h-3zM40 44h3v1h-3zM40 45h3v1h-3zM40 46h3v1h-3zM40 47h3v1h-3zM40 48h3v1h-3zM40 49h3v1h-3zM41 50h2v1h-2z\"/><path fill=\"#5f2c45\" d=\"M14 19h1v1h-1zM15 20h1v1h-1zM15 21h1v1h-1zM15 22h1v1h-1zM15 23h1v1h-1zM15 24h1v1h-1zM24 24h1v1h-1zM15 25h1v1h-1zM24 25h3v1h-3zM15 26h1v1h-1zM24 26h1v1h-1zM27 26h2v1h-2zM15 27h1v1h-1zM25 27h2v1h-2zM29 27h2v1h-2zM15 28h1v1h-1zM27 28h2v1h-2zM31 28h2v1h-2zM15 29h1v1h-1zM29 29h2v1h-2zM33 29h2v1h-2zM15 30h1v1h-1zM31 30h2v1h-2zM35 30h2v1h-2zM15 31h1v1h-1zM24 31h1v1h-1zM33 31h2v1h-2zM37 31h2v1h-2zM15 32h1v1h-1zM24 32h3v1h-3zM35 32h2v1h-2zM39 32h1v1h-1zM15 33h1v1h-1zM24 33h1v1h-1zM27 33h2v1h-2zM37 33h3v1h-3zM15 34h1v1h-1zM24 34h1v1h-1zM29 34h2v1h-2zM39 34h1v1h-1zM15 35h1v1h-1zM24 35h1v1h-1zM31 35h2v1h-2zM48 35h1v1h-1zM33 36h2v1h-2zM48 36h1v1h-1zM35 37h2v1h-2zM48 37h1v1h-1zM37 38h2v1h-2zM48 38h1v1h-1zM39 39h1v1h-1zM48 39h1v1h-1zM39 40h1v1h-1zM48 40h1v1h-1zM39 41h1v1h-1zM48 41h1v1h-1zM39 42h1v1h-1zM48 42h1v1h-1zM39 43h1v1h-1zM48 43h1v1h-1zM39 44h1v1h-1zM48 44h1v1h-1zM39 45h1v1h-1zM48 45h1v1h-1zM39 46h1v1h-1zM48 46h1v1h-1zM39 47h1v1h-1zM48 47h1v1h-1z\"/><path fill=\"#df95a9\" d=\"M19 22h1v1h-1zM19 23h1v1h-1zM19 24h1v1h-1zM19 25h1v1h-1zM19 26h1v1h-1zM21 26h2v1h-2zM21 27h4v1h-4zM23 28h4v1h-4zM19 29h1v1h-1zM25 29h4v1h-4zM19 30h1v1h-1zM27 30h4v1h-4zM19 31h1v1h-1zM29 31h4v1h-4zM19 32h1v1h-1zM31 32h4v1h-4zM19 33h1v1h-1zM33 33h4v1h-4zM19 34h1v1h-1zM35 34h4v1h-4zM43 34h1v1h-1zM45 34h1v1h-1zM19 35h1v1h-1zM37 35h3v1h-3zM43 35h1v1h-1zM19 36h1v1h-1zM39 36h1v1h-1zM43 36h1v1h-1zM19 37h1v1h-1zM43 37h1v1h-1zM19 38h1v1h-1zM43 38h1v1h-1zM19 39h1v1h-1zM43 39h1v1h-1zM43 40h1v1h-1zM43 41h1v1h-1zM43 42h1v1h-1zM43 43h1v1h-1zM43 44h1v1h-1zM43 45h1v1h-1zM43 46h1v1h-1zM43 47h1v1h-1zM43 48h1v1h-1zM43 49h1v1h-1zM43 50h1v1h-1zM43 51h1v1h-1z\"/><path fill=\"#9c5473\" d=\"M20 22h1v1h-1zM20 23h3v1h-3zM20 24h4v1h-4zM20 25h4v1h-4zM20 26h1v1h-1zM23 26h1v1h-1zM20 29h1v1h-1zM20 30h3v1h-3zM20 31h4v1h-4zM20 32h4v1h-4zM20 33h4v1h-4zM20 34h4v1h-4zM44 34h1v1h-1zM46 34h2v1h-2zM20 35h4v1h-4zM44 35h4v1h-4zM20 36h4v1h-4zM44 36h4v1h-4zM20 37h4v1h-4zM44 37h4v1h-4zM20 38h3v1h-3zM44 38h4v1h-4zM20 39h1v1h-1zM44 39h4v1h-4zM44 40h4v1h-4zM44 41h4v1h-4zM44 42h4v1h-4zM44 43h4v1h-4zM44 44h4v1h-4zM44 45h4v1h-4zM44 46h4v1h-4zM44 47h4v1h-4zM44 48h4v1h-4zM44 49h4v1h-4zM44 50h3v1h-3zM44 51h1v1h-1z\"/><path fill=\"#38384a\" d=\"M14 39h1v1h-1zM15 40h2v1h-2zM17 41h2v1h-2zM19 42h1v1h-1zM38 51h1v1h-1zM39 52h2v1h-2zM41 53h2v1h-2zM43 54h1v1h-1z\"/></svg>";
|
|
116248
116558
|
// src/rpcs/contracts.ts
|
|
116249
116559
|
var RpcContracts = class extends make$29(make$31("gateway.servers", {
|
|
116250
116560
|
error: AuthError,
|
|
@@ -143702,13 +144012,12 @@ runApp({
|
|
|
143702
144012
|
}), unwrap$7(gen(function* () {
|
|
143703
144013
|
const now = yield* currentTimeMillis;
|
|
143704
144014
|
return pipe$1(layerMcp({
|
|
143705
|
-
handlers: ToolHandlers,
|
|
143706
144015
|
instructions: join$2([
|
|
143707
144016
|
"Gateway to the user's MCP servers; tools are named <server>__<tool>.",
|
|
143708
144017
|
...map$8(filter$5(yield* (yield* Connections).definitions, (server) => connectionStatus(server, now) === "Connected"), (server) => `${server.id}: ${summary(server)}`),
|
|
143709
144018
|
"If a tool is missing or failing, list_mcp_connections says why."
|
|
143710
144019
|
], "\n"),
|
|
143711
|
-
|
|
144020
|
+
registrations: pipe$1(toolkit(Tools), provide$2(ToolHandlers))
|
|
143712
144021
|
}), provide$2(GatewayDiscovery.layer), provide$2(McpServer.layer));
|
|
143713
144022
|
}))), provide$2(layerServices)),
|
|
143714
144023
|
settings: { GITHUB_ADMINS: ADMINS }
|