feat(canvas): restructure source directory for Canvas Agent, enhancing code maintainability

This commit is contained in:
HouYunFei
2026-07-29 10:47:06 +08:00
parent 92fd0ce129
commit 40c47dd7ff
20 changed files with 3095 additions and 777 deletions
+11
View File
@@ -0,0 +1,11 @@
export type JsonRecord = Record<string, unknown>;
/** 安全读取未知对象中的指定字段。 */
export function field(value: unknown, key: string) {
return value && typeof value === "object" ? (value as JsonRecord)[key] : undefined;
}
/** 将未知异常转换为可展示的错误信息。 */
export function errorMessage(error: unknown) {
return error instanceof Error ? error.message : String(error);
}