openxiangda-devkit-core 2.34.0 → 2.34.1

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.
@@ -3092,6 +3092,9 @@ function validateBackendOperations(rawOperations, declaredResources, declaredRes
3092
3092
  const cardFields = Array.isArray(object(resultCard).fields) ? object(resultCard).fields : [];
3093
3093
  const inputCard = agent?.inputCard;
3094
3094
  const inputCardFields = Array.isArray(object(inputCard).fields) ? object(inputCard).fields : [];
3095
+ const validCardResource = (value) => value === undefined ||
3096
+ (typeof value === 'string' && /^agent-cards\/[A-Za-z0-9][A-Za-z0-9_/-]{0,94}\.js$/.test(value) &&
3097
+ !value.split('/').some(part => part === '..' || part === '.' || part === ''));
3095
3098
  const requestFields = object(object(operation.requestSchema).properties);
3096
3099
  const agentInvalid = agent !== undefined && (!['task', 'support'].includes(string(agent.visibility)) ||
3097
3100
  agentKeys.some(key => !['visibility', 'examples', 'aliases', 'supportOperations', 'inputLookups', 'resultCard', 'inputCard'].includes(key)) ||
@@ -3105,7 +3108,8 @@ function validateBackendOperations(rawOperations, declaredResources, declaredRes
3105
3108
  !/^[a-z][a-z0-9]*(?:[-.][a-z0-9]+)*$/.test(String(operationCode))) ||
3106
3109
  (agent.visibility === 'support' && (supportOperations !== undefined || inputLookups !== undefined || resultCard !== undefined || inputCard !== undefined)) ||
3107
3110
  (resultCard !== undefined && (agent.visibility !== 'task' ||
3108
- Object.keys(object(resultCard)).some(key => !['title', 'fields'].includes(key)) ||
3111
+ Object.keys(object(resultCard)).some(key => !['title', 'fields', 'resource'].includes(key)) ||
3112
+ !validCardResource(object(resultCard).resource) ||
3109
3113
  typeof object(resultCard).title !== 'string' ||
3110
3114
  !object(resultCard).title.trim() ||
3111
3115
  object(resultCard).title.length > 80 ||
@@ -3118,7 +3122,8 @@ function validateBackendOperations(rawOperations, declaredResources, declaredRes
3118
3122
  typeof value.label !== 'string' || !value.label.trim() || value.label.length > 40;
3119
3123
  }))) ||
3120
3124
  (inputCard !== undefined && (agent.visibility !== 'task' ||
3121
- Object.keys(object(inputCard)).some(key => !['title', 'submitLabel', 'fields'].includes(key)) ||
3125
+ Object.keys(object(inputCard)).some(key => !['title', 'submitLabel', 'fields', 'resource'].includes(key)) ||
3126
+ !validCardResource(object(inputCard).resource) ||
3122
3127
  typeof object(inputCard).title !== 'string' ||
3123
3128
  !object(inputCard).title.trim() ||
3124
3129
  object(inputCard).title.length > 80 ||