skedyul 1.7.6 → 1.7.8

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.
@@ -1901,6 +1901,31 @@ var SetupStepDefinitionSchema = z8.object({
1901
1901
  listenToEnv: z8.boolean().optional(),
1902
1902
  capabilities: z8.array(z8.string()).optional()
1903
1903
  });
1904
+ var BatchPaginationSchema = z8.object({
1905
+ hasMore: z8.boolean(),
1906
+ page: z8.number().int().optional(),
1907
+ total: z8.number().int().optional(),
1908
+ nextCursor: z8.union([z8.string(), z8.number()]).optional(),
1909
+ limit: z8.number().int().positive().optional()
1910
+ });
1911
+ var BatchOperationSetupResultSchema = z8.object({
1912
+ state: z8.record(z8.string(), z8.unknown()).optional(),
1913
+ total: z8.number().int().nonnegative().optional()
1914
+ });
1915
+ var BatchOperationIterateResultSchema = z8.object({
1916
+ items: z8.array(z8.record(z8.string(), z8.unknown())),
1917
+ pagination: BatchPaginationSchema,
1918
+ state: z8.record(z8.string(), z8.unknown()).optional()
1919
+ });
1920
+ var BatchOperationDefinitionSchema = z8.object({
1921
+ handle: z8.string(),
1922
+ label: z8.string(),
1923
+ description: z8.string().optional(),
1924
+ entity: z8.string(),
1925
+ maxConcurrent: z8.number().int().positive().optional(),
1926
+ pageSize: z8.number().int().positive().optional(),
1927
+ icon: z8.string().optional()
1928
+ });
1904
1929
  var ProvisionConfigSchema = z8.object({
1905
1930
  env: EnvSchemaSchema.optional(),
1906
1931
  /** INTERNAL model definitions (app-owned, not visible to users) */
@@ -1915,7 +1940,9 @@ var ProvisionConfigSchema = z8.object({
1915
1940
  navigation: NavigationConfigSchema.optional(),
1916
1941
  pages: z8.array(PageDefinitionSchema).optional(),
1917
1942
  /** Install setup checklist steps (opt-in) */
1918
- setup: z8.array(SetupStepDefinitionSchema).optional()
1943
+ setup: z8.array(SetupStepDefinitionSchema).optional(),
1944
+ /** Batch operations for imports, syncs, and long-running tasks */
1945
+ batchOperations: z8.array(BatchOperationDefinitionSchema).optional()
1919
1946
  });
1920
1947
  var SkedyulConfigSchema = z8.object({
1921
1948
  name: z8.string(),
@@ -5437,6 +5464,128 @@ async function handleMcpBatchRoute(req, ctx) {
5437
5464
  }
5438
5465
  };
5439
5466
  }
5467
+ async function handleBatchOperationRoute(req, ctx) {
5468
+ const bodyResult = parseJsonBody(req);
5469
+ if (!bodyResult.success) {
5470
+ return bodyResult.error;
5471
+ }
5472
+ const body = bodyResult.data;
5473
+ const registry = ctx.batchOperationRegistry;
5474
+ if (!registry) {
5475
+ return {
5476
+ status: 404,
5477
+ body: {
5478
+ success: false,
5479
+ error: "No batch operations registered"
5480
+ }
5481
+ };
5482
+ }
5483
+ const operation = registry[body.handle];
5484
+ if (!operation) {
5485
+ return {
5486
+ status: 404,
5487
+ body: {
5488
+ success: false,
5489
+ error: `Batch operation not found: ${body.handle}`
5490
+ }
5491
+ };
5492
+ }
5493
+ const context = body.context;
5494
+ if (!context?.workplaceId || !context?.appInstallationId || !context?.appId) {
5495
+ return {
5496
+ status: 400,
5497
+ body: {
5498
+ success: false,
5499
+ error: "Missing context (workplaceId, appInstallationId, and appId required)"
5500
+ }
5501
+ };
5502
+ }
5503
+ const env = body.env ?? {};
5504
+ const log = {
5505
+ info: (message, meta) => {
5506
+ console.log(`[batch:${body.handle}] ${message}`, meta ?? "");
5507
+ },
5508
+ warn: (message, meta) => {
5509
+ console.warn(`[batch:${body.handle}] ${message}`, meta ?? "");
5510
+ },
5511
+ error: (message, meta) => {
5512
+ console.error(`[batch:${body.handle}] ${message}`, meta ?? "");
5513
+ }
5514
+ };
5515
+ const requestConfig = {
5516
+ baseUrl: env.SKEDYUL_API_URL ?? process.env.SKEDYUL_API_URL ?? "",
5517
+ apiToken: env.SKEDYUL_API_TOKEN ?? process.env.SKEDYUL_API_TOKEN ?? ""
5518
+ };
5519
+ try {
5520
+ if (body.method === "setup") {
5521
+ if (!operation.setup) {
5522
+ return {
5523
+ status: 200,
5524
+ body: {
5525
+ success: true,
5526
+ result: { state: {}, total: void 0 }
5527
+ }
5528
+ };
5529
+ }
5530
+ const result = await runWithConfig(requestConfig, async () => {
5531
+ return operation.setup({
5532
+ workplaceId: context.workplaceId,
5533
+ appInstallationId: context.appInstallationId,
5534
+ appId: context.appId,
5535
+ input: body.input,
5536
+ env,
5537
+ log
5538
+ });
5539
+ });
5540
+ return {
5541
+ status: 200,
5542
+ body: {
5543
+ success: true,
5544
+ result
5545
+ }
5546
+ };
5547
+ }
5548
+ if (body.method === "iterate") {
5549
+ const result = await runWithConfig(requestConfig, async () => {
5550
+ return operation.iterate({
5551
+ workplaceId: context.workplaceId,
5552
+ appInstallationId: context.appInstallationId,
5553
+ appId: context.appId,
5554
+ input: body.input,
5555
+ state: body.state,
5556
+ page: body.page,
5557
+ cursor: body.cursor,
5558
+ limit: body.limit,
5559
+ env,
5560
+ log
5561
+ });
5562
+ });
5563
+ return {
5564
+ status: 200,
5565
+ body: {
5566
+ success: true,
5567
+ result
5568
+ }
5569
+ };
5570
+ }
5571
+ return {
5572
+ status: 400,
5573
+ body: {
5574
+ success: false,
5575
+ error: `Unknown method: ${body.method}`
5576
+ }
5577
+ };
5578
+ } catch (err) {
5579
+ log.error("Batch operation failed", { error: err });
5580
+ return {
5581
+ status: 500,
5582
+ body: {
5583
+ success: false,
5584
+ error: err instanceof Error ? err.message : String(err)
5585
+ }
5586
+ };
5587
+ }
5588
+ }
5440
5589
  function createNotFoundResponse() {
5441
5590
  return {
5442
5591
  status: 404,
@@ -5516,6 +5665,9 @@ async function routeRequest(req, ctx) {
5516
5665
  if (req.path === "/mcp/batch" && req.method === "POST") {
5517
5666
  return handleMcpBatchRoute(req, ctx);
5518
5667
  }
5668
+ if (req.path === "/batch-operation" && req.method === "POST") {
5669
+ return handleBatchOperationRoute(req, ctx);
5670
+ }
5519
5671
  return createNotFoundResponse();
5520
5672
  } catch (err) {
5521
5673
  return createErrorResponse2(err);
@@ -5557,11 +5709,13 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
5557
5709
  const defaultHeaders = getDefaultHeaders(config.cors);
5558
5710
  const registry = config.tools;
5559
5711
  const webhookRegistry = config.webhooks;
5712
+ const batchOperationRegistry = config.batchOperations;
5560
5713
  const ctx = {
5561
5714
  config,
5562
5715
  tools,
5563
5716
  registry,
5564
5717
  webhookRegistry,
5718
+ batchOperationRegistry,
5565
5719
  callTool,
5566
5720
  state,
5567
5721
  mcpServer,
@@ -5676,12 +5830,14 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
5676
5830
  const defaultHeaders = getDefaultHeaders(config.cors);
5677
5831
  const registry = config.tools;
5678
5832
  const webhookRegistry = config.webhooks;
5833
+ const batchOperationRegistry = config.batchOperations;
5679
5834
  let hasLoggedStartup = false;
5680
5835
  const ctx = {
5681
5836
  config,
5682
5837
  tools,
5683
5838
  registry,
5684
5839
  webhookRegistry,
5840
+ batchOperationRegistry,
5685
5841
  callTool,
5686
5842
  state,
5687
5843
  mcpServer,
@@ -5979,6 +6135,9 @@ function defineNavigation(navigation) {
5979
6135
  function defineSetupStep(step) {
5980
6136
  return step;
5981
6137
  }
6138
+ function defineBatchOperation(operation) {
6139
+ return operation;
6140
+ }
5982
6141
 
5983
6142
  // src/config/schema-loader.ts
5984
6143
  import * as fs4 from "fs";
@@ -8423,6 +8582,10 @@ export {
8423
8582
  AssociationSchema,
8424
8583
  AuthenticationError,
8425
8584
  BaseEventPayloadSchema,
8585
+ BatchOperationDefinitionSchema,
8586
+ BatchOperationIterateResultSchema,
8587
+ BatchOperationSetupResultSchema,
8588
+ BatchPaginationSchema,
8426
8589
  BreadcrumbItemSchema,
8427
8590
  CRMCardinalitySchema,
8428
8591
  CRMContextSchema2 as CRMContextSchema,
@@ -8675,6 +8838,7 @@ export {
8675
8838
  src_default as default,
8676
8839
  defaultShouldRetry,
8677
8840
  defineAgent,
8841
+ defineBatchOperation,
8678
8842
  defineChannel,
8679
8843
  defineConfig,
8680
8844
  defineEntity,
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ declare const _default: {
16
16
  z: typeof z;
17
17
  };
18
18
  export default _default;
19
- export { defineConfig, defineModel, defineEntity, defineChannel, definePage, defineWorkflow, defineAgent, defineEnv, defineNavigation, defineSetupStep, getAllEnvKeys, getRequiredInstallEnvKeys, } from './config';
19
+ export { defineConfig, defineModel, defineEntity, defineChannel, definePage, defineWorkflow, defineAgent, defineEnv, defineNavigation, defineSetupStep, defineBatchOperation, getAllEnvKeys, getRequiredInstallEnvKeys, } from './config';
20
20
  export { queuedFetch, requeue, resolveQueue, createQueueHandle, queuedFetchResponse, registerQueueConfig, runWithRateLimitExecutionContext, getRateLimitExecutionContext, defaultShouldRetry, QueueContextError, QueueNotFoundError, QueuedFetchExhaustedError, RequeueOutsideContextError, RateLimitBackendError, RateLimitExceededError, } from './ratelimit';
21
21
  export type { QueueInput, QueueSelector, Lease, QueueLimits, ResolvedQueue, RateLimitExecutionContext, RateLimitBackend, QueueScope, QueueConfig, SerializableQueueConfig, QueueRegistry, } from './ratelimit';
22
22
  export { sequencer, allow as sequencerAllow, acquire as sequencerAcquire, release as sequencerRelease, resolveSequencer, createSequencerHandle, registerSequencerConfig, clearRegisteredSequencerConfig, getSequencerConfig, getSequencerDefinitions, resetSequencerBackendForTests, memorySequencerBackend, platformSequencerBackend, SequencerContextError, SequencerNotFoundError, SequencerBackendError, SequencerLockError, } from './sequencer';
package/dist/index.js CHANGED
@@ -42,6 +42,10 @@ __export(index_exports, {
42
42
  AssociationSchema: () => AssociationSchema,
43
43
  AuthenticationError: () => AuthenticationError,
44
44
  BaseEventPayloadSchema: () => BaseEventPayloadSchema,
45
+ BatchOperationDefinitionSchema: () => BatchOperationDefinitionSchema,
46
+ BatchOperationIterateResultSchema: () => BatchOperationIterateResultSchema,
47
+ BatchOperationSetupResultSchema: () => BatchOperationSetupResultSchema,
48
+ BatchPaginationSchema: () => BatchPaginationSchema,
45
49
  BreadcrumbItemSchema: () => BreadcrumbItemSchema,
46
50
  CRMCardinalitySchema: () => CRMCardinalitySchema,
47
51
  CRMContextSchema: () => CRMContextSchema2,
@@ -294,6 +298,7 @@ __export(index_exports, {
294
298
  default: () => index_default,
295
299
  defaultShouldRetry: () => defaultShouldRetry,
296
300
  defineAgent: () => defineAgent,
301
+ defineBatchOperation: () => defineBatchOperation,
297
302
  defineChannel: () => defineChannel,
298
303
  defineConfig: () => defineConfig,
299
304
  defineEntity: () => defineEntity,
@@ -2275,6 +2280,31 @@ var SetupStepDefinitionSchema = import_v48.z.object({
2275
2280
  listenToEnv: import_v48.z.boolean().optional(),
2276
2281
  capabilities: import_v48.z.array(import_v48.z.string()).optional()
2277
2282
  });
2283
+ var BatchPaginationSchema = import_v48.z.object({
2284
+ hasMore: import_v48.z.boolean(),
2285
+ page: import_v48.z.number().int().optional(),
2286
+ total: import_v48.z.number().int().optional(),
2287
+ nextCursor: import_v48.z.union([import_v48.z.string(), import_v48.z.number()]).optional(),
2288
+ limit: import_v48.z.number().int().positive().optional()
2289
+ });
2290
+ var BatchOperationSetupResultSchema = import_v48.z.object({
2291
+ state: import_v48.z.record(import_v48.z.string(), import_v48.z.unknown()).optional(),
2292
+ total: import_v48.z.number().int().nonnegative().optional()
2293
+ });
2294
+ var BatchOperationIterateResultSchema = import_v48.z.object({
2295
+ items: import_v48.z.array(import_v48.z.record(import_v48.z.string(), import_v48.z.unknown())),
2296
+ pagination: BatchPaginationSchema,
2297
+ state: import_v48.z.record(import_v48.z.string(), import_v48.z.unknown()).optional()
2298
+ });
2299
+ var BatchOperationDefinitionSchema = import_v48.z.object({
2300
+ handle: import_v48.z.string(),
2301
+ label: import_v48.z.string(),
2302
+ description: import_v48.z.string().optional(),
2303
+ entity: import_v48.z.string(),
2304
+ maxConcurrent: import_v48.z.number().int().positive().optional(),
2305
+ pageSize: import_v48.z.number().int().positive().optional(),
2306
+ icon: import_v48.z.string().optional()
2307
+ });
2278
2308
  var ProvisionConfigSchema = import_v48.z.object({
2279
2309
  env: EnvSchemaSchema.optional(),
2280
2310
  /** INTERNAL model definitions (app-owned, not visible to users) */
@@ -2289,7 +2319,9 @@ var ProvisionConfigSchema = import_v48.z.object({
2289
2319
  navigation: NavigationConfigSchema.optional(),
2290
2320
  pages: import_v48.z.array(PageDefinitionSchema).optional(),
2291
2321
  /** Install setup checklist steps (opt-in) */
2292
- setup: import_v48.z.array(SetupStepDefinitionSchema).optional()
2322
+ setup: import_v48.z.array(SetupStepDefinitionSchema).optional(),
2323
+ /** Batch operations for imports, syncs, and long-running tasks */
2324
+ batchOperations: import_v48.z.array(BatchOperationDefinitionSchema).optional()
2293
2325
  });
2294
2326
  var SkedyulConfigSchema = import_v48.z.object({
2295
2327
  name: import_v48.z.string(),
@@ -5811,6 +5843,128 @@ async function handleMcpBatchRoute(req, ctx) {
5811
5843
  }
5812
5844
  };
5813
5845
  }
5846
+ async function handleBatchOperationRoute(req, ctx) {
5847
+ const bodyResult = parseJsonBody(req);
5848
+ if (!bodyResult.success) {
5849
+ return bodyResult.error;
5850
+ }
5851
+ const body = bodyResult.data;
5852
+ const registry = ctx.batchOperationRegistry;
5853
+ if (!registry) {
5854
+ return {
5855
+ status: 404,
5856
+ body: {
5857
+ success: false,
5858
+ error: "No batch operations registered"
5859
+ }
5860
+ };
5861
+ }
5862
+ const operation = registry[body.handle];
5863
+ if (!operation) {
5864
+ return {
5865
+ status: 404,
5866
+ body: {
5867
+ success: false,
5868
+ error: `Batch operation not found: ${body.handle}`
5869
+ }
5870
+ };
5871
+ }
5872
+ const context = body.context;
5873
+ if (!context?.workplaceId || !context?.appInstallationId || !context?.appId) {
5874
+ return {
5875
+ status: 400,
5876
+ body: {
5877
+ success: false,
5878
+ error: "Missing context (workplaceId, appInstallationId, and appId required)"
5879
+ }
5880
+ };
5881
+ }
5882
+ const env = body.env ?? {};
5883
+ const log = {
5884
+ info: (message, meta) => {
5885
+ console.log(`[batch:${body.handle}] ${message}`, meta ?? "");
5886
+ },
5887
+ warn: (message, meta) => {
5888
+ console.warn(`[batch:${body.handle}] ${message}`, meta ?? "");
5889
+ },
5890
+ error: (message, meta) => {
5891
+ console.error(`[batch:${body.handle}] ${message}`, meta ?? "");
5892
+ }
5893
+ };
5894
+ const requestConfig = {
5895
+ baseUrl: env.SKEDYUL_API_URL ?? process.env.SKEDYUL_API_URL ?? "",
5896
+ apiToken: env.SKEDYUL_API_TOKEN ?? process.env.SKEDYUL_API_TOKEN ?? ""
5897
+ };
5898
+ try {
5899
+ if (body.method === "setup") {
5900
+ if (!operation.setup) {
5901
+ return {
5902
+ status: 200,
5903
+ body: {
5904
+ success: true,
5905
+ result: { state: {}, total: void 0 }
5906
+ }
5907
+ };
5908
+ }
5909
+ const result = await runWithConfig(requestConfig, async () => {
5910
+ return operation.setup({
5911
+ workplaceId: context.workplaceId,
5912
+ appInstallationId: context.appInstallationId,
5913
+ appId: context.appId,
5914
+ input: body.input,
5915
+ env,
5916
+ log
5917
+ });
5918
+ });
5919
+ return {
5920
+ status: 200,
5921
+ body: {
5922
+ success: true,
5923
+ result
5924
+ }
5925
+ };
5926
+ }
5927
+ if (body.method === "iterate") {
5928
+ const result = await runWithConfig(requestConfig, async () => {
5929
+ return operation.iterate({
5930
+ workplaceId: context.workplaceId,
5931
+ appInstallationId: context.appInstallationId,
5932
+ appId: context.appId,
5933
+ input: body.input,
5934
+ state: body.state,
5935
+ page: body.page,
5936
+ cursor: body.cursor,
5937
+ limit: body.limit,
5938
+ env,
5939
+ log
5940
+ });
5941
+ });
5942
+ return {
5943
+ status: 200,
5944
+ body: {
5945
+ success: true,
5946
+ result
5947
+ }
5948
+ };
5949
+ }
5950
+ return {
5951
+ status: 400,
5952
+ body: {
5953
+ success: false,
5954
+ error: `Unknown method: ${body.method}`
5955
+ }
5956
+ };
5957
+ } catch (err) {
5958
+ log.error("Batch operation failed", { error: err });
5959
+ return {
5960
+ status: 500,
5961
+ body: {
5962
+ success: false,
5963
+ error: err instanceof Error ? err.message : String(err)
5964
+ }
5965
+ };
5966
+ }
5967
+ }
5814
5968
  function createNotFoundResponse() {
5815
5969
  return {
5816
5970
  status: 404,
@@ -5890,6 +6044,9 @@ async function routeRequest(req, ctx) {
5890
6044
  if (req.path === "/mcp/batch" && req.method === "POST") {
5891
6045
  return handleMcpBatchRoute(req, ctx);
5892
6046
  }
6047
+ if (req.path === "/batch-operation" && req.method === "POST") {
6048
+ return handleBatchOperationRoute(req, ctx);
6049
+ }
5893
6050
  return createNotFoundResponse();
5894
6051
  } catch (err) {
5895
6052
  return createErrorResponse2(err);
@@ -5931,11 +6088,13 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
5931
6088
  const defaultHeaders = getDefaultHeaders(config.cors);
5932
6089
  const registry = config.tools;
5933
6090
  const webhookRegistry = config.webhooks;
6091
+ const batchOperationRegistry = config.batchOperations;
5934
6092
  const ctx = {
5935
6093
  config,
5936
6094
  tools,
5937
6095
  registry,
5938
6096
  webhookRegistry,
6097
+ batchOperationRegistry,
5939
6098
  callTool,
5940
6099
  state,
5941
6100
  mcpServer,
@@ -6050,12 +6209,14 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
6050
6209
  const defaultHeaders = getDefaultHeaders(config.cors);
6051
6210
  const registry = config.tools;
6052
6211
  const webhookRegistry = config.webhooks;
6212
+ const batchOperationRegistry = config.batchOperations;
6053
6213
  let hasLoggedStartup = false;
6054
6214
  const ctx = {
6055
6215
  config,
6056
6216
  tools,
6057
6217
  registry,
6058
6218
  webhookRegistry,
6219
+ batchOperationRegistry,
6059
6220
  callTool,
6060
6221
  state,
6061
6222
  mcpServer,
@@ -6353,6 +6514,9 @@ function defineNavigation(navigation) {
6353
6514
  function defineSetupStep(step) {
6354
6515
  return step;
6355
6516
  }
6517
+ function defineBatchOperation(operation) {
6518
+ return operation;
6519
+ }
6356
6520
 
6357
6521
  // src/config/schema-loader.ts
6358
6522
  var fs4 = __toESM(require("fs"));
@@ -8798,6 +8962,10 @@ var index_default = { z: import_v414.z };
8798
8962
  AssociationSchema,
8799
8963
  AuthenticationError,
8800
8964
  BaseEventPayloadSchema,
8965
+ BatchOperationDefinitionSchema,
8966
+ BatchOperationIterateResultSchema,
8967
+ BatchOperationSetupResultSchema,
8968
+ BatchPaginationSchema,
8801
8969
  BreadcrumbItemSchema,
8802
8970
  CRMCardinalitySchema,
8803
8971
  CRMContextSchema,
@@ -9049,6 +9217,7 @@ var index_default = { z: import_v414.z };
9049
9217
  cron,
9050
9218
  defaultShouldRetry,
9051
9219
  defineAgent,
9220
+ defineBatchOperation,
9052
9221
  defineChannel,
9053
9222
  defineConfig,
9054
9223
  defineEntity,
package/dist/schemas.d.ts CHANGED
@@ -3357,6 +3357,37 @@ export declare const SetupStepDefinitionSchema: z.ZodObject<{
3357
3357
  listenToEnv: z.ZodOptional<z.ZodBoolean>;
3358
3358
  capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
3359
3359
  }, z.core.$strip>;
3360
+ export declare const BatchPaginationSchema: z.ZodObject<{
3361
+ hasMore: z.ZodBoolean;
3362
+ page: z.ZodOptional<z.ZodNumber>;
3363
+ total: z.ZodOptional<z.ZodNumber>;
3364
+ nextCursor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3365
+ limit: z.ZodOptional<z.ZodNumber>;
3366
+ }, z.core.$strip>;
3367
+ export declare const BatchOperationSetupResultSchema: z.ZodObject<{
3368
+ state: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3369
+ total: z.ZodOptional<z.ZodNumber>;
3370
+ }, z.core.$strip>;
3371
+ export declare const BatchOperationIterateResultSchema: z.ZodObject<{
3372
+ items: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3373
+ pagination: z.ZodObject<{
3374
+ hasMore: z.ZodBoolean;
3375
+ page: z.ZodOptional<z.ZodNumber>;
3376
+ total: z.ZodOptional<z.ZodNumber>;
3377
+ nextCursor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3378
+ limit: z.ZodOptional<z.ZodNumber>;
3379
+ }, z.core.$strip>;
3380
+ state: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3381
+ }, z.core.$strip>;
3382
+ export declare const BatchOperationDefinitionSchema: z.ZodObject<{
3383
+ handle: z.ZodString;
3384
+ label: z.ZodString;
3385
+ description: z.ZodOptional<z.ZodString>;
3386
+ entity: z.ZodString;
3387
+ maxConcurrent: z.ZodOptional<z.ZodNumber>;
3388
+ pageSize: z.ZodOptional<z.ZodNumber>;
3389
+ icon: z.ZodOptional<z.ZodString>;
3390
+ }, z.core.$strip>;
3360
3391
  export declare const ProvisionConfigSchema: z.ZodObject<{
3361
3392
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
3362
3393
  label: z.ZodString;
@@ -4161,6 +4192,15 @@ export declare const ProvisionConfigSchema: z.ZodObject<{
4161
4192
  listenToEnv: z.ZodOptional<z.ZodBoolean>;
4162
4193
  capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
4163
4194
  }, z.core.$strip>>>;
4195
+ batchOperations: z.ZodOptional<z.ZodArray<z.ZodObject<{
4196
+ handle: z.ZodString;
4197
+ label: z.ZodString;
4198
+ description: z.ZodOptional<z.ZodString>;
4199
+ entity: z.ZodString;
4200
+ maxConcurrent: z.ZodOptional<z.ZodNumber>;
4201
+ pageSize: z.ZodOptional<z.ZodNumber>;
4202
+ icon: z.ZodOptional<z.ZodString>;
4203
+ }, z.core.$strip>>>;
4164
4204
  }, z.core.$strip>;
4165
4205
  export declare const SkedyulConfigSchema: z.ZodObject<{
4166
4206
  name: z.ZodString;
@@ -4976,6 +5016,15 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
4976
5016
  listenToEnv: z.ZodOptional<z.ZodBoolean>;
4977
5017
  capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
4978
5018
  }, z.core.$strip>>>;
5019
+ batchOperations: z.ZodOptional<z.ZodArray<z.ZodObject<{
5020
+ handle: z.ZodString;
5021
+ label: z.ZodString;
5022
+ description: z.ZodOptional<z.ZodString>;
5023
+ entity: z.ZodString;
5024
+ maxConcurrent: z.ZodOptional<z.ZodNumber>;
5025
+ pageSize: z.ZodOptional<z.ZodNumber>;
5026
+ icon: z.ZodOptional<z.ZodString>;
5027
+ }, z.core.$strip>>>;
4979
5028
  }, z.core.$strip>, z.ZodUnknown]>>;
4980
5029
  agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
4981
5030
  handle: z.ZodString;
@@ -5039,6 +5088,10 @@ export type InstallConfig = z.infer<typeof InstallConfigSchema>;
5039
5088
  export type ProvisionConfig = z.infer<typeof ProvisionConfigSchema>;
5040
5089
  export type SetupStepKind = z.infer<typeof SetupStepKindSchema>;
5041
5090
  export type SetupStepDefinition = z.infer<typeof SetupStepDefinitionSchema>;
5091
+ export type BatchPagination = z.infer<typeof BatchPaginationSchema>;
5092
+ export type BatchOperationSetupResult = z.infer<typeof BatchOperationSetupResultSchema>;
5093
+ export type BatchOperationIterateResult = z.infer<typeof BatchOperationIterateResultSchema>;
5094
+ export type BatchOperationDefinition = z.infer<typeof BatchOperationDefinitionSchema>;
5042
5095
  export type FormV2StyleProps = z.infer<typeof FormV2StylePropsSchema>;
5043
5096
  export type FieldSettingButtonProps = z.infer<typeof FieldSettingButtonPropsSchema>;
5044
5097
  export type RelationshipExtension = z.infer<typeof RelationshipExtensionSchema>;
@@ -1,4 +1,4 @@
1
- import type { DedicatedServerInstance, ServerlessServerInstance, SkedyulServerInstance, ToolRegistry, WebhookRegistry } from '../types';
1
+ import type { DedicatedServerInstance, ServerlessServerInstance, SkedyulServerInstance, ToolRegistry, WebhookRegistry, BatchOperationRegistry } from '../types';
2
2
  import type { SkedyulConfig } from '../config/app-config';
3
3
  export type { RequestState, CoreMethod, ToolCallArgs } from './types';
4
4
  export { normalizeBilling, toJsonSchema, isToolSchemaWithJson, getZodSchema, getJsonSchemaFromToolSchema, parseJsonRecord, parseNumberEnv, mergeRuntimeEnv, readRawRequestBody, parseJSONBody, sendJSON, sendHTML, getDefaultHeaders, createResponse, getListeningPort, } from './utils';
@@ -15,9 +15,10 @@ export type { UnifiedRequest, UnifiedResponse, RouteContext } from './route-hand
15
15
  * Runtime config type - SkedyulConfig with resolved registries (not promises).
16
16
  * This is what server.create() expects at runtime.
17
17
  */
18
- export type RuntimeSkedyulConfig = Omit<SkedyulConfig, 'tools' | 'webhooks'> & {
18
+ export type RuntimeSkedyulConfig = Omit<SkedyulConfig, 'tools' | 'webhooks' | 'batchOperations'> & {
19
19
  tools: ToolRegistry;
20
20
  webhooks?: WebhookRegistry;
21
+ batchOperations?: BatchOperationRegistry;
21
22
  };
22
23
  export declare function createSkedyulServer(config: RuntimeSkedyulConfig & {
23
24
  computeLayer: 'dedicated';
@@ -60,6 +60,13 @@ export declare function handleMcpRoute(req: UnifiedRequest, ctx: RouteContext):
60
60
  * This is used by the message outbox processor for efficient batched delivery.
61
61
  */
62
62
  export declare function handleMcpBatchRoute(req: UnifiedRequest, ctx: RouteContext): Promise<UnifiedResponse>;
63
+ /**
64
+ * Handle /batch-operation route for invoking batch operation setup/iterate.
65
+ *
66
+ * Mirrors tool/install handlers: platform passes env + context in the body;
67
+ * we wrap handlers in runWithConfig so SDK clients (instance.*, etc.) work.
68
+ */
69
+ export declare function handleBatchOperationRoute(req: UnifiedRequest, ctx: RouteContext): Promise<UnifiedResponse>;
63
70
  /**
64
71
  * Create a 404 Not Found response in JSON-RPC format.
65
72
  */
@@ -6,5 +6,5 @@
6
6
  */
7
7
  export type { UnifiedRequest, UnifiedResponse, RouteContext, CallToolFn, ParsedJsonRpcBody, SkedyulToolCallArgs, ParseResult, } from './types';
8
8
  export { fromLambdaEvent, toLambdaResponse, parseJsonBody, parseJsonRpcBody, getHeader, getContentType, parseBodyByContentType, } from './adapters';
9
- export { handleHealthRoute, handleConfigRoute, handleCoreRoute, handleCoreWebhookRoute, handleEstimateRoute, handleInstallRoute, handleUninstallRoute, handleProvisionRoute, handleSetupRevalidateRoute, handleOAuthCallbackRoute, handleWebhookRoute, handleMcpRoute, createNotFoundResponse, createOptionsResponse, createErrorResponse, } from './handlers';
9
+ export { handleHealthRoute, handleConfigRoute, handleCoreRoute, handleCoreWebhookRoute, handleEstimateRoute, handleInstallRoute, handleUninstallRoute, handleProvisionRoute, handleSetupRevalidateRoute, handleOAuthCallbackRoute, handleWebhookRoute, handleMcpRoute, handleBatchOperationRoute, createNotFoundResponse, createOptionsResponse, createErrorResponse, } from './handlers';
10
10
  export { routeRequest } from './router';
@@ -5,7 +5,7 @@
5
5
  * allowing route handlers to be transport-agnostic.
6
6
  */
7
7
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
8
- import type { ToolCallResponse, ToolMetadata, ToolRegistry, WebhookRegistry, InvocationContext } from '../../types';
8
+ import type { ToolCallResponse, ToolMetadata, ToolRegistry, WebhookRegistry, BatchOperationRegistry, InvocationContext } from '../../types';
9
9
  import type { RuntimeSkedyulConfig } from '../index';
10
10
  import type { RequestState } from '../types';
11
11
  /**
@@ -39,6 +39,7 @@ export interface RouteContext {
39
39
  tools: ToolMetadata[];
40
40
  registry: ToolRegistry;
41
41
  webhookRegistry?: WebhookRegistry;
42
+ batchOperationRegistry?: BatchOperationRegistry;
42
43
  callTool: CallToolFn;
43
44
  state: RequestState;
44
45
  mcpServer: McpServer;