unity-agent-tools 0.7.4 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.mjs +18 -5
- package/package.json +1 -1
package/dist/server.mjs
CHANGED
|
@@ -31834,8 +31834,9 @@ async function generateImage(request) {
|
|
|
31834
31834
|
}
|
|
31835
31835
|
});
|
|
31836
31836
|
}
|
|
31837
|
+
const finalPrompt = referenceImage ? `Edit the provided image according to these instructions: ${prompt}` : prompt;
|
|
31837
31838
|
parts.push({
|
|
31838
|
-
text:
|
|
31839
|
+
text: finalPrompt
|
|
31839
31840
|
});
|
|
31840
31841
|
const body = {
|
|
31841
31842
|
contents: [
|
|
@@ -32130,7 +32131,7 @@ function registerEditorPlatformResource(server, bridge) {
|
|
|
32130
32131
|
async function main() {
|
|
32131
32132
|
const server = new McpServer({
|
|
32132
32133
|
name: "unity-agent-tools",
|
|
32133
|
-
version: "0.7.
|
|
32134
|
+
version: "0.7.6"
|
|
32134
32135
|
});
|
|
32135
32136
|
const bridge = new UnityBridge("ws://localhost:8090");
|
|
32136
32137
|
const lspClient = new ShaderLspClient();
|
|
@@ -32161,11 +32162,23 @@ async function main() {
|
|
|
32161
32162
|
console.error("[UnityAgent] Invalid AI query: missing id or prompt");
|
|
32162
32163
|
return;
|
|
32163
32164
|
}
|
|
32165
|
+
let refImageData;
|
|
32166
|
+
if (params.referenceImagePath) {
|
|
32167
|
+
try {
|
|
32168
|
+
const { readFileSync: readFileSync3 } = await import("fs");
|
|
32169
|
+
refImageData = readFileSync3(params.referenceImagePath, "utf-8");
|
|
32170
|
+
console.error(`[NanoBanana] Reference image loaded from ${params.referenceImagePath}`);
|
|
32171
|
+
} catch (e) {
|
|
32172
|
+
console.error(`[NanoBanana] Failed to read reference image: ${e}`);
|
|
32173
|
+
}
|
|
32174
|
+
} else if (params.referenceImage) {
|
|
32175
|
+
refImageData = params.referenceImage;
|
|
32176
|
+
}
|
|
32164
32177
|
if (params.geminiApiKey) {
|
|
32165
32178
|
geminiConfig.apiKey = params.geminiApiKey;
|
|
32166
32179
|
geminiConfig.model = params.geminiModel || geminiConfig.model;
|
|
32167
|
-
geminiConfig.referenceImage =
|
|
32168
|
-
console.error(`[NanoBanana] Config updated: model=${geminiConfig.model}, hasRef=${!!
|
|
32180
|
+
geminiConfig.referenceImage = refImageData || void 0;
|
|
32181
|
+
console.error(`[NanoBanana] Config updated: model=${geminiConfig.model}, hasRef=${!!refImageData}`);
|
|
32169
32182
|
}
|
|
32170
32183
|
console.error(`[UnityAgent] AI query received (id=${id}): ${params.prompt.substring(0, 80)}...`);
|
|
32171
32184
|
try {
|
|
@@ -32176,7 +32189,7 @@ async function main() {
|
|
|
32176
32189
|
projectPath: params.projectPath,
|
|
32177
32190
|
geminiApiKey: params.geminiApiKey,
|
|
32178
32191
|
geminiModel: params.geminiModel,
|
|
32179
|
-
referenceImage:
|
|
32192
|
+
referenceImage: refImageData,
|
|
32180
32193
|
onChunk: (chunk) => {
|
|
32181
32194
|
bridge.sendRaw({ method: "ai/chunk", id, chunk });
|
|
32182
32195
|
},
|
package/package.json
CHANGED