skedyul 1.2.44 → 1.2.48
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/commands/workflows.d.ts +1 -0
- package/dist/cli/index.js +3670 -9073
- package/dist/cli/utils/auth.d.ts +4 -1
- package/dist/cli/utils/auth.js +32 -8
- package/dist/cli/utils/config.d.ts +23 -0
- package/dist/cli/utils/env-sync.d.ts +46 -0
- package/dist/cli/utils/mcp-http-client.d.ts +74 -0
- package/dist/cli/utils/migration-approval.d.ts +39 -0
- package/dist/cli/utils/mock-context.d.ts +19 -9
- package/dist/cli/utils/sse.d.ts +33 -0
- package/dist/cli/utils.d.ts +5 -1
- package/dist/compiler/types.d.ts +11 -9
- package/dist/config/schema-loader.d.ts +15 -2
- package/dist/config/types/model.d.ts +2 -0
- package/dist/config/types/page.d.ts +9 -0
- package/dist/context/index.d.ts +2 -2
- package/dist/context/resolver.d.ts +29 -28
- package/dist/context/types.d.ts +195 -37
- package/dist/core/client.d.ts +189 -233
- package/dist/dedicated/server.js +252 -163
- package/dist/esm/index.mjs +1149 -7671
- package/dist/index.d.ts +11 -6
- package/dist/index.js +1194 -7669
- package/dist/scheduling/calculateWaitTime.d.ts +16 -0
- package/dist/scheduling/index.d.ts +11 -0
- package/dist/scheduling/index.js +334 -0
- package/dist/scheduling/index.mjs +305 -0
- package/dist/scheduling/isTimeInWindow.d.ts +15 -0
- package/dist/scheduling/types-workflow.d.ts +54 -0
- package/dist/scheduling/types.d.ts +166 -0
- package/dist/schemas/agent-schema-v3.d.ts +406 -60
- package/dist/schemas/agent-schema-v3.js +248 -75
- package/dist/schemas/agent-schema-v3.mjs +234 -73
- package/dist/schemas/agent-schema.js +3 -7295
- package/dist/schemas/agent-schema.mjs +3 -7323
- package/dist/schemas/crm-schema.d.ts +53 -19
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas.d.ts +128 -40
- package/dist/server/route-handlers/handlers.d.ts +7 -0
- package/dist/server/utils/env.d.ts +9 -0
- package/dist/server/utils/index.d.ts +1 -0
- package/dist/server/utils/mcp-response.d.ts +11 -0
- package/dist/server.js +252 -163
- package/dist/serverless/server.mjs +252 -163
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/types.d.ts +34 -23
- package/dist/skills/types.js +8 -17
- package/dist/skills/types.mjs +7 -16
- package/dist/types/index.d.ts +3 -3
- package/dist/types/server.d.ts +1 -0
- package/dist/types/tool-context.d.ts +31 -4
- package/dist/types/tool-response.d.ts +2 -0
- package/dist/types/tool.d.ts +33 -1
- package/package.json +8 -1
package/dist/skills/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { SKILL_SCHEMA_VERSION, SkillSourceSchema, SkillToolRequirementSchema, SkillExampleSchema,
|
|
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';
|
package/dist/skills/types.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
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
|
|
101
|
-
|
|
102
|
-
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
/**
|
|
@@ -245,7 +257,6 @@ export declare const SkillMetadataSchema: z.ZodObject<{
|
|
|
245
257
|
s3Key: z.ZodOptional<z.ZodString>;
|
|
246
258
|
appVersionId: z.ZodOptional<z.ZodString>;
|
|
247
259
|
workplaceId: z.ZodOptional<z.ZodString>;
|
|
248
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
249
260
|
createdAt: z.ZodOptional<z.ZodString>;
|
|
250
261
|
updatedAt: z.ZodOptional<z.ZodString>;
|
|
251
262
|
}, z.core.$strip>;
|
package/dist/skills/types.js
CHANGED
|
@@ -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
|
|
87
|
-
|
|
88
|
-
|
|
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(),
|
|
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(),
|
|
@@ -158,7 +150,6 @@ var SkillMetadataSchema = import_v4.z.object({
|
|
|
158
150
|
s3Key: import_v4.z.string().optional(),
|
|
159
151
|
appVersionId: import_v4.z.string().optional(),
|
|
160
152
|
workplaceId: import_v4.z.string().optional(),
|
|
161
|
-
tags: import_v4.z.array(import_v4.z.string()).optional(),
|
|
162
153
|
createdAt: import_v4.z.string().datetime().optional(),
|
|
163
154
|
updatedAt: import_v4.z.string().datetime().optional()
|
|
164
155
|
});
|
|
@@ -254,11 +245,11 @@ IMPORTANT: Always use the proper tool calls. Do NOT output XML-like tags in your
|
|
|
254
245
|
// Annotate the CommonJS export names for ESM import in node:
|
|
255
246
|
0 && (module.exports = {
|
|
256
247
|
CRMContextSchema,
|
|
248
|
+
CRMModelFieldRequirementsSchema,
|
|
257
249
|
LoadedSkillSchema,
|
|
258
250
|
ResolvedSkillSchema,
|
|
259
251
|
SKILL_SCHEMA_VERSION,
|
|
260
252
|
SKILL_SCHEMA_VERSION_V2,
|
|
261
|
-
SkillEvaluationMetricSchema,
|
|
262
253
|
SkillExampleSchema,
|
|
263
254
|
SkillMetadataSchema,
|
|
264
255
|
SkillRefSchema,
|
package/dist/skills/types.mjs
CHANGED
|
@@ -37,14 +37,12 @@ var SkillExampleSchema = z.object({
|
|
|
37
37
|
output: z.string(),
|
|
38
38
|
tool_call: z.string().optional()
|
|
39
39
|
});
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
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(),
|
|
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(),
|
|
@@ -112,7 +104,6 @@ var SkillMetadataSchema = z.object({
|
|
|
112
104
|
s3Key: z.string().optional(),
|
|
113
105
|
appVersionId: z.string().optional(),
|
|
114
106
|
workplaceId: z.string().optional(),
|
|
115
|
-
tags: z.array(z.string()).optional(),
|
|
116
107
|
createdAt: z.string().datetime().optional(),
|
|
117
108
|
updatedAt: z.string().datetime().optional()
|
|
118
109
|
});
|
|
@@ -207,11 +198,11 @@ IMPORTANT: Always use the proper tool calls. Do NOT output XML-like tags in your
|
|
|
207
198
|
}
|
|
208
199
|
export {
|
|
209
200
|
CRMContextSchema,
|
|
201
|
+
CRMModelFieldRequirementsSchema,
|
|
210
202
|
LoadedSkillSchema,
|
|
211
203
|
ResolvedSkillSchema,
|
|
212
204
|
SKILL_SCHEMA_VERSION,
|
|
213
205
|
SKILL_SCHEMA_VERSION_V2,
|
|
214
|
-
SkillEvaluationMetricSchema,
|
|
215
206
|
SkillExampleSchema,
|
|
216
207
|
SkillMetadataSchema,
|
|
217
208
|
SkillRefSchema,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/types/server.d.ts
CHANGED
|
@@ -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 (
|
|
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.
|
package/dist/types/tool.d.ts
CHANGED
|
@@ -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
|
|
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.
|
|
3
|
+
"version": "1.2.48",
|
|
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": [
|
|
@@ -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": {
|