Release v0.1.2

This commit is contained in:
winlifes
2026-04-30 18:12:29 +08:00
parent 8c46313ac6
commit a903f7f0af
12 changed files with 423 additions and 24 deletions
+13 -7
View File
@@ -14,6 +14,7 @@ const {
} = require('./assets');
const { runScriptDiagnostics } = require('./diagnostics');
const { listWindows, sendKeyCombo, sendKeyPress, sendMouseClick, sendMouseDrag } = require('./input');
const { resolveProjectPath } = require('./path-safety');
const { captureDesktopScreenshot, captureEditorWindowScreenshot, capturePanelScreenshot } = require('./screenshots');
const { safeStringify } = require('./utils');
@@ -35,10 +36,6 @@ function toOutput(value) {
return safeStringify(value);
}
function resolveProjectPath(projectPath, rawPath) {
return path.isAbsolute(rawPath) ? rawPath : path.join(projectPath, rawPath);
}
function matchesPattern(fileName, pattern) {
const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
return new RegExp(`^${escaped}$`, 'i').test(fileName);
@@ -1249,7 +1246,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
},
];
return {
const registry = {
listTools() {
const { config } = getRuntimeContext();
return tools
@@ -1260,7 +1257,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
inputSchema: tool.inputSchema,
}));
},
async callTool(name, args) {
async callToolDetailed(name, args) {
const { config } = getRuntimeContext();
const tool = tools.find((item) => item.name === name);
if (!tool) {
@@ -1274,13 +1271,22 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
const result = await tool.handler(args || {});
const output = toOutput(result);
interactionLog.add(name, 'success', output.slice(0, 500));
return output;
return {
value: result,
text: output,
};
} catch (error) {
interactionLog.add(name, 'error', error.message);
throw error;
}
},
async callTool(name, args) {
const result = await registry.callToolDetailed(name, args);
return result.text;
},
};
return registry;
}
module.exports = {