资源登记草稿的推断 kind 收敛到 canonical 词汇

- projectArtifactSummaries.ts:inferProjectFileAssetDraft 的 json 分支由 data 改为 document、判不出扩展名时由 asset 改为 unknown,与 Rust 侧 uploaded_asset_kind 同口径——/asset-register 的 kind 会原样进 register_local_asset 的严格解析,写非 canonical 值只会被判成认不出并留痕。
This commit is contained in:
2026-09-17 15:46:34 +08:00
parent b0ce384b8d
commit a86ead93e4
@@ -311,7 +311,7 @@ export function inferProjectFileAssetDraft(
};
}
if (extension === 'json') {
return { localPath, kind: 'data', mediaType: 'application/json' };
return { localPath, kind: 'document', mediaType: 'application/json' };
}
if (extension === 'html') {
return { localPath, kind: 'document', mediaType: 'text/html' };
@@ -319,7 +319,10 @@ export function inferProjectFileAssetDraft(
if (['txt', 'md', 'csv'].includes(extension)) {
return { localPath, kind: 'document', mediaType: 'text/plain' };
}
return { localPath, kind: 'asset', mediaType: 'application/octet-stream' };
// 判不出内容类型就写 `unknown`(→「待归类」),与 Rust 侧 `uploaded_asset_kind` 同口径:
// `/asset-register` 的 kind 会原样进 `register_local_asset` 的严格解析,写 `data` / `asset`
// 这类非 canonical 值只会被判成"认不出"并留痕,不能靠它表达"这是数据 / 这是资产"。
return { localPath, kind: 'unknown', mediaType: 'application/octet-stream' };
}
export function projectAssetDraftCommand(draft: ProjectAssetDraft) {