skedyul 1.2.44 → 1.2.50

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.
Files changed (59) hide show
  1. package/dist/cli/commands/event.d.ts +1 -0
  2. package/dist/cli/commands/workflows.d.ts +1 -0
  3. package/dist/cli/index.js +3928 -9110
  4. package/dist/cli/utils/auth.d.ts +4 -1
  5. package/dist/cli/utils/auth.js +32 -8
  6. package/dist/cli/utils/config.d.ts +23 -0
  7. package/dist/cli/utils/env-sync.d.ts +46 -0
  8. package/dist/cli/utils/mcp-http-client.d.ts +74 -0
  9. package/dist/cli/utils/migration-approval.d.ts +39 -0
  10. package/dist/cli/utils/mock-context.d.ts +19 -9
  11. package/dist/cli/utils/sse.d.ts +33 -0
  12. package/dist/cli/utils.d.ts +5 -1
  13. package/dist/compiler/types.d.ts +11 -9
  14. package/dist/config/app-config.d.ts +3 -1
  15. package/dist/config/schema-loader.d.ts +15 -2
  16. package/dist/config/types/index.d.ts +1 -0
  17. package/dist/config/types/model.d.ts +2 -0
  18. package/dist/config/types/page.d.ts +9 -0
  19. package/dist/config/types/signal.d.ts +20 -0
  20. package/dist/context/index.d.ts +2 -2
  21. package/dist/context/resolver.d.ts +29 -28
  22. package/dist/context/types.d.ts +195 -37
  23. package/dist/core/client.d.ts +211 -233
  24. package/dist/dedicated/server.js +252 -163
  25. package/dist/dockerfile.d.ts +1 -1
  26. package/dist/esm/index.mjs +1207 -7684
  27. package/dist/index.d.ts +11 -6
  28. package/dist/index.js +1253 -7682
  29. package/dist/scheduling/calculateWaitTime.d.ts +16 -0
  30. package/dist/scheduling/index.d.ts +11 -0
  31. package/dist/scheduling/index.js +334 -0
  32. package/dist/scheduling/index.mjs +305 -0
  33. package/dist/scheduling/isTimeInWindow.d.ts +15 -0
  34. package/dist/scheduling/types-workflow.d.ts +54 -0
  35. package/dist/scheduling/types.d.ts +166 -0
  36. package/dist/schemas/agent-schema-v3.d.ts +416 -60
  37. package/dist/schemas/agent-schema-v3.js +262 -74
  38. package/dist/schemas/agent-schema-v3.mjs +248 -72
  39. package/dist/schemas/agent-schema.js +3 -7295
  40. package/dist/schemas/agent-schema.mjs +3 -7323
  41. package/dist/schemas/crm-schema.d.ts +53 -19
  42. package/dist/schemas/index.d.ts +1 -1
  43. package/dist/schemas.d.ts +128 -40
  44. package/dist/server/route-handlers/handlers.d.ts +7 -0
  45. package/dist/server/utils/env.d.ts +9 -0
  46. package/dist/server/utils/index.d.ts +1 -0
  47. package/dist/server/utils/mcp-response.d.ts +11 -0
  48. package/dist/server.js +252 -163
  49. package/dist/serverless/server.mjs +252 -163
  50. package/dist/skills/index.d.ts +1 -1
  51. package/dist/skills/types.d.ts +35 -23
  52. package/dist/skills/types.js +10 -17
  53. package/dist/skills/types.mjs +9 -16
  54. package/dist/types/index.d.ts +3 -3
  55. package/dist/types/server.d.ts +1 -0
  56. package/dist/types/tool-context.d.ts +31 -4
  57. package/dist/types/tool-response.d.ts +2 -0
  58. package/dist/types/tool.d.ts +33 -1
  59. package/package.json +9 -2
