@deslop/gateway 0.1.1243 → 0.1.1246

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
@@ -5827,6 +5827,27 @@ const empty$14 = () => ({});
5827
5827
  */
5828
5828
  const isEmptyRecord = (self) => Object.keys(self).length === 0;
5829
5829
  /**
5830
+ * Builds a record from an iterable of key-value pairs.
5831
+ *
5832
+ * **Details**
5833
+ *
5834
+ * If there are conflicting keys when using `fromEntries`, the last occurrence of the key/value pair will overwrite the
5835
+ * previous ones. So the resulting record will only have the value of the last occurrence of each key.
5836
+ *
5837
+ * **Example** (Building a record from entries)
5838
+ *
5839
+ * ```ts import.meta.vitest
5840
+ * import { Record } from "effect"
5841
+ *
5842
+ * Record.fromEntries([["a", 1], ["b", 2]]) // => { a: 1, b: 2 }
5843
+ * ```
5844
+ *
5845
+ * @stability stable
5846
+ * @category constructors
5847
+ * @since 2.0.0
5848
+ */
5849
+ const fromEntries = Object.fromEntries;
5850
+ /**
5830
5851
  * Transforms the values of a record into an `Array` with a custom mapping function.
5831
5852
  *
5832
5853
  * **Example** (Collecting mapped record values)
@@ -6814,28 +6835,34 @@ const of = (a) => [a];
6814
6835
  */
6815
6836
  const map$8 = /*#__PURE__*/ dual(2, (self, f) => self.map(f));
6816
6837
  /**
6817
- * Flattens a nested array of arrays into a single array.
6838
+ * Maps each element to an array and flattens the results into a single array.
6818
6839
  *
6819
6840
  * **When to use**
6820
6841
  *
6821
- * Use to collapse one level of nested arrays when no per-element mapping is
6822
- * needed.
6842
+ * Use to map each array element to zero or more values and concatenate the
6843
+ * results in one pass.
6823
6844
  *
6824
- * **Example** (Flattening nested arrays)
6845
+ * **Details**
6846
+ *
6847
+ * The function receives `(element, index)`. This returns `NonEmptyArray` when
6848
+ * both the input and mapped arrays are non-empty.
6849
+ *
6850
+ * **Example** (Flat mapping an array)
6825
6851
  *
6826
6852
  * ```ts import.meta.vitest
6827
6853
  * import { Array } from "effect"
6828
6854
  *
6829
- * Array.flatten([[1, 2], [], [3, 4], [], [5, 6]]) // => [1, 2, 3, 4, 5, 6]
6855
+ * Array.flatMap([1, 2, 3], (x) => [x, x * 2]) // => [1, 2, 2, 4, 3, 6]
6830
6856
  * ```
6831
6857
  *
6832
- * @see {@link flatMap} — map then flatten in one step
6858
+ * @see {@link map} — transform without flattening
6859
+ * @see {@link flatten} — flatten without mapping
6833
6860
  *
6834
6861
  * @stability stable
6835
6862
  * @category sequencing
6836
6863
  * @since 2.0.0
6837
6864
  */
