@electric-ax/agents-mcp 0.2.1 → 0.2.2
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/index.cjs +13 -4
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +13 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -731,22 +731,31 @@ async function loadConfig(path$1, env = process.env) {
|
|
|
731
731
|
* `onChange`, or any error to `onError`. The caller is responsible
|
|
732
732
|
* for performing the initial load — `watchConfig` only sets up the
|
|
733
733
|
* subscription so the caller can fully await its first apply before
|
|
734
|
-
* subsequent change events start firing.
|
|
734
|
+
* subsequent change events start firing. The containing directory is
|
|
735
|
+
* watched so an absent `mcp.json` can be created later without making
|
|
736
|
+
* startup noisy.
|
|
735
737
|
*/
|
|
736
738
|
async function watchConfig(path$1, opts) {
|
|
737
739
|
const debounce = opts.debounceMs ?? 200;
|
|
740
|
+
const watchPath = node_path.default.resolve(path$1);
|
|
741
|
+
const watchParentPath = node_path.default.dirname(watchPath);
|
|
742
|
+
const watchFileName = node_path.default.basename(watchPath);
|
|
738
743
|
let timer;
|
|
739
744
|
const reload = async () => {
|
|
740
745
|
try {
|
|
741
746
|
const cfg = await loadConfig(path$1, opts.env);
|
|
742
747
|
opts.onChange(cfg);
|
|
743
748
|
} catch (err) {
|
|
749
|
+
if (err.code === `ENOENT`) {
|
|
750
|
+
opts.onChange({
|
|
751
|
+
servers: [],
|
|
752
|
+
raw: { servers: {} }
|
|
753
|
+
});
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
744
756
|
opts.onError?.(err);
|
|
745
757
|
}
|
|
746
758
|
};
|
|
747
|
-
const watchPath = node_path.default.resolve(path$1);
|
|
748
|
-
const watchParentPath = node_path.default.dirname(watchPath);
|
|
749
|
-
const watchFileName = node_path.default.basename(watchPath);
|
|
750
759
|
let watcher;
|
|
751
760
|
const onFileChanged = () => {
|
|
752
761
|
if (timer) clearTimeout(timer);
|
package/dist/index.d.cts
CHANGED
|
@@ -331,7 +331,9 @@ interface WatchOpts {
|
|
|
331
331
|
* `onChange`, or any error to `onError`. The caller is responsible
|
|
332
332
|
* for performing the initial load — `watchConfig` only sets up the
|
|
333
333
|
* subscription so the caller can fully await its first apply before
|
|
334
|
-
* subsequent change events start firing.
|
|
334
|
+
* subsequent change events start firing. The containing directory is
|
|
335
|
+
* watched so an absent `mcp.json` can be created later without making
|
|
336
|
+
* startup noisy.
|
|
335
337
|
*/
|
|
336
338
|
declare function watchConfig(path: string, opts: WatchOpts): Promise<() => void>;
|
|
337
339
|
|
package/dist/index.d.ts
CHANGED
|
@@ -331,7 +331,9 @@ interface WatchOpts {
|
|
|
331
331
|
* `onChange`, or any error to `onError`. The caller is responsible
|
|
332
332
|
* for performing the initial load — `watchConfig` only sets up the
|
|
333
333
|
* subscription so the caller can fully await its first apply before
|
|
334
|
-
* subsequent change events start firing.
|
|
334
|
+
* subsequent change events start firing. The containing directory is
|
|
335
|
+
* watched so an absent `mcp.json` can be created later without making
|
|
336
|
+
* startup noisy.
|
|
335
337
|
*/
|
|
336
338
|
declare function watchConfig(path: string, opts: WatchOpts): Promise<() => void>;
|
|
337
339
|
|
package/dist/index.js
CHANGED
|
@@ -707,22 +707,31 @@ async function loadConfig(path, env = process.env) {
|
|
|
707
707
|
* `onChange`, or any error to `onError`. The caller is responsible
|
|
708
708
|
* for performing the initial load — `watchConfig` only sets up the
|
|
709
709
|
* subscription so the caller can fully await its first apply before
|
|
710
|
-
* subsequent change events start firing.
|
|
710
|
+
* subsequent change events start firing. The containing directory is
|
|
711
|
+
* watched so an absent `mcp.json` can be created later without making
|
|
712
|
+
* startup noisy.
|
|
711
713
|
*/
|
|
712
714
|
async function watchConfig(path, opts) {
|
|
713
715
|
const debounce = opts.debounceMs ?? 200;
|
|
716
|
+
const watchPath = pathModule.resolve(path);
|
|
717
|
+
const watchParentPath = pathModule.dirname(watchPath);
|
|
718
|
+
const watchFileName = pathModule.basename(watchPath);
|
|
714
719
|
let timer;
|
|
715
720
|
const reload = async () => {
|
|
716
721
|
try {
|
|
717
722
|
const cfg = await loadConfig(path, opts.env);
|
|
718
723
|
opts.onChange(cfg);
|
|
719
724
|
} catch (err) {
|
|
725
|
+
if (err.code === `ENOENT`) {
|
|
726
|
+
opts.onChange({
|
|
727
|
+
servers: [],
|
|
728
|
+
raw: { servers: {} }
|
|
729
|
+
});
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
720
732
|
opts.onError?.(err);
|
|
721
733
|
}
|
|
722
734
|
};
|
|
723
|
-
const watchPath = pathModule.resolve(path);
|
|
724
|
-
const watchParentPath = pathModule.dirname(watchPath);
|
|
725
|
-
const watchFileName = pathModule.basename(watchPath);
|
|
726
735
|
let watcher;
|
|
727
736
|
const onFileChanged = () => {
|
|
728
737
|
if (timer) clearTimeout(timer);
|