feat: 完善标准 Skill 包底座

- 标准化 SKILL.md、资源模型、校验规则与安全限额

- 支持流式内容存储和单、多 Skill ZIP 双向编解码
This commit is contained in:
2026-07-27 18:53:24 +08:00
parent 6fa93bd671
commit c48d9a9da6
53 changed files with 7809 additions and 666 deletions

View File

@@ -1,17 +1,23 @@
package com.easyagents.skill.exception;
import com.easyagents.skill.validation.SkillValidationReport;
/**
* Skill 包导入导出异常。
*/
public class SkillPackageException extends SkillException {
private final String code;
private final String path;
private final SkillValidationReport report;
/**
* 创建 Skill 包异常。
*
* @param message 异常信息
*/
public SkillPackageException(String message) {
super(message);
this("SKILL_PACKAGE_FAILED", null, message, null, null);
}
/**
@@ -21,6 +27,62 @@ public class SkillPackageException extends SkillException {
* @param cause 原始异常
*/
public SkillPackageException(String message, Throwable cause) {
this("SKILL_PACKAGE_FAILED", null, message, cause, null);
}
/**
* 创建可定位的 Skill 包异常。
*
* @param code 稳定错误码
* @param path 包内路径
* @param message 异常信息
*/
public SkillPackageException(String code, String path, String message) {
this(code, path, message, null, null);
}
/**
* 创建包含根因的可定位 Skill 包异常。
*
* @param code 稳定错误码
* @param path 包内路径
* @param message 异常信息
* @param cause 原始异常
*/
public SkillPackageException(String code, String path, String message, Throwable cause) {
this(code, path, message, cause, null);
}
/**
* 创建包含结构化校验报告的 Skill 包异常。
*
* @param message 异常信息
* @param report 结构化校验报告
*/
public SkillPackageException(String message, SkillValidationReport report) {
this("SKILL_PACKAGE_INVALID", null, message, null, report);
}
private SkillPackageException(String code, String path, String message,
Throwable cause, SkillValidationReport report) {
super(message, cause);
this.code = code;
this.path = path;
this.report = report;
}
/** @return 稳定错误码 */
public String getCode() {
return code;
}
/** @return 包内路径 */
public String getPath() {
return path;
}
/** @return 结构化校验报告 */
public SkillValidationReport getReport() {
return report;
}
}

View File

@@ -1,17 +1,25 @@
package com.easyagents.skill.exception;
import com.easyagents.skill.validation.SkillValidationReport;
/**
* Skill 校验失败异常。
*/
public class SkillValidationException extends SkillException {
private final String code;
private final String path;
private final Integer line;
private final Integer column;
private final SkillValidationReport report;
/**
* 创建 Skill 校验异常。
*
* @param message 异常信息
*/
public SkillValidationException(String message) {
super(message);
this("SKILL_VALIDATION_FAILED", null, null, null, message, null, null);
}
/**
@@ -21,6 +29,77 @@ public class SkillValidationException extends SkillException {
* @param cause 原始异常
*/
public SkillValidationException(String message, Throwable cause) {
this("SKILL_VALIDATION_FAILED", null, null, null, message, cause, null);
}
/**
* 创建包含结构化报告的 Skill 校验异常。
*
* @param message 异常信息
* @param report 结构化校验报告
*/
public SkillValidationException(String message, SkillValidationReport report) {
this("SKILL_VALIDATION_FAILED", null, null, null, message, null, report);
}
/**
* 创建可定位的 Skill 校验异常。
*
* @param code 稳定错误码
* @param path 文件路径
* @param line 一基行号
* @param column 一基列号
* @param message 异常信息
* @param cause 原始异常
*/
public SkillValidationException(String code, String path, Integer line, Integer column,
String message, Throwable cause) {
this(code, path, line, column, message, cause, null);
}
/**
* 创建同时携带定位、根因和完整报告的 Skill 校验异常。
*
* @param code 稳定错误码
* @param path 文件路径
* @param line 一基行号
* @param column 一基列号
* @param message 异常信息
* @param cause 原始异常
* @param report 完整结构化校验报告
*/
public SkillValidationException(String code, String path, Integer line, Integer column,
String message, Throwable cause, SkillValidationReport report) {
super(message, cause);
this.code = code;
this.path = path;
this.line = line;
this.column = column;
this.report = report;
}
/** @return 稳定错误码 */
public String getCode() {
return code;
}
/** @return 文件路径 */
public String getPath() {
return path;
}
/** @return 一基行号 */
public Integer getLine() {
return line;
}
/** @return 一基列号 */
public Integer getColumn() {
return column;
}
/** @return 结构化校验报告 */
public SkillValidationReport getReport() {
return report;
}
}