This commit is contained in:
@@ -5,7 +5,6 @@ import {
|
||||
ToolResult,
|
||||
ToolsConfig,
|
||||
ALL_TOOL_DEFS,
|
||||
getToolDefs as getCoreToolDefs,
|
||||
executeCoreTools,
|
||||
runtimeLogsDir,
|
||||
} from './core.js';
|
||||
@@ -62,6 +61,7 @@ let _checklistModule: ToolModule | null | undefined = undefined;
|
||||
let _msLearnModule: ToolModule | null | undefined = undefined;
|
||||
let _slideModule: ToolModule | null | undefined = undefined;
|
||||
let _userFolderModule: ToolModule | null | undefined = undefined;
|
||||
let _appTestModule: ToolModule | null | undefined = undefined;
|
||||
|
||||
async function getWebModule(): Promise<ToolModule | null> {
|
||||
if (_webModule === undefined) {
|
||||
@@ -280,6 +280,14 @@ async function getCalendarModule(): Promise<ToolModule | null> {
|
||||
return _calendarModule;
|
||||
}
|
||||
|
||||
async function getAppTestModule(): Promise<ToolModule | null> {
|
||||
if (_appTestModule === undefined) {
|
||||
_appTestModule = await tryLoadModule('./app-test.js');
|
||||
if (_appTestModule) logger.debug('[tools/index] app-test module loaded');
|
||||
}
|
||||
return _appTestModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* 全モジュールのツール定義を統合して返す。
|
||||
* allowedTools と editAllowed に応じてフィルタリングする。
|
||||
@@ -365,6 +373,9 @@ export async function getToolDefs(
|
||||
const calendarMod = await getCalendarModule();
|
||||
if (calendarMod) Object.assign(allDefs, calendarMod.TOOL_DEFS);
|
||||
|
||||
const appTestMod = await getAppTestModule();
|
||||
if (appTestMod) Object.assign(allDefs, appTestMod.TOOL_DEFS);
|
||||
|
||||
const { TOOL_DEFS: skillToolDefs } = await import('./skills.js');
|
||||
Object.assign(allDefs, skillToolDefs);
|
||||
|
||||
@@ -397,7 +408,7 @@ export async function getToolDefs(
|
||||
// - ReadAppDoc / ListAppDocs / GetMyOrchestratorState: Help アシスタント用 (#help piece)
|
||||
// ただし他の piece からも参照できるようにメタ扱い
|
||||
// - RequestTool: 足りないツールの要求を記録(タスク詳細/ピース集計で可視化)
|
||||
const META_TOOLS = ['ReadToolDoc', 'CreateChecklist', 'CheckItem', 'GetChecklist', 'MissionUpdate', 'ListUserAssets', 'RunUserScript', 'UpdateUserMemory', 'ReadUserMemory', 'ReadUserAgents', 'UpdateUserAgents', 'ReadUserTemplate', 'RenderUserTemplate', 'WriteUserScript', 'WriteUserTemplate', 'Brainstorm', 'ReadAppDoc', 'ListAppDocs', 'GetMyOrchestratorState', 'ReadSkill', 'ListSkills', 'InstallSkill', 'RequestTool'];
|
||||
const META_TOOLS = ['ReadToolDoc', 'CreateChecklist', 'CheckItem', 'GetChecklist', 'MissionUpdate', 'ListUserAssets', 'RunUserScript', 'UpdateUserMemory', 'ReadUserMemory', 'ReadUserAgents', 'UpdateUserAgents', 'WriteUserScript', 'Brainstorm', 'ReadAppDoc', 'ListAppDocs', 'GetMyOrchestratorState', 'ReadSkill', 'ListSkills', 'InstallSkill', 'RequestTool'];
|
||||
const effectiveAllowed = [...allowedTools];
|
||||
for (const meta of META_TOOLS) {
|
||||
if (!effectiveAllowed.includes(meta) && meta in allDefs) {
|
||||
@@ -645,6 +656,13 @@ async function executeToolInner(
|
||||
if (calendarResult !== null) return calendarResult;
|
||||
}
|
||||
|
||||
// app-test ツール (TestWorkspaceApp)
|
||||
const appTestMod = await getAppTestModule();
|
||||
if (appTestMod) {
|
||||
const appTestResult = await appTestMod.executeTool(name, input, ctx);
|
||||
if (appTestResult !== null) return appTestResult;
|
||||
}
|
||||
|
||||
// skills ツール (ReadSkill)
|
||||
const { executeSkillTool } = await import('./skills.js');
|
||||
const skillResult = executeSkillTool(name, input, ctx);
|
||||
@@ -685,6 +703,3 @@ export async function executeTool(
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// 同期版 getToolDefs のラッパー(後方互換のため、コアツールのみを返す同期版)
|
||||
export { getCoreToolDefs as getCoreToolDefs };
|
||||
|
||||
Reference in New Issue
Block a user