feat: add HoloLake personal channel module runtime
This commit is contained in:
parent
bb96d5eb89
commit
a106b23f9b
21 changed files with 786 additions and 31 deletions
|
|
@ -185,6 +185,34 @@ export class PersonaAgent {
|
|||
execute: async () => JSON.stringify(await this.git.getRepositoryStatus(), null, 2),
|
||||
});
|
||||
|
||||
this.tools.register({
|
||||
name: 'inspect_channel',
|
||||
description: '读取当前个人初始化频道的模块安装与挂载状态(只读)',
|
||||
parameters: {},
|
||||
effect: 'read',
|
||||
execute: async () => JSON.stringify(await this.git.getChannelState(), null, 2),
|
||||
});
|
||||
|
||||
this.tools.register({
|
||||
name: 'set_channel_module_state',
|
||||
description: '安装、打开、收起或移除已在光湖注册表登记的频道模块;执行前必须由人类确认',
|
||||
parameters: {
|
||||
moduleId: { type: 'string', description: '光湖稳定模块编号', required: true },
|
||||
installed: { type: 'boolean', description: '是否安装;不改变时可以省略', required: false },
|
||||
mounted: { type: 'boolean', description: '是否在当前频道展开;不改变时可以省略', required: false },
|
||||
},
|
||||
effect: 'write',
|
||||
execute: async (params) => {
|
||||
const receipt = await this.git.applyChannelPatch({
|
||||
operation: 'set_module_state',
|
||||
moduleId: String(params.moduleId || ''),
|
||||
installed: typeof params.installed === 'boolean' ? params.installed : undefined,
|
||||
mounted: typeof params.mounted === 'boolean' ? params.mounted : undefined,
|
||||
});
|
||||
return `频道状态已更新;回执 ${receipt.id};当前修订 ${receipt.after.revision}`;
|
||||
},
|
||||
});
|
||||
|
||||
// 读取知识库文档
|
||||
this.tools.register({
|
||||
name: 'read_document',
|
||||
|
|
@ -465,7 +493,7 @@ ${toolsList}
|
|||
if (!tool || tool.effect === 'read') {
|
||||
return { id: call.id, name: call.name, output: '', error: `动作不可登记: ${call.name}` };
|
||||
}
|
||||
const target = String(call.arguments.path || call.arguments.title || '当前知识库');
|
||||
const target = String(call.arguments.path || call.arguments.moduleId || call.arguments.title || '当前知识库');
|
||||
const actionId = `action-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`;
|
||||
const action: PendingAction = {
|
||||
id: actionId,
|
||||
|
|
@ -641,6 +669,8 @@ export function createDefaultPersona(git: GitEngine): PersonaAgent {
|
|||
systemPromptBase: '你是 HoloLake 官方语言操作入口的当前模型计算实例。语言协议、权限边界、路径校验和可核验回执高于模型自由发挥。',
|
||||
tools: [
|
||||
'inspect_repository',
|
||||
'inspect_channel',
|
||||
'set_channel_module_state',
|
||||
'read_document',
|
||||
'create_document',
|
||||
'update_document',
|
||||
|
|
|
|||
Loading…
Reference in a new issue