@@ -1 +1 @@
1
- export { SKILL_SCHEMA_VERSION, SkillSourceSchema, SkillToolRequirementSchema, SkillExampleSchema, SkillEvaluationMetricSchema, SkillYAMLSchema, SkillRefSchema, SkillVersionWeightSchema, SkillMetadataSchema, ResolvedSkillSchema, type SkillSource, type SkillToolRequirement, type SkillExample, type SkillEvaluationMetric, type SkillYAML, type SkillRef, type SkillVersionWeight, type SkillMetadata, type ResolvedSkill, type SkillDiscoveryInfo, defineSkill, validateSkillYAML, formatSkillInstructions, formatSkillDiscovery, } from './types';
1
+ export { SKILL_SCHEMA_VERSION, SkillSourceSchema, SkillToolRequirementSchema, SkillExampleSchema, SkillYAMLSchema, SkillRefSchema, SkillVersionWeightSchema, SkillMetadataSchema, ResolvedSkillSchema, CRMModelFieldRequirementsSchema, CRMContextSchema as SkillCRMContextSchema, type SkillSource, type SkillToolRequirement, type SkillExample, type SkillYAML, type SkillRef, type SkillVersionWeight, type SkillMetadata, type ResolvedSkill, type SkillDiscoveryInfo, type CRMModelFieldRequirements, type CRMContext as SkillCRMContext, defineSkill, validateSkillYAML, formatSkillInstructions, formatSkillDiscovery, } from './types';
@@ -95,20 +95,38 @@ export declare const SkillExampleSchema: z.ZodObject<{
95
95
  }, z.core.$strip>;
96
96
  export type SkillExample = z.infer<typeof SkillExampleSchema>;
97
97
  /**
98
- * Skill evaluation metric
98
+ * Field requirements for a CRM model in skill context.
99
+ * - required: Fields that MUST have a value or agent will fail (ERROR)
100
+ * - recommended: Fields that SHOULD have a value for optimal performance (WARNING)
101
+ * - Fields not listed are optional (no validation)
99
102
  */