6838
- const flatten$3 = /*#__PURE__*/ (/* @__PURE__ */ dual(2, (self, f) => {
6865
+ const flatMap$5 = /*#__PURE__*/ dual(2, (self, f) => {
6839
6866
  if (isReadonlyArrayEmpty(self)) return [];
6840
6867
  const out = [];
6841
6868
  for (let i = 0; i < self.length; i++) {
@@ -6843,7 +6870,30 @@ const flatten$3 = /*#__PURE__*/ (/* @__PURE__ */ dual(2, (self, f) => {
6843
6870
  for (let j = 0; j < inner.length; j++) out.push(inner[j]);
6844
6871
  }
6845
6872
  return out;
6846
- }))(identity);
6873
+ });
6874
+ /**
6875
+ * Flattens a nested array of arrays into a single array.
6876
+ *
6877
+ * **When to use**
6878
+ *
6879
+ * Use to collapse one level of nested arrays when no per-element mapping is
6880
+ * needed.
6881
+ *
6882
+ * **Example** (Flattening nested arrays)
6883
+ *
6884
+ * ```ts import.meta.vitest
6885
+ * import { Array } from "effect"
6886
+ *
6887
+ * Array.flatten([[1, 2], [], [3, 4], [], [5, 6]]) // => [1, 2, 3, 4, 5, 6]
6888
+ * ```
6889
+ *
6890
+ * @see {@link flatMap} — map then flatten in one step
6891
+ *
6892
+ * @stability stable
6893
+ * @category sequencing
6894
+ * @since 2.0.0
6895
+ */
6896
+ const flatten$3 = /*#__PURE__*/ flatMap$5(identity);
6847
6897
  /**
6848
6898
  * Extracts all `Some` values from an iterable of `Option`s, discarding `None`s.
6849
6899
  *
@@ -115410,9 +115460,14 @@ const ConnectionStore = Record$1(String$6, Struct({
115410
115460
  mode: Literals(["oauth", "public"]),
115411
115461
  name: NonEmptyString,
115412
115462
  oauth: optionalKey(OAuth),
115463
+ toolDescriptions: optionalKey(Record$1(String$6, String$6)),
115413
115464
  tools: ArraySchema(String$6),
115414
115465
  url: ServerUrl
115415
115466
  }));
115467
+ const ToolInfo = Struct({
115468
+ description: optionalKey(String$6),
115469
+ name: NonEmptyString
115470
+ });
115416
115471
  const ConnectionInfo = Struct({
115417
115472
  error: optionalKey(String$6),
115418
115473
  icons: ArraySchema(ServerIcon),
@@ -115423,13 +115478,14 @@ const ConnectionInfo = Struct({
115423
115478
  "Not connected",
115424
115479
  "Expired"
115425
115480
  ]),
115426
- tools: ArraySchema(String$6),
115481
+ tools: ArraySchema(ToolInfo),
115427
115482
  url: ServerUrl
115428
115483
  });
115429
115484
  TaggedUnion({
115430
115485
  Discovered: {
115431
115486
  icons: ArraySchema(ServerIcon),
115432
115487
  instructions: optionalKey(String$6),
115488
+ toolDescriptions: optionalKey(Record$1(String$6, String$6)),
115433
115489
  tools: ArraySchema(String$6)
115434
115490
  },
115435
115491
  Failed: { error: String$6 }
@@ -115492,11 +115548,17 @@ function connectionInfo(connection, now) {
115492
115548
  ...pick$1(connection, [
115493
115549
  "id",
115494
115550
  "name",
115495
- "tools",
115496
115551
  "url"
115497
115552
  ]),
115498
115553
  icons: connection.icons ?? [],
115499
- status: connectionStatus(connection, now)
115554
+ status: connectionStatus(connection, now),
115555
+ tools: map$8(connection.tools, (name) => ({
115556
+ name,
115557
+ ...match$8(flatMap$7(fromUndefinedOr(connection.toolDescriptions), (descriptions) => get$9(descriptions, name)), {
115558
+ onNone: () => ({}),
115559
+ onSome: (description) => ({ description })
115560
+ })
115561
+ }))
115500
115562
  };
115501
115563
  }
115502
115564
  function serverIcons(implementation) {
@@ -115736,6 +115798,10 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
115736
115798
  link: { _tag: "Connected" },
115737
115799
  mode: "public",
115738
115800
  name: anonymous.getServerVersion()?.name ?? initial.name,
115801
+ toolDescriptions: fromEntries(flatMap$5(tools.tools, (tool) => match$8(fromUndefinedOr(tool.description), {
115802
+ onNone: () => [],
115803
+ onSome: (description) => [[tool.name, description]]
115804
+ }))),
115739
115805
  tools: map$8(tools.tools, (tool) => tool.name)
115740
115806
  };
115741
115807
  }
@@ -115887,8 +115953,16 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
115887
115953
  report: fnUntraced(function* (id, generation, outcome) {
115888
115954
  yield* pipe$1(update(id, generation, (found) => valueTags(outcome, {
115889
115955
  Discovered: (discovered) => ({
115890
- ...omit$1(found, ["error", "instructions"]),
115891
- ...pick$1(discovered, ["icons", "instructions"]),
115956
+ ...omit$1(found, [
115957
+ "error",
115958
+ "instructions",
115959
+ "toolDescriptions"
115960
+ ]),
115961
+ ...pick$1(discovered, [
115962
+ "icons",
115963
+ "instructions",
115964
+ "toolDescriptions"
115965
+ ]),
115892
115966
  tools: discovered.tools
115893
115967
  }),
115894
115968
  Failed: (failure) => ({
@@ -116091,6 +116165,10 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
116091
116165
  onNone: () => ({}),
116092
116166
  onSome: (instructions) => ({ instructions })
116093
116167
  }),
116168
+ toolDescriptions: fromEntries(flatMap$5(found.tools, (tool) => match$8(fromUndefinedOr(tool.description), {
116169
+ onNone: () => [],
116170
+ onSome: (description) => [[tool.name, description]]
116171
+ }))),
116094
116172
  tools: map$8(found.tools, (tool) => tool.name)
116095
116173
  });
116096
116174
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deslop/gateway",
3
- "version": "0.1.1243",
3
+ "version": "0.1.1246",
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": "dfd1a36354b1fd389b07ac76cab8ef3fbae4ac481de6707d1d53dbd783cfb5e7"
35
+ "fingerprint": "15b8f961251005126b5d2917b4b8496394f13c0fabbee5e088213bff0323ccf6"
36
36
  }