skedyul 1.7.28 → 1.7.30
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/README.md +1 -0
- package/dist/.build-stamp +1 -1
- package/dist/cli/api/apps.d.ts +38 -0
- package/dist/cli/api/index.d.ts +5 -2
- package/dist/cli/api/index.js +64 -1
- package/dist/cli/api/playground.d.ts +92 -0
- package/dist/cli/commands/apps.d.ts +1 -0
- package/dist/cli/index.js +398 -2
- package/dist/config/types/entity.d.ts +41 -0
- package/dist/esm/index.mjs +475 -339
- package/dist/index.d.ts +2 -2
- package/dist/index.js +487 -339
- package/dist/schemas/agent-schema-v3.d.ts +3 -0
- package/dist/schemas/agent-schema-v3.js +56 -1
- package/dist/schemas/agent-schema-v3.mjs +56 -1
- package/dist/schemas/agent-schema.d.ts +248 -1
- package/dist/schemas/agent-schema.js +36 -1
- package/dist/schemas/agent-schema.mjs +36 -1
- package/dist/schemas/crm-schema.d.ts +16 -16
- package/dist/schemas.d.ts +282 -20
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/types.d.ts +176 -0
- package/dist/skills/types.js +57 -1
- package/dist/skills/types.mjs +53 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -63,6 +63,12 @@ __export(index_exports, {
|
|
|
63
63
|
CRMRelationshipLinkSchema: () => CRMRelationshipLinkSchema,
|
|
64
64
|
CRMRelationshipSchemaZ: () => CRMRelationshipSchemaZ,
|
|
65
65
|
CRMSchemaZ: () => CRMSchemaZ,
|
|
66
|
+
CalendarWindowPullCalendarsSchema: () => CalendarWindowPullCalendarsSchema,
|
|
67
|
+
CalendarWindowPullEntitySchema: () => CalendarWindowPullEntitySchema,
|
|
68
|
+
CalendarWindowPullInputSchema: () => CalendarWindowPullInputSchema,
|
|
69
|
+
CalendarWindowPullModelSchema: () => CalendarWindowPullModelSchema,
|
|
70
|
+
CalendarWindowPullOutputSchema: () => CalendarWindowPullOutputSchema,
|
|
71
|
+
CalendarWindowPullWindowSchema: () => CalendarWindowPullWindowSchema,
|
|
66
72
|
CardBlockDefinitionSchema: () => CardBlockDefinitionSchema,
|
|
67
73
|
CardBlockHeaderSchema: () => CardBlockHeaderSchema,
|
|
68
74
|
ChannelBatchCapabilitySchema: () => ChannelBatchCapabilitySchema,
|
|
@@ -93,7 +99,11 @@ __export(index_exports, {
|
|
|
93
99
|
EntityCrmMapDefaultsSchema: () => EntityCrmMapDefaultsSchema,
|
|
94
100
|
EntityDefinitionSchema: () => EntityDefinitionSchema,
|
|
95
101
|
EntityFieldDefinitionSchema: () => EntityFieldDefinitionSchema,
|
|
102
|
+
EntityOperationSchema: () => EntityOperationSchema,
|
|
103
|
+
EntityPoliciesSchema: () => EntityPoliciesSchema,
|
|
96
104
|
EntityRelationshipDefinitionSchema: () => EntityRelationshipDefinitionSchema,
|
|
105
|
+
EntityRuntimeToolsSchema: () => EntityRuntimeToolsSchema,
|
|
106
|
+
EntitySaveInteractionSchema: () => EntitySaveInteractionSchema,
|
|
97
107
|
EnvSchemaSchema: () => EnvSchemaSchema,
|
|
98
108
|
EnvVariableDefinitionSchema: () => EnvVariableDefinitionSchema,
|
|
99
109
|
EnvVisibilitySchema: () => EnvVisibilitySchema,
|
|
@@ -192,6 +202,7 @@ __export(index_exports, {
|
|
|
192
202
|
ParticipantEventPayloadSchema: () => ParticipantEventPayloadSchema,
|
|
193
203
|
ParticipantKindSchema: () => ParticipantKindSchema,
|
|
194
204
|
ProvisionConfigSchema: () => ProvisionConfigSchema,
|
|
205
|
+
ProvisionSkillDefinitionSchema: () => ProvisionSkillDefinitionSchema,
|
|
195
206
|
QueueContextError: () => QueueContextError,
|
|
196
207
|
QueueNotFoundError: () => QueueNotFoundError,
|
|
197
208
|
QueuedFetchExhaustedError: () => QueuedFetchExhaustedError,
|
|
@@ -218,6 +229,7 @@ __export(index_exports, {
|
|
|
218
229
|
SetupStepDefinitionSchema: () => SetupStepDefinitionSchema,
|
|
219
230
|
SetupStepKindSchema: () => SetupStepKindSchema,
|
|
220
231
|
SkedyulConfigSchema: () => SkedyulConfigSchema,
|
|
232
|
+
SkillEvaluatorSchema: () => SkillEvaluatorSchema,
|
|
221
233
|
SkillExampleSchema: () => SkillExampleSchema,
|
|
222
234
|
SkillMetadataSchema: () => SkillMetadataSchema,
|
|
223
235
|
SkillRefSchema: () => SkillRefSchema,
|
|
@@ -712,9 +724,235 @@ function isRuntimeWebhookContext(ctx) {
|
|
|
712
724
|
// src/schemas.ts
|
|
713
725
|
var import_v48 = require("zod/v4");
|
|
714
726
|
|
|
715
|
-
// src/
|
|
727
|
+
// src/skills/types.ts
|
|
716
728
|
var import_v43 = require("zod/v4");
|
|
717
|
-
var
|
|
729
|
+
var SKILL_SCHEMA_VERSION = "https://skedyul.com/schemas/skill/v1";
|
|
730
|
+
var SKILL_SCHEMA_VERSION_V2 = "https://skedyul.com/schemas/skill/v2";
|
|
731
|
+
var SkillSourceSchema = import_v43.z.enum(["BUILTIN", "S3", "APP", "EXTERNAL"]);
|
|
732
|
+
var SkillToolRequirementSchema = import_v43.z.object({
|
|
733
|
+
requires: import_v43.z.array(import_v43.z.string()).optional(),
|
|
734
|
+
provides: import_v43.z.array(import_v43.z.string()).optional()
|
|
735
|
+
});
|
|
736
|
+
var SkillToolSandboxSchema = import_v43.z.object({
|
|
737
|
+
mock: import_v43.z.unknown().optional()
|
|
738
|
+
});
|
|
739
|
+
var ToolConstraintsSchema = import_v43.z.object({
|
|
740
|
+
maxCallsPerRun: import_v43.z.number().optional(),
|
|
741
|
+
idempotent: import_v43.z.boolean().optional(),
|
|
742
|
+
restricted: import_v43.z.boolean().optional(),
|
|
743
|
+
tags: import_v43.z.array(import_v43.z.string()).optional()
|
|
744
|
+
});
|
|
745
|
+
var SkillToolDefinitionSchema = import_v43.z.object({
|
|
746
|
+
tool: import_v43.z.string(),
|
|
747
|
+
description: import_v43.z.string().optional(),
|
|
748
|
+
overrides: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
749
|
+
sandbox: SkillToolSandboxSchema.optional(),
|
|
750
|
+
requiresApproval: import_v43.z.boolean().optional(),
|
|
751
|
+
constraints: ToolConstraintsSchema.optional()
|
|
752
|
+
});
|
|
753
|
+
var SkillToolsSchema = import_v43.z.union([
|
|
754
|
+
SkillToolRequirementSchema,
|
|
755
|
+
import_v43.z.array(SkillToolDefinitionSchema)
|
|
756
|
+
]);
|
|
757
|
+
var SkillExampleSchema = import_v43.z.object({
|
|
758
|
+
context: import_v43.z.string().optional(),
|
|
759
|
+
input: import_v43.z.string(),
|
|
760
|
+
reasoning: import_v43.z.string().optional(),
|
|
761
|
+
output: import_v43.z.string(),
|
|
762
|
+
tool_call: import_v43.z.string().optional()
|
|
763
|
+
});
|
|
764
|
+
var CRMModelFieldRequirementsSchema = import_v43.z.object({
|
|
765
|
+
required: import_v43.z.array(import_v43.z.string()).optional(),
|
|
766
|
+
recommended: import_v43.z.array(import_v43.z.string()).optional()
|
|
767
|
+
});
|
|
768
|
+
var CRMContextSchema = import_v43.z.object({
|
|
769
|
+
models: import_v43.z.record(import_v43.z.string(), CRMModelFieldRequirementsSchema)
|
|
770
|
+
});
|
|
771
|
+
var EntityOperationSchema = import_v43.z.enum(["get", "list", "update", "create", "delete"]);
|
|
772
|
+
var EntityPoliciesSchema = import_v43.z.record(
|
|
773
|
+
import_v43.z.string(),
|
|
774
|
+
// entity handle (e.g., "member", "booking")
|
|
775
|
+
import_v43.z.array(EntityOperationSchema)
|
|
776
|
+
// allowed operations
|
|
777
|
+
);
|
|
778
|
+
var EvaluatorPreconditionsSchema = import_v43.z.object({
|
|
779
|
+
toolSucceeded: import_v43.z.boolean().optional(),
|
|
780
|
+
anyWrittenFields: import_v43.z.array(import_v43.z.string()).optional(),
|
|
781
|
+
noneOfWrittenFields: import_v43.z.array(import_v43.z.string()).optional(),
|
|
782
|
+
crm: import_v43.z.array(
|
|
783
|
+
import_v43.z.object({
|
|
784
|
+
field: import_v43.z.string(),
|
|
785
|
+
op: import_v43.z.enum(["eq", "in", "empty", "notEmpty"]),
|
|
786
|
+
value: import_v43.z.unknown().optional()
|
|
787
|
+
})
|
|
788
|
+
).optional(),
|
|
789
|
+
skillsLoaded: import_v43.z.array(import_v43.z.string()).optional(),
|
|
790
|
+
skillsNotLoaded: import_v43.z.array(import_v43.z.string()).optional()
|
|
791
|
+
});
|
|
792
|
+
var SkillEvaluatorSchema = import_v43.z.object({
|
|
793
|
+
name: import_v43.z.string(),
|
|
794
|
+
description: import_v43.z.string().optional(),
|
|
795
|
+
target: import_v43.z.enum(["message", "tool", "entity"]),
|
|
796
|
+
selector: import_v43.z.string().optional(),
|
|
797
|
+
criteria: import_v43.z.string(),
|
|
798
|
+
passThreshold: import_v43.z.number().optional(),
|
|
799
|
+
checks: import_v43.z.object({
|
|
800
|
+
requiredArgs: import_v43.z.array(import_v43.z.string()).optional(),
|
|
801
|
+
forbiddenArgValues: import_v43.z.record(import_v43.z.string(), import_v43.z.array(import_v43.z.unknown())).optional()
|
|
802
|
+
}).optional(),
|
|
803
|
+
preconditions: EvaluatorPreconditionsSchema.optional()
|
|
804
|
+
});
|
|
805
|
+
var SkillYAMLSchema = import_v43.z.object({
|
|
806
|
+
// Schema version
|
|
807
|
+
$schema: import_v43.z.string().optional(),
|
|
808
|
+
// Identity
|
|
809
|
+
handle: import_v43.z.string(),
|
|
810
|
+
name: import_v43.z.string(),
|
|
811
|
+
version: import_v43.z.string().optional(),
|
|
812
|
+
description: import_v43.z.string().optional(),
|
|
813
|
+
// Instructions injected into agent system prompt
|
|
814
|
+
instructions: import_v43.z.string(),
|
|
815
|
+
// Entity policies - declares which entity operations this skill needs
|
|
816
|
+
// At runtime, these are resolved to CRM tools via AppCrmMap
|
|
817
|
+
entityPolicies: EntityPoliciesSchema.optional(),
|
|
818
|
+
// Tool configuration - supports both v1 and v2 formats
|
|
819
|
+
// Use for non-entity tools (MCP tools, system tools)
|
|
820
|
+
tools: SkillToolsSchema.optional(),
|
|
821
|
+
// CRM context - specifies which models/fields to include in schema
|
|
822
|
+
crmContext: CRMContextSchema.optional(),
|
|
823
|
+
ownedFields: import_v43.z.array(import_v43.z.string()).optional(),
|
|
824
|
+
// Quality evaluators owned by this skill
|
|
825
|
+
evaluators: import_v43.z.array(SkillEvaluatorSchema).optional(),
|
|
826
|
+
// Few-shot examples
|
|
827
|
+
examples: import_v43.z.array(SkillExampleSchema).optional()
|
|
828
|
+
});
|
|
829
|
+
var SkillYAMLV2Schema = import_v43.z.object({
|
|
830
|
+
$schema: import_v43.z.literal(SKILL_SCHEMA_VERSION_V2).optional(),
|
|
831
|
+
handle: import_v43.z.string(),
|
|
832
|
+
name: import_v43.z.string(),
|
|
833
|
+
version: import_v43.z.string().optional(),
|
|
834
|
+
description: import_v43.z.string().optional(),
|
|
835
|
+
instructions: import_v43.z.string(),
|
|
836
|
+
entityPolicies: EntityPoliciesSchema.optional(),
|
|
837
|
+
tools: import_v43.z.array(SkillToolDefinitionSchema).optional(),
|
|
838
|
+
crmContext: CRMContextSchema.optional(),
|
|
839
|
+
ownedFields: import_v43.z.array(import_v43.z.string()).optional(),
|
|
840
|
+
evaluators: import_v43.z.array(SkillEvaluatorSchema).optional(),
|
|
841
|
+
examples: import_v43.z.array(SkillExampleSchema).optional()
|
|
842
|
+
});
|
|
843
|
+
var SkillVersionWeightSchema = import_v43.z.object({
|
|
844
|
+
version: import_v43.z.number(),
|
|
845
|
+
weight: import_v43.z.number()
|
|
846
|
+
});
|
|
847
|
+
var SkillRefSchema = import_v43.z.union([
|
|
848
|
+
import_v43.z.string(),
|
|
849
|
+
// Just handle - uses latest published version
|
|
850
|
+
import_v43.z.object({
|
|
851
|
+
skill: import_v43.z.string(),
|
|
852
|
+
description: import_v43.z.string().optional(),
|
|
853
|
+
// For AI SDK Agent Skills discovery
|
|
854
|
+
/**
|
|
855
|
+
* @deprecated Ignored. The agent must call system:skill:load each turn.
|
|
856
|
+
* Kept so existing agent YAML still validates.
|
|
857
|
+
*/
|
|
858
|
+
alwaysLoad: import_v43.z.boolean().optional(),
|
|
859
|
+
// Version selection (pick one):
|
|
860
|
+
version: import_v43.z.number().optional(),
|
|
861
|
+
// Pin to specific version number
|
|
862
|
+
versions: import_v43.z.array(SkillVersionWeightSchema).optional(),
|
|
863
|
+
// A/B testing weights
|
|
864
|
+
// Legacy support:
|
|
865
|
+
instructions: import_v43.z.string().optional(),
|
|
866
|
+
// Inline instructions (deprecated)
|
|
867
|
+
enabled: import_v43.z.boolean().optional()
|
|
868
|
+
})
|
|
869
|
+
]);
|
|
870
|
+
var SkillMetadataSchema = import_v43.z.object({
|
|
871
|
+
id: import_v43.z.string(),
|
|
872
|
+
handle: import_v43.z.string(),
|
|
873
|
+
name: import_v43.z.string(),
|
|
874
|
+
version: import_v43.z.string().optional(),
|
|
875
|
+
description: import_v43.z.string().optional(),
|
|
876
|
+
source: SkillSourceSchema,
|
|
877
|
+
s3Key: import_v43.z.string().optional(),
|
|
878
|
+
appVersionId: import_v43.z.string().optional(),
|
|
879
|
+
workplaceId: import_v43.z.string().optional(),
|
|
880
|
+
createdAt: import_v43.z.string().datetime().optional(),
|
|
881
|
+
updatedAt: import_v43.z.string().datetime().optional()
|
|
882
|
+
});
|
|
883
|
+
var ResolvedSkillSchema = import_v43.z.object({
|
|
884
|
+
handle: import_v43.z.string(),
|
|
885
|
+
name: import_v43.z.string(),
|
|
886
|
+
instructions: import_v43.z.string().optional(),
|
|
887
|
+
description: import_v43.z.string().optional(),
|
|
888
|
+
tools: import_v43.z.array(import_v43.z.string()).optional(),
|
|
889
|
+
examples: import_v43.z.array(SkillExampleSchema).optional()
|
|
890
|
+
});
|
|
891
|
+
var LoadedSkillSchema = import_v43.z.object({
|
|
892
|
+
handle: import_v43.z.string(),
|
|
893
|
+
name: import_v43.z.string(),
|
|
894
|
+
instructions: import_v43.z.string().optional(),
|
|
895
|
+
description: import_v43.z.string().optional(),
|
|
896
|
+
entityPolicies: EntityPoliciesSchema.optional(),
|
|
897
|
+
tools: import_v43.z.array(SkillToolDefinitionSchema).optional(),
|
|
898
|
+
examples: import_v43.z.array(SkillExampleSchema).optional()
|
|
899
|
+
});
|
|
900
|
+
function isV2SkillTools(tools) {
|
|
901
|
+
if (!tools) return false;
|
|
902
|
+
return Array.isArray(tools);
|
|
903
|
+
}
|
|
904
|
+
function getSkillToolNames(tools) {
|
|
905
|
+
if (!tools) return [];
|
|
906
|
+
if (isV2SkillTools(tools)) {
|
|
907
|
+
return tools.map((t) => t.tool);
|
|
908
|
+
}
|
|
909
|
+
return tools.requires || [];
|
|
910
|
+
}
|
|
911
|
+
function defineSkill(skill) {
|
|
912
|
+
return SkillYAMLSchema.parse(skill);
|
|
913
|
+
}
|
|
914
|
+
function validateSkillYAML(skill) {
|
|
915
|
+
const result = SkillYAMLSchema.safeParse(skill);
|
|
916
|
+
if (result.success) {
|
|
917
|
+
return { success: true, data: result.data };
|
|
918
|
+
}
|
|
919
|
+
return { success: false, error: result.error };
|
|
920
|
+
}
|
|
921
|
+
function formatSkillInstructions(skills) {
|
|
922
|
+
if (skills.length === 0) return "";
|
|
923
|
+
const sections = skills.map((skill) => {
|
|
924
|
+
if (!skill.instructions) {
|
|
925
|
+
return `## ${skill.name}
|
|
926
|
+
|
|
927
|
+
${skill.description || "No description available."}`;
|
|
928
|
+
}
|
|
929
|
+
let section = `## ${skill.name}
|
|
930
|
+
|
|
931
|
+
${skill.instructions}`;
|
|
932
|
+
if (skill.examples && skill.examples.length > 0) {
|
|
933
|
+
section += "\n\n### Examples\n";
|
|
934
|
+
for (const example of skill.examples) {
|
|
935
|
+
section += `
|
|
936
|
+
**Input:** ${example.input}
|
|
937
|
+
`;
|
|
938
|
+
if (example.reasoning) {
|
|
939
|
+
section += `**Reasoning:** ${example.reasoning}
|
|
940
|
+
`;
|
|
941
|
+
}
|
|
942
|
+
section += `**Output:** ${example.output}
|
|
943
|
+
`;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
return section;
|
|
947
|
+
});
|
|
948
|
+
return `# Skills
|
|
949
|
+
|
|
950
|
+
${sections.join("\n\n---\n\n")}`;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
// src/schemas/crm-schema.ts
|
|
954
|
+
var import_v44 = require("zod/v4");
|
|
955
|
+
var CRMFieldTypeSchema = import_v44.z.enum([
|
|
718
956
|
"string",
|
|
719
957
|
"long_string",
|
|
720
958
|
"number",
|
|
@@ -726,51 +964,51 @@ var CRMFieldTypeSchema = import_v43.z.enum([
|
|
|
726
964
|
"image",
|
|
727
965
|
"object"
|
|
728
966
|
]);
|
|
729
|
-
var CRMFieldRequirementSchema =
|
|
967
|
+
var CRMFieldRequirementSchema = import_v44.z.enum([
|
|
730
968
|
"optional",
|
|
731
969
|
"on_create",
|
|
732
970
|
"required"
|
|
733
971
|
]);
|
|
734
|
-
var CRMFieldOptionSchema =
|
|
735
|
-
label:
|
|
736
|
-
value:
|
|
737
|
-
color:
|
|
738
|
-
});
|
|
739
|
-
var CRMFieldDefinitionObjectSchema =
|
|
740
|
-
options:
|
|
741
|
-
limitChoices:
|
|
742
|
-
minLength:
|
|
743
|
-
maxLength:
|
|
744
|
-
min:
|
|
745
|
-
max:
|
|
746
|
-
pattern:
|
|
747
|
-
});
|
|
748
|
-
var CRMFieldDefinitionSchema =
|
|
749
|
-
|
|
972
|
+
var CRMFieldOptionSchema = import_v44.z.object({
|
|
973
|
+
label: import_v44.z.string(),
|
|
974
|
+
value: import_v44.z.string(),
|
|
975
|
+
color: import_v44.z.string().optional()
|
|
976
|
+
});
|
|
977
|
+
var CRMFieldDefinitionObjectSchema = import_v44.z.object({
|
|
978
|
+
options: import_v44.z.array(CRMFieldOptionSchema).optional(),
|
|
979
|
+
limitChoices: import_v44.z.number().optional(),
|
|
980
|
+
minLength: import_v44.z.number().optional(),
|
|
981
|
+
maxLength: import_v44.z.number().optional(),
|
|
982
|
+
min: import_v44.z.number().optional(),
|
|
983
|
+
max: import_v44.z.number().optional(),
|
|
984
|
+
pattern: import_v44.z.string().optional()
|
|
985
|
+
});
|
|
986
|
+
var CRMFieldDefinitionSchema = import_v44.z.union([
|
|
987
|
+
import_v44.z.string(),
|
|
750
988
|
CRMFieldDefinitionObjectSchema
|
|
751
989
|
]);
|
|
752
|
-
var CRMFieldAppearanceSchemaZ =
|
|
753
|
-
leftIcon:
|
|
754
|
-
rightIcon:
|
|
755
|
-
placeholder:
|
|
756
|
-
helpText:
|
|
757
|
-
});
|
|
758
|
-
var CRMFieldAiMetaSchemaZ =
|
|
759
|
-
description:
|
|
760
|
-
mutability:
|
|
761
|
-
});
|
|
762
|
-
var CRMFieldSchemaZ =
|
|
763
|
-
handle:
|
|
764
|
-
label:
|
|
990
|
+
var CRMFieldAppearanceSchemaZ = import_v44.z.object({
|
|
991
|
+
leftIcon: import_v44.z.string().optional(),
|
|
992
|
+
rightIcon: import_v44.z.string().optional(),
|
|
993
|
+
placeholder: import_v44.z.string().optional(),
|
|
994
|
+
helpText: import_v44.z.string().optional()
|
|
995
|
+
});
|
|
996
|
+
var CRMFieldAiMetaSchemaZ = import_v44.z.object({
|
|
997
|
+
description: import_v44.z.string().optional(),
|
|
998
|
+
mutability: import_v44.z.enum(["always", "restricted", "create_only", "immutable"]).optional()
|
|
999
|
+
});
|
|
1000
|
+
var CRMFieldSchemaZ = import_v44.z.object({
|
|
1001
|
+
handle: import_v44.z.string().regex(/^[a-z][a-z0-9_]*$/, "Handle must be lowercase alphanumeric with underscores, starting with a letter"),
|
|
1002
|
+
label: import_v44.z.string().min(1, "Label is required"),
|
|
765
1003
|
type: CRMFieldTypeSchema,
|
|
766
1004
|
/** Field description - explains what the field is for (metadata, not UI) */
|
|
767
|
-
description:
|
|
1005
|
+
description: import_v44.z.string().optional(),
|
|
768
1006
|
/** Field appearance - UI presentation settings */
|
|
769
1007
|
appearance: CRMFieldAppearanceSchemaZ.optional(),
|
|
770
1008
|
requirement: CRMFieldRequirementSchema.optional(),
|
|
771
|
-
unique:
|
|
772
|
-
list:
|
|
773
|
-
default:
|
|
1009
|
+
unique: import_v44.z.boolean().optional(),
|
|
1010
|
+
list: import_v44.z.boolean().optional(),
|
|
1011
|
+
default: import_v44.z.unknown().optional(),
|
|
774
1012
|
definition: CRMFieldDefinitionSchema.optional(),
|
|
775
1013
|
/** AI metadata - description and mutability hints for agents */
|
|
776
1014
|
aiMeta: CRMFieldAiMetaSchemaZ.optional(),
|
|
@@ -778,96 +1016,96 @@ var CRMFieldSchemaZ = import_v43.z.object({
|
|
|
778
1016
|
* Workplace-scoped field section handle (visualization helper).
|
|
779
1017
|
* Find-or-create on apply; display name is derived from the handle on create.
|
|
780
1018
|
*/
|
|
781
|
-
section:
|
|
782
|
-
});
|
|
783
|
-
var CRMModelSchemaZ =
|
|
784
|
-
handle:
|
|
785
|
-
name:
|
|
786
|
-
namePlural:
|
|
787
|
-
labelTemplate:
|
|
788
|
-
description:
|
|
789
|
-
icon:
|
|
790
|
-
fields:
|
|
791
|
-
});
|
|
792
|
-
var CRMCardinalitySchema =
|
|
1019
|
+
section: import_v44.z.string().regex(/^[a-z][a-z0-9_-]*$/, "Section handle must be lowercase alphanumeric with underscores/hyphens, starting with a letter").optional()
|
|
1020
|
+
});
|
|
1021
|
+
var CRMModelSchemaZ = import_v44.z.object({
|
|
1022
|
+
handle: import_v44.z.string().regex(/^[a-z][a-z0-9_]*$/, "Handle must be lowercase alphanumeric with underscores, starting with a letter"),
|
|
1023
|
+
name: import_v44.z.string().min(1, "Name is required"),
|
|
1024
|
+
namePlural: import_v44.z.string().optional(),
|
|
1025
|
+
labelTemplate: import_v44.z.string().optional(),
|
|
1026
|
+
description: import_v44.z.string().optional(),
|
|
1027
|
+
icon: import_v44.z.string().optional(),
|
|
1028
|
+
fields: import_v44.z.array(CRMFieldSchemaZ)
|
|
1029
|
+
});
|
|
1030
|
+
var CRMCardinalitySchema = import_v44.z.enum([
|
|
793
1031
|
"one_to_one",
|
|
794
1032
|
"one_to_many",
|
|
795
1033
|
"many_to_one",
|
|
796
1034
|
"many_to_many"
|
|
797
1035
|
]);
|
|
798
|
-
var CRMOnDeleteSchema =
|
|
1036
|
+
var CRMOnDeleteSchema = import_v44.z.enum([
|
|
799
1037
|
"none",
|
|
800
1038
|
"cascade",
|
|
801
1039
|
"restrict",
|
|
802
1040
|
"set_null"
|
|
803
1041
|
]);
|
|
804
|
-
var CRMRelationshipLinkSchema =
|
|
805
|
-
model:
|
|
806
|
-
field:
|
|
807
|
-
label:
|
|
1042
|
+
var CRMRelationshipLinkSchema = import_v44.z.object({
|
|
1043
|
+
model: import_v44.z.string(),
|
|
1044
|
+
field: import_v44.z.string(),
|
|
1045
|
+
label: import_v44.z.string()
|
|
808
1046
|
});
|
|
809
|
-
var CRMRelationshipSchemaZ =
|
|
1047
|
+
var CRMRelationshipSchemaZ = import_v44.z.object({
|
|
810
1048
|
source: CRMRelationshipLinkSchema,
|
|
811
1049
|
target: CRMRelationshipLinkSchema,
|
|
812
1050
|
cardinality: CRMCardinalitySchema,
|
|
813
1051
|
onDelete: CRMOnDeleteSchema.optional()
|
|
814
1052
|
});
|
|
815
|
-
var CRMBlockTypeSchema =
|
|
1053
|
+
var CRMBlockTypeSchema = import_v44.z.enum([
|
|
816
1054
|
"spreadsheet",
|
|
817
1055
|
"form",
|
|
818
1056
|
"card",
|
|
819
1057
|
"metric",
|
|
820
1058
|
"kanban"
|
|
821
1059
|
]);
|
|
822
|
-
var CRMBlockSchemaZ =
|
|
1060
|
+
var CRMBlockSchemaZ = import_v44.z.object({
|
|
823
1061
|
type: CRMBlockTypeSchema,
|
|
824
|
-
title:
|
|
825
|
-
config:
|
|
826
|
-
default:
|
|
1062
|
+
title: import_v44.z.string().optional(),
|
|
1063
|
+
config: import_v44.z.unknown().optional(),
|
|
1064
|
+
default: import_v44.z.boolean().optional()
|
|
827
1065
|
});
|
|
828
|
-
var CRMPageTypeSchema =
|
|
829
|
-
var CRMPageSchemaZ =
|
|
830
|
-
path:
|
|
1066
|
+
var CRMPageTypeSchema = import_v44.z.enum(["list", "instance"]);
|
|
1067
|
+
var CRMPageSchemaZ = import_v44.z.object({
|
|
1068
|
+
path: import_v44.z.string(),
|
|
831
1069
|
type: CRMPageTypeSchema,
|
|
832
|
-
title:
|
|
833
|
-
icon:
|
|
834
|
-
modelHandle:
|
|
835
|
-
parentPath:
|
|
836
|
-
isDefault:
|
|
837
|
-
visibility:
|
|
838
|
-
baseQuery:
|
|
839
|
-
blocks:
|
|
840
|
-
});
|
|
841
|
-
var CRMNavigationNodeBaseSchemaZ =
|
|
842
|
-
label:
|
|
843
|
-
icon:
|
|
844
|
-
path:
|
|
845
|
-
kind:
|
|
846
|
-
sortIndex:
|
|
847
|
-
});
|
|
848
|
-
var CRMNavigationItemSchemaZ =
|
|
1070
|
+
title: import_v44.z.string(),
|
|
1071
|
+
icon: import_v44.z.string().optional(),
|
|
1072
|
+
modelHandle: import_v44.z.string(),
|
|
1073
|
+
parentPath: import_v44.z.string().optional(),
|
|
1074
|
+
isDefault: import_v44.z.boolean().optional(),
|
|
1075
|
+
visibility: import_v44.z.enum(["team", "private"]).optional(),
|
|
1076
|
+
baseQuery: import_v44.z.unknown().optional(),
|
|
1077
|
+
blocks: import_v44.z.array(CRMBlockSchemaZ).optional()
|
|
1078
|
+
});
|
|
1079
|
+
var CRMNavigationNodeBaseSchemaZ = import_v44.z.object({
|
|
1080
|
+
label: import_v44.z.string(),
|
|
1081
|
+
icon: import_v44.z.string().optional(),
|
|
1082
|
+
path: import_v44.z.string().optional(),
|
|
1083
|
+
kind: import_v44.z.enum(["section", "group"]).optional(),
|
|
1084
|
+
sortIndex: import_v44.z.number().optional()
|
|
1085
|
+
});
|
|
1086
|
+
var CRMNavigationItemSchemaZ = import_v44.z.lazy(
|
|
849
1087
|
() => CRMNavigationNodeBaseSchemaZ.extend({
|
|
850
|
-
children:
|
|
1088
|
+
children: import_v44.z.array(CRMNavigationItemSchemaZ).optional()
|
|
851
1089
|
})
|
|
852
1090
|
);
|
|
853
|
-
var CRMNavigationSchemaZ =
|
|
854
|
-
sidebar:
|
|
1091
|
+
var CRMNavigationSchemaZ = import_v44.z.object({
|
|
1092
|
+
sidebar: import_v44.z.array(CRMNavigationItemSchemaZ).optional()
|
|
855
1093
|
});
|
|
856
|
-
var CRMSchemaZ =
|
|
1094
|
+
var CRMSchemaZ = import_v44.z.object({
|
|
857
1095
|
/** Schema format version for future compatibility */
|
|
858
|
-
$schema:
|
|
1096
|
+
$schema: import_v44.z.literal("https://skedyul.com/schemas/crm/v1").optional(),
|
|
859
1097
|
/** Schema name for identification */
|
|
860
|
-
name:
|
|
1098
|
+
name: import_v44.z.string().min(1, "Name is required"),
|
|
861
1099
|
/** Optional description */
|
|
862
|
-
description:
|
|
1100
|
+
description: import_v44.z.string().optional(),
|
|
863
1101
|
/** Schema version (semver) */
|
|
864
|
-
version:
|
|
1102
|
+
version: import_v44.z.string().optional(),
|
|
865
1103
|
/** Model definitions */
|
|
866
|
-
models:
|
|
1104
|
+
models: import_v44.z.array(CRMModelSchemaZ),
|
|
867
1105
|
/** Relationship definitions */
|
|
868
|
-
relationships:
|
|
1106
|
+
relationships: import_v44.z.array(CRMRelationshipSchemaZ).optional(),
|
|
869
1107
|
/** Page definitions */
|
|
870
|
-
pages:
|
|
1108
|
+
pages: import_v44.z.array(CRMPageSchemaZ).optional(),
|
|
871
1109
|
/** Navigation definitions */
|
|
872
1110
|
navigation: CRMNavigationSchemaZ.optional()
|
|
873
1111
|
});
|
|
@@ -897,8 +1135,8 @@ function safeParseCRMSchema(data) {
|
|
|
897
1135
|
var import_v47 = require("zod/v4");
|
|
898
1136
|
|
|
899
1137
|
// src/events/types.ts
|
|
900
|
-
var
|
|
901
|
-
var ThreadEventTypeSchema =
|
|
1138
|
+
var import_v45 = require("zod/v4");
|
|
1139
|
+
var ThreadEventTypeSchema = import_v45.z.enum([
|
|
902
1140
|
// Message events
|
|
903
1141
|
"thread.message.received",
|
|
904
1142
|
"thread.message.sent",
|
|
@@ -921,73 +1159,73 @@ var ThreadEventTypeSchema = import_v44.z.enum([
|
|
|
921
1159
|
// Signal events
|
|
922
1160
|
"thread.signal.created"
|
|
923
1161
|
]);
|
|
924
|
-
var CustomEventTypeSchema =
|
|
1162
|
+
var CustomEventTypeSchema = import_v45.z.string().regex(/^custom\.[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/, {
|
|
925
1163
|
message: "Custom event type must match pattern: custom.{namespace}.{event}"
|
|
926
1164
|
});
|
|
927
|
-
var EventTypeSchema =
|
|
928
|
-
var ParticipantKindSchema =
|
|
929
|
-
var BaseEventPayloadSchema =
|
|
930
|
-
threadId:
|
|
931
|
-
workplaceId:
|
|
932
|
-
timestamp:
|
|
1165
|
+
var EventTypeSchema = import_v45.z.union([ThreadEventTypeSchema, CustomEventTypeSchema]);
|
|
1166
|
+
var ParticipantKindSchema = import_v45.z.enum(["CONTACT", "MEMBER", "AGENT", "WORKFLOW"]);
|
|
1167
|
+
var BaseEventPayloadSchema = import_v45.z.object({
|
|
1168
|
+
threadId: import_v45.z.string(),
|
|
1169
|
+
workplaceId: import_v45.z.string(),
|
|
1170
|
+
timestamp: import_v45.z.string().datetime().optional()
|
|
933
1171
|
});
|
|
934
1172
|
var MessageEventPayloadSchema = BaseEventPayloadSchema.extend({
|
|
935
|
-
message:
|
|
936
|
-
id:
|
|
937
|
-
content:
|
|
938
|
-
senderId:
|
|
1173
|
+
message: import_v45.z.object({
|
|
1174
|
+
id: import_v45.z.string(),
|
|
1175
|
+
content: import_v45.z.string(),
|
|
1176
|
+
senderId: import_v45.z.string().optional()
|
|
939
1177
|
}),
|
|
940
|
-
participant:
|
|
941
|
-
id:
|
|
1178
|
+
participant: import_v45.z.object({
|
|
1179
|
+
id: import_v45.z.string(),
|
|
942
1180
|
kind: ParticipantKindSchema,
|
|
943
|
-
displayName:
|
|
1181
|
+
displayName: import_v45.z.string().optional()
|
|
944
1182
|
}).optional(),
|
|
945
|
-
isFirstMessage:
|
|
946
|
-
messageCount:
|
|
1183
|
+
isFirstMessage: import_v45.z.boolean().optional(),
|
|
1184
|
+
messageCount: import_v45.z.number().optional()
|
|
947
1185
|
});
|
|
948
1186
|
var ParticipantEventPayloadSchema = BaseEventPayloadSchema.extend({
|
|
949
|
-
participant:
|
|
950
|
-
id:
|
|
1187
|
+
participant: import_v45.z.object({
|
|
1188
|
+
id: import_v45.z.string(),
|
|
951
1189
|
kind: ParticipantKindSchema,
|
|
952
|
-
displayName:
|
|
953
|
-
contactId:
|
|
954
|
-
memberId:
|
|
955
|
-
agentId:
|
|
956
|
-
workflowId:
|
|
1190
|
+
displayName: import_v45.z.string().optional(),
|
|
1191
|
+
contactId: import_v45.z.string().optional(),
|
|
1192
|
+
memberId: import_v45.z.string().optional(),
|
|
1193
|
+
agentId: import_v45.z.string().optional(),
|
|
1194
|
+
workflowId: import_v45.z.string().optional()
|
|
957
1195
|
})
|
|
958
1196
|
});
|
|
959
1197
|
var ContextChangedPayloadSchema = BaseEventPayloadSchema.extend({
|
|
960
|
-
context:
|
|
961
|
-
handle:
|
|
962
|
-
model:
|
|
963
|
-
instanceId:
|
|
1198
|
+
context: import_v45.z.object({
|
|
1199
|
+
handle: import_v45.z.string(),
|
|
1200
|
+
model: import_v45.z.string(),
|
|
1201
|
+
instanceId: import_v45.z.string()
|
|
964
1202
|
}),
|
|
965
|
-
change:
|
|
966
|
-
field:
|
|
967
|
-
oldValue:
|
|
968
|
-
newValue:
|
|
1203
|
+
change: import_v45.z.object({
|
|
1204
|
+
field: import_v45.z.string().optional(),
|
|
1205
|
+
oldValue: import_v45.z.unknown().optional(),
|
|
1206
|
+
newValue: import_v45.z.unknown().optional()
|
|
969
1207
|
}).optional()
|
|
970
1208
|
});
|
|
971
1209
|
var StatusChangedPayloadSchema = BaseEventPayloadSchema.extend({
|
|
972
|
-
oldStatus:
|
|
973
|
-
newStatus:
|
|
1210
|
+
oldStatus: import_v45.z.string(),
|
|
1211
|
+
newStatus: import_v45.z.string()
|
|
974
1212
|
});
|
|
975
1213
|
var ScheduledEventPayloadSchema = BaseEventPayloadSchema.extend({
|
|
976
|
-
scheduledEventId:
|
|
977
|
-
reason:
|
|
978
|
-
context:
|
|
1214
|
+
scheduledEventId: import_v45.z.string(),
|
|
1215
|
+
reason: import_v45.z.string().optional(),
|
|
1216
|
+
context: import_v45.z.record(import_v45.z.string(), import_v45.z.unknown()).optional()
|
|
979
1217
|
});
|
|
980
1218
|
var AgentWorkflowEventPayloadSchema = BaseEventPayloadSchema.extend({
|
|
981
|
-
agentId:
|
|
982
|
-
workflowId:
|
|
983
|
-
workflowRunId:
|
|
984
|
-
outputs:
|
|
985
|
-
error:
|
|
1219
|
+
agentId: import_v45.z.string().optional(),
|
|
1220
|
+
workflowId: import_v45.z.string().optional(),
|
|
1221
|
+
workflowRunId: import_v45.z.string().optional(),
|
|
1222
|
+
outputs: import_v45.z.record(import_v45.z.string(), import_v45.z.unknown()).optional(),
|
|
1223
|
+
error: import_v45.z.string().optional()
|
|
986
1224
|
});
|
|
987
1225
|
var CustomEventPayloadSchema = BaseEventPayloadSchema.extend({
|
|
988
|
-
data:
|
|
1226
|
+
data: import_v45.z.record(import_v45.z.string(), import_v45.z.unknown()).optional()
|
|
989
1227
|
});
|
|
990
|
-
var ThreadEventPayloadSchema =
|
|
1228
|
+
var ThreadEventPayloadSchema = import_v45.z.union([
|
|
991
1229
|
MessageEventPayloadSchema,
|
|
992
1230
|
ParticipantEventPayloadSchema,
|
|
993
1231
|
ContextChangedPayloadSchema,
|
|
@@ -996,218 +1234,40 @@ var ThreadEventPayloadSchema = import_v44.z.union([
|
|
|
996
1234
|
AgentWorkflowEventPayloadSchema,
|
|
997
1235
|
CustomEventPayloadSchema
|
|
998
1236
|
]);
|
|
999
|
-
var ThreadEventSchema =
|
|
1000
|
-
id:
|
|
1001
|
-
threadId:
|
|
1237
|
+
var ThreadEventSchema = import_v45.z.object({
|
|
1238
|
+
id: import_v45.z.string(),
|
|
1239
|
+
threadId: import_v45.z.string(),
|
|
1002
1240
|
type: EventTypeSchema,
|
|
1003
1241
|
payload: ThreadEventPayloadSchema,
|
|
1004
|
-
emittedBy:
|
|
1005
|
-
createdAt:
|
|
1242
|
+
emittedBy: import_v45.z.string().optional(),
|
|
1243
|
+
createdAt: import_v45.z.string().datetime()
|
|
1006
1244
|
});
|
|
1007
|
-
var CreateThreadEventInputSchema =
|
|
1008
|
-
threadId:
|
|
1245
|
+
var CreateThreadEventInputSchema = import_v45.z.object({
|
|
1246
|
+
threadId: import_v45.z.string(),
|
|
1009
1247
|
type: EventTypeSchema,
|
|
1010
|
-
payload:
|
|
1011
|
-
emittedBy:
|
|
1248
|
+
payload: import_v45.z.record(import_v45.z.string(), import_v45.z.unknown()),
|
|
1249
|
+
emittedBy: import_v45.z.string().optional()
|
|
1012
1250
|
});
|
|
1013
|
-
var EventSubscriptionSchema =
|
|
1014
|
-
subscribes:
|
|
1015
|
-
condition:
|
|
1016
|
-
cancels:
|
|
1017
|
-
cancelCondition:
|
|
1251
|
+
var EventSubscriptionSchema = import_v45.z.object({
|
|
1252
|
+
subscribes: import_v45.z.array(EventTypeSchema),
|
|
1253
|
+
condition: import_v45.z.string().optional(),
|
|
1254
|
+
cancels: import_v45.z.array(EventTypeSchema).optional(),
|
|
1255
|
+
cancelCondition: import_v45.z.string().optional()
|
|
1018
1256
|
});
|
|
1019
|
-
var EventWaitSchema =
|
|
1257
|
+
var EventWaitSchema = import_v45.z.object({
|
|
1020
1258
|
event: EventTypeSchema,
|
|
1021
|
-
timeout:
|
|
1022
|
-
onTimeout:
|
|
1259
|
+
timeout: import_v45.z.string().optional(),
|
|
1260
|
+
onTimeout: import_v45.z.string().optional()
|
|
1023
1261
|
});
|
|
1024
|
-
var EventsConfigSchema =
|
|
1025
|
-
subscribes:
|
|
1026
|
-
condition:
|
|
1027
|
-
emits:
|
|
1028
|
-
waits:
|
|
1029
|
-
cancels:
|
|
1030
|
-
cancelCondition:
|
|
1262
|
+
var EventsConfigSchema = import_v45.z.object({
|
|
1263
|
+
subscribes: import_v45.z.array(EventTypeSchema).optional(),
|
|
1264
|
+
condition: import_v45.z.string().optional(),
|
|
1265
|
+
emits: import_v45.z.array(EventTypeSchema).optional(),
|
|
1266
|
+
waits: import_v45.z.array(EventWaitSchema).optional(),
|
|
1267
|
+
cancels: import_v45.z.array(EventTypeSchema).optional(),
|
|
1268
|
+
cancelCondition: import_v45.z.string().optional()
|
|
1031
1269
|
});
|
|
1032
1270
|
|
|
1033
|
-
// src/skills/types.ts
|
|
1034
|
-
var import_v45 = require("zod/v4");
|
|
1035
|
-
var SKILL_SCHEMA_VERSION = "https://skedyul.com/schemas/skill/v1";
|
|
1036
|
-
var SKILL_SCHEMA_VERSION_V2 = "https://skedyul.com/schemas/skill/v2";
|
|
1037
|
-
var SkillSourceSchema = import_v45.z.enum(["BUILTIN", "S3", "APP", "EXTERNAL"]);
|
|
1038
|
-
var SkillToolRequirementSchema = import_v45.z.object({
|
|
1039
|
-
requires: import_v45.z.array(import_v45.z.string()).optional(),
|
|
1040
|
-
provides: import_v45.z.array(import_v45.z.string()).optional()
|
|
1041
|
-
});
|
|
1042
|
-
var SkillToolSandboxSchema = import_v45.z.object({
|
|
1043
|
-
mock: import_v45.z.unknown().optional()
|
|
1044
|
-
});
|
|
1045
|
-
var ToolConstraintsSchema = import_v45.z.object({
|
|
1046
|
-
maxCallsPerRun: import_v45.z.number().optional(),
|
|
1047
|
-
idempotent: import_v45.z.boolean().optional(),
|
|
1048
|
-
restricted: import_v45.z.boolean().optional(),
|
|
1049
|
-
tags: import_v45.z.array(import_v45.z.string()).optional()
|
|
1050
|
-
});
|
|
1051
|
-
var SkillToolDefinitionSchema = import_v45.z.object({
|
|
1052
|
-
tool: import_v45.z.string(),
|
|
1053
|
-
description: import_v45.z.string().optional(),
|
|
1054
|
-
overrides: import_v45.z.record(import_v45.z.string(), import_v45.z.unknown()).optional(),
|
|
1055
|
-
sandbox: SkillToolSandboxSchema.optional(),
|
|
1056
|
-
requiresApproval: import_v45.z.boolean().optional(),
|
|
1057
|
-
constraints: ToolConstraintsSchema.optional()
|
|
1058
|
-
});
|
|
1059
|
-
var SkillToolsSchema = import_v45.z.union([
|
|
1060
|
-
SkillToolRequirementSchema,
|
|
1061
|
-
import_v45.z.array(SkillToolDefinitionSchema)
|
|
1062
|
-
]);
|
|
1063
|
-
var SkillExampleSchema = import_v45.z.object({
|
|
1064
|
-
context: import_v45.z.string().optional(),
|
|
1065
|
-
input: import_v45.z.string(),
|
|
1066
|
-
reasoning: import_v45.z.string().optional(),
|
|
1067
|
-
output: import_v45.z.string(),
|
|
1068
|
-
tool_call: import_v45.z.string().optional()
|
|
1069
|
-
});
|
|
1070
|
-
var CRMModelFieldRequirementsSchema = import_v45.z.object({
|
|
1071
|
-
required: import_v45.z.array(import_v45.z.string()).optional(),
|
|
1072
|
-
recommended: import_v45.z.array(import_v45.z.string()).optional()
|
|
1073
|
-
});
|
|
1074
|
-
var CRMContextSchema = import_v45.z.object({
|
|
1075
|
-
models: import_v45.z.record(import_v45.z.string(), CRMModelFieldRequirementsSchema)
|
|
1076
|
-
});
|
|
1077
|
-
var SkillYAMLSchema = import_v45.z.object({
|
|
1078
|
-
// Schema version
|
|
1079
|
-
$schema: import_v45.z.string().optional(),
|
|
1080
|
-
// Identity
|
|
1081
|
-
handle: import_v45.z.string(),
|
|
1082
|
-
name: import_v45.z.string(),
|
|
1083
|
-
version: import_v45.z.string().optional(),
|
|
1084
|
-
description: import_v45.z.string().optional(),
|
|
1085
|
-
// Instructions injected into agent system prompt
|
|
1086
|
-
instructions: import_v45.z.string(),
|
|
1087
|
-
// Tool configuration - supports both v1 and v2 formats
|
|
1088
|
-
tools: SkillToolsSchema.optional(),
|
|
1089
|
-
// CRM context - specifies which models/fields to include in schema
|
|
1090
|
-
crmContext: CRMContextSchema.optional(),
|
|
1091
|
-
// Few-shot examples
|
|
1092
|
-
examples: import_v45.z.array(SkillExampleSchema).optional()
|
|
1093
|
-
});
|
|
1094
|
-
var SkillYAMLV2Schema = import_v45.z.object({
|
|
1095
|
-
$schema: import_v45.z.literal(SKILL_SCHEMA_VERSION_V2).optional(),
|
|
1096
|
-
handle: import_v45.z.string(),
|
|
1097
|
-
name: import_v45.z.string(),
|
|
1098
|
-
version: import_v45.z.string().optional(),
|
|
1099
|
-
description: import_v45.z.string().optional(),
|
|
1100
|
-
instructions: import_v45.z.string(),
|
|
1101
|
-
tools: import_v45.z.array(SkillToolDefinitionSchema).optional(),
|
|
1102
|
-
crmContext: CRMContextSchema.optional(),
|
|
1103
|
-
examples: import_v45.z.array(SkillExampleSchema).optional()
|
|
1104
|
-
});
|
|
1105
|
-
var SkillVersionWeightSchema = import_v45.z.object({
|
|
1106
|
-
version: import_v45.z.number(),
|
|
1107
|
-
weight: import_v45.z.number()
|
|
1108
|
-
});
|
|
1109
|
-
var SkillRefSchema = import_v45.z.union([
|
|
1110
|
-
import_v45.z.string(),
|
|
1111
|
-
// Just handle - uses latest published version
|
|
1112
|
-
import_v45.z.object({
|
|
1113
|
-
skill: import_v45.z.string(),
|
|
1114
|
-
description: import_v45.z.string().optional(),
|
|
1115
|
-
// For AI SDK Agent Skills discovery
|
|
1116
|
-
/** Auto-inject this skill's instructions and tools on every agent turn */
|
|
1117
|
-
alwaysLoad: import_v45.z.boolean().optional(),
|
|
1118
|
-
// Version selection (pick one):
|
|
1119
|
-
version: import_v45.z.number().optional(),
|
|
1120
|
-
// Pin to specific version number
|
|
1121
|
-
versions: import_v45.z.array(SkillVersionWeightSchema).optional(),
|
|
1122
|
-
// A/B testing weights
|
|
1123
|
-
// Legacy support:
|
|
1124
|
-
instructions: import_v45.z.string().optional(),
|
|
1125
|
-
// Inline instructions (deprecated)
|
|
1126
|
-
enabled: import_v45.z.boolean().optional()
|
|
1127
|
-
})
|
|
1128
|
-
]);
|
|
1129
|
-
var SkillMetadataSchema = import_v45.z.object({
|
|
1130
|
-
id: import_v45.z.string(),
|
|
1131
|
-
handle: import_v45.z.string(),
|
|
1132
|
-
name: import_v45.z.string(),
|
|
1133
|
-
version: import_v45.z.string().optional(),
|
|
1134
|
-
description: import_v45.z.string().optional(),
|
|
1135
|
-
source: SkillSourceSchema,
|
|
1136
|
-
s3Key: import_v45.z.string().optional(),
|
|
1137
|
-
appVersionId: import_v45.z.string().optional(),
|
|
1138
|
-
workplaceId: import_v45.z.string().optional(),
|
|
1139
|
-
createdAt: import_v45.z.string().datetime().optional(),
|
|
1140
|
-
updatedAt: import_v45.z.string().datetime().optional()
|
|
1141
|
-
});
|
|
1142
|
-
var ResolvedSkillSchema = import_v45.z.object({
|
|
1143
|
-
handle: import_v45.z.string(),
|
|
1144
|
-
name: import_v45.z.string(),
|
|
1145
|
-
instructions: import_v45.z.string().optional(),
|
|
1146
|
-
description: import_v45.z.string().optional(),
|
|
1147
|
-
tools: import_v45.z.array(import_v45.z.string()).optional(),
|
|
1148
|
-
examples: import_v45.z.array(SkillExampleSchema).optional()
|
|
1149
|
-
});
|
|
1150
|
-
var LoadedSkillSchema = import_v45.z.object({
|
|
1151
|
-
handle: import_v45.z.string(),
|
|
1152
|
-
name: import_v45.z.string(),
|
|
1153
|
-
instructions: import_v45.z.string().optional(),
|
|
1154
|
-
description: import_v45.z.string().optional(),
|
|
1155
|
-
tools: import_v45.z.array(SkillToolDefinitionSchema).optional(),
|
|
1156
|
-
examples: import_v45.z.array(SkillExampleSchema).optional()
|
|
1157
|
-
});
|
|
1158
|
-
function isV2SkillTools(tools) {
|
|
1159
|
-
if (!tools) return false;
|
|
1160
|
-
return Array.isArray(tools);
|
|
1161
|
-
}
|
|
1162
|
-
function getSkillToolNames(tools) {
|
|
1163
|
-
if (!tools) return [];
|
|
1164
|
-
if (isV2SkillTools(tools)) {
|
|
1165
|
-
return tools.map((t) => t.tool);
|
|
1166
|
-
}
|
|
1167
|
-
return tools.requires || [];
|
|
1168
|
-
}
|
|
1169
|
-
function defineSkill(skill) {
|
|
1170
|
-
return SkillYAMLSchema.parse(skill);
|
|
1171
|
-
}
|
|
1172
|
-
function validateSkillYAML(skill) {
|
|
1173
|
-
const result = SkillYAMLSchema.safeParse(skill);
|
|
1174
|
-
if (result.success) {
|
|
1175
|
-
return { success: true, data: result.data };
|
|
1176
|
-
}
|
|
1177
|
-
return { success: false, error: result.error };
|
|
1178
|
-
}
|
|
1179
|
-
function formatSkillInstructions(skills) {
|
|
1180
|
-
if (skills.length === 0) return "";
|
|
1181
|
-
const sections = skills.map((skill) => {
|
|
1182
|
-
if (!skill.instructions) {
|
|
1183
|
-
return `## ${skill.name}
|
|
1184
|
-
|
|
1185
|
-
${skill.description || "No description available."}`;
|
|
1186
|
-
}
|
|
1187
|
-
let section = `## ${skill.name}
|
|
1188
|
-
|
|
1189
|
-
${skill.instructions}`;
|
|
1190
|
-
if (skill.examples && skill.examples.length > 0) {
|
|
1191
|
-
section += "\n\n### Examples\n";
|
|
1192
|
-
for (const example of skill.examples) {
|
|
1193
|
-
section += `
|
|
1194
|
-
**Input:** ${example.input}
|
|
1195
|
-
`;
|
|
1196
|
-
if (example.reasoning) {
|
|
1197
|
-
section += `**Reasoning:** ${example.reasoning}
|
|
1198
|
-
`;
|
|
1199
|
-
}
|
|
1200
|
-
section += `**Output:** ${example.output}
|
|
1201
|
-
`;
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
return section;
|
|
1205
|
-
});
|
|
1206
|
-
return `# Skills
|
|
1207
|
-
|
|
1208
|
-
${sections.join("\n\n---\n\n")}`;
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
1271
|
// src/context/types.ts
|
|
1212
1272
|
var import_v46 = require("zod/v4");
|
|
1213
1273
|
var CRMContextSchema2 = import_v46.z.object({
|
|
@@ -1454,6 +1514,13 @@ var ResponsesBehaviorConfigSchema = import_v47.z.object({
|
|
|
1454
1514
|
* @default false
|
|
1455
1515
|
*/
|
|
1456
1516
|
allowSchedule: import_v47.z.boolean().optional(),
|
|
1517
|
+
/**
|
|
1518
|
+
* Whether the agent may skip sending when no reply is warranted.
|
|
1519
|
+
* Platform injects silence rules and exposes system:message:skip.
|
|
1520
|
+
* An explicit skip satisfies requireFinal. Off by default.
|
|
1521
|
+
* @default false
|
|
1522
|
+
*/
|
|
1523
|
+
allowSilent: import_v47.z.boolean().optional(),
|
|
1457
1524
|
/**
|
|
1458
1525
|
* Message splitting configuration.
|
|
1459
1526
|
* Controls whether and how the agent splits responses into multiple messages.
|
|
@@ -1757,6 +1824,25 @@ var EntityCrmMapDefaultsSchema = import_v48.z.object({
|
|
|
1757
1824
|
relationshipHandles: import_v48.z.record(import_v48.z.string(), import_v48.z.string()).optional(),
|
|
1758
1825
|
valueAliases: import_v48.z.record(import_v48.z.string(), import_v48.z.record(import_v48.z.string(), import_v48.z.string())).optional()
|
|
1759
1826
|
});
|
|
1827
|
+
var EntityRuntimeToolsSchema = import_v48.z.object({
|
|
1828
|
+
calendarWindowPull: import_v48.z.string().min(1).optional()
|
|
1829
|
+
});
|
|
1830
|
+
var EntitySaveInteractionSchema = import_v48.z.object({
|
|
1831
|
+
handle: import_v48.z.string(),
|
|
1832
|
+
when: import_v48.z.object({
|
|
1833
|
+
onCreate: import_v48.z.boolean().optional(),
|
|
1834
|
+
onUpdate: import_v48.z.boolean().optional(),
|
|
1835
|
+
fieldsChanged: import_v48.z.array(import_v48.z.string()).optional(),
|
|
1836
|
+
relationshipsChanged: import_v48.z.array(import_v48.z.string()).optional()
|
|
1837
|
+
}),
|
|
1838
|
+
dialog: import_v48.z.object({
|
|
1839
|
+
title: import_v48.z.string(),
|
|
1840
|
+
message: import_v48.z.string(),
|
|
1841
|
+
severity: import_v48.z.enum(["warning", "info"]).optional(),
|
|
1842
|
+
fields: import_v48.z.array(import_v48.z.string()),
|
|
1843
|
+
defaults: import_v48.z.record(import_v48.z.string(), import_v48.z.string()).optional()
|
|
1844
|
+
})
|
|
1845
|
+
});
|
|
1760
1846
|
var EntityDefinitionSchema = import_v48.z.object({
|
|
1761
1847
|
handle: import_v48.z.string(),
|
|
1762
1848
|
label: import_v48.z.string(),
|
|
@@ -1765,7 +1851,9 @@ var EntityDefinitionSchema = import_v48.z.object({
|
|
|
1765
1851
|
fields: import_v48.z.array(EntityFieldDefinitionSchema),
|
|
1766
1852
|
contextFields: import_v48.z.array(EntityFieldDefinitionSchema).optional(),
|
|
1767
1853
|
relationships: import_v48.z.array(EntityRelationshipDefinitionSchema).optional(),
|
|
1768
|
-
crmMapDefaults: EntityCrmMapDefaultsSchema.optional()
|
|
1854
|
+
crmMapDefaults: EntityCrmMapDefaultsSchema.optional(),
|
|
1855
|
+
tools: EntityRuntimeToolsSchema.optional(),
|
|
1856
|
+
saveInteractions: import_v48.z.array(EntitySaveInteractionSchema).optional()
|
|
1769
1857
|
});
|
|
1770
1858
|
var RelationshipCardinalitySchema = import_v48.z.enum([
|
|
1771
1859
|
"ONE_TO_ONE",
|
|
@@ -2382,6 +2470,26 @@ var BatchOperationDefinitionSchema = import_v48.z.object({
|
|
|
2382
2470
|
pageSize: import_v48.z.number().int().positive().optional(),
|
|
2383
2471
|
icon: import_v48.z.string().optional()
|
|
2384
2472
|
});
|
|
2473
|
+
var ProvisionSkillDefinitionSchema = import_v48.z.object({
|
|
2474
|
+
/** Unique identifier for the skill */
|
|
2475
|
+
handle: import_v48.z.string(),
|
|
2476
|
+
/** Display name */
|
|
2477
|
+
name: import_v48.z.string(),
|
|
2478
|
+
/** Short description for skill discovery */
|
|
2479
|
+
description: import_v48.z.string().optional(),
|
|
2480
|
+
/** Full instructions injected into agent context when skill is loaded */
|
|
2481
|
+
instructions: import_v48.z.string(),
|
|
2482
|
+
/** Entity policies - declares which entity operations this skill needs */
|
|
2483
|
+
entityPolicies: EntityPoliciesSchema.optional(),
|
|
2484
|
+
/** Additional tools (MCP, system) not covered by entity policies */
|
|
2485
|
+
tools: import_v48.z.array(SkillToolDefinitionSchema).optional(),
|
|
2486
|
+
/** CRM context - specifies which model fields to include in schema */
|
|
2487
|
+
crmContext: import_v48.z.object({
|
|
2488
|
+
models: import_v48.z.record(import_v48.z.string(), CRMModelFieldRequirementsSchema)
|
|
2489
|
+
}).optional(),
|
|
2490
|
+
/** Few-shot examples for the skill */
|
|
2491
|
+
examples: import_v48.z.array(SkillExampleSchema).optional()
|
|
2492
|
+
});
|
|
2385
2493
|
var ProvisionConfigSchema = import_v48.z.object({
|
|
2386
2494
|
env: EnvSchemaSchema.optional(),
|
|
2387
2495
|
/** INTERNAL model definitions for data shared across installs */
|
|
@@ -2398,7 +2506,9 @@ var ProvisionConfigSchema = import_v48.z.object({
|
|
|
2398
2506
|
/** Install setup checklist steps (opt-in) */
|
|
2399
2507
|
setup: import_v48.z.array(SetupStepDefinitionSchema).optional(),
|
|
2400
2508
|
/** Batch operations for imports, syncs, and long-running tasks */
|
|
2401
|
-
batchOperations: import_v48.z.array(BatchOperationDefinitionSchema).optional()
|
|
2509
|
+
batchOperations: import_v48.z.array(BatchOperationDefinitionSchema).optional(),
|
|
2510
|
+
/** Skills provided by this app */
|
|
2511
|
+
skills: import_v48.z.array(ProvisionSkillDefinitionSchema).optional()
|
|
2402
2512
|
});
|
|
2403
2513
|
var SkedyulConfigSchema = import_v48.z.object({
|
|
2404
2514
|
name: import_v48.z.string(),
|
|
@@ -2457,6 +2567,32 @@ var MessageSendOutputSchema = import_v48.z.object({
|
|
|
2457
2567
|
status: import_v48.z.enum(["sent", "queued", "failed"]),
|
|
2458
2568
|
remoteId: import_v48.z.string().optional()
|
|
2459
2569
|
});
|
|
2570
|
+
var CalendarWindowPullWindowSchema = import_v48.z.object({
|
|
2571
|
+
startAt: import_v48.z.string(),
|
|
2572
|
+
endAt: import_v48.z.string(),
|
|
2573
|
+
timezone: import_v48.z.string().optional()
|
|
2574
|
+
});
|
|
2575
|
+
var CalendarWindowPullModelSchema = import_v48.z.object({
|
|
2576
|
+
id: import_v48.z.string(),
|
|
2577
|
+
handle: import_v48.z.string().optional()
|
|
2578
|
+
});
|
|
2579
|
+
var CalendarWindowPullEntitySchema = import_v48.z.object({
|
|
2580
|
+
handle: import_v48.z.string()
|
|
2581
|
+
});
|
|
2582
|
+
var CalendarWindowPullCalendarsSchema = import_v48.z.object({
|
|
2583
|
+
ids: import_v48.z.array(import_v48.z.string()).optional()
|
|
2584
|
+
});
|
|
2585
|
+
var CalendarWindowPullInputSchema = import_v48.z.object({
|
|
2586
|
+
window: CalendarWindowPullWindowSchema,
|
|
2587
|
+
model: CalendarWindowPullModelSchema.optional(),
|
|
2588
|
+
entity: CalendarWindowPullEntitySchema.optional(),
|
|
2589
|
+
calendars: CalendarWindowPullCalendarsSchema.optional()
|
|
2590
|
+
});
|
|
2591
|
+
var CalendarWindowPullOutputSchema = import_v48.z.object({
|
|
2592
|
+
calendarsUpserted: import_v48.z.number().int().nonnegative(),
|
|
2593
|
+
eventsUpserted: import_v48.z.number().int().nonnegative(),
|
|
2594
|
+
truncated: import_v48.z.boolean()
|
|
2595
|
+
});
|
|
2460
2596
|
var MessageBulkRecipientSchema = import_v48.z.object({
|
|
2461
2597
|
address: import_v48.z.string(),
|
|
2462
2598
|
renderedBody: import_v48.z.string(),
|
|
@@ -9289,6 +9425,12 @@ var index_default = { z: import_v414.z };
|
|
|
9289
9425
|
CRMRelationshipLinkSchema,
|
|
9290
9426
|
CRMRelationshipSchemaZ,
|
|
9291
9427
|
CRMSchemaZ,
|
|
9428
|
+
CalendarWindowPullCalendarsSchema,
|
|
9429
|
+
CalendarWindowPullEntitySchema,
|
|
9430
|
+
CalendarWindowPullInputSchema,
|
|
9431
|
+
CalendarWindowPullModelSchema,
|
|
9432
|
+
CalendarWindowPullOutputSchema,
|
|
9433
|
+
CalendarWindowPullWindowSchema,
|
|
9292
9434
|
CardBlockDefinitionSchema,
|
|
9293
9435
|
CardBlockHeaderSchema,
|
|
9294
9436
|
ChannelBatchCapabilitySchema,
|
|
@@ -9319,7 +9461,11 @@ var index_default = { z: import_v414.z };
|
|
|
9319
9461
|
EntityCrmMapDefaultsSchema,
|
|
9320
9462
|
EntityDefinitionSchema,
|
|
9321
9463
|
EntityFieldDefinitionSchema,
|
|
9464
|
+
EntityOperationSchema,
|
|
9465
|
+
EntityPoliciesSchema,
|
|
9322
9466
|
EntityRelationshipDefinitionSchema,
|
|
9467
|
+
EntityRuntimeToolsSchema,
|
|
9468
|
+
EntitySaveInteractionSchema,
|
|
9323
9469
|
EnvSchemaSchema,
|
|
9324
9470
|
EnvVariableDefinitionSchema,
|
|
9325
9471
|
EnvVisibilitySchema,
|
|
@@ -9418,6 +9564,7 @@ var index_default = { z: import_v414.z };
|
|
|
9418
9564
|
ParticipantEventPayloadSchema,
|
|
9419
9565
|
ParticipantKindSchema,
|
|
9420
9566
|
ProvisionConfigSchema,
|
|
9567
|
+
ProvisionSkillDefinitionSchema,
|
|
9421
9568
|
QueueContextError,
|
|
9422
9569
|
QueueNotFoundError,
|
|
9423
9570
|
QueuedFetchExhaustedError,
|
|
@@ -9444,6 +9591,7 @@ var index_default = { z: import_v414.z };
|
|
|
9444
9591
|
SetupStepDefinitionSchema,
|
|
9445
9592
|
SetupStepKindSchema,
|
|
9446
9593
|
SkedyulConfigSchema,
|
|
9594
|
+
SkillEvaluatorSchema,
|
|
9447
9595
|
SkillExampleSchema,
|
|
9448
9596
|
SkillMetadataSchema,
|
|
9449
9597
|
SkillRefSchema,
|