100
- export declare const SkillEvaluationMetricSchema: z.ZodObject<{
101
- metric: z.ZodString;
102
- description: z.ZodOptional<z.ZodString>;
103
- threshold: z.ZodOptional<z.ZodNumber>;
103
+ export declare const CRMModelFieldRequirementsSchema: z.ZodObject<{
104
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
105
+ recommended: z.ZodOptional<z.ZodArray<z.ZodString>>;
104
106
  }, z.core.$strip>;
105
- export type SkillEvaluationMetric = z.infer<typeof SkillEvaluationMetricSchema>;
107
+ export type CRMModelFieldRequirements = z.infer<typeof CRMModelFieldRequirementsSchema>;
106
108
  /**
107
109
  * CRM context configuration - specifies which models and fields to include
108
- * in the CRM schema when loading this skill.
110
+ * in the CRM schema when loading this skill, with requirement levels.
111
+ *
112
+ * Example:
113
+ * ```yaml
114
+ * crmContext:
115
+ * models:
116
+ * prospect:
117
+ * required:
118
+ * - stage
119
+ * - intent_score
120
+ * recommended:
121
+ * - goals
122
+ * - desired_frequency
123
+ * ```
109
124
  */
110
125
  export declare const CRMContextSchema: z.ZodObject<{
111
- models: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
126
+ models: z.ZodRecord<z.ZodString, z.ZodObject<{
127
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
+ recommended: z.ZodOptional<z.ZodArray<z.ZodString>>;
129
+ }, z.core.$strip>>;
112
130
  }, z.core.$strip>;
113
131
  export type CRMContext = z.infer<typeof CRMContextSchema>;
114
132
  /**
@@ -143,7 +161,10 @@ export declare const SkillYAMLSchema: z.ZodObject<{
143
161
  }, z.core.$strip>>;
144
162
  }, z.core.$strip>>]>>;
145
163
  crmContext: z.ZodOptional<z.ZodObject<{
146
- models: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
164
+ models: z.ZodRecord<z.ZodString, z.ZodObject<{
165
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
166
+ recommended: z.ZodOptional<z.ZodArray<z.ZodString>>;
167
+ }, z.core.$strip>>;
147
168
  }, z.core.$strip>>;
148
169
  examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
149
170
  context: z.ZodOptional<z.ZodString>;
@@ -152,12 +173,6 @@ export declare const SkillYAMLSchema: z.ZodObject<{
152
173
  output: z.ZodString;
153
174
  tool_call: z.ZodOptional<z.ZodString>;
154
175
  }, z.core.$strip>>>;
155
- evaluation: z.ZodOptional<z.ZodArray<z.ZodObject<{
156
- metric: z.ZodString;
157
- description: z.ZodOptional<z.ZodString>;
158
- threshold: z.ZodOptional<z.ZodNumber>;
159
- }, z.core.$strip>>>;
160
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
161
176
  }, z.core.$strip>;
162
177
  export type SkillYAML = z.infer<typeof SkillYAMLSchema>;
163
178
  /**
@@ -187,7 +202,10 @@ export declare const SkillYAMLV2Schema: z.ZodObject<{
187
202
  }, z.core.$strip>>;
188
203
  }, z.core.$strip>>>;
189
204
  crmContext: z.ZodOptional<z.ZodObject<{
190
- models: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
205
+ models: z.ZodRecord<z.ZodString, z.ZodObject<{
206
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
207
+ recommended: z.ZodOptional<z.ZodArray<z.ZodString>>;
208
+ }, z.core.$strip>>;
191
209
  }, z.core.$strip>>;
192
210
  examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
193
211
  context: z.ZodOptional<z.ZodString>;
@@ -196,12 +214,6 @@ export declare const SkillYAMLV2Schema: z.ZodObject<{
196
214
  output: z.ZodString;
197
215
  tool_call: z.ZodOptional<z.ZodString>;
198
216
  }, z.core.$strip>>>;
199
- evaluation: z.ZodOptional<z.ZodArray<z.ZodObject<{
200
- metric: z.ZodString;
201
- description: z.ZodOptional<z.ZodString>;
202
- threshold: z.ZodOptional<z.ZodNumber>;
203
- }, z.core.$strip>>>;
204
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
205
217
  }, z.core.$strip>;
206
218
  export type SkillYAMLV2 = z.infer<typeof SkillYAMLV2Schema>;
207
219
  /**
@@ -218,6 +230,7 @@ export type SkillVersionWeight = z.infer<typeof SkillVersionWeightSchema>;
218
230
  export declare const SkillRefSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
219
231
  skill: z.ZodString;
220
232
  description: z.ZodOptional<z.ZodString>;
233
+ alwaysLoad: z.ZodOptional<z.ZodBoolean>;
221
234
  version: z.ZodOptional<z.ZodNumber>;
222
235
  versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
223
236
  version: z.ZodNumber;
@@ -245,7 +258,6 @@ export declare const SkillMetadataSchema: z.ZodObject<{
245
258
  s3Key: z.ZodOptional<z.ZodString>;
246
259
  appVersionId: z.ZodOptional<z.ZodString>;
247
260
  workplaceId: z.ZodOptional<z.ZodString>;
248
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
249
261
  createdAt: z.ZodOptional<z.ZodString>;
250
262
  updatedAt: z.ZodOptional<z.ZodString>;
251
263
  }, z.core.$strip>;
@@ -21,11 +21,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var types_exports = {};
22
22
  __export(types_exports, {
23
23
  CRMContextSchema: () => CRMContextSchema,
24
+ CRMModelFieldRequirementsSchema: () => CRMModelFieldRequirementsSchema,
24
25
  LoadedSkillSchema: () => LoadedSkillSchema,
25
26
  ResolvedSkillSchema: () => ResolvedSkillSchema,
26
27
  SKILL_SCHEMA_VERSION: () => SKILL_SCHEMA_VERSION,
27
28
  SKILL_SCHEMA_VERSION_V2: () => SKILL_SCHEMA_VERSION_V2,
28
- SkillEvaluationMetricSchema: () => SkillEvaluationMetricSchema,
29
29
  SkillExampleSchema: () => SkillExampleSchema,
30
30
  SkillMetadataSchema: () => SkillMetadataSchema,
31
31
  SkillRefSchema: () => SkillRefSchema,
@@ -83,14 +83,12 @@ var SkillExampleSchema = import_v4.z.object({
83
83
  output: import_v4.z.string(),
84
84
  tool_call: import_v4.z.string().optional()
85
85
  });
86
- var SkillEvaluationMetricSchema = import_v4.z.object({
87
- metric: import_v4.z.string(),
88
- description: import_v4.z.string().optional(),
89
- threshold: import_v4.z.number().optional()
86
+ var CRMModelFieldRequirementsSchema = import_v4.z.object({
87
+ required: import_v4.z.array(import_v4.z.string()).optional(),
88
+ recommended: import_v4.z.array(import_v4.z.string()).optional()
90
89
  });
91
90
  var CRMContextSchema = import_v4.z.object({
92
- models: import_v4.z.record(import_v4.z.string(), import_v4.z.array(import_v4.z.string()))
93
- // { modelHandle: [fieldHandles] }
91
+ models: import_v4.z.record(import_v4.z.string(), CRMModelFieldRequirementsSchema)
94
92
  });
95
93
  var SkillYAMLSchema = import_v4.z.object({
96
94
  // Schema version
@@ -107,11 +105,7 @@ var SkillYAMLSchema = import_v4.z.object({
107
105
  // CRM context - specifies which models/fields to include in schema
108
106
  crmContext: CRMContextSchema.optional(),
109
107
  // Few-shot examples
110
- examples: import_v4.z.array(SkillExampleSchema).optional(),
111
- // Evaluation criteria
112
- evaluation: import_v4.z.array(SkillEvaluationMetricSchema).optional(),
113
- // Tags for discovery
114
- tags: import_v4.z.array(import_v4.z.string()).optional()
108
+ examples: import_v4.z.array(SkillExampleSchema).optional()
115
109
  });
116
110
  var SkillYAMLV2Schema = import_v4.z.object({
117
111
  $schema: import_v4.z.literal(SKILL_SCHEMA_VERSION_V2).optional(),
@@ -122,9 +116,7 @@ var SkillYAMLV2Schema = import_v4.z.object({
122
116
  instructions: import_v4.z.string(),
123
117
  tools: import_v4.z.array(SkillToolDefinitionSchema).optional(),
124
118
  crmContext: CRMContextSchema.optional(),
125
- examples: import_v4.z.array(SkillExampleSchema).optional(),
126
- evaluation: import_v4.z.array(SkillEvaluationMetricSchema).optional(),
127
- tags: import_v4.z.array(import_v4.z.string()).optional()
119
+ examples: import_v4.z.array(SkillExampleSchema).optional()
128
120
  });
129
121
  var SkillVersionWeightSchema = import_v4.z.object({
130
122
  version: import_v4.z.number(),
@@ -137,6 +129,8 @@ var SkillRefSchema = import_v4.z.union([
137
129
  skill: import_v4.z.string(),
138
130
  description: import_v4.z.string().optional(),
139
131
  // For AI SDK Agent Skills discovery
132
+ /** Auto-inject this skill's instructions and tools on every agent turn */
133
+ alwaysLoad: import_v4.z.boolean().optional(),
140
134
  // Version selection (pick one):
141
135
  version: import_v4.z.number().optional(),
142
136
  // Pin to specific version number
@@ -158,7 +152,6 @@ var SkillMetadataSchema = import_v4.z.object({
158
152
  s3Key: import_v4.z.string().optional(),
159
153
  appVersionId: import_v4.z.string().optional(),
160
154
  workplaceId: import_v4.z.string().optional(),
161
- tags: import_v4.z.array(import_v4.z.string()).optional(),
162
155
  createdAt: import_v4.z.string().datetime().optional(),
163
156
  updatedAt: import_v4.z.string().datetime().optional()
164
157
  });
@@ -254,11 +247,11 @@ IMPORTANT: Always use the proper tool calls. Do NOT output XML-like tags in your
254
247
  // Annotate the CommonJS export names for ESM import in node:
255
248
  0 && (module.exports = {
256
249
  CRMContextSchema,
250
+ CRMModelFieldRequirementsSchema,
257
251
  LoadedSkillSchema,
258
252
  ResolvedSkillSchema,
259
253
  SKILL_SCHEMA_VERSION,
260
254
  SKILL_SCHEMA_VERSION_V2,
261
- SkillEvaluationMetricSchema,
262
255
  SkillExampleSchema,
263
256
  SkillMetadataSchema,
264
257
  SkillRefSchema,
@@ -37,14 +37,12 @@ var SkillExampleSchema = z.object({
37
37
  output: z.string(),
38
38
  tool_call: z.string().optional()
39
39
  });
40
- var SkillEvaluationMetricSchema = z.object({
41
- metric: z.string(),
42
- description: z.string().optional(),
43
- threshold: z.number().optional()
40
+ var CRMModelFieldRequirementsSchema = z.object({
41
+ required: z.array(z.string()).optional(),
42
+ recommended: z.array(z.string()).optional()
44
43
  });
45
44
  var CRMContextSchema = z.object({
46
- models: z.record(z.string(), z.array(z.string()))
47
- // { modelHandle: [fieldHandles] }
45
+ models: z.record(z.string(), CRMModelFieldRequirementsSchema)
48
46
  });
49
47
  var SkillYAMLSchema = z.object({
50
48
  // Schema version
@@ -61,11 +59,7 @@ var SkillYAMLSchema = z.object({
61
59
  // CRM context - specifies which models/fields to include in schema
62
60
  crmContext: CRMContextSchema.optional(),
63
61
  // Few-shot examples
64
- examples: z.array(SkillExampleSchema).optional(),
65
- // Evaluation criteria
66
- evaluation: z.array(SkillEvaluationMetricSchema).optional(),
67
- // Tags for discovery
68
- tags: z.array(z.string()).optional()
62
+ examples: z.array(SkillExampleSchema).optional()
69
63
  });
70
64
  var SkillYAMLV2Schema = z.object({
71
65
  $schema: z.literal(SKILL_SCHEMA_VERSION_V2).optional(),
@@ -76,9 +70,7 @@ var SkillYAMLV2Schema = z.object({
76
70
  instructions: z.string(),
77
71
  tools: z.array(SkillToolDefinitionSchema).optional(),
78
72
  crmContext: CRMContextSchema.optional(),
79
- examples: z.array(SkillExampleSchema).optional(),
80
- evaluation: z.array(SkillEvaluationMetricSchema).optional(),
81
- tags: z.array(z.string()).optional()
73
+ examples: z.array(SkillExampleSchema).optional()
82
74
  });
83
75
  var SkillVersionWeightSchema = z.object({
84
76
  version: z.number(),
@@ -91,6 +83,8 @@ var SkillRefSchema = z.union([
91
83
  skill: z.string(),
92
84
  description: z.string().optional(),
93
85
  // For AI SDK Agent Skills discovery
86
+ /** Auto-inject this skill's instructions and tools on every agent turn */
87
+ alwaysLoad: z.boolean().optional(),
94
88
  // Version selection (pick one):
95
89
  version: z.number().optional(),
96
90
  // Pin to specific version number
@@ -112,7 +106,6 @@ var SkillMetadataSchema = z.object({
112
106
  s3Key: z.string().optional(),
113
107
  appVersionId: z.string().optional(),
114
108
  workplaceId: z.string().optional(),
115
- tags: z.array(z.string()).optional(),
116
109
  createdAt: z.string().datetime().optional(),
117
110
  updatedAt: z.string().datetime().optional()
118
111
  });
@@ -207,11 +200,11 @@ IMPORTANT: Always use the proper tool calls. Do NOT output XML-like tags in your
207
200
  }
208
201
  export {
209
202
  CRMContextSchema,
203
+ CRMModelFieldRequirementsSchema,
210
204
  LoadedSkillSchema,
211
205
  ResolvedSkillSchema,
212
206
  SKILL_SCHEMA_VERSION,
213
207
  SKILL_SCHEMA_VERSION_V2,
214
- SkillEvaluationMetricSchema,
215
208
  SkillExampleSchema,
216
209
  SkillMetadataSchema,
217
210
  SkillRefSchema,
@@ -7,9 +7,9 @@
7
7
  export type { AppInfo, AppInfoWithHandles, WorkplaceInfo, RequestInfo } from './shared';
8
8
  export type { InvocationType, ServerHookHandle, InvocationContext, } from './invocation';
9
9
  export { createToolCallContext, createServerHookContext, createWebhookContext, createWorkflowStepContext, } from './invocation';
10
- export type { ToolTrigger, ProvisionToolContext, FieldChangeToolContext, PageActionToolContext, FormSubmitToolContext, AgentToolContext, WorkflowToolContext, ToolExecutionContext, } from './tool-context';
11
- export { isProvisionContext, isRuntimeContext } from './tool-context';
12
- export type { ToolResult, ToolSuccess, ToolFailure, ErrorCode, ErrorCategory, ToolWarning, ToolPagination, ToolBilling, ToolRetry, ToolTiming, ToolCompletionHints, ToolConfig, BillingInfo, ToolResponseMeta, ToolEffect, ToolError, ToolExecutionResult, ToolSchemaWithJson, ToolSchema, ToolHandler, ToolDefinition, ToolRegistryEntry, ToolRegistry, ToolName, ToolMetadata, ToolCallResponse, } from './tool';
10
+ export type { ToolTrigger, ProvisionToolContext, DeveloperPageActionToolContext, DeveloperFormSubmitToolContext, FieldChangeToolContext, PageActionToolContext, FormSubmitToolContext, AgentToolContext, WorkflowToolContext, CronToolContext, CronContext, ToolExecutionContext, } from './tool-context';
11
+ export { isProvisionContext, isRuntimeContext, isCronContext, isDeveloperContext } from './tool-context';
12
+ export type { ToolResult, ToolSuccess, ToolFailure, ErrorCode, ErrorCategory, ToolWarning, ToolPagination, ToolBilling, ToolRetry, ToolTiming, ToolCompletionHints, ToolConfig, BillingInfo, ToolResponseMeta, ToolEffect, ToolError, ToolExecutionResult, ToolSchemaWithJson, ToolSchema, ToolHandler, ToolDefinition, ToolRegistryEntry, ToolRegistry, ToolName, ToolMetadata, ToolCallResponse, ExecutionScope, } from './tool';
13
13
  export { ToolResponseMetaSchema } from './tool';
14
14
  export { createSuccessResponse, createListResponse, createErrorResponse, createValidationError, createNotFoundError, createAuthError, createRateLimitError, createExternalError, createTimeoutError, createPermissionError, createConflictError, isSuccess, isFailure, isRetryable, getRetryDelay, } from './tool-response';
15
15
  export type { HealthStatus, ComputeLayer, DedicatedServerInstance, ServerlessServerInstance, SkedyulServerInstance, } from './server';
@@ -13,6 +13,7 @@ export interface HealthStatus {
13
13
  export type { ComputeLayer };
14
14
  export interface DedicatedServerInstance {
15
15
  listen(port?: number): Promise<void>;
16
+ close(): Promise<void>;
16
17
  getHealthStatus(): HealthStatus;
17
18
  }
18
19
  export interface ServerlessServerInstance {
@@ -2,7 +2,7 @@ import type { AppInfo, WorkplaceInfo, RequestInfo } from './shared';
2
2
  import type { InvocationContext } from './invocation';
3
3
  import type { ContextLogger } from '../server/logger';
4
4
  /** Trigger types for tool execution */
5
- export type ToolTrigger = 'provision' | 'field_change' | 'page_action' | 'form_submit' | 'agent' | 'workflow' | 'page_context';
5
+ export type ToolTrigger = 'provision' | 'field_change' | 'page_action' | 'form_submit' | 'agent' | 'workflow' | 'page_context' | 'cron' | 'developer_page_action' | 'developer_form_submit';
6
6
  /** Base context shared by all tool executions */
7
7
  interface BaseToolContext {
8
8
  /** Environment variables */
@@ -20,6 +20,14 @@ interface BaseToolContext {
20
20
  export interface ProvisionToolContext extends BaseToolContext {
21
21
  trigger: 'provision';
22
22
  }
23
+ /** Developer page action context - no installation, uses sk_prv_ token */
24
+ export interface DeveloperPageActionToolContext extends BaseToolContext {
25
+ trigger: 'developer_page_action';
26
+ }
27
+ /** Developer form submit context - no installation, uses sk_prv_ token */
28
+ export interface DeveloperFormSubmitToolContext extends BaseToolContext {
29
+ trigger: 'developer_form_submit';
30
+ }
23
31
  /** Runtime base - has installation, workplace, request */
24
32
  interface RuntimeToolContext extends BaseToolContext {
25
33
  appInstallationId: string;
@@ -61,10 +69,29 @@ export interface AgentToolContext extends RuntimeToolContext {
61
69
  export interface WorkflowToolContext extends RuntimeToolContext {
62
70
  trigger: 'workflow';
63
71
  }
72
+ /** Cron subscription metadata */
73
+ export interface CronContext {
74
+ /** The subscription that triggered this execution */
75
+ subscriptionId: string;
76
+ /** When the cron was scheduled to run */
77
+ scheduledTime: Date;
78
+ /** Cursor from the last run (null on first run) */
79
+ cursor: Record<string, unknown> | null;
80
+ }
81
+ /** Cron-triggered context */
82
+ export interface CronToolContext extends RuntimeToolContext {
83
+ trigger: 'cron';
84
+ /** Cron subscription metadata including cursor */
85
+ cron: CronContext;
86
+ }
64
87
  /** Discriminated union of all tool execution contexts */
65
- export type ToolExecutionContext = ProvisionToolContext | FieldChangeToolContext | PageActionToolContext | FormSubmitToolContext | AgentToolContext | WorkflowToolContext;
88
+ export type ToolExecutionContext = ProvisionToolContext | DeveloperPageActionToolContext | DeveloperFormSubmitToolContext | FieldChangeToolContext | PageActionToolContext | FormSubmitToolContext | AgentToolContext | WorkflowToolContext | CronToolContext;
66
89
  /** Type guard for provision context */
67
90
  export declare function isProvisionContext(ctx: ToolExecutionContext): ctx is ProvisionToolContext;
68
- /** Type guard for runtime context (any non-provision trigger) */
69
- export declare function isRuntimeContext(ctx: ToolExecutionContext): ctx is FieldChangeToolContext | PageActionToolContext | FormSubmitToolContext | AgentToolContext | WorkflowToolContext;
91
+ /** Type guard for runtime context (requires appInstallationId) */
92
+ export declare function isRuntimeContext(ctx: ToolExecutionContext): ctx is FieldChangeToolContext | PageActionToolContext | FormSubmitToolContext | AgentToolContext | WorkflowToolContext | CronToolContext;
93
+ /** Type guard for developer context (no appInstallationId, uses sk_prv_ token) */
94
+ export declare function isDeveloperContext(ctx: ToolExecutionContext): ctx is DeveloperPageActionToolContext | DeveloperFormSubmitToolContext;
95
+ /** Type guard for cron context */
96
+ export declare function isCronContext(ctx: ToolExecutionContext): ctx is CronToolContext;
70
97
  export {};
@@ -30,6 +30,8 @@ export declare function createSuccessResponse<T>(output: T, options?: {
30
30
  pagination?: ToolPagination;
31
31
  billing?: ToolBilling;
32
32
  effect?: ToolEffect;
33
+ /** Cursor state for cron subscriptions - saved and passed to the next run */
34
+ cursor?: Record<string, unknown>;
33
35
  }): ToolSuccess<T>;
34
36
  /**
35
37
  * Create a successful list response with pagination.
@@ -117,6 +117,8 @@ export interface ToolSuccess<T = unknown> {
117
117
  billing?: ToolBilling;
118
118
  effect?: ToolEffect;
119
119
  timing?: ToolTiming;
120
+ /** Cursor state for cron subscriptions - saved and passed to the next run */
121
+ cursor?: Record<string, unknown>;
120
122
  }
121
123
  /**
122
124
  * Failed tool execution result.
@@ -170,13 +172,17 @@ export type ToolResponseMeta = z.infer<typeof ToolResponseMetaSchema>;
170
172
  * @deprecated Use ToolResult<T> instead. This type is kept for backward compatibility.
171
173
  */
172
174
  export interface ToolExecutionResult<Output = unknown> {
175
+ /** Discriminator for new ToolResult shape (true=success, false=failure) */
176
+ success?: boolean;
173
177
  output: Output | null;
174
178
  billing: BillingInfo;
175
- meta: ToolResponseMeta;
179
+ meta?: ToolResponseMeta;
176
180
  effect?: ToolEffect;
177
181
  error?: ToolError | null;
178
182
  /** Rich data blocks for UI rendering (profiles, spreadsheets, datetime cards) */
179
183
  dataBlocks?: import('./data-blocks').DataBlock[];
184
+ /** Cursor state for cron subscriptions - saved and passed to the next run */
185
+ cursor?: Record<string, unknown>;
180
186
  }
181
187
  export interface ToolSchemaWithJson<Schema extends z.ZodTypeAny = z.ZodTypeAny> {
182
188
  zod: Schema;
@@ -189,6 +195,17 @@ export type ToolSchema<Schema extends z.ZodTypeAny = z.ZodTypeAny> = Schema | To
189
195
  * Supports both new ToolResult and legacy ToolExecutionResult return types.
190
196
  */
191
197
  export type ToolHandler<Input, Output> = (input: Input, context: ToolExecutionContext) => Promise<ToolResult<Output> | ToolExecutionResult<Output>> | ToolResult<Output> | ToolExecutionResult<Output>;
198
+ /**
199
+ * Execution scope for tools.
200
+ *
201
+ * - `installation` (default): Tool requires an appInstallationId at invoke time.
202
+ * Standard for most tools - receives sk_wkp_ token scoped to the installation.
203
+ *
204
+ * - `app_version`: Tool runs without appInstallationId (developer/admin tools).
205
+ * Receives sk_prv_ token. Handler discovers appInstallationId from records
206
+ * and uses token.exchange for scoped writes.
207
+ */
208
+ export type ExecutionScope = 'installation' | 'app_version';
192
209
  export interface ToolDefinition<Input = unknown, Output = unknown, InputSchema extends z.ZodTypeAny = z.ZodType<Input>, OutputSchema extends z.ZodTypeAny = z.ZodType<Output>> {
193
210
  name: string;
194
211
  label?: string;
@@ -198,6 +215,13 @@ export interface ToolDefinition<Input = unknown, Output = unknown, InputSchema e
198
215
  outputSchema?: ToolSchema<OutputSchema>;
199
216
  /** Tool execution configuration (timeout, retries, completion hints) */
200
217
  config?: ToolConfig;
218
+ /**
219
+ * Execution scope for this tool.
220
+ * - `installation` (default): Requires appInstallationId, receives sk_wkp_ token.
221
+ * - `app_version`: No appInstallationId required, receives sk_prv_ token.
222
+ * Used for developer/admin tools that discover installations from records.
223
+ */
224
+ executionScope?: ExecutionScope;
201
225
  [key: string]: unknown;
202
226
  }
203
227
  export interface ToolRegistryEntry {
@@ -209,6 +233,8 @@ export interface ToolRegistryEntry {
209
233
  outputSchema?: ToolSchema;
210
234
  /** Tool execution configuration (timeout, retries, completion hints) */
211
235
  config?: ToolConfig;
236
+ /** Execution scope for this tool */
237
+ executionScope?: ExecutionScope;
212
238
  [key: string]: unknown;
213
239
  }
214
240
  export type ToolRegistry = Record<string, ToolRegistryEntry>;
@@ -219,8 +245,14 @@ export interface ToolMetadata {
219
245
  description: string;
220
246
  inputSchema?: Record<string, unknown>;
221
247
  outputSchema?: Record<string, unknown>;
248
+ /** Timeout in milliseconds for this tool (top-level for sync) */
249
+ timeout?: number;
250
+ /** Maximum retry attempts (top-level for sync) */
251
+ retries?: number;
222
252
  /** Tool execution configuration (timeout, retries, completion hints) */
223
253
  config?: ToolConfig;
254
+ /** Execution scope for this tool */
255
+ executionScope?: ExecutionScope;
224
256
  }
225
257
  /**
226
258
  * Response from a tool call.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "1.2.44",
3
+ "version": "1.2.50",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -49,6 +49,12 @@
49
49
  "import": "./dist/skills/types.mjs",
50
50
  "require": "./dist/skills/types.js",
51
51
  "default": "./dist/skills/types.js"
52
+ },
53
+ "./scheduling": {
54
+ "types": "./dist/scheduling/index.d.ts",
55
+ "import": "./dist/scheduling/index.mjs",
56
+ "require": "./dist/scheduling/index.js",
57
+ "default": "./dist/scheduling/index.js"
52
58
  }
53
59
  },
54
60
  "files": [
@@ -58,7 +64,7 @@
58
64
  "build": "rm -rf dist tsconfig.tsbuildinfo && tsc --emitDeclarationOnly && tsup",
59
65
  "db:generate": "echo 'No database generation needed for this package'",
60
66
  "dev": "npx nodemon --watch src --ext js,ts --exec \"pnpm run build\"",
61
- "test": "tsc --project tsconfig.tests.json && node --test dist-tests/tests/server.test.js dist-tests/tests/cli.test.js"
67
+ "test": "tsc --project tsconfig.tests.json && node --test dist-tests/tests/server.test.js dist-tests/tests/cli.test.js dist-tests/tests/agent-schema-v3.test.js"
62
68
  },
63
69
  "keywords": [
64
70
  "mcp",
@@ -76,6 +82,7 @@
76
82
  "dependencies": {
77
83
  "@modelcontextprotocol/sdk": "^1.23.0",
78
84
  "tsx": "^4.19.0",
85
+ "yaml": "^2.3.1",
79
86
  "zod": "^4.0.0"
80
87
  },
81
88
  "devDependencies": {