skedyul 1.2.18 → 1.2.21
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/cli/index.js +50 -88
- package/dist/config/app-config.d.ts +26 -2
- package/dist/config/index.d.ts +1 -2
- package/dist/dedicated/server.js +42 -76
- package/dist/esm/index.mjs +42 -78
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -80
- package/dist/server/config-serializer.d.ts +12 -0
- package/dist/server/dedicated.d.ts +3 -2
- package/dist/server/index.d.ts +15 -6
- package/dist/server/serverless.d.ts +3 -2
- package/dist/server/startup-logger.d.ts +3 -2
- package/dist/server/utils/http.d.ts +3 -2
- package/dist/server.d.ts +1 -1
- package/dist/server.js +42 -76
- package/dist/serverless/server.mjs +42 -76
- package/dist/types/index.d.ts +1 -1
- package/dist/types/server.d.ts +0 -25
- package/package.json +1 -1
- package/dist/config/resolve.d.ts +0 -27
package/dist/server.js
CHANGED
|
@@ -709,10 +709,11 @@ function padEnd(str, length) {
|
|
|
709
709
|
}
|
|
710
710
|
return str + " ".repeat(length - str.length);
|
|
711
711
|
}
|
|
712
|
-
function printStartupLog(config, tools,
|
|
712
|
+
function printStartupLog(config, tools, port) {
|
|
713
713
|
if (process.env.NODE_ENV === "test") {
|
|
714
714
|
return;
|
|
715
715
|
}
|
|
716
|
+
const webhookRegistry = config.webhooks;
|
|
716
717
|
const webhookCount = webhookRegistry ? Object.keys(webhookRegistry).length : 0;
|
|
717
718
|
const webhookNames = webhookRegistry ? Object.keys(webhookRegistry) : [];
|
|
718
719
|
const maxRequests = config.maxRequests ?? parseNumberEnv(process.env.MCP_MAX_REQUESTS) ?? null;
|
|
@@ -725,9 +726,9 @@ function printStartupLog(config, tools, webhookRegistry, port) {
|
|
|
725
726
|
console.log(`\u2551 \u{1F680} Skedyul MCP Server Starting \u2551`);
|
|
726
727
|
console.log(`\u2560${divider}\u2563`);
|
|
727
728
|
console.log(`\u2551 \u2551`);
|
|
728
|
-
console.log(`\u2551 \u{1F4E6} Server: ${padEnd(config.
|
|
729
|
-
console.log(`\u2551 \u{1F3F7}\uFE0F Version: ${padEnd(config.
|
|
730
|
-
console.log(`\u2551 \u26A1 Compute: ${padEnd(config.computeLayer, 49)}\u2551`);
|
|
729
|
+
console.log(`\u2551 \u{1F4E6} Server: ${padEnd(config.name, 49)}\u2551`);
|
|
730
|
+
console.log(`\u2551 \u{1F3F7}\uFE0F Version: ${padEnd(config.version ?? "N/A", 49)}\u2551`);
|
|
731
|
+
console.log(`\u2551 \u26A1 Compute: ${padEnd(config.computeLayer ?? "serverless", 49)}\u2551`);
|
|
731
732
|
if (port) {
|
|
732
733
|
console.log(`\u2551 \u{1F310} Port: ${padEnd(String(port), 49)}\u2551`);
|
|
733
734
|
}
|
|
@@ -769,67 +770,40 @@ function printStartupLog(config, tools, webhookRegistry, port) {
|
|
|
769
770
|
console.log("");
|
|
770
771
|
}
|
|
771
772
|
|
|
772
|
-
// src/config
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
}
|
|
777
|
-
if (value instanceof Promise) {
|
|
778
|
-
const resolved = await value;
|
|
779
|
-
if (resolved && typeof resolved === "object" && "default" in resolved) {
|
|
780
|
-
return resolved.default;
|
|
781
|
-
}
|
|
782
|
-
return resolved;
|
|
783
|
-
}
|
|
784
|
-
return value;
|
|
785
|
-
}
|
|
786
|
-
function serializeTools(registry) {
|
|
787
|
-
return Object.entries(registry).map(([key, tool]) => ({
|
|
788
|
-
name: tool.name || key,
|
|
789
|
-
displayName: tool.label,
|
|
790
|
-
description: tool.description,
|
|
791
|
-
timeout: tool.timeout,
|
|
792
|
-
retries: tool.retries
|
|
793
|
-
}));
|
|
794
|
-
}
|
|
795
|
-
function serializeWebhooks(registry) {
|
|
796
|
-
return Object.values(registry).map((webhook) => ({
|
|
797
|
-
name: webhook.name,
|
|
798
|
-
description: webhook.description,
|
|
799
|
-
methods: webhook.methods ?? ["POST"],
|
|
800
|
-
type: webhook.type ?? "WEBHOOK"
|
|
801
|
-
}));
|
|
802
|
-
}
|
|
803
|
-
async function resolveConfig(config, registry, webhookRegistry) {
|
|
804
|
-
const provision = await resolveDynamicImport(
|
|
805
|
-
config.provision
|
|
806
|
-
);
|
|
807
|
-
const install = await resolveDynamicImport(
|
|
808
|
-
config.install
|
|
809
|
-
);
|
|
810
|
-
const tools = serializeTools(registry);
|
|
811
|
-
const webhooks = webhookRegistry ? serializeWebhooks(webhookRegistry) : [];
|
|
773
|
+
// src/server/config-serializer.ts
|
|
774
|
+
function serializeConfig(config) {
|
|
775
|
+
const registry = config.tools;
|
|
776
|
+
const webhookRegistry = config.webhooks;
|
|
812
777
|
return {
|
|
813
778
|
name: config.name,
|
|
814
779
|
version: config.version,
|
|
815
780
|
description: config.description,
|
|
816
781
|
computeLayer: config.computeLayer,
|
|
817
|
-
tools,
|
|
818
|
-
|
|
819
|
-
|
|
782
|
+
tools: registry ? Object.entries(registry).map(([key, tool]) => ({
|
|
783
|
+
name: tool.name || key,
|
|
784
|
+
description: tool.description,
|
|
785
|
+
timeout: tool.timeout,
|
|
786
|
+
retries: tool.retries
|
|
787
|
+
})) : [],
|
|
788
|
+
webhooks: webhookRegistry ? Object.values(webhookRegistry).map((w) => ({
|
|
789
|
+
name: w.name,
|
|
790
|
+
description: w.description,
|
|
791
|
+
methods: w.methods ?? ["POST"],
|
|
792
|
+
type: w.type ?? "WEBHOOK"
|
|
793
|
+
})) : [],
|
|
794
|
+
provision: isProvisionConfig(config.provision) ? config.provision : void 0,
|
|
820
795
|
agents: config.agents
|
|
821
796
|
};
|
|
822
797
|
}
|
|
823
|
-
function
|
|
824
|
-
return
|
|
825
|
-
name,
|
|
826
|
-
version
|
|
827
|
-
};
|
|
798
|
+
function isProvisionConfig(value) {
|
|
799
|
+
return value !== void 0 && value !== null && !(value instanceof Promise);
|
|
828
800
|
}
|
|
829
801
|
|
|
830
802
|
// src/server/dedicated.ts
|
|
831
|
-
function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
|
|
803
|
+
function createDedicatedServerInstance(config, tools, callTool, state, mcpServer) {
|
|
832
804
|
const port = getListeningPort(config);
|
|
805
|
+
const registry = config.tools;
|
|
806
|
+
const webhookRegistry = config.webhooks;
|
|
833
807
|
const httpServer = import_http2.default.createServer(
|
|
834
808
|
async (req, res) => {
|
|
835
809
|
function sendCoreResult(result) {
|
|
@@ -846,12 +820,7 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
|
|
|
846
820
|
return;
|
|
847
821
|
}
|
|
848
822
|
if (pathname === "/config" && req.method === "GET") {
|
|
849
|
-
|
|
850
|
-
config.metadata.name,
|
|
851
|
-
config.metadata.version
|
|
852
|
-
);
|
|
853
|
-
const serializedConfig = await resolveConfig(appConfig, registry, webhookRegistry);
|
|
854
|
-
sendJSON(res, 200, serializedConfig);
|
|
823
|
+
sendJSON(res, 200, serializeConfig(config));
|
|
855
824
|
return;
|
|
856
825
|
}
|
|
857
826
|
if (pathname.startsWith("/webhooks/") && webhookRegistry) {
|
|
@@ -1380,7 +1349,7 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
|
|
|
1380
1349
|
const finalPort = listenPort ?? port;
|
|
1381
1350
|
return new Promise((resolve, reject) => {
|
|
1382
1351
|
httpServer.listen(finalPort, () => {
|
|
1383
|
-
printStartupLog(config, tools,
|
|
1352
|
+
printStartupLog(config, tools, finalPort);
|
|
1384
1353
|
resolve();
|
|
1385
1354
|
});
|
|
1386
1355
|
httpServer.once("error", reject);
|
|
@@ -1391,13 +1360,15 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
|
|
|
1391
1360
|
}
|
|
1392
1361
|
|
|
1393
1362
|
// src/server/serverless.ts
|
|
1394
|
-
function createServerlessInstance(config, tools, callTool, state, mcpServer
|
|
1363
|
+
function createServerlessInstance(config, tools, callTool, state, mcpServer) {
|
|
1395
1364
|
const headers = getDefaultHeaders(config.cors);
|
|
1365
|
+
const registry = config.tools;
|
|
1366
|
+
const webhookRegistry = config.webhooks;
|
|
1396
1367
|
let hasLoggedStartup = false;
|
|
1397
1368
|
return {
|
|
1398
1369
|
async handler(event) {
|
|
1399
1370
|
if (!hasLoggedStartup) {
|
|
1400
|
-
printStartupLog(config, tools
|
|
1371
|
+
printStartupLog(config, tools);
|
|
1401
1372
|
hasLoggedStartup = true;
|
|
1402
1373
|
}
|
|
1403
1374
|
try {
|
|
@@ -1942,12 +1913,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
|
|
|
1942
1913
|
return createResponse(200, state.getHealthStatus(), headers);
|
|
1943
1914
|
}
|
|
1944
1915
|
if (path === "/config" && method === "GET") {
|
|
1945
|
-
|
|
1946
|
-
config.metadata.name,
|
|
1947
|
-
config.metadata.version
|
|
1948
|
-
);
|
|
1949
|
-
const serializedConfig = await resolveConfig(appConfig, registry, webhookRegistry);
|
|
1950
|
-
return createResponse(200, serializedConfig, headers);
|
|
1916
|
+
return createResponse(200, serializeConfig(config), headers);
|
|
1951
1917
|
}
|
|
1952
1918
|
if (path === "/mcp" && method === "POST") {
|
|
1953
1919
|
let body;
|
|
@@ -2165,9 +2131,11 @@ console.log("[skedyul-node/server] All imports complete");
|
|
|
2165
2131
|
console.log("[skedyul-node/server] Installing context logger...");
|
|
2166
2132
|
installContextLogger();
|
|
2167
2133
|
console.log("[skedyul-node/server] Context logger installed");
|
|
2168
|
-
function createSkedyulServer(config
|
|
2134
|
+
function createSkedyulServer(config) {
|
|
2169
2135
|
console.log("[createSkedyulServer] Step 1: mergeRuntimeEnv()");
|
|
2170
2136
|
mergeRuntimeEnv();
|
|
2137
|
+
const registry = config.tools;
|
|
2138
|
+
const webhookRegistry = config.webhooks;
|
|
2171
2139
|
console.log("[createSkedyulServer] Step 2: coreApi setup");
|
|
2172
2140
|
if (config.coreApi?.service) {
|
|
2173
2141
|
coreApiService.register(config.coreApi.service);
|
|
@@ -2179,7 +2147,7 @@ function createSkedyulServer(config, registry, webhookRegistry) {
|
|
|
2179
2147
|
const tools = buildToolMetadata(registry);
|
|
2180
2148
|
console.log("[createSkedyulServer] Step 3 done, tools:", tools.length);
|
|
2181
2149
|
const toolNames = Object.values(registry).map((tool) => tool.name);
|
|
2182
|
-
const runtimeLabel = config.computeLayer;
|
|
2150
|
+
const runtimeLabel = config.computeLayer ?? "serverless";
|
|
2183
2151
|
const maxRequests = config.maxRequests ?? parseNumberEnv(process.env.MCP_MAX_REQUESTS) ?? null;
|
|
2184
2152
|
const ttlExtendSeconds = config.ttlExtendSeconds ?? parseNumberEnv(process.env.MCP_TTL_EXTEND) ?? 3600;
|
|
2185
2153
|
console.log("[createSkedyulServer] Step 4: createRequestState()");
|
|
@@ -2192,8 +2160,8 @@ function createSkedyulServer(config, registry, webhookRegistry) {
|
|
|
2192
2160
|
console.log("[createSkedyulServer] Step 4 done");
|
|
2193
2161
|
console.log("[createSkedyulServer] Step 5: new McpServer()");
|
|
2194
2162
|
const mcpServer = new import_mcp.McpServer({
|
|
2195
|
-
name: config.
|
|
2196
|
-
version: config.
|
|
2163
|
+
name: config.name,
|
|
2164
|
+
version: config.version ?? "0.0.0"
|
|
2197
2165
|
});
|
|
2198
2166
|
console.log("[createSkedyulServer] Step 5 done");
|
|
2199
2167
|
const dedicatedShutdown = () => {
|
|
@@ -2321,13 +2289,11 @@ function createSkedyulServer(config, registry, webhookRegistry) {
|
|
|
2321
2289
|
tools,
|
|
2322
2290
|
callTool,
|
|
2323
2291
|
state,
|
|
2324
|
-
mcpServer
|
|
2325
|
-
registry,
|
|
2326
|
-
webhookRegistry
|
|
2292
|
+
mcpServer
|
|
2327
2293
|
);
|
|
2328
2294
|
}
|
|
2329
2295
|
console.log("[createSkedyulServer] Creating serverless instance");
|
|
2330
|
-
const serverlessInstance = createServerlessInstance(config, tools, callTool, state, mcpServer
|
|
2296
|
+
const serverlessInstance = createServerlessInstance(config, tools, callTool, state, mcpServer);
|
|
2331
2297
|
console.log("[createSkedyulServer] Serverless instance created successfully");
|
|
2332
2298
|
return serverlessInstance;
|
|
2333
2299
|
}
|
|
@@ -648,10 +648,11 @@ function padEnd(str, length) {
|
|
|
648
648
|
}
|
|
649
649
|
return str + " ".repeat(length - str.length);
|
|
650
650
|
}
|
|
651
|
-
function printStartupLog(config, tools,
|
|
651
|
+
function printStartupLog(config, tools, port) {
|
|
652
652
|
if (process.env.NODE_ENV === "test") {
|
|
653
653
|
return;
|
|
654
654
|
}
|
|
655
|
+
const webhookRegistry = config.webhooks;
|
|
655
656
|
const webhookCount = webhookRegistry ? Object.keys(webhookRegistry).length : 0;
|
|
656
657
|
const webhookNames = webhookRegistry ? Object.keys(webhookRegistry) : [];
|
|
657
658
|
const maxRequests = config.maxRequests ?? parseNumberEnv(process.env.MCP_MAX_REQUESTS) ?? null;
|
|
@@ -664,9 +665,9 @@ function printStartupLog(config, tools, webhookRegistry, port) {
|
|
|
664
665
|
console.log(`\u2551 \u{1F680} Skedyul MCP Server Starting \u2551`);
|
|
665
666
|
console.log(`\u2560${divider}\u2563`);
|
|
666
667
|
console.log(`\u2551 \u2551`);
|
|
667
|
-
console.log(`\u2551 \u{1F4E6} Server: ${padEnd(config.
|
|
668
|
-
console.log(`\u2551 \u{1F3F7}\uFE0F Version: ${padEnd(config.
|
|
669
|
-
console.log(`\u2551 \u26A1 Compute: ${padEnd(config.computeLayer, 49)}\u2551`);
|
|
668
|
+
console.log(`\u2551 \u{1F4E6} Server: ${padEnd(config.name, 49)}\u2551`);
|
|
669
|
+
console.log(`\u2551 \u{1F3F7}\uFE0F Version: ${padEnd(config.version ?? "N/A", 49)}\u2551`);
|
|
670
|
+
console.log(`\u2551 \u26A1 Compute: ${padEnd(config.computeLayer ?? "serverless", 49)}\u2551`);
|
|
670
671
|
if (port) {
|
|
671
672
|
console.log(`\u2551 \u{1F310} Port: ${padEnd(String(port), 49)}\u2551`);
|
|
672
673
|
}
|
|
@@ -708,67 +709,40 @@ function printStartupLog(config, tools, webhookRegistry, port) {
|
|
|
708
709
|
console.log("");
|
|
709
710
|
}
|
|
710
711
|
|
|
711
|
-
// src/config
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
}
|
|
716
|
-
if (value instanceof Promise) {
|
|
717
|
-
const resolved = await value;
|
|
718
|
-
if (resolved && typeof resolved === "object" && "default" in resolved) {
|
|
719
|
-
return resolved.default;
|
|
720
|
-
}
|
|
721
|
-
return resolved;
|
|
722
|
-
}
|
|
723
|
-
return value;
|
|
724
|
-
}
|
|
725
|
-
function serializeTools(registry) {
|
|
726
|
-
return Object.entries(registry).map(([key, tool]) => ({
|
|
727
|
-
name: tool.name || key,
|
|
728
|
-
displayName: tool.label,
|
|
729
|
-
description: tool.description,
|
|
730
|
-
timeout: tool.timeout,
|
|
731
|
-
retries: tool.retries
|
|
732
|
-
}));
|
|
733
|
-
}
|
|
734
|
-
function serializeWebhooks(registry) {
|
|
735
|
-
return Object.values(registry).map((webhook) => ({
|
|
736
|
-
name: webhook.name,
|
|
737
|
-
description: webhook.description,
|
|
738
|
-
methods: webhook.methods ?? ["POST"],
|
|
739
|
-
type: webhook.type ?? "WEBHOOK"
|
|
740
|
-
}));
|
|
741
|
-
}
|
|
742
|
-
async function resolveConfig(config, registry, webhookRegistry) {
|
|
743
|
-
const provision = await resolveDynamicImport(
|
|
744
|
-
config.provision
|
|
745
|
-
);
|
|
746
|
-
const install = await resolveDynamicImport(
|
|
747
|
-
config.install
|
|
748
|
-
);
|
|
749
|
-
const tools = serializeTools(registry);
|
|
750
|
-
const webhooks = webhookRegistry ? serializeWebhooks(webhookRegistry) : [];
|
|
712
|
+
// src/server/config-serializer.ts
|
|
713
|
+
function serializeConfig(config) {
|
|
714
|
+
const registry = config.tools;
|
|
715
|
+
const webhookRegistry = config.webhooks;
|
|
751
716
|
return {
|
|
752
717
|
name: config.name,
|
|
753
718
|
version: config.version,
|
|
754
719
|
description: config.description,
|
|
755
720
|
computeLayer: config.computeLayer,
|
|
756
|
-
tools,
|
|
757
|
-
|
|
758
|
-
|
|
721
|
+
tools: registry ? Object.entries(registry).map(([key, tool]) => ({
|
|
722
|
+
name: tool.name || key,
|
|
723
|
+
description: tool.description,
|
|
724
|
+
timeout: tool.timeout,
|
|
725
|
+
retries: tool.retries
|
|
726
|
+
})) : [],
|
|
727
|
+
webhooks: webhookRegistry ? Object.values(webhookRegistry).map((w) => ({
|
|
728
|
+
name: w.name,
|
|
729
|
+
description: w.description,
|
|
730
|
+
methods: w.methods ?? ["POST"],
|
|
731
|
+
type: w.type ?? "WEBHOOK"
|
|
732
|
+
})) : [],
|
|
733
|
+
provision: isProvisionConfig(config.provision) ? config.provision : void 0,
|
|
759
734
|
agents: config.agents
|
|
760
735
|
};
|
|
761
736
|
}
|
|
762
|
-
function
|
|
763
|
-
return
|
|
764
|
-
name,
|
|
765
|
-
version
|
|
766
|
-
};
|
|
737
|
+
function isProvisionConfig(value) {
|
|
738
|
+
return value !== void 0 && value !== null && !(value instanceof Promise);
|
|
767
739
|
}
|
|
768
740
|
|
|
769
741
|
// src/server/dedicated.ts
|
|
770
|
-
function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
|
|
742
|
+
function createDedicatedServerInstance(config, tools, callTool, state, mcpServer) {
|
|
771
743
|
const port = getListeningPort(config);
|
|
744
|
+
const registry = config.tools;
|
|
745
|
+
const webhookRegistry = config.webhooks;
|
|
772
746
|
const httpServer = http.createServer(
|
|
773
747
|
async (req, res) => {
|
|
774
748
|
function sendCoreResult(result) {
|
|
@@ -785,12 +759,7 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
|
|
|
785
759
|
return;
|
|
786
760
|
}
|
|
787
761
|
if (pathname === "/config" && req.method === "GET") {
|
|
788
|
-
|
|
789
|
-
config.metadata.name,
|
|
790
|
-
config.metadata.version
|
|
791
|
-
);
|
|
792
|
-
const serializedConfig = await resolveConfig(appConfig, registry, webhookRegistry);
|
|
793
|
-
sendJSON(res, 200, serializedConfig);
|
|
762
|
+
sendJSON(res, 200, serializeConfig(config));
|
|
794
763
|
return;
|
|
795
764
|
}
|
|
796
765
|
if (pathname.startsWith("/webhooks/") && webhookRegistry) {
|
|
@@ -1319,7 +1288,7 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
|
|
|
1319
1288
|
const finalPort = listenPort ?? port;
|
|
1320
1289
|
return new Promise((resolve, reject) => {
|
|
1321
1290
|
httpServer.listen(finalPort, () => {
|
|
1322
|
-
printStartupLog(config, tools,
|
|
1291
|
+
printStartupLog(config, tools, finalPort);
|
|
1323
1292
|
resolve();
|
|
1324
1293
|
});
|
|
1325
1294
|
httpServer.once("error", reject);
|
|
@@ -1330,13 +1299,15 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
|
|
|
1330
1299
|
}
|
|
1331
1300
|
|
|
1332
1301
|
// src/server/serverless.ts
|
|
1333
|
-
function createServerlessInstance(config, tools, callTool, state, mcpServer
|
|
1302
|
+
function createServerlessInstance(config, tools, callTool, state, mcpServer) {
|
|
1334
1303
|
const headers = getDefaultHeaders(config.cors);
|
|
1304
|
+
const registry = config.tools;
|
|
1305
|
+
const webhookRegistry = config.webhooks;
|
|
1335
1306
|
let hasLoggedStartup = false;
|
|
1336
1307
|
return {
|
|
1337
1308
|
async handler(event) {
|
|
1338
1309
|
if (!hasLoggedStartup) {
|
|
1339
|
-
printStartupLog(config, tools
|
|
1310
|
+
printStartupLog(config, tools);
|
|
1340
1311
|
hasLoggedStartup = true;
|
|
1341
1312
|
}
|
|
1342
1313
|
try {
|
|
@@ -1881,12 +1852,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
|
|
|
1881
1852
|
return createResponse(200, state.getHealthStatus(), headers);
|
|
1882
1853
|
}
|
|
1883
1854
|
if (path === "/config" && method === "GET") {
|
|
1884
|
-
|
|
1885
|
-
config.metadata.name,
|
|
1886
|
-
config.metadata.version
|
|
1887
|
-
);
|
|
1888
|
-
const serializedConfig = await resolveConfig(appConfig, registry, webhookRegistry);
|
|
1889
|
-
return createResponse(200, serializedConfig, headers);
|
|
1855
|
+
return createResponse(200, serializeConfig(config), headers);
|
|
1890
1856
|
}
|
|
1891
1857
|
if (path === "/mcp" && method === "POST") {
|
|
1892
1858
|
let body;
|
|
@@ -2104,9 +2070,11 @@ console.log("[skedyul-node/server] All imports complete");
|
|
|
2104
2070
|
console.log("[skedyul-node/server] Installing context logger...");
|
|
2105
2071
|
installContextLogger();
|
|
2106
2072
|
console.log("[skedyul-node/server] Context logger installed");
|
|
2107
|
-
function createSkedyulServer(config
|
|
2073
|
+
function createSkedyulServer(config) {
|
|
2108
2074
|
console.log("[createSkedyulServer] Step 1: mergeRuntimeEnv()");
|
|
2109
2075
|
mergeRuntimeEnv();
|
|
2076
|
+
const registry = config.tools;
|
|
2077
|
+
const webhookRegistry = config.webhooks;
|
|
2110
2078
|
console.log("[createSkedyulServer] Step 2: coreApi setup");
|
|
2111
2079
|
if (config.coreApi?.service) {
|
|
2112
2080
|
coreApiService.register(config.coreApi.service);
|
|
@@ -2118,7 +2086,7 @@ function createSkedyulServer(config, registry, webhookRegistry) {
|
|
|
2118
2086
|
const tools = buildToolMetadata(registry);
|
|
2119
2087
|
console.log("[createSkedyulServer] Step 3 done, tools:", tools.length);
|
|
2120
2088
|
const toolNames = Object.values(registry).map((tool) => tool.name);
|
|
2121
|
-
const runtimeLabel = config.computeLayer;
|
|
2089
|
+
const runtimeLabel = config.computeLayer ?? "serverless";
|
|
2122
2090
|
const maxRequests = config.maxRequests ?? parseNumberEnv(process.env.MCP_MAX_REQUESTS) ?? null;
|
|
2123
2091
|
const ttlExtendSeconds = config.ttlExtendSeconds ?? parseNumberEnv(process.env.MCP_TTL_EXTEND) ?? 3600;
|
|
2124
2092
|
console.log("[createSkedyulServer] Step 4: createRequestState()");
|
|
@@ -2131,8 +2099,8 @@ function createSkedyulServer(config, registry, webhookRegistry) {
|
|
|
2131
2099
|
console.log("[createSkedyulServer] Step 4 done");
|
|
2132
2100
|
console.log("[createSkedyulServer] Step 5: new McpServer()");
|
|
2133
2101
|
const mcpServer = new McpServer({
|
|
2134
|
-
name: config.
|
|
2135
|
-
version: config.
|
|
2102
|
+
name: config.name,
|
|
2103
|
+
version: config.version ?? "0.0.0"
|
|
2136
2104
|
});
|
|
2137
2105
|
console.log("[createSkedyulServer] Step 5 done");
|
|
2138
2106
|
const dedicatedShutdown = () => {
|
|
@@ -2260,13 +2228,11 @@ function createSkedyulServer(config, registry, webhookRegistry) {
|
|
|
2260
2228
|
tools,
|
|
2261
2229
|
callTool,
|
|
2262
2230
|
state,
|
|
2263
|
-
mcpServer
|
|
2264
|
-
registry,
|
|
2265
|
-
webhookRegistry
|
|
2231
|
+
mcpServer
|
|
2266
2232
|
);
|
|
2267
2233
|
}
|
|
2268
2234
|
console.log("[createSkedyulServer] Creating serverless instance");
|
|
2269
|
-
const serverlessInstance = createServerlessInstance(config, tools, callTool, state, mcpServer
|
|
2235
|
+
const serverlessInstance = createServerlessInstance(config, tools, callTool, state, mcpServer);
|
|
2270
2236
|
console.log("[createSkedyulServer] Serverless instance created successfully");
|
|
2271
2237
|
return serverlessInstance;
|
|
2272
2238
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type { ToolTrigger, ProvisionToolContext, FieldChangeToolContext, PageAct
|
|
|
11
11
|
export { isProvisionContext, isRuntimeContext } from './tool-context';
|
|
12
12
|
export type { ProvisionToolInput, BillingInfo, ToolResponseMeta, ToolEffect, ToolError, ToolExecutionResult, ToolSchemaWithJson, ToolSchema, ToolHandler, ToolDefinition, ToolRegistryEntry, ToolRegistry, ToolName, ToolMetadata, ToolCallResponse, } from './tool';
|
|
13
13
|
export { ToolResponseMetaSchema } from './tool';
|
|
14
|
-
export type { HealthStatus, ComputeLayer,
|
|
14
|
+
export type { HealthStatus, ComputeLayer, DedicatedServerInstance, ServerlessServerInstance, SkedyulServerInstance, } from './server';
|
|
15
15
|
export type { InstallHandlerContext, InstallHandlerResponseOAuth, InstallHandlerResponseStandard, HasOAuthCallback, InstallHandlerResult, InstallHandler, UninstallHandlerContext, UninstallHandlerResult, UninstallHandler, OAuthCallbackContext, OAuthCallbackResult, OAuthCallbackHandler, ProvisionHandlerContext, ProvisionHandlerResult, ProvisionHandler, ServerHooksWithOAuth, ServerHooksWithoutOAuth, ServerHooks, } from './handlers';
|
|
16
16
|
export type { APIGatewayProxyEvent, APIGatewayProxyResult } from './aws';
|
|
17
17
|
export type { HandlerRawRequest, WebhookRequest, WebhookResponse, ProvisionWebhookContext, RuntimeWebhookContext, WebhookContext, WebhookHandler, WebhookLifecycleContext, CommunicationChannelLifecycleContext, WebhookLifecycleResult, WebhookLifecycleHook, WebhookType, WebhookDefinition, WebhookRegistry, WebhookName, WebhookMetadata, } from './webhook';
|
package/dist/types/server.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type { CoreApiConfig } from '../core/types';
|
|
2
|
-
import type { ServerHooks } from './handlers';
|
|
3
1
|
import type { APIGatewayProxyEvent, APIGatewayProxyResult } from './aws';
|
|
4
2
|
import type { ComputeLayer } from '../config/types/compute';
|
|
5
|
-
import type { SkedyulConfig } from '../config/app-config';
|
|
6
3
|
export interface HealthStatus {
|
|
7
4
|
status: 'running';
|
|
8
5
|
requests: number;
|
|
@@ -14,28 +11,6 @@ export interface HealthStatus {
|
|
|
14
11
|
tools: string[];
|
|
15
12
|
}
|
|
16
13
|
export type { ComputeLayer };
|
|
17
|
-
export interface ServerMetadata {
|
|
18
|
-
name: string;
|
|
19
|
-
version: string;
|
|
20
|
-
}
|
|
21
|
-
export interface CorsOptions {
|
|
22
|
-
allowOrigin?: string;
|
|
23
|
-
allowMethods?: string;
|
|
24
|
-
allowHeaders?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface SkedyulServerConfig {
|
|
27
|
-
computeLayer: ComputeLayer;
|
|
28
|
-
metadata: ServerMetadata;
|
|
29
|
-
defaultPort?: number;
|
|
30
|
-
maxRequests?: number | null;
|
|
31
|
-
ttlExtendSeconds?: number;
|
|
32
|
-
cors?: CorsOptions;
|
|
33
|
-
coreApi?: CoreApiConfig;
|
|
34
|
-
/** Lifecycle hooks for install and provision handlers */
|
|
35
|
-
hooks?: ServerHooks;
|
|
36
|
-
/** Original app config from skedyul.config.ts for /config endpoint serialization */
|
|
37
|
-
appConfig?: SkedyulConfig;
|
|
38
|
-
}
|
|
39
14
|
export interface DedicatedServerInstance {
|
|
40
15
|
listen(port?: number): Promise<void>;
|
|
41
16
|
getHealthStatus(): HealthStatus;
|
package/package.json
CHANGED
package/dist/config/resolve.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Config resolution utilities.
|
|
3
|
-
*
|
|
4
|
-
* This module provides functions to resolve dynamic imports in SkedyulConfig
|
|
5
|
-
* and convert it to a serializable format for the /config endpoint.
|
|
6
|
-
*/
|
|
7
|
-
import type { SkedyulConfig, SerializableSkedyulConfig } from './app-config';
|
|
8
|
-
import type { ToolRegistry, WebhookRegistry } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* Resolves all dynamic imports in a SkedyulConfig and returns a serializable version.
|
|
11
|
-
*
|
|
12
|
-
* This function:
|
|
13
|
-
* 1. Resolves dynamic imports for tools, webhooks, provision, and install
|
|
14
|
-
* 2. Serializes tool and webhook registries to metadata arrays
|
|
15
|
-
* 3. Returns a plain object suitable for JSON serialization
|
|
16
|
-
*
|
|
17
|
-
* @param config - The original SkedyulConfig (may contain dynamic imports)
|
|
18
|
-
* @param registry - The resolved tool registry (already loaded by mcp_server.ts)
|
|
19
|
-
* @param webhookRegistry - The resolved webhook registry (if any)
|
|
20
|
-
* @returns A fully resolved and serializable config
|
|
21
|
-
*/
|
|
22
|
-
export declare function resolveConfig(config: SkedyulConfig, registry: ToolRegistry, webhookRegistry?: WebhookRegistry): Promise<SerializableSkedyulConfig>;
|
|
23
|
-
/**
|
|
24
|
-
* Creates a minimal SkedyulConfig from server metadata.
|
|
25
|
-
* Used as a fallback when appConfig is not provided.
|
|
26
|
-
*/
|
|
27
|
-
export declare function createMinimalConfig(name: string, version?: string): SkedyulConfig;
|