@mcpc-tech/cli 0.1.53 → 0.1.54
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/app.cjs +145 -42
- package/app.mjs +146 -43
- package/bin/mcpc.cjs +96 -39
- package/bin/mcpc.mjs +96 -39
- package/bin.cjs +96 -39
- package/bin.mjs +96 -39
- package/index.cjs +145 -42
- package/index.mjs +146 -43
- package/package.json +1 -1
- package/server.cjs +145 -42
- package/server.mjs +146 -43
package/app.cjs
CHANGED
|
@@ -551,10 +551,9 @@ var ProgressTokenSchema = z.union([z.string(), z.number().int()]);
|
|
|
551
551
|
var CursorSchema = z.string();
|
|
552
552
|
var TaskCreationParamsSchema = z.looseObject({
|
|
553
553
|
/**
|
|
554
|
-
*
|
|
555
|
-
* If null, the task has unlimited lifetime until manually cleaned up.
|
|
554
|
+
* Requested duration in milliseconds to retain task from creation.
|
|
556
555
|
*/
|
|
557
|
-
ttl: z.
|
|
556
|
+
ttl: z.number().optional(),
|
|
558
557
|
/**
|
|
559
558
|
* Time in milliseconds to wait between task status requests.
|
|
560
559
|
*/
|
|
@@ -854,7 +853,11 @@ var ClientCapabilitiesSchema = z.object({
|
|
|
854
853
|
/**
|
|
855
854
|
* Present if the client supports task creation.
|
|
856
855
|
*/
|
|
857
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
856
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
857
|
+
/**
|
|
858
|
+
* Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
|
|
859
|
+
*/
|
|
860
|
+
extensions: z.record(z.string(), AssertObjectSchema).optional()
|
|
858
861
|
});
|
|
859
862
|
var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
860
863
|
/**
|
|
@@ -916,7 +919,11 @@ var ServerCapabilitiesSchema = z.object({
|
|
|
916
919
|
/**
|
|
917
920
|
* Present if the server supports task creation.
|
|
918
921
|
*/
|
|
919
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
922
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
923
|
+
/**
|
|
924
|
+
* Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
|
|
925
|
+
*/
|
|
926
|
+
extensions: z.record(z.string(), AssertObjectSchema).optional()
|
|
920
927
|
});
|
|
921
928
|
var InitializeResultSchema = ResultSchema.extend({
|
|
922
929
|
/**
|
|
@@ -1109,6 +1116,12 @@ var ResourceSchema = z.object({
|
|
|
1109
1116
|
* The MIME type of this resource, if known.
|
|
1110
1117
|
*/
|
|
1111
1118
|
mimeType: z.optional(z.string()),
|
|
1119
|
+
/**
|
|
1120
|
+
* The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
|
|
1121
|
+
*
|
|
1122
|
+
* This can be used by Hosts to display file sizes and estimate context window usage.
|
|
1123
|
+
*/
|
|
1124
|
+
size: z.optional(z.number()),
|
|
1112
1125
|
/**
|
|
1113
1126
|
* Optional annotations for the client.
|
|
1114
1127
|
*/
|
|
@@ -2673,6 +2686,10 @@ var Protocol = class {
|
|
|
2673
2686
|
this._progressHandlers.clear();
|
|
2674
2687
|
this._taskProgressTokens.clear();
|
|
2675
2688
|
this._pendingDebouncedNotifications.clear();
|
|
2689
|
+
for (const info of this._timeoutInfo.values()) {
|
|
2690
|
+
clearTimeout(info.timeoutId);
|
|
2691
|
+
}
|
|
2692
|
+
this._timeoutInfo.clear();
|
|
2676
2693
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
2677
2694
|
controller.abort();
|
|
2678
2695
|
}
|
|
@@ -2803,7 +2820,9 @@ var Protocol = class {
|
|
|
2803
2820
|
await capturedTransport?.send(errorResponse);
|
|
2804
2821
|
}
|
|
2805
2822
|
}).catch((error) => this._onerror(new Error(`Failed to send response: ${error}`))).finally(() => {
|
|
2806
|
-
this._requestHandlerAbortControllers.
|
|
2823
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
2824
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
2825
|
+
}
|
|
2807
2826
|
});
|
|
2808
2827
|
}
|
|
2809
2828
|
_onprogress(notification) {
|
|
@@ -4927,7 +4946,7 @@ var StdioClientTransport = class {
|
|
|
4927
4946
|
},
|
|
4928
4947
|
stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
|
|
4929
4948
|
shell: false,
|
|
4930
|
-
windowsHide: import_node_process.default.platform === "win32"
|
|
4949
|
+
windowsHide: import_node_process.default.platform === "win32",
|
|
4931
4950
|
cwd: this._serverParams.cwd
|
|
4932
4951
|
});
|
|
4933
4952
|
this._process.on("error", (error) => {
|
|
@@ -5034,9 +5053,6 @@ var StdioClientTransport = class {
|
|
|
5034
5053
|
});
|
|
5035
5054
|
}
|
|
5036
5055
|
};
|
|
5037
|
-
function isElectron() {
|
|
5038
|
-
return "type" in import_node_process.default;
|
|
5039
|
-
}
|
|
5040
5056
|
|
|
5041
5057
|
// __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
|
|
5042
5058
|
var ParseError = class extends Error {
|
|
@@ -5781,12 +5797,12 @@ var AUTHORIZATION_CODE_RESPONSE_TYPE = "code";
|
|
|
5781
5797
|
var AUTHORIZATION_CODE_CHALLENGE_METHOD = "S256";
|
|
5782
5798
|
function selectClientAuthMethod(clientInformation, supportedMethods) {
|
|
5783
5799
|
const hasClientSecret = clientInformation.client_secret !== void 0;
|
|
5784
|
-
if (supportedMethods.length === 0) {
|
|
5785
|
-
return hasClientSecret ? "client_secret_post" : "none";
|
|
5786
|
-
}
|
|
5787
|
-
if ("token_endpoint_auth_method" in clientInformation && clientInformation.token_endpoint_auth_method && isClientAuthMethod(clientInformation.token_endpoint_auth_method) && supportedMethods.includes(clientInformation.token_endpoint_auth_method)) {
|
|
5800
|
+
if ("token_endpoint_auth_method" in clientInformation && clientInformation.token_endpoint_auth_method && isClientAuthMethod(clientInformation.token_endpoint_auth_method) && (supportedMethods.length === 0 || supportedMethods.includes(clientInformation.token_endpoint_auth_method))) {
|
|
5788
5801
|
return clientInformation.token_endpoint_auth_method;
|
|
5789
5802
|
}
|
|
5803
|
+
if (supportedMethods.length === 0) {
|
|
5804
|
+
return hasClientSecret ? "client_secret_basic" : "none";
|
|
5805
|
+
}
|
|
5790
5806
|
if (hasClientSecret && supportedMethods.includes("client_secret_basic")) {
|
|
5791
5807
|
return "client_secret_basic";
|
|
5792
5808
|
}
|
|
@@ -5897,6 +5913,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
5897
5913
|
});
|
|
5898
5914
|
}
|
|
5899
5915
|
const resource = await selectResourceURL(serverUrl, provider, resourceMetadata);
|
|
5916
|
+
const resolvedScope = scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope;
|
|
5900
5917
|
let clientInformation = await Promise.resolve(provider.clientInformation());
|
|
5901
5918
|
if (!clientInformation) {
|
|
5902
5919
|
if (authorizationCode !== void 0) {
|
|
@@ -5920,6 +5937,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
5920
5937
|
const fullInformation = await registerClient(authorizationServerUrl, {
|
|
5921
5938
|
metadata,
|
|
5922
5939
|
clientMetadata: provider.clientMetadata,
|
|
5940
|
+
scope: resolvedScope,
|
|
5923
5941
|
fetchFn
|
|
5924
5942
|
});
|
|
5925
5943
|
await provider.saveClientInformation(fullInformation);
|
|
@@ -5963,7 +5981,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
5963
5981
|
clientInformation,
|
|
5964
5982
|
state,
|
|
5965
5983
|
redirectUrl: provider.redirectUrl,
|
|
5966
|
-
scope:
|
|
5984
|
+
scope: resolvedScope,
|
|
5967
5985
|
resource
|
|
5968
5986
|
});
|
|
5969
5987
|
await provider.saveCodeVerifier(codeVerifier);
|
|
@@ -6281,7 +6299,7 @@ async function fetchToken(provider, authorizationServerUrl, { metadata, resource
|
|
|
6281
6299
|
fetchFn
|
|
6282
6300
|
});
|
|
6283
6301
|
}
|
|
6284
|
-
async function registerClient(authorizationServerUrl, { metadata, clientMetadata, fetchFn }) {
|
|
6302
|
+
async function registerClient(authorizationServerUrl, { metadata, clientMetadata, scope, fetchFn }) {
|
|
6285
6303
|
let registrationUrl;
|
|
6286
6304
|
if (metadata) {
|
|
6287
6305
|
if (!metadata.registration_endpoint) {
|
|
@@ -6296,7 +6314,10 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
|
|
|
6296
6314
|
headers: {
|
|
6297
6315
|
"Content-Type": "application/json"
|
|
6298
6316
|
},
|
|
6299
|
-
body: JSON.stringify(
|
|
6317
|
+
body: JSON.stringify({
|
|
6318
|
+
...clientMetadata,
|
|
6319
|
+
...scope !== void 0 ? { scope } : {}
|
|
6320
|
+
})
|
|
6300
6321
|
});
|
|
6301
6322
|
if (!response.ok) {
|
|
6302
6323
|
throw await parseErrorResponse(response);
|
|
@@ -7391,7 +7412,7 @@ var SystemPrompts = {
|
|
|
7391
7412
|
</rules>
|
|
7392
7413
|
|
|
7393
7414
|
<format>
|
|
7394
|
-
Get tool
|
|
7415
|
+
Get tool definitions: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
|
|
7395
7416
|
Execute a tool: \`{ "tool": "tool_name", "args": { /* parameters */ } }\`
|
|
7396
7417
|
</format>`,
|
|
7397
7418
|
/**
|
|
@@ -7516,7 +7537,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
7516
7537
|
*
|
|
7517
7538
|
* Only two fields:
|
|
7518
7539
|
* - `tool`: which tool to execute (enum includes "man" + all tool names)
|
|
7519
|
-
* - `args`: object with parameters. For "man": { tools: ["a", "b"] }. For others: tool parameters.
|
|
7540
|
+
* - `args`: object with parameters. For "man": { tools: ["a", "b"] } to fetch tool definitions (including input/output schemas). For others: tool parameters.
|
|
7520
7541
|
*/
|
|
7521
7542
|
forAgentic: function(allToolNames) {
|
|
7522
7543
|
const toolEnum = [
|
|
@@ -9468,11 +9489,12 @@ var ToolManager = class {
|
|
|
9468
9489
|
/**
|
|
9469
9490
|
* Register a tool in the registry
|
|
9470
9491
|
*/
|
|
9471
|
-
registerTool(name, description,
|
|
9492
|
+
registerTool(name, description, inputSchema, callback, options = {}) {
|
|
9472
9493
|
this.toolRegistry.set(name, {
|
|
9473
9494
|
callback,
|
|
9474
9495
|
description,
|
|
9475
|
-
|
|
9496
|
+
inputSchema,
|
|
9497
|
+
outputSchema: options.outputSchema
|
|
9476
9498
|
});
|
|
9477
9499
|
if (options.hidden) {
|
|
9478
9500
|
this.toolConfigs.set(name, {
|
|
@@ -9485,13 +9507,16 @@ var ToolManager = class {
|
|
|
9485
9507
|
/**
|
|
9486
9508
|
* Explicitly mark a tool as public (exposed to MCP clients)
|
|
9487
9509
|
*/
|
|
9488
|
-
addPublicTool(name, description,
|
|
9510
|
+
addPublicTool(name, description, inputSchema, outputSchema) {
|
|
9489
9511
|
const existingTool = this.publicTools.find((t) => t.name === name);
|
|
9490
9512
|
if (!existingTool) {
|
|
9491
9513
|
this.publicTools.push({
|
|
9492
9514
|
name,
|
|
9493
9515
|
description,
|
|
9494
|
-
inputSchema
|
|
9516
|
+
inputSchema,
|
|
9517
|
+
...outputSchema ? {
|
|
9518
|
+
outputSchema
|
|
9519
|
+
} : {}
|
|
9495
9520
|
});
|
|
9496
9521
|
}
|
|
9497
9522
|
this.toolConfigs.set(name, {
|
|
@@ -9617,10 +9642,13 @@ var ToolManager = class {
|
|
|
9617
9642
|
getHiddenToolSchema(name) {
|
|
9618
9643
|
const tool2 = this.toolRegistry.get(name);
|
|
9619
9644
|
const config = this.toolConfigs.get(name);
|
|
9620
|
-
if (tool2 && config?.visibility?.hidden && tool2.
|
|
9645
|
+
if (tool2 && config?.visibility?.hidden && tool2.inputSchema) {
|
|
9621
9646
|
return {
|
|
9622
9647
|
description: tool2.description,
|
|
9623
|
-
|
|
9648
|
+
inputSchema: tool2.inputSchema,
|
|
9649
|
+
...tool2.outputSchema ? {
|
|
9650
|
+
outputSchema: tool2.outputSchema
|
|
9651
|
+
} : {}
|
|
9624
9652
|
};
|
|
9625
9653
|
}
|
|
9626
9654
|
return void 0;
|
|
@@ -9656,10 +9684,13 @@ var ToolManager = class {
|
|
|
9656
9684
|
composedTools[name] = {
|
|
9657
9685
|
name,
|
|
9658
9686
|
description: tool2.description,
|
|
9659
|
-
inputSchema: jsonSchema(tool2.
|
|
9687
|
+
inputSchema: jsonSchema(tool2.inputSchema || {
|
|
9660
9688
|
type: "object",
|
|
9661
9689
|
properties: {}
|
|
9662
9690
|
}),
|
|
9691
|
+
...tool2.outputSchema ? {
|
|
9692
|
+
outputSchema: jsonSchema(tool2.outputSchema)
|
|
9693
|
+
} : {},
|
|
9663
9694
|
execute: tool2.callback
|
|
9664
9695
|
};
|
|
9665
9696
|
}
|
|
@@ -9676,10 +9707,13 @@ var ToolManager = class {
|
|
|
9676
9707
|
return {
|
|
9677
9708
|
name,
|
|
9678
9709
|
description: tool2.description,
|
|
9679
|
-
inputSchema: tool2.
|
|
9710
|
+
inputSchema: tool2.inputSchema ?? {
|
|
9680
9711
|
type: "object",
|
|
9681
9712
|
properties: {}
|
|
9682
9713
|
},
|
|
9714
|
+
...tool2.outputSchema ? {
|
|
9715
|
+
outputSchema: tool2.outputSchema
|
|
9716
|
+
} : {},
|
|
9683
9717
|
execute: tool2.callback
|
|
9684
9718
|
};
|
|
9685
9719
|
}
|
|
@@ -9693,10 +9727,13 @@ var ToolManager = class {
|
|
|
9693
9727
|
composedTools.push({
|
|
9694
9728
|
name,
|
|
9695
9729
|
description: tool2.description,
|
|
9696
|
-
inputSchema: tool2.
|
|
9730
|
+
inputSchema: tool2.inputSchema ?? {
|
|
9697
9731
|
type: "object",
|
|
9698
9732
|
properties: {}
|
|
9699
9733
|
},
|
|
9734
|
+
...tool2.outputSchema ? {
|
|
9735
|
+
outputSchema: tool2.outputSchema
|
|
9736
|
+
} : {},
|
|
9700
9737
|
execute: tool2.callback
|
|
9701
9738
|
});
|
|
9702
9739
|
}
|
|
@@ -9749,7 +9786,10 @@ async function processToolsWithPlugins(server, _externalTools, mode) {
|
|
|
9749
9786
|
const tempTool = {
|
|
9750
9787
|
name: toolId,
|
|
9751
9788
|
description: toolData.description,
|
|
9752
|
-
inputSchema: toolData.
|
|
9789
|
+
inputSchema: toolData.inputSchema || defaultSchema,
|
|
9790
|
+
...toolData.outputSchema ? {
|
|
9791
|
+
outputSchema: toolData.outputSchema
|
|
9792
|
+
} : {},
|
|
9753
9793
|
execute: toolData.callback
|
|
9754
9794
|
};
|
|
9755
9795
|
const processedTool = await pluginManager.applyTransformToolHooks(tempTool, {
|
|
@@ -9761,7 +9801,9 @@ async function processToolsWithPlugins(server, _externalTools, mode) {
|
|
|
9761
9801
|
},
|
|
9762
9802
|
transformationIndex: 0
|
|
9763
9803
|
});
|
|
9764
|
-
toolManager.registerTool(toolId, processedTool.description || toolData.description, processedTool.inputSchema, processedTool.execute
|
|
9804
|
+
toolManager.registerTool(toolId, processedTool.description || toolData.description, processedTool.inputSchema, processedTool.execute, {
|
|
9805
|
+
outputSchema: processedTool.outputSchema
|
|
9806
|
+
});
|
|
9765
9807
|
}
|
|
9766
9808
|
}
|
|
9767
9809
|
function buildDependencyGroups(toolNameToDetailList, hiddenToolNames, publicToolNames, server) {
|
|
@@ -9936,9 +9978,13 @@ var ComposableMCPServer = class extends Server {
|
|
|
9936
9978
|
}
|
|
9937
9979
|
tool(name, description, paramsSchema, cb, options = {}) {
|
|
9938
9980
|
const jsonSchemaObj = extractJsonSchema(paramsSchema);
|
|
9939
|
-
|
|
9981
|
+
const outputSchemaObj = options.outputSchema ? extractJsonSchema(options.outputSchema) : void 0;
|
|
9982
|
+
this.toolManager.registerTool(name, description, jsonSchemaObj, cb, {
|
|
9983
|
+
...options,
|
|
9984
|
+
outputSchema: outputSchemaObj
|
|
9985
|
+
});
|
|
9940
9986
|
if (!options.internal) {
|
|
9941
|
-
this.toolManager.addPublicTool(name, description, jsonSchemaObj);
|
|
9987
|
+
this.toolManager.addPublicTool(name, description, jsonSchemaObj, outputSchemaObj);
|
|
9942
9988
|
}
|
|
9943
9989
|
if (options.plugins) {
|
|
9944
9990
|
for (const plugin of options.plugins) {
|
|
@@ -10195,9 +10241,12 @@ var ComposableMCPServer = class extends Server {
|
|
|
10195
10241
|
return {
|
|
10196
10242
|
name,
|
|
10197
10243
|
description: tool2?.description || "",
|
|
10198
|
-
inputSchema: tool2?.
|
|
10244
|
+
inputSchema: tool2?.inputSchema || {
|
|
10199
10245
|
type: "object"
|
|
10200
|
-
}
|
|
10246
|
+
},
|
|
10247
|
+
...tool2?.outputSchema ? {
|
|
10248
|
+
outputSchema: tool2.outputSchema
|
|
10249
|
+
} : {}
|
|
10201
10250
|
};
|
|
10202
10251
|
});
|
|
10203
10252
|
}
|
|
@@ -10222,9 +10271,12 @@ var ComposableMCPServer = class extends Server {
|
|
|
10222
10271
|
return Array.from(registry.entries()).map(([name, tool2]) => ({
|
|
10223
10272
|
name,
|
|
10224
10273
|
description: tool2?.description || "",
|
|
10225
|
-
inputSchema: tool2?.
|
|
10274
|
+
inputSchema: tool2?.inputSchema || {
|
|
10226
10275
|
type: "object"
|
|
10227
|
-
}
|
|
10276
|
+
},
|
|
10277
|
+
...tool2?.outputSchema ? {
|
|
10278
|
+
outputSchema: tool2.outputSchema
|
|
10279
|
+
} : {}
|
|
10228
10280
|
}));
|
|
10229
10281
|
}
|
|
10230
10282
|
/**
|
|
@@ -10366,7 +10418,9 @@ var ComposableMCPServer = class extends Server {
|
|
|
10366
10418
|
});
|
|
10367
10419
|
});
|
|
10368
10420
|
Object.entries(tools).forEach(([toolId, tool2]) => {
|
|
10369
|
-
this.toolManager.registerTool(toolId, tool2.description || "", tool2.inputSchema, tool2.execute
|
|
10421
|
+
this.toolManager.registerTool(toolId, tool2.description || "", tool2.inputSchema, tool2.execute, {
|
|
10422
|
+
outputSchema: tool2.outputSchema
|
|
10423
|
+
});
|
|
10370
10424
|
});
|
|
10371
10425
|
const registeredTools = this.toolManager.getRegisteredToolsAsComposed();
|
|
10372
10426
|
const allTools = {
|
|
@@ -10427,7 +10481,8 @@ var ComposableMCPServer = class extends Server {
|
|
|
10427
10481
|
return;
|
|
10428
10482
|
}
|
|
10429
10483
|
this.tool(toolId, tool2.description || "", jsonSchema(tool2.inputSchema), tool2.execute, {
|
|
10430
|
-
internal: false
|
|
10484
|
+
internal: false,
|
|
10485
|
+
outputSchema: tool2.outputSchema
|
|
10431
10486
|
});
|
|
10432
10487
|
});
|
|
10433
10488
|
await this.pluginManager.triggerComposeEnd({
|
|
@@ -13720,6 +13775,50 @@ if (typeof global.crypto === "undefined") {
|
|
|
13720
13775
|
global.crypto = import_crypto.default;
|
|
13721
13776
|
}
|
|
13722
13777
|
var outgoingEnded = Symbol("outgoingEnded");
|
|
13778
|
+
var incomingDraining = Symbol("incomingDraining");
|
|
13779
|
+
var DRAIN_TIMEOUT_MS = 500;
|
|
13780
|
+
var MAX_DRAIN_BYTES = 64 * 1024 * 1024;
|
|
13781
|
+
var drainIncoming = (incoming) => {
|
|
13782
|
+
const incomingWithDrainState = incoming;
|
|
13783
|
+
if (incoming.destroyed || incomingWithDrainState[incomingDraining]) {
|
|
13784
|
+
return;
|
|
13785
|
+
}
|
|
13786
|
+
incomingWithDrainState[incomingDraining] = true;
|
|
13787
|
+
if (incoming instanceof import_http2.Http2ServerRequest) {
|
|
13788
|
+
try {
|
|
13789
|
+
;
|
|
13790
|
+
incoming.stream?.close?.(import_http2.constants.NGHTTP2_NO_ERROR);
|
|
13791
|
+
} catch {
|
|
13792
|
+
}
|
|
13793
|
+
return;
|
|
13794
|
+
}
|
|
13795
|
+
let bytesRead = 0;
|
|
13796
|
+
const cleanup = () => {
|
|
13797
|
+
clearTimeout(timer);
|
|
13798
|
+
incoming.off("data", onData);
|
|
13799
|
+
incoming.off("end", cleanup);
|
|
13800
|
+
incoming.off("error", cleanup);
|
|
13801
|
+
};
|
|
13802
|
+
const forceClose = () => {
|
|
13803
|
+
cleanup();
|
|
13804
|
+
const socket = incoming.socket;
|
|
13805
|
+
if (socket && !socket.destroyed) {
|
|
13806
|
+
socket.destroySoon();
|
|
13807
|
+
}
|
|
13808
|
+
};
|
|
13809
|
+
const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS);
|
|
13810
|
+
timer.unref?.();
|
|
13811
|
+
const onData = (chunk) => {
|
|
13812
|
+
bytesRead += chunk.length;
|
|
13813
|
+
if (bytesRead > MAX_DRAIN_BYTES) {
|
|
13814
|
+
forceClose();
|
|
13815
|
+
}
|
|
13816
|
+
};
|
|
13817
|
+
incoming.on("data", onData);
|
|
13818
|
+
incoming.on("end", cleanup);
|
|
13819
|
+
incoming.on("error", cleanup);
|
|
13820
|
+
incoming.resume();
|
|
13821
|
+
};
|
|
13723
13822
|
var handleRequestError = () => new Response(null, {
|
|
13724
13823
|
status: 400
|
|
13725
13824
|
});
|
|
@@ -13891,14 +13990,18 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
13891
13990
|
setTimeout(() => {
|
|
13892
13991
|
if (!incomingEnded) {
|
|
13893
13992
|
setTimeout(() => {
|
|
13894
|
-
incoming
|
|
13895
|
-
outgoing.destroy();
|
|
13993
|
+
drainIncoming(incoming);
|
|
13896
13994
|
});
|
|
13897
13995
|
}
|
|
13898
13996
|
});
|
|
13899
13997
|
}
|
|
13900
13998
|
};
|
|
13901
13999
|
}
|
|
14000
|
+
outgoing.on("finish", () => {
|
|
14001
|
+
if (!incomingEnded) {
|
|
14002
|
+
drainIncoming(incoming);
|
|
14003
|
+
}
|
|
14004
|
+
});
|
|
13902
14005
|
}
|
|
13903
14006
|
outgoing.on("close", () => {
|
|
13904
14007
|
const abortController = req[abortControllerKey];
|
|
@@ -13913,7 +14016,7 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
13913
14016
|
setTimeout(() => {
|
|
13914
14017
|
if (!incomingEnded) {
|
|
13915
14018
|
setTimeout(() => {
|
|
13916
|
-
incoming
|
|
14019
|
+
drainIncoming(incoming);
|
|
13917
14020
|
});
|
|
13918
14021
|
}
|
|
13919
14022
|
});
|
|
@@ -14925,7 +15028,7 @@ var import_promises4 = require("node:fs/promises");
|
|
|
14925
15028
|
var import_node_os3 = require("node:os");
|
|
14926
15029
|
var import_node_path6 = require("node:path");
|
|
14927
15030
|
var import_node_process10 = __toESM(require("node:process"), 1);
|
|
14928
|
-
var CLI_VERSION = "0.1.
|
|
15031
|
+
var CLI_VERSION = "0.1.54";
|
|
14929
15032
|
function extractServerName(command, commandArgs) {
|
|
14930
15033
|
for (const arg of commandArgs) {
|
|
14931
15034
|
if (!arg.startsWith("-")) {
|