@mushi-mushi/core 1.14.0 → 1.15.0
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/CONTRIBUTING.md +23 -1
- package/dist/index.cjs +24 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +24 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -237,7 +237,7 @@ interface MushiBannerConfig {
|
|
|
237
237
|
label?: string | false;
|
|
238
238
|
/** Override the call-to-action text in the banner. Defaults to '🐛 Report a bug'. */
|
|
239
239
|
bugCta?: string;
|
|
240
|
-
/** Show a "
|
|
240
|
+
/** Show a "Request a feature" button alongside the bug button. Defaults to true. */
|
|
241
241
|
featureCta?: boolean;
|
|
242
242
|
/** Override the feature-request button label. */
|
|
243
243
|
featureCtaLabel?: string;
|
|
@@ -1761,6 +1761,13 @@ interface LoggerOptions {
|
|
|
1761
1761
|
level?: LogLevel;
|
|
1762
1762
|
meta?: Record<string, unknown>;
|
|
1763
1763
|
format?: LogFormat;
|
|
1764
|
+
/**
|
|
1765
|
+
* Where to write log output.
|
|
1766
|
+
* - `'stdout'` (default): normal servers, browsers.
|
|
1767
|
+
* - `'stderr'`: use for stdio MCP servers where stdout is the JSON-RPC
|
|
1768
|
+
* protocol pipe; any non-JSON-RPC bytes there corrupt the connection.
|
|
1769
|
+
*/
|
|
1770
|
+
destination?: 'stdout' | 'stderr';
|
|
1764
1771
|
}
|
|
1765
1772
|
interface Logger {
|
|
1766
1773
|
debug(msg: string, meta?: Record<string, unknown>): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -237,7 +237,7 @@ interface MushiBannerConfig {
|
|
|
237
237
|
label?: string | false;
|
|
238
238
|
/** Override the call-to-action text in the banner. Defaults to '🐛 Report a bug'. */
|
|
239
239
|
bugCta?: string;
|
|
240
|
-
/** Show a "
|
|
240
|
+
/** Show a "Request a feature" button alongside the bug button. Defaults to true. */
|
|
241
241
|
featureCta?: boolean;
|
|
242
242
|
/** Override the feature-request button label. */
|
|
243
243
|
featureCtaLabel?: string;
|
|
@@ -1761,6 +1761,13 @@ interface LoggerOptions {
|
|
|
1761
1761
|
level?: LogLevel;
|
|
1762
1762
|
meta?: Record<string, unknown>;
|
|
1763
1763
|
format?: LogFormat;
|
|
1764
|
+
/**
|
|
1765
|
+
* Where to write log output.
|
|
1766
|
+
* - `'stdout'` (default): normal servers, browsers.
|
|
1767
|
+
* - `'stderr'`: use for stdio MCP servers where stdout is the JSON-RPC
|
|
1768
|
+
* protocol pipe; any non-JSON-RPC bytes there corrupt the connection.
|
|
1769
|
+
*/
|
|
1770
|
+
destination?: 'stdout' | 'stderr';
|
|
1764
1771
|
}
|
|
1765
1772
|
interface Logger {
|
|
1766
1773
|
debug(msg: string, meta?: Record<string, unknown>): void;
|
package/dist/index.js
CHANGED
|
@@ -577,20 +577,27 @@ function formatPretty(entry) {
|
|
|
577
577
|
function formatJson(entry) {
|
|
578
578
|
return JSON.stringify(entry);
|
|
579
579
|
}
|
|
580
|
-
function
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
case "fatal":
|
|
580
|
+
function makeEmitter(destination) {
|
|
581
|
+
if (destination === "stderr") {
|
|
582
|
+
return (level, formatted) => {
|
|
584
583
|
console.error(formatted);
|
|
585
|
-
|
|
586
|
-
case "warn":
|
|
587
|
-
console.warn(formatted);
|
|
588
|
-
break;
|
|
589
|
-
default:
|
|
590
|
-
console.log(formatted);
|
|
584
|
+
};
|
|
591
585
|
}
|
|
586
|
+
return (level, formatted) => {
|
|
587
|
+
switch (level) {
|
|
588
|
+
case "error":
|
|
589
|
+
case "fatal":
|
|
590
|
+
console.error(formatted);
|
|
591
|
+
break;
|
|
592
|
+
case "warn":
|
|
593
|
+
console.warn(formatted);
|
|
594
|
+
break;
|
|
595
|
+
default:
|
|
596
|
+
console.log(formatted);
|
|
597
|
+
}
|
|
598
|
+
};
|
|
592
599
|
}
|
|
593
|
-
function buildLogger(scope, minLevel, baseMeta, formatter) {
|
|
600
|
+
function buildLogger(scope, minLevel, baseMeta, formatter, emit) {
|
|
594
601
|
let currentLevel = minLevel;
|
|
595
602
|
function log(level, msg, meta) {
|
|
596
603
|
if (LEVEL_VALUE[level] < LEVEL_VALUE[currentLevel]) return;
|
|
@@ -615,7 +622,8 @@ function buildLogger(scope, minLevel, baseMeta, formatter) {
|
|
|
615
622
|
`${scope}:${childScope}`,
|
|
616
623
|
currentLevel,
|
|
617
624
|
{ ...baseMeta, ...childMeta },
|
|
618
|
-
formatter
|
|
625
|
+
formatter,
|
|
626
|
+
emit
|
|
619
627
|
);
|
|
620
628
|
},
|
|
621
629
|
setLevel(level) {
|
|
@@ -628,11 +636,13 @@ function createLogger(options) {
|
|
|
628
636
|
scope,
|
|
629
637
|
level = "info",
|
|
630
638
|
meta = {},
|
|
631
|
-
format = "auto"
|
|
639
|
+
format = "auto",
|
|
640
|
+
destination = "stdout"
|
|
632
641
|
} = options;
|
|
633
642
|
const resolvedFormat = format === "auto" ? detectFormat() : format;
|
|
634
643
|
const formatter = resolvedFormat === "json" ? formatJson : formatPretty;
|
|
635
|
-
|
|
644
|
+
const emit = makeEmitter(destination);
|
|
645
|
+
return buildLogger(scope, level, meta, formatter, emit);
|
|
636
646
|
}
|
|
637
647
|
var noopLogger = {
|
|
638
648
|
debug: () => {
|