skedyul 1.2.41 → 1.2.43
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/agents.d.ts +1 -0
- package/dist/cli/commands/chat.d.ts +1 -0
- package/dist/cli/commands/crm.d.ts +1 -0
- package/dist/cli/commands/skills.d.ts +1 -0
- package/dist/cli/index.js +17627 -6229
- package/dist/cli/utils/auth.js +495 -0
- package/dist/cli/utils/mock-context.d.ts +22 -0
- package/dist/cli/utils/sse.d.ts +100 -0
- package/dist/compiler/compiler.d.ts +12 -0
- package/dist/compiler/index.d.ts +2 -0
- package/dist/compiler/types.d.ts +173 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/schema-loader.d.ts +156 -0
- package/dist/config/types/model.d.ts +28 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/resolver.d.ts +51 -0
- package/dist/context/types.d.ts +217 -0
- package/dist/dedicated/server.js +10 -6
- package/dist/esm/index.mjs +9616 -444
- package/dist/events/index.d.ts +1 -0
- package/dist/events/types.d.ts +528 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +9709 -455
- package/dist/memory/index.d.ts +4 -0
- package/dist/memory/service.d.ts +78 -0
- package/dist/memory/types.d.ts +169 -0
- package/dist/schemas/agent-schema-v3.d.ts +437 -0
- package/dist/schemas/agent-schema-v3.js +539 -0
- package/dist/schemas/agent-schema-v3.mjs +497 -0
- package/dist/schemas/agent-schema.d.ts +1504 -0
- package/dist/schemas/agent-schema.js +7896 -0
- package/dist/schemas/agent-schema.mjs +7867 -0
- package/dist/schemas/crm-schema.d.ts +448 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas.d.ts +69 -36
- package/dist/server.js +10 -6
- package/dist/serverless/server.mjs +10 -6
- package/dist/skills/index.d.ts +1 -0
- package/dist/skills/types.d.ts +355 -0
- package/dist/skills/types.js +281 -0
- package/dist/skills/types.mjs +234 -0
- package/dist/triggers/index.d.ts +2 -0
- package/dist/triggers/resolver.d.ts +31 -0
- package/dist/triggers/types.d.ts +313 -0
- package/dist/types/data-blocks.d.ts +105 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/tool-response.d.ts +16 -0
- package/dist/types/tool.d.ts +30 -8
- package/dist/workflows/index.d.ts +1 -0
- package/dist/workflows/types.d.ts +295 -0
- package/package.json +19 -1
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Skill YAML schema versions
|
|
4
|
+
*/
|
|
5
|
+
export declare const SKILL_SCHEMA_VERSION = "https://skedyul.com/schemas/skill/v1";
|
|
6
|
+
export declare const SKILL_SCHEMA_VERSION_V2 = "https://skedyul.com/schemas/skill/v2";
|
|
7
|
+
/**
|
|
8
|
+
* Skill source - where the skill comes from
|
|
9
|
+
*/
|
|
10
|
+
export declare const SkillSourceSchema: z.ZodEnum<{
|
|
11
|
+
BUILTIN: "BUILTIN";
|
|
12
|
+
S3: "S3";
|
|
13
|
+
APP: "APP";
|
|
14
|
+
EXTERNAL: "EXTERNAL";
|
|
15
|
+
}>;
|
|
16
|
+
export type SkillSource = z.infer<typeof SkillSourceSchema>;
|
|
17
|
+
/**
|
|
18
|
+
* Skill tool requirement (v1 - legacy)
|
|
19
|
+
* @deprecated Use SkillToolDefinitionSchema for v2 skills
|
|
20
|
+
*/
|
|
21
|
+
export declare const SkillToolRequirementSchema: z.ZodObject<{
|
|
22
|
+
requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
+
provides: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type SkillToolRequirement = z.infer<typeof SkillToolRequirementSchema>;
|
|
26
|
+
/**
|
|
27
|
+
* Sandbox configuration for skill tools
|
|
28
|
+
*/
|
|
29
|
+
export declare const SkillToolSandboxSchema: z.ZodObject<{
|
|
30
|
+
mock: z.ZodOptional<z.ZodUnknown>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export type SkillToolSandbox = z.infer<typeof SkillToolSandboxSchema>;
|
|
33
|
+
/**
|
|
34
|
+
* Tool constraints configuration for execution limits and categorization.
|
|
35
|
+
* Used to control how tools are executed at runtime.
|
|
36
|
+
*/
|
|
37
|
+
export declare const ToolConstraintsSchema: z.ZodObject<{
|
|
38
|
+
maxCallsPerRun: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
idempotent: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
restricted: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export type ToolConstraints = z.infer<typeof ToolConstraintsSchema>;
|
|
44
|
+
/**
|
|
45
|
+
* Full tool definition owned by a skill (v2)
|
|
46
|
+
* Skills own their tools with full configuration including descriptions,
|
|
47
|
+
* overrides, sandbox mocks, approval settings, and execution constraints.
|
|
48
|
+
*/
|
|
49
|
+
export declare const SkillToolDefinitionSchema: z.ZodObject<{
|
|
50
|
+
tool: z.ZodString;
|
|
51
|
+
description: z.ZodOptional<z.ZodString>;
|
|
52
|
+
overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
53
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
mock: z.ZodOptional<z.ZodUnknown>;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
requiresApproval: z.ZodOptional<z.ZodBoolean>;
|
|
57
|
+
constraints: z.ZodOptional<z.ZodObject<{
|
|
58
|
+
maxCallsPerRun: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
idempotent: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
restricted: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export type SkillToolDefinition = z.infer<typeof SkillToolDefinitionSchema>;
|
|
65
|
+
/**
|
|
66
|
+
* Tools configuration - supports both v1 (requires array) and v2 (full definitions)
|
|
67
|
+
*/
|
|
68
|
+
export declare const SkillToolsSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
69
|
+
requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
+
provides: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
71
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
72
|
+
tool: z.ZodString;
|
|
73
|
+
description: z.ZodOptional<z.ZodString>;
|
|
74
|
+
overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
75
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
76
|
+
mock: z.ZodOptional<z.ZodUnknown>;
|
|
77
|
+
}, z.core.$strip>>;
|
|
78
|
+
requiresApproval: z.ZodOptional<z.ZodBoolean>;
|
|
79
|
+
constraints: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
maxCallsPerRun: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
idempotent: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
restricted: z.ZodOptional<z.ZodBoolean>;
|
|
83
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
84
|
+
}, z.core.$strip>>;
|
|
85
|
+
}, z.core.$strip>>]>;
|
|
86
|
+
/**
|
|
87
|
+
* Skill example - few-shot learning example
|
|
88
|
+
*/
|
|
89
|
+
export declare const SkillExampleSchema: z.ZodObject<{
|
|
90
|
+
context: z.ZodOptional<z.ZodString>;
|
|
91
|
+
input: z.ZodString;
|
|
92
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
93
|
+
output: z.ZodString;
|
|
94
|
+
tool_call: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
export type SkillExample = z.infer<typeof SkillExampleSchema>;
|
|
97
|
+
/**
|
|
98
|
+
* Skill evaluation metric
|
|
99
|
+
*/
|
|
100
|
+
export declare const SkillEvaluationMetricSchema: z.ZodObject<{
|
|
101
|
+
metric: z.ZodString;
|
|
102
|
+
description: z.ZodOptional<z.ZodString>;
|
|
103
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
export type SkillEvaluationMetric = z.infer<typeof SkillEvaluationMetricSchema>;
|
|
106
|
+
/**
|
|
107
|
+
* CRM context configuration - specifies which models and fields to include
|
|
108
|
+
* in the CRM schema when loading this skill.
|
|
109
|
+
*/
|
|
110
|
+
export declare const CRMContextSchema: z.ZodObject<{
|
|
111
|
+
models: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
export type CRMContext = z.infer<typeof CRMContextSchema>;
|
|
114
|
+
/**
|
|
115
|
+
* Full Skill YAML schema (supports both v1 and v2)
|
|
116
|
+
*
|
|
117
|
+
* v1: tools is SkillToolRequirementSchema ({ requires: [...] })
|
|
118
|
+
* v2: tools is array of SkillToolDefinitionSchema (full tool ownership)
|
|
119
|
+
*/
|
|
120
|
+
export declare const SkillYAMLSchema: z.ZodObject<{
|
|
121
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
122
|
+
handle: z.ZodString;
|
|
123
|
+
name: z.ZodString;
|
|
124
|
+
version: z.ZodOptional<z.ZodString>;
|
|
125
|
+
description: z.ZodOptional<z.ZodString>;
|
|
126
|
+
instructions: z.ZodString;
|
|
127
|
+
tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
128
|
+
requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
129
|
+
provides: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
130
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
131
|
+
tool: z.ZodString;
|
|
132
|
+
description: z.ZodOptional<z.ZodString>;
|
|
133
|
+
overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
134
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
135
|
+
mock: z.ZodOptional<z.ZodUnknown>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
requiresApproval: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
+
constraints: z.ZodOptional<z.ZodObject<{
|
|
139
|
+
maxCallsPerRun: z.ZodOptional<z.ZodNumber>;
|
|
140
|
+
idempotent: z.ZodOptional<z.ZodBoolean>;
|
|
141
|
+
restricted: z.ZodOptional<z.ZodBoolean>;
|
|
142
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
143
|
+
}, z.core.$strip>>;
|
|
144
|
+
}, z.core.$strip>>]>>;
|
|
145
|
+
crmContext: z.ZodOptional<z.ZodObject<{
|
|
146
|
+
models: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
147
|
+
}, z.core.$strip>>;
|
|
148
|
+
examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
149
|
+
context: z.ZodOptional<z.ZodString>;
|
|
150
|
+
input: z.ZodString;
|
|
151
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
152
|
+
output: z.ZodString;
|
|
153
|
+
tool_call: z.ZodOptional<z.ZodString>;
|
|
154
|
+
}, 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
|
+
}, z.core.$strip>;
|
|
162
|
+
export type SkillYAML = z.infer<typeof SkillYAMLSchema>;
|
|
163
|
+
/**
|
|
164
|
+
* Skill YAML v2 schema - explicit v2 with tool ownership
|
|
165
|
+
* Use this when you want to enforce v2 format with full tool definitions.
|
|
166
|
+
*/
|
|
167
|
+
export declare const SkillYAMLV2Schema: z.ZodObject<{
|
|
168
|
+
$schema: z.ZodOptional<z.ZodLiteral<"https://skedyul.com/schemas/skill/v2">>;
|
|
169
|
+
handle: z.ZodString;
|
|
170
|
+
name: z.ZodString;
|
|
171
|
+
version: z.ZodOptional<z.ZodString>;
|
|
172
|
+
description: z.ZodOptional<z.ZodString>;
|
|
173
|
+
instructions: z.ZodString;
|
|
174
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
175
|
+
tool: z.ZodString;
|
|
176
|
+
description: z.ZodOptional<z.ZodString>;
|
|
177
|
+
overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
178
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
179
|
+
mock: z.ZodOptional<z.ZodUnknown>;
|
|
180
|
+
}, z.core.$strip>>;
|
|
181
|
+
requiresApproval: z.ZodOptional<z.ZodBoolean>;
|
|
182
|
+
constraints: z.ZodOptional<z.ZodObject<{
|
|
183
|
+
maxCallsPerRun: z.ZodOptional<z.ZodNumber>;
|
|
184
|
+
idempotent: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
+
restricted: z.ZodOptional<z.ZodBoolean>;
|
|
186
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
187
|
+
}, z.core.$strip>>;
|
|
188
|
+
}, z.core.$strip>>>;
|
|
189
|
+
crmContext: z.ZodOptional<z.ZodObject<{
|
|
190
|
+
models: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
191
|
+
}, z.core.$strip>>;
|
|
192
|
+
examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
193
|
+
context: z.ZodOptional<z.ZodString>;
|
|
194
|
+
input: z.ZodString;
|
|
195
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
196
|
+
output: z.ZodString;
|
|
197
|
+
tool_call: z.ZodOptional<z.ZodString>;
|
|
198
|
+
}, 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
|
+
}, z.core.$strip>;
|
|
206
|
+
export type SkillYAMLV2 = z.infer<typeof SkillYAMLV2Schema>;
|
|
207
|
+
/**
|
|
208
|
+
* Version weight for A/B testing
|
|
209
|
+
*/
|
|
210
|
+
export declare const SkillVersionWeightSchema: z.ZodObject<{
|
|
211
|
+
version: z.ZodNumber;
|
|
212
|
+
weight: z.ZodNumber;
|
|
213
|
+
}, z.core.$strip>;
|
|
214
|
+
export type SkillVersionWeight = z.infer<typeof SkillVersionWeightSchema>;
|
|
215
|
+
/**
|
|
216
|
+
* Skill reference in agent YAML - can be a string handle or object with version config
|
|
217
|
+
*/
|
|
218
|
+
export declare const SkillRefSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
219
|
+
skill: z.ZodString;
|
|
220
|
+
description: z.ZodOptional<z.ZodString>;
|
|
221
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
222
|
+
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
223
|
+
version: z.ZodNumber;
|
|
224
|
+
weight: z.ZodNumber;
|
|
225
|
+
}, z.core.$strip>>>;
|
|
226
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
227
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
228
|
+
}, z.core.$strip>]>;
|
|
229
|
+
export type SkillRef = z.infer<typeof SkillRefSchema>;
|
|
230
|
+
/**
|
|
231
|
+
* Skill metadata (for registry)
|
|
232
|
+
*/
|
|
233
|
+
export declare const SkillMetadataSchema: z.ZodObject<{
|
|
234
|
+
id: z.ZodString;
|
|
235
|
+
handle: z.ZodString;
|
|
236
|
+
name: z.ZodString;
|
|
237
|
+
version: z.ZodOptional<z.ZodString>;
|
|
238
|
+
description: z.ZodOptional<z.ZodString>;
|
|
239
|
+
source: z.ZodEnum<{
|
|
240
|
+
BUILTIN: "BUILTIN";
|
|
241
|
+
S3: "S3";
|
|
242
|
+
APP: "APP";
|
|
243
|
+
EXTERNAL: "EXTERNAL";
|
|
244
|
+
}>;
|
|
245
|
+
s3Key: z.ZodOptional<z.ZodString>;
|
|
246
|
+
appVersionId: z.ZodOptional<z.ZodString>;
|
|
247
|
+
workplaceId: z.ZodOptional<z.ZodString>;
|
|
248
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
249
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
250
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
251
|
+
}, z.core.$strip>;
|
|
252
|
+
export type SkillMetadata = z.infer<typeof SkillMetadataSchema>;
|
|
253
|
+
/**
|
|
254
|
+
* Resolved skill - loaded and ready for injection.
|
|
255
|
+
* Tools are represented as string names for backward compatibility with IR.
|
|
256
|
+
* Use LoadedSkill for runtime skill loading with full tool definitions.
|
|
257
|
+
*/
|
|
258
|
+
export declare const ResolvedSkillSchema: z.ZodObject<{
|
|
259
|
+
handle: z.ZodString;
|
|
260
|
+
name: z.ZodString;
|
|
261
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
262
|
+
description: z.ZodOptional<z.ZodString>;
|
|
263
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
264
|
+
examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
265
|
+
context: z.ZodOptional<z.ZodString>;
|
|
266
|
+
input: z.ZodString;
|
|
267
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
268
|
+
output: z.ZodString;
|
|
269
|
+
tool_call: z.ZodOptional<z.ZodString>;
|
|
270
|
+
}, z.core.$strip>>>;
|
|
271
|
+
}, z.core.$strip>;
|
|
272
|
+
export type ResolvedSkill = z.infer<typeof ResolvedSkillSchema>;
|
|
273
|
+
/**
|
|
274
|
+
* Loaded skill - skill loaded at runtime with full tool definitions.
|
|
275
|
+
* Used by SkillToolRegistry for dynamic tool registration.
|
|
276
|
+
*/
|
|
277
|
+
export declare const LoadedSkillSchema: z.ZodObject<{
|
|
278
|
+
handle: z.ZodString;
|
|
279
|
+
name: z.ZodString;
|
|
280
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
281
|
+
description: z.ZodOptional<z.ZodString>;
|
|
282
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
283
|
+
tool: z.ZodString;
|
|
284
|
+
description: z.ZodOptional<z.ZodString>;
|
|
285
|
+
overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
286
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
287
|
+
mock: z.ZodOptional<z.ZodUnknown>;
|
|
288
|
+
}, z.core.$strip>>;
|
|
289
|
+
requiresApproval: z.ZodOptional<z.ZodBoolean>;
|
|
290
|
+
constraints: z.ZodOptional<z.ZodObject<{
|
|
291
|
+
maxCallsPerRun: z.ZodOptional<z.ZodNumber>;
|
|
292
|
+
idempotent: z.ZodOptional<z.ZodBoolean>;
|
|
293
|
+
restricted: z.ZodOptional<z.ZodBoolean>;
|
|
294
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
295
|
+
}, z.core.$strip>>;
|
|
296
|
+
}, z.core.$strip>>>;
|
|
297
|
+
examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
298
|
+
context: z.ZodOptional<z.ZodString>;
|
|
299
|
+
input: z.ZodString;
|
|
300
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
301
|
+
output: z.ZodString;
|
|
302
|
+
tool_call: z.ZodOptional<z.ZodString>;
|
|
303
|
+
}, z.core.$strip>>>;
|
|
304
|
+
}, z.core.$strip>;
|
|
305
|
+
export type LoadedSkill = z.infer<typeof LoadedSkillSchema>;
|
|
306
|
+
/**
|
|
307
|
+
* Helper to check if skill tools are v2 format (array of tool definitions)
|
|
308
|
+
*/
|
|
309
|
+
export declare function isV2SkillTools(tools: SkillToolRequirement | SkillToolDefinition[] | undefined): tools is SkillToolDefinition[];
|
|
310
|
+
/**
|
|
311
|
+
* Helper to extract tool names from either v1 or v2 format
|
|
312
|
+
*/
|
|
313
|
+
export declare function getSkillToolNames(tools: SkillToolRequirement | SkillToolDefinition[] | undefined): string[];
|
|
314
|
+
/**
|
|
315
|
+
* Helper to convert v1 tool requirements to v2 tool definitions
|
|
316
|
+
* Used during migration or when loading legacy skills
|
|
317
|
+
*/
|
|
318
|
+
export declare function convertV1ToV2Tools(requires: string[]): SkillToolDefinition[];
|
|
319
|
+
/**
|
|
320
|
+
* Skill discovery metadata - minimal info for system prompt
|
|
321
|
+
* Following AI SDK Agent Skills pattern: only name + description at startup
|
|
322
|
+
*/
|
|
323
|
+
export interface SkillDiscoveryInfo {
|
|
324
|
+
handle: string;
|
|
325
|
+
name: string;
|
|
326
|
+
description: string;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Helper function to define a skill with type safety
|
|
330
|
+
*/
|
|
331
|
+
export declare function defineSkill(skill: SkillYAML): SkillYAML;
|
|
332
|
+
/**
|
|
333
|
+
* Validate a skill YAML object
|
|
334
|
+
*/
|
|
335
|
+
export declare function validateSkillYAML(skill: unknown): {
|
|
336
|
+
success: true;
|
|
337
|
+
data: SkillYAML;
|
|
338
|
+
} | {
|
|
339
|
+
success: false;
|
|
340
|
+
error: z.ZodError;
|
|
341
|
+
};
|
|
342
|
+
/**
|
|
343
|
+
* Format skill instructions for injection into system prompt
|
|
344
|
+
* @deprecated Use formatSkillDiscovery for AI SDK Agent Skills pattern
|
|
345
|
+
*/
|
|
346
|
+
export declare function formatSkillInstructions(skills: ResolvedSkill[]): string;
|
|
347
|
+
/**
|
|
348
|
+
* Format skill discovery list for system prompt.
|
|
349
|
+
* Following AI SDK Agent Skills pattern: only name + description at startup.
|
|
350
|
+
* Full instructions are loaded on-demand via the loadSkill tool.
|
|
351
|
+
*
|
|
352
|
+
* @param skills - Array of skill discovery info objects
|
|
353
|
+
* @param workflowInstructions - Optional custom workflow instructions for the agent
|
|
354
|
+
*/
|
|
355
|
+
export declare function formatSkillDiscovery(skills: SkillDiscoveryInfo[], workflowInstructions?: string): string;
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/skills/types.ts
|
|
21
|
+
var types_exports = {};
|
|
22
|
+
__export(types_exports, {
|
|
23
|
+
CRMContextSchema: () => CRMContextSchema,
|
|
24
|
+
LoadedSkillSchema: () => LoadedSkillSchema,
|
|
25
|
+
ResolvedSkillSchema: () => ResolvedSkillSchema,
|
|
26
|
+
SKILL_SCHEMA_VERSION: () => SKILL_SCHEMA_VERSION,
|
|
27
|
+
SKILL_SCHEMA_VERSION_V2: () => SKILL_SCHEMA_VERSION_V2,
|
|
28
|
+
SkillEvaluationMetricSchema: () => SkillEvaluationMetricSchema,
|
|
29
|
+
SkillExampleSchema: () => SkillExampleSchema,
|
|
30
|
+
SkillMetadataSchema: () => SkillMetadataSchema,
|
|
31
|
+
SkillRefSchema: () => SkillRefSchema,
|
|
32
|
+
SkillSourceSchema: () => SkillSourceSchema,
|
|
33
|
+
SkillToolDefinitionSchema: () => SkillToolDefinitionSchema,
|
|
34
|
+
SkillToolRequirementSchema: () => SkillToolRequirementSchema,
|
|
35
|
+
SkillToolSandboxSchema: () => SkillToolSandboxSchema,
|
|
36
|
+
SkillToolsSchema: () => SkillToolsSchema,
|
|
37
|
+
SkillVersionWeightSchema: () => SkillVersionWeightSchema,
|
|
38
|
+
SkillYAMLSchema: () => SkillYAMLSchema,
|
|
39
|
+
SkillYAMLV2Schema: () => SkillYAMLV2Schema,
|
|
40
|
+
ToolConstraintsSchema: () => ToolConstraintsSchema,
|
|
41
|
+
convertV1ToV2Tools: () => convertV1ToV2Tools,
|
|
42
|
+
defineSkill: () => defineSkill,
|
|
43
|
+
formatSkillDiscovery: () => formatSkillDiscovery,
|
|
44
|
+
formatSkillInstructions: () => formatSkillInstructions,
|
|
45
|
+
getSkillToolNames: () => getSkillToolNames,
|
|
46
|
+
isV2SkillTools: () => isV2SkillTools,
|
|
47
|
+
validateSkillYAML: () => validateSkillYAML
|
|
48
|
+
});
|
|
49
|
+
module.exports = __toCommonJS(types_exports);
|
|
50
|
+
var import_v4 = require("zod/v4");
|
|
51
|
+
var SKILL_SCHEMA_VERSION = "https://skedyul.com/schemas/skill/v1";
|
|
52
|
+
var SKILL_SCHEMA_VERSION_V2 = "https://skedyul.com/schemas/skill/v2";
|
|
53
|
+
var SkillSourceSchema = import_v4.z.enum(["BUILTIN", "S3", "APP", "EXTERNAL"]);
|
|
54
|
+
var SkillToolRequirementSchema = import_v4.z.object({
|
|
55
|
+
requires: import_v4.z.array(import_v4.z.string()).optional(),
|
|
56
|
+
provides: import_v4.z.array(import_v4.z.string()).optional()
|
|
57
|
+
});
|
|
58
|
+
var SkillToolSandboxSchema = import_v4.z.object({
|
|
59
|
+
mock: import_v4.z.unknown().optional()
|
|
60
|
+
});
|
|
61
|
+
var ToolConstraintsSchema = import_v4.z.object({
|
|
62
|
+
maxCallsPerRun: import_v4.z.number().optional(),
|
|
63
|
+
idempotent: import_v4.z.boolean().optional(),
|
|
64
|
+
restricted: import_v4.z.boolean().optional(),
|
|
65
|
+
tags: import_v4.z.array(import_v4.z.string()).optional()
|
|
66
|
+
});
|
|
67
|
+
var SkillToolDefinitionSchema = import_v4.z.object({
|
|
68
|
+
tool: import_v4.z.string(),
|
|
69
|
+
description: import_v4.z.string().optional(),
|
|
70
|
+
overrides: import_v4.z.record(import_v4.z.string(), import_v4.z.unknown()).optional(),
|
|
71
|
+
sandbox: SkillToolSandboxSchema.optional(),
|
|
72
|
+
requiresApproval: import_v4.z.boolean().optional(),
|
|
73
|
+
constraints: ToolConstraintsSchema.optional()
|
|
74
|
+
});
|
|
75
|
+
var SkillToolsSchema = import_v4.z.union([
|
|
76
|
+
SkillToolRequirementSchema,
|
|
77
|
+
import_v4.z.array(SkillToolDefinitionSchema)
|
|
78
|
+
]);
|
|
79
|
+
var SkillExampleSchema = import_v4.z.object({
|
|
80
|
+
context: import_v4.z.string().optional(),
|
|
81
|
+
input: import_v4.z.string(),
|
|
82
|
+
reasoning: import_v4.z.string().optional(),
|
|
83
|
+
output: import_v4.z.string(),
|
|
84
|
+
tool_call: import_v4.z.string().optional()
|
|
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()
|
|
90
|
+
});
|
|
91
|
+
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] }
|
|
94
|
+
});
|
|
95
|
+
var SkillYAMLSchema = import_v4.z.object({
|
|
96
|
+
// Schema version
|
|
97
|
+
$schema: import_v4.z.string().optional(),
|
|
98
|
+
// Identity
|
|
99
|
+
handle: import_v4.z.string(),
|
|
100
|
+
name: import_v4.z.string(),
|
|
101
|
+
version: import_v4.z.string().optional(),
|
|
102
|
+
description: import_v4.z.string().optional(),
|
|
103
|
+
// Instructions injected into agent system prompt
|
|
104
|
+
instructions: import_v4.z.string(),
|
|
105
|
+
// Tool configuration - supports both v1 and v2 formats
|
|
106
|
+
tools: SkillToolsSchema.optional(),
|
|
107
|
+
// CRM context - specifies which models/fields to include in schema
|
|
108
|
+
crmContext: CRMContextSchema.optional(),
|
|
109
|
+
// 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()
|
|
115
|
+
});
|
|
116
|
+
var SkillYAMLV2Schema = import_v4.z.object({
|
|
117
|
+
$schema: import_v4.z.literal(SKILL_SCHEMA_VERSION_V2).optional(),
|
|
118
|
+
handle: import_v4.z.string(),
|
|
119
|
+
name: import_v4.z.string(),
|
|
120
|
+
version: import_v4.z.string().optional(),
|
|
121
|
+
description: import_v4.z.string().optional(),
|
|
122
|
+
instructions: import_v4.z.string(),
|
|
123
|
+
tools: import_v4.z.array(SkillToolDefinitionSchema).optional(),
|
|
124
|
+
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()
|
|
128
|
+
});
|
|
129
|
+
var SkillVersionWeightSchema = import_v4.z.object({
|
|
130
|
+
version: import_v4.z.number(),
|
|
131
|
+
weight: import_v4.z.number()
|
|
132
|
+
});
|
|
133
|
+
var SkillRefSchema = import_v4.z.union([
|
|
134
|
+
import_v4.z.string(),
|
|
135
|
+
// Just handle - uses latest published version
|
|
136
|
+
import_v4.z.object({
|
|
137
|
+
skill: import_v4.z.string(),
|
|
138
|
+
description: import_v4.z.string().optional(),
|
|
139
|
+
// For AI SDK Agent Skills discovery
|
|
140
|
+
// Version selection (pick one):
|
|
141
|
+
version: import_v4.z.number().optional(),
|
|
142
|
+
// Pin to specific version number
|
|
143
|
+
versions: import_v4.z.array(SkillVersionWeightSchema).optional(),
|
|
144
|
+
// A/B testing weights
|
|
145
|
+
// Legacy support:
|
|
146
|
+
instructions: import_v4.z.string().optional(),
|
|
147
|
+
// Inline instructions (deprecated)
|
|
148
|
+
enabled: import_v4.z.boolean().optional()
|
|
149
|
+
})
|
|
150
|
+
]);
|
|
151
|
+
var SkillMetadataSchema = import_v4.z.object({
|
|
152
|
+
id: import_v4.z.string(),
|
|
153
|
+
handle: import_v4.z.string(),
|
|
154
|
+
name: import_v4.z.string(),
|
|
155
|
+
version: import_v4.z.string().optional(),
|
|
156
|
+
description: import_v4.z.string().optional(),
|
|
157
|
+
source: SkillSourceSchema,
|
|
158
|
+
s3Key: import_v4.z.string().optional(),
|
|
159
|
+
appVersionId: import_v4.z.string().optional(),
|
|
160
|
+
workplaceId: import_v4.z.string().optional(),
|
|
161
|
+
tags: import_v4.z.array(import_v4.z.string()).optional(),
|
|
162
|
+
createdAt: import_v4.z.string().datetime().optional(),
|
|
163
|
+
updatedAt: import_v4.z.string().datetime().optional()
|
|
164
|
+
});
|
|
165
|
+
var ResolvedSkillSchema = import_v4.z.object({
|
|
166
|
+
handle: import_v4.z.string(),
|
|
167
|
+
name: import_v4.z.string(),
|
|
168
|
+
instructions: import_v4.z.string().optional(),
|
|
169
|
+
description: import_v4.z.string().optional(),
|
|
170
|
+
tools: import_v4.z.array(import_v4.z.string()).optional(),
|
|
171
|
+
examples: import_v4.z.array(SkillExampleSchema).optional()
|
|
172
|
+
});
|
|
173
|
+
var LoadedSkillSchema = import_v4.z.object({
|
|
174
|
+
handle: import_v4.z.string(),
|
|
175
|
+
name: import_v4.z.string(),
|
|
176
|
+
instructions: import_v4.z.string().optional(),
|
|
177
|
+
description: import_v4.z.string().optional(),
|
|
178
|
+
tools: import_v4.z.array(SkillToolDefinitionSchema).optional(),
|
|
179
|
+
examples: import_v4.z.array(SkillExampleSchema).optional()
|
|
180
|
+
});
|
|
181
|
+
function isV2SkillTools(tools) {
|
|
182
|
+
if (!tools) return false;
|
|
183
|
+
return Array.isArray(tools);
|
|
184
|
+
}
|
|
185
|
+
function getSkillToolNames(tools) {
|
|
186
|
+
if (!tools) return [];
|
|
187
|
+
if (isV2SkillTools(tools)) {
|
|
188
|
+
return tools.map((t) => t.tool);
|
|
189
|
+
}
|
|
190
|
+
return tools.requires || [];
|
|
191
|
+
}
|
|
192
|
+
function convertV1ToV2Tools(requires) {
|
|
193
|
+
return requires.map((tool) => ({ tool }));
|
|
194
|
+
}
|
|
195
|
+
function defineSkill(skill) {
|
|
196
|
+
return SkillYAMLSchema.parse(skill);
|
|
197
|
+
}
|
|
198
|
+
function validateSkillYAML(skill) {
|
|
199
|
+
const result = SkillYAMLSchema.safeParse(skill);
|
|
200
|
+
if (result.success) {
|
|
201
|
+
return { success: true, data: result.data };
|
|
202
|
+
}
|
|
203
|
+
return { success: false, error: result.error };
|
|
204
|
+
}
|
|
205
|
+
function formatSkillInstructions(skills) {
|
|
206
|
+
if (skills.length === 0) return "";
|
|
207
|
+
const sections = skills.map((skill) => {
|
|
208
|
+
if (!skill.instructions) {
|
|
209
|
+
return `## ${skill.name}
|
|
210
|
+
|
|
211
|
+
${skill.description || "No description available."}`;
|
|
212
|
+
}
|
|
213
|
+
let section = `## ${skill.name}
|
|
214
|
+
|
|
215
|
+
${skill.instructions}`;
|
|
216
|
+
if (skill.examples && skill.examples.length > 0) {
|
|
217
|
+
section += "\n\n### Examples\n";
|
|
218
|
+
for (const example of skill.examples) {
|
|
219
|
+
section += `
|
|
220
|
+
**Input:** ${example.input}
|
|
221
|
+
`;
|
|
222
|
+
if (example.reasoning) {
|
|
223
|
+
section += `**Reasoning:** ${example.reasoning}
|
|
224
|
+
`;
|
|
225
|
+
}
|
|
226
|
+
section += `**Output:** ${example.output}
|
|
227
|
+
`;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return section;
|
|
231
|
+
});
|
|
232
|
+
return `# Skills
|
|
233
|
+
|
|
234
|
+
${sections.join("\n\n---\n\n")}`;
|
|
235
|
+
}
|
|
236
|
+
function formatSkillDiscovery(skills, workflowInstructions) {
|
|
237
|
+
if (skills.length === 0) return "";
|
|
238
|
+
const skillsList = skills.map((s) => `- **${s.name}**: ${s.description}`).join("\n");
|
|
239
|
+
const defaultWorkflow = `WORKFLOW FOR EVERY RESPONSE:
|
|
240
|
+
1. Check the Current Context data to understand the current state
|
|
241
|
+
2. Read the skill descriptions below - each tells you WHEN to use it
|
|
242
|
+
3. Load the matching skill using \`system:skill:load\`
|
|
243
|
+
4. Follow the skill's instructions exactly`;
|
|
244
|
+
const workflow = workflowInstructions ?? defaultWorkflow;
|
|
245
|
+
return `## Skills
|
|
246
|
+
|
|
247
|
+
${workflow}
|
|
248
|
+
|
|
249
|
+
Available skills:
|
|
250
|
+
${skillsList}
|
|
251
|
+
|
|
252
|
+
IMPORTANT: Always use the proper tool calls. Do NOT output XML-like tags in your response.`;
|
|
253
|
+
}
|
|
254
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
255
|
+
0 && (module.exports = {
|
|
256
|
+
CRMContextSchema,
|
|
257
|
+
LoadedSkillSchema,
|
|
258
|
+
ResolvedSkillSchema,
|
|
259
|
+
SKILL_SCHEMA_VERSION,
|
|
260
|
+
SKILL_SCHEMA_VERSION_V2,
|
|
261
|
+
SkillEvaluationMetricSchema,
|
|
262
|
+
SkillExampleSchema,
|
|
263
|
+
SkillMetadataSchema,
|
|
264
|
+
SkillRefSchema,
|
|
265
|
+
SkillSourceSchema,
|
|
266
|
+
SkillToolDefinitionSchema,
|
|
267
|
+
SkillToolRequirementSchema,
|
|
268
|
+
SkillToolSandboxSchema,
|
|
269
|
+
SkillToolsSchema,
|
|
270
|
+
SkillVersionWeightSchema,
|
|
271
|
+
SkillYAMLSchema,
|
|
272
|
+
SkillYAMLV2Schema,
|
|
273
|
+
ToolConstraintsSchema,
|
|
274
|
+
convertV1ToV2Tools,
|
|
275
|
+
defineSkill,
|
|
276
|
+
formatSkillDiscovery,
|
|
277
|
+
formatSkillInstructions,
|
|
278
|
+
getSkillToolNames,
|
|
279
|
+
isV2SkillTools,
|
|
280
|
+
validateSkillYAML
|
|
281
|
+
});
|