@deslop/gateway 0.1.1232 → 0.1.1235

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/server.js CHANGED
@@ -88003,10 +88003,6 @@ const layerWeb = unwrap$7(gen(function* () {
88003
88003
  background_color: "#0a0a0a",
88004
88004
  display: "standalone",
88005
88005
  icons: [{
88006
- sizes: "any",
88007
- src: "/icon",
88008
- type: "image/svg+xml"
88009
- }, {
88010
88006
  purpose: "any",
88011
88007
  sizes: "512x512",
88012
88008
  src: "/apple-touch-icon.png",
@@ -88283,69 +88279,8 @@ function runApp(app) {
88283
88279
  });
88284
88280
  runMain(pipe$1(program, scoped, provide(layerPlatform), provideService(LogToStderr, true)));
88285
88281
  }
88286
- // src/services/connections/lib/utils.ts
88287
- const gatewayUrl = String$5("APP_URL");
88288
- function clientMetadata(url) {
88289
- return {
88290
- client_id: `${url}/oauth/client.json`,
88291
- client_name: "Deslop MCP gateway",
88292
- grant_types: ["authorization_code", "refresh_token"],
88293
- redirect_uris: [`${url}/oauth/callback`],
88294
- response_types: ["code"],
88295
- token_endpoint_auth_method: "none"
88296
- };
88297
- }
88298
- function connectionStatus(connection, now) {
88299
- return valueTags(connection.link, {
88300
- Authorized: (link) => match$1(link.expiresAt <= now && link.token.refresh_token === void 0, {
88301
- onFalse: () => "Connected",
88302
- onTrue: () => "Expired"
88303
- }),
88304
- Connected: () => "Connected",
88305
- Disconnected: () => "Not connected"
88306
- });
88307
- }
88308
- function connectionInfo(connection, now) {
88309
- return {
88310
- ...match$8(fromUndefinedOr(connection.error), {
88311
- onNone: () => ({}),
88312
- onSome: (error) => ({ error })
88313
- }),
88314
- ...pick$1(connection, [
88315
- "hidden",
88316
- "id",
88317
- "name",
88318
- "tools",
88319
- "url"
88320
- ]),
88321
- icons: connection.icons ?? [],
88322
- status: connectionStatus(connection, now)
88323
- };
88324
- }
88325
- function serverIcons(implementation) {
88326
- return pipe$1(implementation?.icons ?? [], filter$5((icon) => isSome(match$3(/^(?:https:|data:image\/)/u)(icon.src)) && icon.src.length <= 32768), take$3(2), map$8((icon) => ({
88327
- src: icon.src,
88328
- ...match$8(fromUndefinedOr(icon.theme), {
88329
- onNone: () => ({}),
88330
- onSome: (theme) => ({ theme })
88331
- })
88332
- })));
88333
- }
88334
- function summary(connection) {
88335
- return pipe$1(fromUndefinedOr(connection.instructions), flatMap$7((text) => fromUndefinedOr(split$1(text, /(?<=\.)\s/u)[0])), map$11(slice(0, 160)), getOrElse(() => connection.name));
88336
- }
88337
- function describe(cause) {
88338
- if (is$2(AuthError)(cause)) return cause.message;
88339
- if (isTagged(cause, "TimeoutError")) return "It did not answer in time";
88340
- if (isHttpClientError(cause) && cause.reason._tag === "StatusCodeError") return `It answered HTTP ${cause.reason.response.status}`;
88341
- if (hasProperty(cause, "cause") && isNotUndefined(cause.cause) && isTagged(cause, "UnknownError")) return describe(cause.cause);
88342
- if (hasProperty(cause, "message") && isString$1(cause.message)) return slice(0, 300)(cause.message);
88343
- return "It failed for an unknown reason";
88344
- }
88345
- function serverName(url) {
88346
- return pipe$1(new URL(url).hostname, replace(/^(?:api|app|mcp)\./u, ""), split$1("."), headNonEmpty, replaceAll(/[^a-z0-9_-]/giu, "-"), replaceAll(/^[^a-z0-9]+|[^a-z0-9]+$/giu, ""), slice(0, 16), toLowerCase);
88347
- }
88348
88282
  // src/services/connections/schema.ts
88283
+ var UpstreamError = class extends TaggedError()("UpstreamError", { cause: Defect() }) {};
88349
88284
  const ServerId = String$6.check(isPattern(/^[a-z0-9][a-z0-9_-]{0,23}$/u));
88350
88285
  const ServerUrl = NonEmptyString.check(isMaxLength(2048), makeFilter((value) => {
88351
88286
  if (!URL.canParse(value)) return false;
@@ -88354,11 +88289,6 @@ const ServerUrl = NonEmptyString.check(isMaxLength(2048), makeFilter((value) =>
88354
88289
  }, { expected: "a public HTTPS URL without credentials or a fragment" }));
88355
88290
  const AddServer = Struct({ url: ServerUrl });
88356
88291
  const ServerParams = Struct({ id: ServerId });
88357
- const ToolVisibility = Struct({
88358
- hidden: Boolean$5,
88359
- id: ServerId,
88360
- tool: NonEmptyString
88361
- });
88362
88292
  const Metadata = Struct({
88363
88293
  authorization_endpoint: NonEmptyString,
88364
88294
  authorization_response_iss_parameter_supported: optionalKey(Boolean$5),
@@ -88397,7 +88327,6 @@ const ServerIcon = Struct({
88397
88327
  const ConnectionStore = Record$1(String$6, Struct({
88398
88328
  error: optionalKey(String$6),
88399
88329
  generation: NonEmptyString,
88400
- hidden: ArraySchema(String$6),
88401
88330
  icons: optionalKey(ArraySchema(ServerIcon)),
88402
88331
  id: ServerId,
88403
88332
  instructions: optionalKey(String$6),
@@ -88410,7 +88339,6 @@ const ConnectionStore = Record$1(String$6, Struct({
88410
88339
  }));
88411
88340
  const ConnectionInfo = Struct({
88412
88341
  error: optionalKey(String$6),
88413
- hidden: ArraySchema(String$6),
88414
88342
  icons: ArraySchema(ServerIcon),
88415
88343
  id: ServerId,
88416
88344
  name: NonEmptyString,
@@ -88436,6 +88364,67 @@ const Callback = Struct({
88436
88364
  iss: optionalKey(NonEmptyString),
88437
88365
  state: NonEmptyString
88438
88366
  });
88367
+ // src/services/connections/lib/utils.ts
88368
+ const gatewayUrl = String$5("APP_URL");
88369
+ function clientMetadata(url) {
88370
+ return {
88371
+ client_id: `${url}/oauth/client.json`,
88372
+ client_name: "Deslop MCP gateway",
88373
+ grant_types: ["authorization_code", "refresh_token"],
88374
+ redirect_uris: [`${url}/oauth/callback`],
88375
+ response_types: ["code"],
88376
+ token_endpoint_auth_method: "none"
88377
+ };
88378
+ }
88379
+ function connectionStatus(connection, now) {
88380
+ return valueTags(connection.link, {
88381
+ Authorized: (link) => match$1(link.expiresAt <= now && link.token.refresh_token === void 0, {
88382
+ onFalse: () => "Connected",
88383
+ onTrue: () => "Expired"
88384
+ }),
88385
+ Connected: () => "Connected",
88386
+ Disconnected: () => "Not connected"
88387
+ });
88388
+ }
88389
+ function connectionInfo(connection, now) {
88390
+ return {
88391
+ ...match$8(fromUndefinedOr(connection.error), {
88392
+ onNone: () => ({}),
88393
+ onSome: (error) => ({ error })
88394
+ }),
88395
+ ...pick$1(connection, [
88396
+ "id",
88397
+ "name",
88398
+ "tools",
88399
+ "url"
88400
+ ]),
88401
+ icons: connection.icons ?? [],
88402
+ status: connectionStatus(connection, now)
88403
+ };
88404
+ }
88405
+ function serverIcons(implementation) {
88406
+ return pipe$1(implementation?.icons ?? [], filter$5((icon) => isSome(match$3(/^(?:https:|data:image\/)/u)(icon.src)) && icon.src.length <= 32768), take$3(2), map$8((icon) => ({
88407
+ src: icon.src,
88408
+ ...match$8(fromUndefinedOr(icon.theme), {
88409
+ onNone: () => ({}),
88410
+ onSome: (theme) => ({ theme })
88411
+ })
88412
+ })));
88413
+ }
88414
+ function summary(connection) {
88415
+ return pipe$1(fromUndefinedOr(connection.instructions), flatMap$7((text) => fromUndefinedOr(split$1(text, /(?<=\.)\s/u)[0])), map$11(slice(0, 160)), getOrElse(() => connection.name));
88416
+ }
88417
+ function describe(cause) {
88418
+ if (is$2(AuthError)(cause)) return cause.message;
88419
+ if (isTagged(cause, "TimeoutError")) return "It did not answer in time";
88420
+ if (isHttpClientError(cause) && cause.reason._tag === "StatusCodeError") return `It answered HTTP ${cause.reason.response.status}`;
88421
+ if (is$2(UpstreamError)(cause)) return describe(cause.cause);
88422
+ if (hasProperty(cause, "message") && isString$1(cause.message)) return slice(0, 300)(cause.message);
88423
+ return "It failed for an unknown reason";
88424
+ }
88425
+ function serverName(url) {
88426
+ return pipe$1(new URL(url).hostname, replace(/^(?:api|app|mcp)\./u, ""), split$1("."), headNonEmpty, replaceAll(/[^a-z0-9_-]/giu, "-"), replaceAll(/^[^a-z0-9]+|[^a-z0-9]+$/giu, ""), slice(0, 16), toLowerCase);
88427
+ }
88439
88428
  // ../../node_modules/.pnpm/@modelcontextprotocol+client@2.4.0/node_modules/@modelcontextprotocol/client/dist/chunk-DYPzFuB5.mjs
88440
88429
  var __create = Object.create;
88441
88430
  var __defProp = Object.defineProperty;
@@ -115162,30 +115151,39 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
115162
115151
  method: "tools/list",
115163
115152
  params: {}
115164
115153
  });
115165
- const response = yield* tryPromise((signal) => fetch(initial.url, {
115166
- body: probe,
115167
- headers: {
115168
- accept: "application/json, text/event-stream",
115169
- "content-type": "application/json",
115170
- "mcp-protocol-version": "2025-06-18"
115171
- },
115172
- method: "POST",
115173
- signal
115174
- }));
115154
+ const response = yield* tryPromise({
115155
+ catch: (cause) => UpstreamError.make({ cause }),
115156
+ try: (signal) => fetch(initial.url, {
115157
+ body: probe,
115158
+ headers: {
115159
+ accept: "application/json, text/event-stream",
115160
+ "content-type": "application/json",
115161
+ "mcp-protocol-version": "2025-06-18"
115162
+ },
115163
+ method: "POST",
115164
+ signal
115165
+ })
115166
+ });
115175
115167
  const challenge = extractWWWAuthenticateParams(response);
115176
115168
  yield* match$8(fromNullishOr(response.body), {
115177
115169
  onNone: () => void_$1,
115178
115170
  onSome: fnUntraced(function* (body) {
115179
- yield* tryPromise(() => body.cancel());
115171
+ yield* tryPromise({
115172
+ catch: (cause) => UpstreamError.make({ cause }),
115173
+ try: () => body.cancel()
115174
+ });
115175
+ })
115176
+ });
115177
+ const discovery = yield* tryPromise({
115178
+ catch: (cause) => UpstreamError.make({ cause }),
115179
+ try: (signal) => discoverOAuthServerInfo(initial.url, {
115180
+ fetchFn: (target, init) => fetch(target, {
115181
+ ...init,
115182
+ signal: AbortSignal.any([signal, ...toArray$1(fromNullishOr(init?.signal))])
115183
+ }),
115184
+ resourceMetadataUrl: challenge.resourceMetadataUrl
115180
115185
  })
115181
115186
  });
115182
- const discovery = yield* tryPromise((signal) => discoverOAuthServerInfo(initial.url, {
115183
- fetchFn: (target, init) => fetch(target, {
115184
- ...init,
115185
- signal: AbortSignal.any([signal, ...toArray$1(fromNullishOr(init?.signal))])
115186
- }),
115187
- resourceMetadataUrl: challenge.resourceMetadataUrl
115188
- }));
115189
115187
  if (discovery.resourceMetadata !== void 0 && discovery.resourceMetadata.resource !== initial.url) return yield* AuthError.make({ message: "The MCP metadata names a different resource URL." });
115190
115188
  if (discovery.authorizationServerMetadata === void 0) {
115191
115189
  const transport = new StreamableHTTPClientTransport(new URL(initial.url), {
@@ -115195,12 +115193,21 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
115195
115193
  const anonymous = yield* acquireRelease(sync(() => new Client({
115196
115194
  name: "Deslop MCP gateway",
115197
115195
  version: "0.1.0"
115198
- }, { versionNegotiation: { mode: "auto" } })), (acquired) => pipe$1(tryPromise(() => transport.terminateSession()), timeout("3 seconds"), ignore$1({
115196
+ }, { versionNegotiation: { mode: "auto" } })), (acquired) => pipe$1(tryPromise({
115197
+ catch: (cause) => UpstreamError.make({ cause }),
115198
+ try: () => transport.terminateSession()
115199
+ }), timeout("3 seconds"), ignore$1({
115199
115200
  log: "Warn",
115200
115201
  message: "Cannot terminate the anonymous MCP session"
115201
115202
  }), andThen(promise(() => acquired.close()))));
115202
- yield* tryPromise((signal) => anonymous.connect(transport, { signal }));
115203
- const tools = yield* tryPromise((signal) => anonymous.listTools(void 0, { signal }));
115203
+ yield* tryPromise({
115204
+ catch: (cause) => UpstreamError.make({ cause }),
115205
+ try: (signal) => anonymous.connect(transport, { signal })
115206
+ });
115207
+ const tools = yield* tryPromise({
115208
+ catch: (cause) => UpstreamError.make({ cause }),
115209
+ try: (signal) => anonymous.listTools(void 0, { signal })
115210
+ });
115204
115211
  return {
115205
115212
  ...initial,
115206
115213
  ...match$8(fromUndefinedOr(anonymous.getInstructions()), {
@@ -115267,7 +115274,6 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
115267
115274
  });
115268
115275
  const connection = yield* discover({
115269
115276
  generation: yield* nonce,
115270
- hidden: [],
115271
115277
  id,
115272
115278
  name: capitalize(base),
115273
115279
  tools: [],
@@ -115357,16 +115363,7 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
115357
115363
  }), timeout("30 seconds"), catch_$2((cause) => fail(connection, cause)));
115358
115364
  }, failed("Cannot finish the connection")),
115359
115365
  definitions: map$5(get(state), values),
115360
- disconnect: (id, user) => manage(id, user, (found) => some$1({
115361
- ...omit$1(found, ["error"]),
115362
- link: { _tag: "Disconnected" },
115363
- tools: []
115364
- })),
115365
115366
  get: get$11,
115366
- hide: (visibility, user) => manage(visibility.id, user, (found) => some$1({
115367
- ...found,
115368
- hidden: [...filter$5(found.hidden, (tool) => tool !== visibility.tool), ...filter$5([visibility.tool], () => visibility.hidden)]
115369
- })),
115370
115367
  list,
115371
115368
  remove: (id, user) => manage(id, user, () => none()),
115372
115369
  report: fnUntraced(function* (id, generation, outcome) {
@@ -115429,7 +115426,7 @@ const HttpHandlers = use((router) => gen(function* () {
115429
115426
  yield* router.add("GET", "/oauth/callback/:id", flatMap$2(params, (params) => callback(fromUndefinedOr(params["id"]))));
115430
115427
  }));
115431
115428
  // src/routes/icon.svg
115432
- var icon_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\" shape-rendering=\"crispEdges\"><rect width=\"64\" height=\"64\" fill=\"#fafafa\"/><path fill=\"#0a0a0a\" d=\"M15 7h2v1h-2zM13 8h2v1h-2zM17 8h1v1h-1zM12 9h1v1h-1zM18 9h1v2h-1zM11 10h1v2h-1zM19 11h2v1h-2zM9 12h2v1h-2zM21 12h2v1h-2zM8 13h1v1h-1zM23 13h2v1h-2zM25 14h2v1h-2zM7 14h1v2h-1zM27 15h2v1h-2zM8 16h1v1h-1zM29 16h2v1h-2zM31 17h2v1h-2zM9 17h1v2h-1zM33 18h2v1h-2zM10 19h1v1h-1zM35 19h2v1h-2zM11 20h2v1h-2zM37 20h2v1h-2zM13 21h2v1h-2zM39 21h2v1h-2zM14 22h1v1h-1zM41 22h2v1h-2zM43 23h2v1h-2zM13 23h1v2h-1zM45 24h2v1h-2zM14 25h1v1h-1zM47 25h2v1h-2zM15 26h2v1h-2zM49 26h2v1h-2zM53 26h2v1h-2zM51 27h2v1h-2zM55 27h1v1h-1zM26 31h1v1h-1zM56 28h1v4h-1zM26 32h3v1h-3zM55 32h1v1h-1zM29 33h2v1h-2zM53 33h2v1h-2zM31 34h2v1h-2zM51 34h2v1h-2zM33 35h2v1h-2zM49 35h2v1h-2zM49 36h1v1h-1zM17 27h1v12h-1zM26 33h1v6h-1zM50 37h1v2h-1zM15 39h2v1h-2zM27 39h2v1h-2zM49 39h1v1h-1zM14 40h1v1h-1zM29 40h1v1h-1zM44 40h1v1h-1zM47 40h2v1h-2zM44 41h3v1h-3zM13 41h1v2h-1zM30 41h1v2h-1zM14 43h1v1h-1zM29 43h1v1h-1zM15 44h2v1h-2zM27 44h2v1h-2zM17 45h2v1h-2zM25 45h2v1h-2zM19 46h2v1h-2zM23 46h2v1h-2zM21 47h2v1h-2zM35 36h1v12h-1zM44 42h1v6h-1zM33 48h2v1h-2zM45 48h2v1h-2zM32 49h1v1h-1zM47 49h1v1h-1zM31 50h1v2h-1zM48 50h1v2h-1zM32 52h1v1h-1zM47 52h1v1h-1zM33 53h2v1h-2zM45 53h2v1h-2zM35 54h2v1h-2zM43 54h2v1h-2zM37 55h2v1h-2zM41 55h2v1h-2zM39 56h2v1h-2z\"/><path fill=\"#8b7ec8\" d=\"M10 17h1v1h-1zM10 18h3v1h-3zM11 19h4v1h-4zM13 20h4v1h-4zM15 21h4v1h-4zM17 22h4v1h-4zM14 23h1v1h-1zM18 23h5v1h-5zM14 24h3v1h-3zM18 24h7v1h-7zM15 25h7v1h-7zM23 25h4v1h-4zM17 26h5v1h-5zM25 26h4v1h-4zM18 27h5v1h-5zM27 27h4v1h-4zM18 28h7v1h-7zM28 28h5v1h-5zM23 29h4v1h-4zM28 29h7v1h-7zM25 30h7v1h-7zM33 30h4v1h-4zM27 31h5v1h-5zM35 31h4v1h-4zM29 32h4v1h-4zM36 32h5v1h-5zM31 33h4v1h-4zM36 33h7v1h-7zM33 34h7v1h-7zM41 34h4v1h-4zM35 35h5v1h-5zM43 35h3v1h-3zM36 36h5v1h-5zM45 36h1v1h-1zM36 37h7v1h-7zM41 38h4v1h-4zM43 39h3v1h-3zM18 29h4v12h-4zM45 40h1v1h-1zM19 41h3v1h-3zM21 42h1v1h-1zM36 38h4v12h-4zM37 50h3v1h-3zM39 51h1v1h-1z\"/><path fill=\"#282726\" d=\"M12 10h1v1h-1zM12 11h2v1h-2zM13 12h1v1h-1zM8 14h1v1h-1zM8 15h3v1h-3zM9 16h4v1h-4zM11 17h4v1h-4zM13 18h4v1h-4zM15 19h4v1h-4zM17 20h4v1h-4zM19 21h4v1h-4zM21 22h4v1h-4zM23 23h4v1h-4zM25 24h4v1h-4zM27 25h4v1h-4zM29 26h4v1h-4zM31 27h4v1h-4zM33 28h4v1h-4zM35 29h4v1h-4zM50 29h1v1h-1zM37 30h4v1h-4zM50 30h2v1h-2zM39 31h4v1h-4zM51 31h1v1h-1zM41 32h4v1h-4zM43 33h4v1h-4zM45 34h3v1h-3zM47 35h1v1h-1z\"/><path fill=\"#403e3c\" d=\"M15 8h2v1h-2zM13 9h3v1h-3zM17 11h2v1h-2zM11 12h2v1h-2zM15 12h6v1h-6zM9 13h14v1h-14zM10 14h15v1h-15zM12 15h15v1h-15zM14 16h15v1h-15zM16 17h15v1h-15zM18 18h15v1h-15zM20 19h15v1h-15zM22 20h15v1h-15zM24 21h15v1h-15zM26 22h15v1h-15zM28 23h15v1h-15zM30 24h15v1h-15zM32 25h15v1h-15zM34 26h15v1h-15zM36 27h15v1h-15zM53 27h2v1h-2zM38 28h16v1h-16zM40 29h10v1h-10zM42 30h8v1h-8zM44 31h7v1h-7zM46 32h4v1h-4z\"/><path fill=\"#838280\" d=\"M16 9h1v1h-1zM13 10h2v1h-2zM9 14h1v1h-1zM11 15h1v1h-1zM13 16h1v1h-1zM15 17h1v1h-1zM17 18h1v1h-1zM19 19h1v1h-1zM21 20h1v1h-1zM23 21h1v1h-1zM25 22h1v1h-1zM27 23h1v1h-1zM29 24h1v1h-1zM31 25h1v1h-1zM33 26h1v1h-1zM35 27h1v1h-1zM37 28h1v1h-1zM54 28h1v1h-1zM39 29h1v1h-1zM51 29h2v1h-2zM41 30h1v1h-1zM43 31h1v1h-1zM45 32h1v1h-1zM50 32h1v1h-1zM47 33h2v1h-2z\"/><path fill=\"#5e409d\" d=\"M22 25h1v2h-1zM22 29h1v1h-1zM22 30h3v1h-3zM32 30h1v2h-1zM40 34h1v2h-1zM46 35h1v2h-1zM49 37h1v1h-1zM40 38h1v1h-1zM47 38h3v1h-3zM40 39h3v1h-3zM46 39h3v1h-3zM22 31h4v10h-4zM46 40h1v1h-1zM22 41h3v1h-3zM22 42h1v1h-1zM40 40h4v10h-4zM40 50h3v1h-3zM40 51h1v1h-1z\"/><path fill=\"#cecdc3\" d=\"M17 39h1v1h-1zM26 39h1v1h-1zM15 40h3v1h-3zM26 40h3v1h-3zM16 41h3v1h-3zM25 41h3v1h-3zM18 42h3v1h-3zM23 42h3v1h-3zM20 43h4v1h-4zM35 48h1v1h-1zM44 48h1v1h-1zM33 49h3v1h-3zM44 49h3v1h-3zM34 50h3v1h-3zM43 50h3v1h-3zM36 51h3v1h-3zM41 51h3v1h-3zM38 52h4v1h-4z\"/><path fill=\"#dfded8\" d=\"M15 41h1v1h-1zM28 41h1v1h-1zM17 42h1v1h-1zM26 42h1v1h-1zM19 43h1v1h-1zM24 43h1v1h-1zM21 44h2v1h-2zM33 50h1v1h-1zM46 50h1v1h-1zM35 51h1v1h-1zM44 51h1v1h-1zM37 52h1v1h-1zM42 52h1v1h-1zM39 53h2v1h-2z\"/><path fill=\"#e6e4d9\" d=\"M15 45h2v1h-2zM27 45h2v1h-2zM17 46h2v1h-2zM25 46h2v1h-2zM19 47h2v1h-2zM23 47h2v1h-2zM21 48h2v1h-2zM33 54h2v1h-2zM45 54h2v1h-2zM35 55h2v1h-2zM43 55h2v1h-2zM37 56h2v1h-2zM41 56h2v1h-2zM39 57h2v1h-2z\"/><path fill=\"#b7b5ac\" d=\"M14 41h1v1h-1zM14 42h3v1h-3zM15 43h4v1h-4zM17 44h4v1h-4zM19 45h3v1h-3zM21 46h1v1h-1zM32 50h1v1h-1zM32 51h3v1h-3zM33 52h4v1h-4zM35 53h4v1h-4zM37 54h3v1h-3zM39 55h1v1h-1z\"/><path fill=\"#878580\" d=\"M29 41h1v1h-1zM27 42h3v1h-3zM25 43h4v1h-4zM23 44h4v1h-4zM22 45h3v1h-3zM22 46h1v1h-1zM47 50h1v1h-1zM45 51h3v1h-3zM43 52h4v1h-4zM41 53h4v1h-4zM40 54h3v1h-3zM40 55h1v1h-1z\"/><path fill=\"#1c1b1a\" d=\"M17 9h1v1h-1zM15 10h3v1h-3zM14 11h3v1h-3zM14 12h1v1h-1zM55 28h1v1h-1zM53 29h3v1h-3zM52 30h4v2h-4zM51 32h4v1h-4zM49 33h4v1h-4zM48 34h3v1h-3zM48 35h1v1h-1z\"/><path fill=\"#a699d0\" d=\"M15 22h2v1h-2zM16 23h2v1h-2zM23 26h2v1h-2zM24 27h3v1h-3zM26 28h2v1h-2zM33 31h2v1h-2zM34 32h2v1h-2zM41 35h2v1h-2zM42 36h3v1h-3zM47 36h2v1h-2zM44 37h4v1h-4z\"/><path fill=\"#c5bde0\" d=\"M15 23h1v1h-1zM17 24h1v1h-1zM23 27h1v1h-1zM25 28h1v1h-1zM27 29h1v1h-1zM33 32h1v1h-1zM35 33h1v1h-1zM41 36h1v1h-1zM43 37h1v1h-1zM48 37h1v1h-1zM45 38h2v1h-2z\"/></svg>\n";
115429
+ var icon_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\" shape-rendering=\"crispEdges\"><path fill=\"#8b7ec8\" d=\"M13 20h2v1h-2zM15 21h2v1h-2zM17 22h2v1h-2zM19 23h2v1h-2zM19 24h1v17h-1zM21 24h2v1h-2zM22 25h3v1h-3zM15 26h1v3h-1zM22 26h2v16h-2zM25 26h2v1h-2zM16 27h2v3h-2zM27 27h2v1h-2zM18 28h1v3h-1zM29 28h2v1h-2zM30 29h3v1h-3zM30 30h2v3h-2zM33 30h2v1h-2zM24 31h2v3h-2zM35 31h2v1h-2zM26 32h2v3h-2zM37 32h2v1h-2zM28 33h2v3h-2zM31 33h1v4h-1zM37 33h1v17h-1zM39 33h2v1h-2zM30 34h1v3h-1zM40 34h3v1h-3zM32 35h2v3h-2zM40 35h2v16h-2zM43 35h2v1h-2zM34 36h2v3h-2zM45 36h2v1h-2zM36 37h1v3h-1zM42 40h2v3h-2zM44 41h2v3h-2z\"/><path fill=\"#0a0a0a\" d=\"M13 8h2v1h-2zM11 9h2v1h-2zM15 9h2v1h-2zM9 10h2v1h-2zM17 10h1v3h-1zM8 11h1v1h-1zM7 12h1v2h-1zM18 12h1v1h-1zM19 13h2v1h-2zM8 14h1v4h-1zM21 14h2v1h-2zM23 15h2v1h-2zM25 16h2v1h-2zM27 17h2v1h-2zM9 18h2v1h-2zM29 18h2v1h-2zM11 19h2v1h-2zM31 19h2v1h-2zM12 20h1v1h-1zM33 20h2v1h-2zM13 21h2v1h-2zM35 21h2v1h-2zM15 22h2v1h-2zM37 22h2v1h-2zM17 23h2v1h-2zM39 23h2v1h-2zM15 24h2v1h-2zM18 24h1v1h-1zM41 24h2v1h-2zM14 25h1v4h-1zM43 25h2v1h-2zM45 26h2v1h-2zM47 27h2v1h-2zM27 28h2v1h-2zM49 28h6v1h-6zM15 29h1v1h-1zM28 29h2v1h-2zM55 29h1v1h-1zM16 30h2v1h-2zM56 30h1v2h-1zM18 31h1v8h-1zM34 31h1v2h-1zM35 32h2v1h-2zM55 32h1v3h-1zM36 33h1v1h-1zM27 35h1v4h-1zM53 35h2v1h-2zM28 36h2v1h-2zM51 36h2v1h-2zM30 37h2v1h-2zM45 37h6v1h-6zM17 38h1v1h-1zM28 38h1v1h-1zM32 38h2v1h-2zM46 38h2v1h-2zM15 39h2v1h-2zM29 39h2v1h-2zM34 39h2v1h-2zM48 39h1v1h-1zM14 40h1v4h-1zM31 40h1v4h-1zM36 40h1v8h-1zM49 40h1v4h-1zM15 44h2v1h-2zM29 44h2v1h-2zM45 44h1v4h-1zM47 44h2v1h-2zM17 45h2v1h-2zM27 45h2v1h-2zM46 45h1v1h-1zM19 46h2v1h-2zM25 46h2v1h-2zM21 47h4v1h-4zM35 47h1v1h-1zM46 47h1v1h-1zM33 48h2v1h-2zM47 48h2v1h-2zM32 49h1v4h-1zM49 49h1v4h-1zM33 53h2v1h-2zM47 53h2v1h-2zM35 54h2v1h-2zM45 54h2v1h-2zM37 55h2v1h-2zM43 55h2v1h-2zM39 56h4v1h-4z\"/><path fill=\"#575653\" d=\"M13 9h2v2h-2zM11 10h2v2h-2zM9 11h2v1h-2zM15 13h4v4h-4zM13 14h2v2h-2zM19 14h2v5h-2zM21 15h2v5h-2zM23 16h2v5h-2zM17 17h2v1h-2zM25 17h2v5h-2zM27 18h2v5h-2zM29 19h2v5h-2zM31 20h2v5h-2zM33 21h2v5h-2zM35 22h2v5h-2zM37 23h2v5h-2zM39 24h2v5h-2zM41 25h2v5h-2zM43 26h2v5h-2zM45 27h2v5h-2zM47 28h2v3h-2zM49 29h6v1h-6zM49 30h4v1h-4zM49 31h2v1h-2z\"/><path fill=\"#403e3c\" d=\"M8 12h1v2h-1zM9 13h2v5h-2zM11 16h2v3h-2zM13 17h2v3h-2zM15 18h2v3h-2zM17 19h2v3h-2zM19 20h2v3h-2zM21 21h2v3h-2zM23 22h2v3h-2zM25 23h2v3h-2zM27 24h2v3h-2zM29 25h2v3h-2zM31 26h2v3h-2zM33 27h2v3h-2zM35 28h2v3h-2zM37 29h2v3h-2zM39 30h2v3h-2zM41 31h2v3h-2zM43 32h2v3h-2zM47 32h2v5h-2zM45 33h2v3h-2zM49 33h1v2h-1z\"/><path fill=\"#a699d0\" d=\"M17 24h1v2h-1zM20 24h1v18h-1zM16 25h1v1h-1zM18 25h1v2h-1zM21 25h1v17h-1zM26 29h2v2h-2zM28 30h2v2h-2zM33 33h3v1h-3zM38 33h1v18h-1zM34 34h3v1h-3zM39 34h1v17h-1zM36 35h1v1h-1zM44 38h2v2h-2zM46 39h2v1h-2zM46 40h1v1h-1z\"/><path fill=\"#5e409d\" d=\"M24 26h1v4h-1zM25 27h2v2h-2zM25 29h1v1h-1zM32 30h1v4h-1zM33 31h1v2h-1zM24 34h2v8h-2zM26 35h1v6h-1zM42 35h1v4h-1zM43 36h2v2h-2zM43 38h1v1h-1zM47 41h2v3h-2zM46 42h1v3h-1zM42 43h2v8h-2zM44 44h1v6h-1z\"/><path fill=\"#6f6e69\" d=\"M15 10h2v1h-2zM13 11h2v1h-2zM9 12h4v1h-4zM11 15h2v1h-2zM13 16h2v1h-2zM15 17h2v1h-2zM17 18h2v1h-2zM19 19h2v1h-2zM21 20h2v1h-2zM23 21h2v1h-2zM25 22h2v1h-2zM27 23h2v1h-2zM29 24h2v1h-2zM31 25h2v1h-2zM33 26h2v1h-2zM35 27h2v1h-2zM37 28h2v1h-2zM39 29h2v1h-2zM41 30h2v1h-2zM53 30h2v1h-2zM43 31h2v1h-2zM47 31h2v1h-2zM51 31h2v1h-2zM45 32h2v1h-2zM49 32h2v1h-2z\"/><path fill=\"#b7b5ac\" d=\"M15 41h2v3h-2zM17 42h2v3h-2zM19 43h2v3h-2zM21 44h2v3h-2zM33 50h2v3h-2zM35 51h2v3h-2zM37 52h2v3h-2zM39 53h2v3h-2z\"/><path fill=\"#878580\" d=\"M29 41h2v3h-2zM27 42h2v3h-2zM25 43h2v3h-2zM23 44h2v3h-2zM47 50h2v3h-2zM45 51h2v3h-2zM43 52h2v3h-2zM41 53h2v3h-2z\"/><path fill=\"#343331\" d=\"M15 11h2v2h-2zM13 12h2v2h-2zM11 13h2v2h-2zM55 30h1v2h-1zM53 31h2v4h-2zM51 32h2v4h-2zM50 33h1v4h-1zM49 35h1v2h-1z\"/><path fill=\"#e6e4d9\" d=\"M15 40h2v1h-2zM29 40h2v1h-2zM17 41h2v1h-2zM27 41h2v1h-2zM19 42h2v1h-2zM25 42h2v1h-2zM21 43h4v1h-4zM33 49h2v1h-2zM47 49h2v1h-2zM35 50h2v1h-2zM45 50h2v1h-2zM37 51h2v1h-2zM43 51h2v1h-2zM39 52h4v1h-4z\"/><path fill=\"#cecdc3\" d=\"M17 39h2v2h-2zM27 39h2v2h-2zM19 41h1v1h-1zM26 41h1v1h-1zM21 42h4v1h-4zM35 48h2v2h-2zM45 48h2v2h-2zM37 50h1v1h-1zM44 50h1v1h-1zM39 51h4v1h-4z\"/><path fill=\"#000000\" fill-opacity=\"0.353\" d=\"M17 46h2v1h-2zM27 46h2v1h-2zM19 47h2v1h-2zM25 47h2v1h-2zM21 48h4v1h-4zM35 55h2v1h-2zM45 55h2v1h-2zM37 56h2v1h-2zM43 56h2v1h-2zM39 57h4v1h-4z\"/><path fill=\"#c4b9e0\" d=\"M15 25h1v1h-1zM16 26h2v1h-2zM18 27h1v1h-1zM24 30h2v1h-2zM26 31h2v1h-2zM28 32h2v1h-2zM30 33h1v1h-1zM32 34h2v1h-2zM34 35h2v1h-2zM36 36h1v1h-1zM42 39h2v1h-2zM44 40h2v1h-2zM47 40h2v1h-2zM46 41h1v1h-1z\"/></svg>\n";
115433
115430
  // src/rpcs/contracts.ts
115434
115431
  var RpcContracts = class extends make$33(make$39("gateway.servers", {
115435
115432
  error: AuthError,
@@ -115443,15 +115440,9 @@ var RpcContracts = class extends make$33(make$39("gateway.servers", {
115443
115440
  error: AuthError,
115444
115441
  payload: AddServer,
115445
115442
  success: ConnectionInfo
115446
- }), make$39("gateway.disconnect", {
115447
- error: AuthError,
115448
- payload: ServerParams
115449
115443
  }), make$39("gateway.remove", {
115450
115444
  error: AuthError,
115451
115445
  payload: ServerParams
115452
- }), make$39("gateway.hide", {
115453
- error: AuthError,
115454
- payload: ToolVisibility
115455
115446
  })).middleware(RpcAuth) {};
115456
115447
  // src/rpcs/handlers.ts
115457
115448
  const RpcHandlers = RpcContracts.toLayer(gen(function* () {
@@ -115461,12 +115452,6 @@ const RpcHandlers = RpcContracts.toLayer(gen(function* () {
115461
115452
  return yield* connections.add(input.url, yield* CurrentUser);
115462
115453
  }),
115463
115454
  "gateway.calls": () => unwrap$3(map$5(CurrentUser, connections.calls)),
115464
- "gateway.disconnect": fnUntraced(function* (input) {
115465
- return yield* connections.disconnect(input.id, yield* CurrentUser);
115466
- }),
115467
- "gateway.hide": fnUntraced(function* (input) {
115468
- return yield* connections.hide(input, yield* CurrentUser);
115469
- }),
115470
115455
  "gateway.remove": fnUntraced(function* (input) {
115471
115456
  return yield* connections.remove(input.id, yield* CurrentUser);
115472
115457
  }),
@@ -115518,9 +115503,9 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
115518
115503
  });
115519
115504
  const visible = yield* make$44(empty$8());
115520
115505
  const installed = yield* make$44({});
115521
- const usable = fnUntraced(function* (id, generation, tool) {
115506
+ const usable = fnUntraced(function* (id, generation) {
115522
115507
  const now = yield* currentTimeMillis;
115523
- return exists(yield* option$1(connections.get(id)), (found) => found.generation === generation && connectionStatus(found, now) === "Connected" && !contains(found.hidden, tool));
115508
+ return exists(yield* option$1(connections.get(id)), (found) => found.generation === generation && connectionStatus(found, now) === "Connected");
115524
115509
  });
115525
115510
  const refreshes = yield* make$70(1);
115526
115511
  const scope$2 = yield* scope;
@@ -115531,7 +115516,7 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
115531
115516
  });
115532
115517
  const prune = fnUntraced(function* (registry) {
115533
115518
  const definitions = yield* connections.definitions;
115534
- for (const entry of toEntries(yield* get$1(installed))) if (!some(definitions, (server) => server.id === entry[1].id && server.generation === entry[1].generation && server.link._tag !== "Disconnected" && !contains(server.hidden, entry[1].tool))) yield* remove(entry[0], registry);
115519
+ for (const entry of toEntries(yield* get$1(installed))) if (!some(definitions, (server) => server.id === entry[1].id && server.generation === entry[1].generation && server.link._tag !== "Disconnected")) yield* remove(entry[0], registry);
115535
115520
  });
115536
115521
  const updateVisible = fnUntraced(function* (server, names, registry) {
115537
115522
  if (yield* modify$1(visible, (current) => {
@@ -115544,7 +115529,7 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
115544
115529
  if (!has(yield* get$1(visible), options.target)) return false;
115545
115530
  const entry = (yield* get$1(installed))[options.target];
115546
115531
  if (entry === void 0) return false;
115547
- return yield* usable(entry.id, entry.generation, entry.tool);
115532
+ return yield* usable(entry.id, entry.generation);
115548
115533
  })).layer);
115549
115534
  const upstreamFor = fnUntraced(function* (server) {
115550
115535
  const current = yield* connections.get(server.id);
@@ -115575,10 +115560,16 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
115575
115560
  const client = yield* acquireRelease(sync(() => new Client({
115576
115561
  name: "Deslop MCP gateway",
115577
115562
  version: "0.1.0"
115578
- }, { versionNegotiation: { mode: "auto" } })), (acquired) => pipe$1(tryPromise(() => transport.terminateSession()), timeout("3 seconds"), ignore$1({
115563
+ }, { versionNegotiation: { mode: "auto" } })), (acquired) => pipe$1(tryPromise({
115564
+ catch: rejected(server),
115565
+ try: () => transport.terminateSession()
115566
+ }), timeout("3 seconds"), ignore$1({
115579
115567
  log: "Warn",
115580
115568
  message: "Cannot terminate the upstream MCP session"
115581
- }), andThen(tryPromise(() => acquired.close())), ignore$1({
115569
+ }), andThen(tryPromise({
115570
+ catch: rejected(server),
115571
+ try: () => acquired.close()
115572
+ })), ignore$1({
115582
115573
  log: "Warn",
115583
115574
  message: "Cannot close the upstream MCP client"
115584
115575
  })));
@@ -115630,7 +115621,7 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
115630
115621
  "mode"
115631
115622
  ]);
115632
115623
  const names = make$73();
115633
- for (const tool of filter$5(found.tools, (candidate) => !contains(latest.hidden, candidate.name))) {
115624
+ for (const tool of found.tools) {
115634
115625
  const upstreamName = tool.name;
115635
115626
  const name = yield* namespaced(`${server.id}__${tool.name}`);
115636
115627
  const fingerprint = yield* encodeEffect(fromJsonString(Tool$5))(tool);
@@ -115652,8 +115643,7 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
115652
115643
  [name]: {
115653
115644
  fingerprint: `${server.generation}:${fingerprint}`,
115654
115645
  generation: server.generation,
115655
- id: server.id,
115656
- tool: upstreamName
115646
+ id: server.id
115657
115647
  }
115658
115648
  }));
115659
115649
  }
@@ -143776,7 +143766,7 @@ const ToolHandlers = Tools.toLayer(gen(function* () {
143776
143766
  onSome: (instructions) => ({ instructions })
143777
143767
  }),
143778
143768
  status: connectionStatus(server, now),
143779
- tools: length(filter$5(server.tools, (tool) => !contains(server.hidden, tool)))
143769
+ tools: length(server.tools)
143780
143770
  })) };
143781
143771
  }) });
143782
143772
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deslop/gateway",
3
- "version": "0.1.1232",
3
+ "version": "0.1.1235",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/MP281X/deslop.git",
@@ -32,5 +32,5 @@
32
32
  "engines": {
33
33
  "node": ">=26"
34
34
  },
35
- "fingerprint": "e1aacb14fbece9b817f4b772a812657d533d6aab4f7b6752af03340bf3255e01"
35
+ "fingerprint": "db6a86a7c68347b9ff507f6dfce470b3c8b34f1998d668762c03dcdf523dc972"
36
36
  }