skedyul 0.1.10 → 0.1.12
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/commands/validate.js +0 -2
- package/dist/config.d.ts +0 -3
- package/dist/config.js +0 -4
- package/dist/index.d.ts +1 -1
- package/dist/server.js +65 -28
- package/dist/types.d.ts +3 -6
- package/package.json +1 -1
|
@@ -177,7 +177,6 @@ async function validateCommand(args) {
|
|
|
177
177
|
name: config.name,
|
|
178
178
|
version: config.version,
|
|
179
179
|
computeLayer: config.computeLayer,
|
|
180
|
-
runtime: config.runtime,
|
|
181
180
|
tools: config.tools,
|
|
182
181
|
workflows: config.workflows,
|
|
183
182
|
globalEnvKeys: envKeys.global,
|
|
@@ -200,7 +199,6 @@ async function validateCommand(args) {
|
|
|
200
199
|
if (verbose) {
|
|
201
200
|
console.log('Configuration:');
|
|
202
201
|
console.log(` Compute Layer: ${config.computeLayer || 'dedicated (default)'}`);
|
|
203
|
-
console.log(` Runtime: ${config.runtime || 'node-22 (default)'}`);
|
|
204
202
|
console.log(` Tools: ${config.tools || './src/registry.ts (default)'}`);
|
|
205
203
|
console.log(` Workflows: ${config.workflows || './workflows (default)'}`);
|
|
206
204
|
console.log('');
|
package/dist/config.d.ts
CHANGED
|
@@ -36,7 +36,6 @@ export interface InstallConfig {
|
|
|
36
36
|
appModels?: AppModelDefinition[];
|
|
37
37
|
}
|
|
38
38
|
export type ComputeLayerType = 'serverless' | 'dedicated';
|
|
39
|
-
export type RuntimeType = 'node-22' | 'node-20' | 'node-18';
|
|
40
39
|
export interface SkedyulConfig {
|
|
41
40
|
/** App name */
|
|
42
41
|
name: string;
|
|
@@ -46,8 +45,6 @@ export interface SkedyulConfig {
|
|
|
46
45
|
description?: string;
|
|
47
46
|
/** Compute layer: 'serverless' (Lambda) or 'dedicated' (ECS/Docker) */
|
|
48
47
|
computeLayer?: ComputeLayerType;
|
|
49
|
-
/** Runtime environment */
|
|
50
|
-
runtime?: RuntimeType;
|
|
51
48
|
/** Path to the tool registry file (default: './src/registry.ts') */
|
|
52
49
|
tools?: string;
|
|
53
50
|
/** Path to the workflows directory (default: './workflows') */
|
package/dist/config.js
CHANGED
|
@@ -172,10 +172,6 @@ function validateConfig(config) {
|
|
|
172
172
|
if (config.computeLayer && !['serverless', 'dedicated'].includes(config.computeLayer)) {
|
|
173
173
|
errors.push(`Invalid computeLayer: ${config.computeLayer}. Must be 'serverless' or 'dedicated'`);
|
|
174
174
|
}
|
|
175
|
-
// Validate runtime
|
|
176
|
-
if (config.runtime && !['node-22', 'node-20', 'node-18'].includes(config.runtime)) {
|
|
177
|
-
errors.push(`Invalid runtime: ${config.runtime}. Must be 'node-22', 'node-20', or 'node-18'`);
|
|
178
|
-
}
|
|
179
175
|
// Validate env schema
|
|
180
176
|
if (config.env) {
|
|
181
177
|
for (const [key, def] of Object.entries(config.env)) {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export * from './types';
|
|
|
2
2
|
export { server } from './server';
|
|
3
3
|
export { workplace, communicationChannel } from './core/client';
|
|
4
4
|
export { defineConfig, loadConfig, validateConfig, getRequiredInstallEnvKeys, getAllEnvKeys, CONFIG_FILE_NAMES, } from './config';
|
|
5
|
-
export type { SkedyulConfig, EnvVariableDefinition, EnvSchema, EnvVisibility, InstallConfig, AppModelDefinition, ComputeLayerType,
|
|
5
|
+
export type { SkedyulConfig, EnvVariableDefinition, EnvSchema, EnvVisibility, InstallConfig, AppModelDefinition, ComputeLayerType, } from './config';
|
package/dist/server.js
CHANGED
|
@@ -338,27 +338,15 @@ function createCallToolHandler(registry, state, onMaxRequests) {
|
|
|
338
338
|
});
|
|
339
339
|
const billing = normalizeBilling(functionResult.billing);
|
|
340
340
|
return {
|
|
341
|
-
|
|
342
|
-
{
|
|
343
|
-
type: 'text',
|
|
344
|
-
text: JSON.stringify(functionResult.output),
|
|
345
|
-
},
|
|
346
|
-
],
|
|
341
|
+
output: functionResult.output,
|
|
347
342
|
billing,
|
|
348
343
|
};
|
|
349
344
|
}
|
|
350
345
|
catch (error) {
|
|
351
346
|
return {
|
|
352
|
-
|
|
353
|
-
{
|
|
354
|
-
type: 'text',
|
|
355
|
-
text: JSON.stringify({
|
|
356
|
-
error: error instanceof Error ? error.message : String(error ?? ''),
|
|
357
|
-
}),
|
|
358
|
-
},
|
|
359
|
-
],
|
|
347
|
+
output: null,
|
|
360
348
|
billing: { credits: 0 },
|
|
361
|
-
|
|
349
|
+
error: error instanceof Error ? error.message : String(error ?? ''),
|
|
362
350
|
};
|
|
363
351
|
}
|
|
364
352
|
finally {
|
|
@@ -443,21 +431,43 @@ function createSkedyulServer(config, registry) {
|
|
|
443
431
|
const toolName = tool.name || toolKey;
|
|
444
432
|
const inputZodSchema = getZodSchema(tool.inputs);
|
|
445
433
|
const outputZodSchema = getZodSchema(tool.outputSchema);
|
|
434
|
+
// Wrap the input schema to accept Skedyul format: { inputs: {...}, env: {...} }
|
|
435
|
+
// This allows the MCP SDK to pass through the wrapper without stripping fields
|
|
436
|
+
const wrappedInputSchema = z.object({
|
|
437
|
+
inputs: inputZodSchema ?? z.record(z.string(), z.unknown()).optional(),
|
|
438
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
439
|
+
}).passthrough();
|
|
446
440
|
mcpServer.registerTool(toolName, {
|
|
447
441
|
title: toolName,
|
|
448
442
|
description: tool.description,
|
|
449
|
-
inputSchema:
|
|
443
|
+
inputSchema: wrappedInputSchema,
|
|
450
444
|
outputSchema: outputZodSchema,
|
|
451
445
|
}, async (args) => {
|
|
452
|
-
|
|
446
|
+
// Args are in Skedyul format: { inputs: {...}, env: {...} }
|
|
447
|
+
const rawArgs = args;
|
|
448
|
+
const toolInputs = (rawArgs.inputs ?? {});
|
|
449
|
+
const toolEnv = rawArgs.env;
|
|
450
|
+
const validatedInputs = inputZodSchema ? inputZodSchema.parse(toolInputs) : toolInputs;
|
|
453
451
|
const result = await callTool(toolKey, {
|
|
454
|
-
inputs:
|
|
452
|
+
inputs: validatedInputs,
|
|
453
|
+
env: toolEnv,
|
|
455
454
|
});
|
|
455
|
+
// Handle error case
|
|
456
|
+
if (result.error) {
|
|
457
|
+
const errorOutput = { error: result.error };
|
|
458
|
+
return {
|
|
459
|
+
content: [{ type: 'text', text: JSON.stringify(errorOutput) }],
|
|
460
|
+
structuredContent: errorOutput,
|
|
461
|
+
isError: true,
|
|
462
|
+
billing: result.billing,
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
// Transform internal format to MCP protocol format
|
|
466
|
+
const outputData = result.output;
|
|
456
467
|
return {
|
|
457
|
-
content: result.
|
|
458
|
-
structuredContent:
|
|
459
|
-
|
|
460
|
-
: JSON.parse(result.content[0]?.text ?? '{}'),
|
|
468
|
+
content: [{ type: 'text', text: JSON.stringify(result.output) }],
|
|
469
|
+
structuredContent: outputData ?? undefined,
|
|
470
|
+
billing: result.billing,
|
|
461
471
|
};
|
|
462
472
|
});
|
|
463
473
|
}
|
|
@@ -771,7 +781,13 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
|
|
|
771
781
|
}
|
|
772
782
|
else if (rpcMethod === 'tools/call') {
|
|
773
783
|
const toolName = params?.name;
|
|
774
|
-
|
|
784
|
+
// Support both formats:
|
|
785
|
+
// 1. Skedyul format: { inputs: {...}, env: {...} }
|
|
786
|
+
// 2. Standard MCP format: { ...directArgs }
|
|
787
|
+
const rawArgs = (params?.arguments ?? {});
|
|
788
|
+
const hasSkedyulFormat = 'inputs' in rawArgs || 'env' in rawArgs;
|
|
789
|
+
const toolInputs = hasSkedyulFormat ? (rawArgs.inputs ?? {}) : rawArgs;
|
|
790
|
+
const toolEnv = hasSkedyulFormat ? rawArgs.env : undefined;
|
|
775
791
|
// Find tool by name (check both registry key and tool.name)
|
|
776
792
|
let toolKey = null;
|
|
777
793
|
let tool = null;
|
|
@@ -794,12 +810,33 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
|
|
|
794
810
|
}
|
|
795
811
|
try {
|
|
796
812
|
const inputSchema = getZodSchema(tool.inputs);
|
|
797
|
-
const
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
813
|
+
const outputSchema = getZodSchema(tool.outputSchema);
|
|
814
|
+
const hasOutputSchema = Boolean(outputSchema);
|
|
815
|
+
const validatedInputs = inputSchema
|
|
816
|
+
? inputSchema.parse(toolInputs)
|
|
817
|
+
: toolInputs;
|
|
818
|
+
const toolResult = await callTool(toolKey, {
|
|
819
|
+
inputs: validatedInputs,
|
|
820
|
+
env: toolEnv,
|
|
802
821
|
});
|
|
822
|
+
// Transform internal format to MCP protocol format
|
|
823
|
+
if (toolResult.error) {
|
|
824
|
+
const errorOutput = { error: toolResult.error };
|
|
825
|
+
result = {
|
|
826
|
+
content: [{ type: 'text', text: JSON.stringify(errorOutput) }],
|
|
827
|
+
structuredContent: errorOutput,
|
|
828
|
+
isError: true,
|
|
829
|
+
billing: toolResult.billing,
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
else {
|
|
833
|
+
const outputData = toolResult.output;
|
|
834
|
+
result = {
|
|
835
|
+
content: [{ type: 'text', text: JSON.stringify(toolResult.output) }],
|
|
836
|
+
structuredContent: outputData ?? undefined,
|
|
837
|
+
billing: toolResult.billing,
|
|
838
|
+
};
|
|
839
|
+
}
|
|
803
840
|
}
|
|
804
841
|
catch (validationError) {
|
|
805
842
|
return createResponse(200, {
|
package/dist/types.d.ts
CHANGED
|
@@ -97,12 +97,9 @@ export interface APIGatewayProxyResult {
|
|
|
97
97
|
body: string;
|
|
98
98
|
}
|
|
99
99
|
export interface ToolCallResponse {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}[];
|
|
104
|
-
billing?: BillingInfo;
|
|
105
|
-
isError?: boolean;
|
|
100
|
+
output: unknown;
|
|
101
|
+
billing: BillingInfo;
|
|
102
|
+
error?: string;
|
|
106
103
|
}
|
|
107
104
|
export interface DedicatedServerInstance {
|
|
108
105
|
listen(port?: number): Promise<void>;
|