skedyul 0.1.10 → 0.1.11

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.
@@ -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, RuntimeType, } from './config';
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
- content: [
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
- content: [
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
- isError: true,
349
+ error: error instanceof Error ? error.message : String(error ?? ''),
362
350
  };
363
351
  }
364
352
  finally {
@@ -443,21 +431,41 @@ 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
+ const hasOutputSchema = Boolean(outputZodSchema);
446
435
  mcpServer.registerTool(toolName, {
447
436
  title: toolName,
448
437
  description: tool.description,
449
438
  inputSchema: inputZodSchema,
450
439
  outputSchema: outputZodSchema,
451
440
  }, async (args) => {
452
- const validatedArgs = inputZodSchema ? inputZodSchema.parse(args) : args;
441
+ // Support both formats:
442
+ // 1. Skedyul format: { inputs: {...}, env: {...} }
443
+ // 2. Standard MCP format: { ...directArgs }
444
+ const rawArgs = args;
445
+ const hasSkedyulFormat = 'inputs' in rawArgs || 'env' in rawArgs;
446
+ const toolInputs = hasSkedyulFormat ? (rawArgs.inputs ?? {}) : rawArgs;
447
+ const toolEnv = hasSkedyulFormat ? rawArgs.env : undefined;
448
+ const validatedInputs = inputZodSchema ? inputZodSchema.parse(toolInputs) : toolInputs;
453
449
  const result = await callTool(toolKey, {
454
- inputs: validatedArgs,
450
+ inputs: validatedInputs,
451
+ env: toolEnv,
455
452
  });
453
+ // Handle error case
454
+ if (result.error) {
455
+ const errorOutput = { error: result.error };
456
+ return {
457
+ content: [{ type: 'text', text: JSON.stringify(errorOutput) }],
458
+ structuredContent: errorOutput,
459
+ isError: true,
460
+ billing: result.billing,
461
+ };
462
+ }
463
+ // Transform internal format to MCP protocol format
464
+ const outputData = result.output;
456
465
  return {
457
- content: result.content,
458
- structuredContent: result.isError
459
- ? undefined
460
- : JSON.parse(result.content[0]?.text ?? '{}'),
466
+ content: [{ type: 'text', text: JSON.stringify(result.output) }],
467
+ structuredContent: outputData ?? undefined,
468
+ billing: result.billing,
461
469
  };
462
470
  });
463
471
  }
@@ -771,7 +779,13 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
771
779
  }
772
780
  else if (rpcMethod === 'tools/call') {
773
781
  const toolName = params?.name;
774
- const toolArgs = params?.arguments ?? {};
782
+ // Support both formats:
783
+ // 1. Skedyul format: { inputs: {...}, env: {...} }
784
+ // 2. Standard MCP format: { ...directArgs }
785
+ const rawArgs = (params?.arguments ?? {});
786
+ const hasSkedyulFormat = 'inputs' in rawArgs || 'env' in rawArgs;
787
+ const toolInputs = hasSkedyulFormat ? (rawArgs.inputs ?? {}) : rawArgs;
788
+ const toolEnv = hasSkedyulFormat ? rawArgs.env : undefined;
775
789
  // Find tool by name (check both registry key and tool.name)
776
790
  let toolKey = null;
777
791
  let tool = null;
@@ -794,12 +808,33 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
794
808
  }
795
809
  try {
796
810
  const inputSchema = getZodSchema(tool.inputs);
797
- const validatedArgs = inputSchema
798
- ? inputSchema.parse(toolArgs)
799
- : toolArgs;
800
- result = await callTool(toolKey, {
801
- inputs: validatedArgs,
811
+ const outputSchema = getZodSchema(tool.outputSchema);
812
+ const hasOutputSchema = Boolean(outputSchema);
813
+ const validatedInputs = inputSchema
814
+ ? inputSchema.parse(toolInputs)
815
+ : toolInputs;
816
+ const toolResult = await callTool(toolKey, {
817
+ inputs: validatedInputs,
818
+ env: toolEnv,
802
819
  });
820
+ // Transform internal format to MCP protocol format
821
+ if (toolResult.error) {
822
+ const errorOutput = { error: toolResult.error };
823
+ result = {
824
+ content: [{ type: 'text', text: JSON.stringify(errorOutput) }],
825
+ structuredContent: errorOutput,
826
+ isError: true,
827
+ billing: toolResult.billing,
828
+ };
829
+ }
830
+ else {
831
+ const outputData = toolResult.output;
832
+ result = {
833
+ content: [{ type: 'text', text: JSON.stringify(toolResult.output) }],
834
+ structuredContent: outputData ?? undefined,
835
+ billing: toolResult.billing,
836
+ };
837
+ }
803
838
  }
804
839
  catch (validationError) {
805
840
  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
- content: {
101
- type: 'text';
102
- text: string;
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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",