skedyul 1.5.2 → 1.5.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/index.js CHANGED
@@ -2799,9 +2799,12 @@ function registerQueueConfig(config) {
2799
2799
  // src/server/utils/schema.ts
2800
2800
  var z4 = __toESM(require("zod"));
2801
2801
  function normalizeBilling(billing) {
2802
- if (!billing || typeof billing.credits !== "number") {
2802
+ if (!billing || typeof billing !== "object") {
2803
2803
  return { credits: 0 };
2804
2804
  }
2805
+ if (typeof billing.credits !== "number") {
2806
+ return { ...billing, credits: 0 };
2807
+ }
2805
2808
  return billing;
2806
2809
  }
2807
2810
  function toJsonSchema2(schema) {
@@ -3103,6 +3106,7 @@ function buildToolMetadata(registry) {
3103
3106
  const timeout = typeof rawTimeout === "number" && rawTimeout > 0 ? rawTimeout : 1e4;
3104
3107
  const retries = typeof rawRetries === "number" && rawRetries >= 1 ? rawRetries : 1;
3105
3108
  const queueTouchPoints = tool.queueTouchPoints ?? toolConfig.queueTouchPoints;
3109
+ const rateLimitHandoff = tool.rateLimitHandoff ?? toolConfig.rateLimitHandoff;
3106
3110
  return {
3107
3111
  name: tool.name,
3108
3112
  displayName: tool.label || tool.name,
@@ -3113,11 +3117,13 @@ function buildToolMetadata(registry) {
3113
3117
  timeout,
3114
3118
  retries,
3115
3119
  queueTouchPoints,
3120
+ rateLimitHandoff,
3116
3121
  config: {
3117
3122
  timeout,
3118
3123
  retries,
3119
3124
  completionHints: toolConfig.completionHints,
3120
- queueTouchPoints
3125
+ queueTouchPoints,
3126
+ rateLimitHandoff
3121
3127
  }
3122
3128
  };
3123
3129
  });
@@ -3159,7 +3165,8 @@ function createCallToolHandler(registry, state, onMaxRequests) {
3159
3165
  }
3160
3166
  const fn = tool.handler;
3161
3167
  const args2 = toolArgsInput ?? {};
3162
- const estimateMode = args2.estimate === true;
3168
+ const rawContextForMode = args2.context ?? {};
3169
+ const estimateMode = args2.estimate === true || rawContextForMode.mode === "estimate";
3163
3170
  if (!estimateMode) {
3164
3171
  state.incrementRequestCount();
3165
3172
  if (state.shouldShutdown()) {
@@ -3646,7 +3653,8 @@ function serializeConfig(config) {
3646
3653
  // Read timeout/retries from top-level first, then fallback to config
3647
3654
  timeout: tool.timeout ?? tool.config?.timeout,
3648
3655
  retries: tool.retries ?? tool.config?.retries,
3649
- queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints
3656
+ queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints,
3657
+ rateLimitHandoff: tool.rateLimitHandoff ?? tool.config?.rateLimitHandoff
3650
3658
  })) : [],
3651
3659
  webhooks: webhookRegistry ? Object.values(webhookRegistry).map((w) => ({
3652
3660
  name: w.name,
@@ -4341,11 +4349,12 @@ async function handleMcpRoute(req, ctx) {
4341
4349
  async function handleMcpToolsCall(params, id, ctx) {
4342
4350
  const toolName = params?.name;
4343
4351
  const rawArgs = params?.arguments ?? {};
4344
- const hasSkedyulFormat = "inputs" in rawArgs || "env" in rawArgs || "context" in rawArgs || "invocation" in rawArgs;
4352
+ const hasSkedyulFormat = "inputs" in rawArgs || "env" in rawArgs || "context" in rawArgs || "invocation" in rawArgs || "estimate" in rawArgs;
4345
4353
  const toolInputs = hasSkedyulFormat ? rawArgs.inputs ?? {} : rawArgs;
4346
4354
  const toolContext = hasSkedyulFormat ? rawArgs.context : void 0;
4347
4355
  const toolEnv = hasSkedyulFormat ? rawArgs.env : void 0;
4348
4356
  const toolInvocation = hasSkedyulFormat ? rawArgs.invocation : void 0;
4357
+ const estimate = hasSkedyulFormat && rawArgs.estimate === true;
4349
4358
  const found = findToolInRegistry(ctx.registry, toolName);
4350
4359
  if (!found) {
4351
4360
  return {
@@ -4370,7 +4379,8 @@ async function handleMcpToolsCall(params, id, ctx) {
4370
4379
  inputs: validatedInputs,
4371
4380
  context: toolContext,
4372
4381
  env: toolEnv,
4373
- invocation: toolInvocation
4382
+ invocation: toolInvocation,
4383
+ estimate
4374
4384
  });
4375
4385
  let result;
4376
4386
  const isFailure = isToolCallFailure(toolResult);
@@ -6425,7 +6435,8 @@ function serializeResolvedConfig(config) {
6425
6435
  // Read timeout/retries from top-level first, then fallback to config
6426
6436
  timeout: tool.timeout ?? tool.config?.timeout,
6427
6437
  retries: tool.retries ?? tool.config?.retries,
6428
- queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints
6438
+ queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints,
6439
+ rateLimitHandoff: tool.rateLimitHandoff ?? tool.config?.rateLimitHandoff
6429
6440
  })) : [],
6430
6441
  webhooks: config.webhooks ? Object.values(config.webhooks).map((w) => ({
6431
6442
  name: w.name,
@@ -22,6 +22,10 @@ export interface SerializableQueueConfig {
22
22
  retryDelayMs?: number;
23
23
  /** Hard timeout for acquire wait + fn execution (ms) */
24
24
  timeout?: number;
25
+ /** Mark queue as a correctness mutex (typically maxConcurrent: 1). */
26
+ mutex?: boolean;
27
+ /** Nested queue names that skip acquire while this mutex holds a lease. */
28
+ suppressesQueues?: string[];
25
29
  }
26
30
  /**
27
31
  * Full queue config including non-serializable retry predicate.
@@ -13,6 +13,16 @@ import type { FieldVisibility, InlineFieldDefinition } from './model';
13
13
  * - 'video': Video calls
14
14
  */
15
15
  export type CapabilityType = 'messaging' | 'voice' | 'video';
16
+ /**
17
+ * Batch messaging capability: send tool + status poll tool.
18
+ * Prefer this over a bare `send_batch` string when status tracking is supported.
19
+ */
20
+ export interface ChannelBatchCapability {
21
+ /** Tool that accepts the batch and returns an operationId */
22
+ send: string;
23
+ /** Tool that fetches operation + per-message status by operationId */
24
+ get_status: string;
25
+ }
16
26
  /**
17
27
  * Capability definition with display info and handler references.
18
28
  */
@@ -25,6 +35,12 @@ export interface ChannelCapability {
25
35
  receive?: string;
26
36
  /** Outbound tool handle */
27
37
  send?: string;
38
+ /**
39
+ * Batch outbound capability.
40
+ * - string: send tool only (legacy)
41
+ * - object: send tool + get_status tool for operation tracking
42
+ */
43
+ send_batch?: string | ChannelBatchCapability;
28
44
  }
29
45
  /**
30
46
  * Field permissions for channel fields.
@@ -100,9 +100,12 @@ function registerQueueConfig(config) {
100
100
  // src/server/utils/schema.ts
101
101
  var z = __toESM(require("zod"));
102
102
  function normalizeBilling(billing) {
103
- if (!billing || typeof billing.credits !== "number") {
103
+ if (!billing || typeof billing !== "object") {
104
104
  return { credits: 0 };
105
105
  }
106
+ if (typeof billing.credits !== "number") {
107
+ return { ...billing, credits: 0 };
108
+ }
106
109
  return billing;
107
110
  }
108
111
  function toJsonSchema(schema) {
@@ -436,6 +439,7 @@ function buildToolMetadata(registry) {
436
439
  const timeout = typeof rawTimeout === "number" && rawTimeout > 0 ? rawTimeout : 1e4;
437
440
  const retries = typeof rawRetries === "number" && rawRetries >= 1 ? rawRetries : 1;
438
441
  const queueTouchPoints = tool.queueTouchPoints ?? toolConfig.queueTouchPoints;
442
+ const rateLimitHandoff = tool.rateLimitHandoff ?? toolConfig.rateLimitHandoff;
439
443
  return {
440
444
  name: tool.name,
441
445
  displayName: tool.label || tool.name,
@@ -446,11 +450,13 @@ function buildToolMetadata(registry) {
446
450
  timeout,
447
451
  retries,
448
452
  queueTouchPoints,
453
+ rateLimitHandoff,
449
454
  config: {
450
455
  timeout,
451
456
  retries,
452
457
  completionHints: toolConfig.completionHints,
453
- queueTouchPoints
458
+ queueTouchPoints,
459
+ rateLimitHandoff
454
460
  }
455
461
  };
456
462
  });
@@ -492,7 +498,8 @@ function createCallToolHandler(registry, state, onMaxRequests) {
492
498
  }
493
499
  const fn = tool.handler;
494
500
  const args = toolArgsInput ?? {};
495
- const estimateMode = args.estimate === true;
501
+ const rawContextForMode = args.context ?? {};
502
+ const estimateMode = args.estimate === true || rawContextForMode.mode === "estimate";
496
503
  if (!estimateMode) {
497
504
  state.incrementRequestCount();
498
505
  if (state.shouldShutdown()) {
@@ -979,7 +986,8 @@ function serializeConfig(config) {
979
986
  // Read timeout/retries from top-level first, then fallback to config
980
987
  timeout: tool.timeout ?? tool.config?.timeout,
981
988
  retries: tool.retries ?? tool.config?.retries,
982
- queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints
989
+ queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints,
990
+ rateLimitHandoff: tool.rateLimitHandoff ?? tool.config?.rateLimitHandoff
983
991
  })) : [],
984
992
  webhooks: webhookRegistry ? Object.values(webhookRegistry).map((w) => ({
985
993
  name: w.name,
@@ -1674,11 +1682,12 @@ async function handleMcpRoute(req, ctx) {
1674
1682
  async function handleMcpToolsCall(params, id, ctx) {
1675
1683
  const toolName = params?.name;
1676
1684
  const rawArgs = params?.arguments ?? {};
1677
- const hasSkedyulFormat = "inputs" in rawArgs || "env" in rawArgs || "context" in rawArgs || "invocation" in rawArgs;
1685
+ const hasSkedyulFormat = "inputs" in rawArgs || "env" in rawArgs || "context" in rawArgs || "invocation" in rawArgs || "estimate" in rawArgs;
1678
1686
  const toolInputs = hasSkedyulFormat ? rawArgs.inputs ?? {} : rawArgs;
1679
1687
  const toolContext = hasSkedyulFormat ? rawArgs.context : void 0;
1680
1688
  const toolEnv = hasSkedyulFormat ? rawArgs.env : void 0;
1681
1689
  const toolInvocation = hasSkedyulFormat ? rawArgs.invocation : void 0;
1690
+ const estimate = hasSkedyulFormat && rawArgs.estimate === true;
1682
1691
  const found = findToolInRegistry(ctx.registry, toolName);
1683
1692
  if (!found) {
1684
1693
  return {
@@ -1703,7 +1712,8 @@ async function handleMcpToolsCall(params, id, ctx) {
1703
1712
  inputs: validatedInputs,
1704
1713
  context: toolContext,
1705
1714
  env: toolEnv,
1706
- invocation: toolInvocation
1715
+ invocation: toolInvocation,
1716
+ estimate
1707
1717
  });
1708
1718
  let result;
1709
1719
  const isFailure = isToolCallFailure(toolResult);