@fre4x/grok 1.1.11 → 1.1.14
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.js +42 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34174,17 +34174,33 @@ function normalizeObjectSchema(schema) {
|
|
|
34174
34174
|
}
|
|
34175
34175
|
return void 0;
|
|
34176
34176
|
}
|
|
34177
|
+
function getDotPath(path4) {
|
|
34178
|
+
if (path4.length === 0) {
|
|
34179
|
+
return "object root";
|
|
34180
|
+
}
|
|
34181
|
+
return path4.reduce((acc, seg, index) => {
|
|
34182
|
+
if (index === 0) {
|
|
34183
|
+
return String(seg);
|
|
34184
|
+
}
|
|
34185
|
+
if (typeof seg === "number") {
|
|
34186
|
+
return `${acc}[${seg}]`;
|
|
34187
|
+
}
|
|
34188
|
+
return `${acc}.${seg}`;
|
|
34189
|
+
}, "");
|
|
34190
|
+
}
|
|
34177
34191
|
function getParseErrorMessage(error48) {
|
|
34178
34192
|
if (error48 && typeof error48 === "object") {
|
|
34193
|
+
if ("issues" in error48 && Array.isArray(error48.issues) && error48.issues.length > 0) {
|
|
34194
|
+
return error48.issues.map((i) => {
|
|
34195
|
+
if (!i.path?.length) {
|
|
34196
|
+
return i.message;
|
|
34197
|
+
}
|
|
34198
|
+
return `${i.message} at ${getDotPath(i.path)}`;
|
|
34199
|
+
}).join("\n");
|
|
34200
|
+
}
|
|
34179
34201
|
if ("message" in error48 && typeof error48.message === "string") {
|
|
34180
34202
|
return error48.message;
|
|
34181
34203
|
}
|
|
34182
|
-
if ("issues" in error48 && Array.isArray(error48.issues) && error48.issues.length > 0) {
|
|
34183
|
-
const firstIssue = error48.issues[0];
|
|
34184
|
-
if (firstIssue && typeof firstIssue === "object" && "message" in firstIssue) {
|
|
34185
|
-
return String(firstIssue.message);
|
|
34186
|
-
}
|
|
34187
|
-
}
|
|
34188
34204
|
try {
|
|
34189
34205
|
return JSON.stringify(error48);
|
|
34190
34206
|
} catch {
|
|
@@ -40578,16 +40594,7 @@ var Server = class extends Protocol {
|
|
|
40578
40594
|
if (!methodSchema) {
|
|
40579
40595
|
throw new Error("Schema is missing a method literal");
|
|
40580
40596
|
}
|
|
40581
|
-
|
|
40582
|
-
if (isZ4Schema(methodSchema)) {
|
|
40583
|
-
const v4Schema = methodSchema;
|
|
40584
|
-
const v4Def = v4Schema._zod?.def;
|
|
40585
|
-
methodValue = v4Def?.value ?? v4Schema.value;
|
|
40586
|
-
} else {
|
|
40587
|
-
const v3Schema = methodSchema;
|
|
40588
|
-
const legacyDef = v3Schema._def;
|
|
40589
|
-
methodValue = legacyDef?.value ?? v3Schema.value;
|
|
40590
|
-
}
|
|
40597
|
+
const methodValue = getLiteralValue(methodSchema);
|
|
40591
40598
|
if (typeof methodValue !== "string") {
|
|
40592
40599
|
throw new Error("Schema method literal must be a string");
|
|
40593
40600
|
}
|
|
@@ -42019,8 +42026,17 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
42019
42026
|
import process3 from "node:process";
|
|
42020
42027
|
|
|
42021
42028
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
42029
|
+
var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
|
|
42022
42030
|
var ReadBuffer = class {
|
|
42031
|
+
constructor(options) {
|
|
42032
|
+
this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
42033
|
+
}
|
|
42023
42034
|
append(chunk) {
|
|
42035
|
+
const newSize = (this._buffer?.length ?? 0) + chunk.length;
|
|
42036
|
+
if (newSize > this._maxBufferSize) {
|
|
42037
|
+
this.clear();
|
|
42038
|
+
throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
|
|
42039
|
+
}
|
|
42024
42040
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
42025
42041
|
}
|
|
42026
42042
|
readMessage() {
|
|
@@ -42048,18 +42064,24 @@ function serializeMessage(message) {
|
|
|
42048
42064
|
|
|
42049
42065
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
42050
42066
|
var StdioServerTransport = class {
|
|
42051
|
-
constructor(_stdin = process3.stdin, _stdout = process3.stdout) {
|
|
42067
|
+
constructor(_stdin = process3.stdin, _stdout = process3.stdout, options) {
|
|
42052
42068
|
this._stdin = _stdin;
|
|
42053
42069
|
this._stdout = _stdout;
|
|
42054
|
-
this._readBuffer = new ReadBuffer();
|
|
42055
42070
|
this._started = false;
|
|
42056
42071
|
this._ondata = (chunk) => {
|
|
42057
|
-
|
|
42058
|
-
|
|
42072
|
+
try {
|
|
42073
|
+
this._readBuffer.append(chunk);
|
|
42074
|
+
this.processReadBuffer();
|
|
42075
|
+
} catch (error48) {
|
|
42076
|
+
this.onerror?.(error48);
|
|
42077
|
+
this.close().catch(() => {
|
|
42078
|
+
});
|
|
42079
|
+
}
|
|
42059
42080
|
};
|
|
42060
42081
|
this._onerror = (error48) => {
|
|
42061
42082
|
this.onerror?.(error48);
|
|
42062
42083
|
};
|
|
42084
|
+
this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
|
|
42063
42085
|
}
|
|
42064
42086
|
/**
|
|
42065
42087
|
* Starts listening for messages on stdin.
|