Guanghu Domestic Migration d1e47f4565
Some checks are pending
自动更新代码和重启 / update-and-restart (push) Waiting to run
CI检查 + 自动部署 / check (push) Waiting to run
CI检查 + 自动部署 / deploy (push) Blocked by required conditions
重启聊天服务 / restart (push) Waiting to run
chore: import sanitized domestic snapshot for REPO-002
Source snapshot: ca48d3ddf926d79aa138306164169baf764bb829
2026-07-17 15:54:41 +08:00

68 lines
2.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* ═══════════════════════════════════════════════════════════
* MCP 工具 · COS 双桶操作cosWrite / cosRead / cosDelete / cosList / cosArchive
* + 人格体COS隔离路径操作personaCosWrite / personaCosRead / personaCosList
* ═══════════════════════════════════════════════════════════
*
* 签发: 铸渊 · ICE-GL-ZY001
* 版权: 国作登字-2026-A-00037559
*/
'use strict';
const cos = require('../cos');
async function cosWrite(input) {
const { bucket, key, content, content_type } = input;
return cos.write(bucket, key, content, content_type);
}
async function cosRead(input) {
const { bucket, key } = input;
return cos.read(bucket, key);
}
async function cosDelete(input) {
const { bucket, key } = input;
return cos.del(bucket, key);
}
async function cosList(input) {
const { bucket, prefix, limit } = input;
return cos.list(bucket, prefix, limit);
}
async function cosArchive(input) {
const { source_key, version_tag } = input;
return cos.archive(source_key, version_tag);
}
// ─── 人格体 COS 隔离路径操作 ───
// 每个人格体只能访问 /{persona_id}/ 目录下的对象
async function personaCosWrite(input) {
const { persona_id, key, content, content_type } = input;
if (!persona_id) throw new Error('缺少 persona_id');
if (!key) throw new Error('缺少 key');
if (!content) throw new Error('缺少 content');
return cos.personaWrite(persona_id, key, content, content_type);
}
async function personaCosRead(input) {
const { persona_id, key } = input;
if (!persona_id) throw new Error('缺少 persona_id');
if (!key) throw new Error('缺少 key');
return cos.personaRead(persona_id, key);
}
async function personaCosList(input) {
const { persona_id, prefix, limit } = input;
if (!persona_id) throw new Error('缺少 persona_id');
return cos.personaList(persona_id, prefix, limit);
}
module.exports = {
cosWrite, cosRead, cosDelete, cosList, cosArchive,
personaCosWrite, personaCosRead, personaCosList
};