skedyul 1.2.21 → 1.2.24

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.
@@ -5,4 +5,4 @@ import type { RequestState } from './types';
5
5
  /**
6
6
  * Creates a dedicated (long-running HTTP) server instance
7
7
  */
8
- export declare function createDedicatedServerInstance(config: RuntimeSkedyulConfig, tools: ToolMetadata[], callTool: (nameRaw: unknown, argsRaw: unknown) => Promise<ToolCallResponse>, state: RequestState, mcpServer: McpServer): SkedyulServerInstance;
8
+ export declare function createDedicatedServerInstance(config: RuntimeSkedyulConfig, tools: ToolMetadata[], callTool: (toolNameInput: unknown, toolArgsInput: unknown) => Promise<ToolCallResponse>, state: RequestState, mcpServer: McpServer): SkedyulServerInstance;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shared handlers for serverless and dedicated servers.
3
+ *
4
+ * These handlers contain the core business logic that is identical
5
+ * between serverless (Lambda) and dedicated (HTTP) server modes.
6
+ */
7
+ export * from './types';
8
+ export { handleInstall } from './install-handler';
9
+ export { handleUninstall } from './uninstall-handler';
10
+ export { handleProvision } from './provision-handler';
11
+ export { handleOAuthCallback } from './oauth-callback-handler';
12
+ export { parseWebhookRequest, executeWebhookHandler, isMethodAllowed, type ParsedWebhookData, } from './webhook-handler';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Install handler - shared implementation for serverless and dedicated servers.
3
+ */
4
+ import type { ServerHooks } from '../../types';
5
+ import type { HandlerResult, InstallRequestBody } from './types';
6
+ /**
7
+ * Handle install request.
8
+ */
9
+ export declare function handleInstall(body: InstallRequestBody, hooks: ServerHooks | undefined): Promise<HandlerResult>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * OAuth callback handler - shared implementation for serverless and dedicated servers.
3
+ */
4
+ import type { ServerHooks } from '../../types';
5
+ import type { HandlerResult } from './types';
6
+ /**
7
+ * Handle OAuth callback request.
8
+ */
9
+ export declare function handleOAuthCallback(parsedBody: unknown, hooks: ServerHooks | undefined): Promise<HandlerResult>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Provision handler - shared implementation for serverless and dedicated servers.
3
+ */
4
+ import type { ServerHooks } from '../../types';
5
+ import type { HandlerResult, ProvisionRequestBody } from './types';
6
+ /**
7
+ * Handle provision request.
8
+ */
9
+ export declare function handleProvision(body: ProvisionRequestBody, hooks: ServerHooks | undefined): Promise<HandlerResult>;
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Shared types for handler implementations.
3
+ * These types abstract over serverless vs dedicated server differences.
4
+ */
5
+ import type { InvocationContext } from '../../types';
6
+ /**
7
+ * Generic handler result that can be converted to either serverless or HTTP response.
8
+ */
9
+ export interface HandlerResult {
10
+ status: number;
11
+ body: unknown;
12
+ headers?: Record<string, string>;
13
+ }
14
+ /**
15
+ * Common envelope format from the platform.
16
+ */
17
+ export interface HandlerEnvelope {
18
+ env: Record<string, string>;
19
+ request: RawRequest;
20
+ context?: EnvelopeContext;
21
+ invocation?: InvocationContext;
22
+ }
23
+ /**
24
+ * Raw request from envelope.
25
+ */
26
+ export interface RawRequest {
27
+ method: string;
28
+ url: string;
29
+ path: string;
30
+ headers: Record<string, string>;
31
+ query: Record<string, string>;
32
+ body: string;
33
+ }
34
+ /**
35
+ * Context from envelope.
36
+ */
37
+ export interface EnvelopeContext {
38
+ app: {
39
+ id: string;
40
+ versionId: string;
41
+ };
42
+ appInstallationId?: string | null;
43
+ workplace?: {
44
+ id: string;
45
+ subdomain: string;
46
+ } | null;
47
+ registration?: Record<string, unknown> | null;
48
+ }
49
+ /**
50
+ * Install request body format.
51
+ */
52
+ export interface InstallRequestBody {
53
+ env?: Record<string, string>;
54
+ invocation?: InvocationContext;
55
+ context?: {
56
+ app: {
57
+ id: string;
58
+ versionId: string;
59
+ handle: string;
60
+ versionHandle: string;
61
+ };
62
+ appInstallationId: string;
63
+ workplace: {
64
+ id: string;
65
+ subdomain: string;
66
+ };
67
+ };
68
+ }
69
+ /**
70
+ * Uninstall request body format.
71
+ */
72
+ export interface UninstallRequestBody {
73
+ env?: Record<string, string>;
74
+ invocation?: InvocationContext;
75
+ context?: {
76
+ app: {
77
+ id: string;
78
+ versionId: string;
79
+ handle: string;
80
+ versionHandle: string;
81
+ };
82
+ appInstallationId: string;
83
+ workplace: {
84
+ id: string;
85
+ subdomain: string;
86
+ };
87
+ };
88
+ }
89
+ /**
90
+ * Provision request body format.
91
+ */
92
+ export interface ProvisionRequestBody {
93
+ env?: Record<string, string>;
94
+ invocation?: InvocationContext;
95
+ context?: {
96
+ app: {
97
+ id: string;
98
+ versionId: string;
99
+ };
100
+ };
101
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Uninstall handler - shared implementation for serverless and dedicated servers.
3
+ */
4
+ import type { ServerHooks } from '../../types';
5
+ import type { HandlerResult, UninstallRequestBody } from './types';
6
+ /**
7
+ * Handle uninstall request.
8
+ */
9
+ export declare function handleUninstall(body: UninstallRequestBody, hooks: ServerHooks | undefined): Promise<HandlerResult>;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Webhook handler - shared implementation for serverless and dedicated servers.
3
+ */
4
+ import type { WebhookContext, WebhookRequest, InvocationContext, WebhookRegistry } from '../../types';
5
+ import type { HandlerResult } from './types';
6
+ /**
7
+ * Parsed webhook request data.
8
+ */
9
+ export interface ParsedWebhookData {
10
+ webhookRequest: WebhookRequest;
11
+ webhookContext: WebhookContext;
12
+ requestEnv: Record<string, string>;
13
+ invocation?: InvocationContext;
14
+ }
15
+ /**
16
+ * Parse webhook request from envelope or direct format.
17
+ */
18
+ export declare function parseWebhookRequest(parsedBody: unknown, method: string, url: string, path: string, headers: Record<string, string | string[] | undefined>, query: Record<string, string>, rawBody: string, appIdHeader?: string, appVersionIdHeader?: string): ParsedWebhookData | {
19
+ error: string;
20
+ };
21
+ /**
22
+ * Execute webhook handler with proper context.
23
+ */
24
+ export declare function executeWebhookHandler(handle: string, webhookRegistry: WebhookRegistry, data: ParsedWebhookData): Promise<HandlerResult>;
25
+ /**
26
+ * Check if HTTP method is allowed for webhook.
27
+ */
28
+ export declare function isMethodAllowed(webhookRegistry: WebhookRegistry, handle: string, method: string): boolean;
@@ -5,4 +5,4 @@ import type { RequestState } from './types';
5
5
  /**
6
6
  * Creates a serverless (Lambda-style) server instance
7
7
  */
8
- export declare function createServerlessInstance(config: RuntimeSkedyulConfig, tools: ToolMetadata[], callTool: (nameRaw: unknown, argsRaw: unknown) => Promise<ToolCallResponse>, state: RequestState, mcpServer: McpServer): SkedyulServerInstance;
8
+ export declare function createServerlessInstance(config: RuntimeSkedyulConfig, tools: ToolMetadata[], callTool: (toolNameInput: unknown, toolArgsInput: unknown) => Promise<ToolCallResponse>, state: RequestState, mcpServer: McpServer): SkedyulServerInstance;
@@ -11,4 +11,4 @@ export declare function createRequestState(maxRequests: number | null, ttlExtend
11
11
  /**
12
12
  * Creates a tool call handler function for executing tools from the registry
13
13
  */
14
- export declare function createCallToolHandler<T extends ToolRegistry>(registry: T, state: RequestState, onMaxRequests?: () => void): (nameRaw: unknown, argsRaw: unknown) => Promise<ToolCallResponse>;
14
+ export declare function createCallToolHandler<T extends ToolRegistry>(registry: T, state: RequestState, onMaxRequests?: () => void): (toolNameInput: unknown, toolArgsInput: unknown) => Promise<ToolCallResponse>;
package/dist/server.d.ts CHANGED
@@ -4,4 +4,4 @@
4
4
  * This file maintains backward compatibility while the actual implementation
5
5
  * has been split into smaller, focused modules in the server/ folder.
6
6
  */
7
- export { createSkedyulServer, server, type RequestState, type CoreMethod, type ToolCallArgs, type RuntimeSkedyulConfig, normalizeBilling, toJsonSchema, isToolSchemaWithJson, getZodSchema, getJsonSchemaFromToolSchema, parseJsonRecord, parseNumberEnv, mergeRuntimeEnv, readRawRequestBody, parseJSONBody, sendJSON, sendHTML, getDefaultHeaders, createResponse, getListeningPort, handleCoreMethod, buildToolMetadata, createRequestState, createCallToolHandler, parseHandlerEnvelope, buildRequestFromRaw, buildRequestScopedConfig, printStartupLog, padEnd, createDedicatedServerInstance, createServerlessInstance, } from './server/index';
7
+ export { createSkedyulServer, server, type RuntimeSkedyulConfig, toJsonSchema, isToolSchemaWithJson, getZodSchema, getJsonSchemaFromToolSchema, } from './server/index';