@openbone/mcp 0.4.4 → 0.4.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/bridge.js CHANGED
@@ -9,7 +9,7 @@ import { isLocalRequest } from "./local-only.js";
9
9
  *
10
10
  * Messages (JSON):
11
11
  * editor → server: {type:"hello", doc?} | {type:"op", op, args} | {type:"undo"} | {type:"redo"} | {type:"load", doc}
12
- * server → editor: {type:"load", doc, path} | {type:"ops", ops} | {type:"error", message}
12
+ * server → editor: {type:"load", doc, path} | {type:"synced"} (took over the hello's scene) | {type:"ops", ops} | {type:"error", message}
13
13
  * | {type:"files", files:[{src, kind, mime, base64}]}
14
14
  *
15
15
  * The server stores imported art and sound as paths relative to the project file, which the editor (a web page, or
@@ -17,8 +17,9 @@ import { isLocalRequest } from "./local-only.js";
17
17
  * server sends the file's bytes ("files"), and the editor shows and plays them from memory.
18
18
  *
19
19
  * Connecting never replaces the editor's scene with an empty one: the editor's hello carries its document, and a
20
- * server that has no project yet (nothing created, opened or edited) takes it over and waits for the agent. A server
21
- * already working on a project sends that project instead.
20
+ * server that has no project yet (nothing created, opened or edited) takes it over, answers "synced" and waits for the
21
+ * agent. A server already working on a project sends that project, and the editor asks whether to open it or send its
22
+ * own scene ("load", which detaches the server from its project file so autosave never overwrites it).
22
23
  */
23
24
  const MEDIA = {
24
25
  ttf: { kind: "font", mime: "font/ttf" },
@@ -132,6 +133,7 @@ export function startBridge(session, port, log) {
132
133
  sentFiles.delete(ws); // a fresh editor page: send every file again
133
134
  if (msg.doc && session.pristine) {
134
135
  session.store.load(msg.doc, "bridge");
136
+ send(ws, { type: "synced" });
135
137
  log("bridge: took over the editor's open project");
136
138
  }
137
139
  else {
@@ -145,8 +147,11 @@ export function startBridge(session, port, log) {
145
147
  session.store.undo();
146
148
  else if (msg.type === "redo")
147
149
  session.store.redo();
148
- else if (msg.type === "load" && msg.doc)
150
+ else if (msg.type === "load" && msg.doc) {
151
+ // The editor's scene, not the project file the server had open: never autosave it over that file.
152
+ session.filePath = null;
149
153
  session.store.load(msg.doc, "bridge");
154
+ }
150
155
  await session.maybeAutosave();
151
156
  }
152
157
  catch (e) {
package/dist/server.js CHANGED
@@ -30,7 +30,7 @@ export function createServer(opts = {}) {
30
30
  const session = opts.session ?? new ProjectSession();
31
31
  let host = opts.scriptHost;
32
32
  const scriptHost = async () => (host ??= await createQuickJsHost({ timeoutMs: 50 }));
33
- const server = new McpServer({ name: "openbone", version: "0.4.4" }, {
33
+ const server = new McpServer({ name: "openbone", version: "0.4.6" }, {
34
34
  instructions: "OpenBone: 2D skeletal animation + interactive state machines. Read the openbone://guide resource (or call get_guide) first. Start with new_project or open_project; edit with the add_*/update_*/set_keys tools; verify with render_frame and simulate_state_machine.",
35
35
  });
36
36
  // ---------- Generated edit tools (one per core op) ----------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openbone/mcp",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "MCP server for OpenBone: let AI agents rig, animate and wire up interactive skeletal animations",
5
5
  "keywords": [
6
6
  "openbone",
@@ -52,12 +52,12 @@
52
52
  "gifenc": "^1.0.3",
53
53
  "ws": "^8.18.0",
54
54
  "zod": "^4.1.0",
55
- "@openbone/core": "0.4.4",
56
- "@openbone/export": "0.4.4",
57
- "@openbone/render-canvas": "0.4.4",
58
- "@openbone/runtime": "0.4.4",
59
- "@openbone/player": "0.4.4",
60
- "@openbone/scripting": "0.4.4"
55
+ "@openbone/core": "0.4.6",
56
+ "@openbone/runtime": "0.4.6",
57
+ "@openbone/render-canvas": "0.4.6",
58
+ "@openbone/scripting": "0.4.6",
59
+ "@openbone/player": "0.4.6",
60
+ "@openbone/export": "0.4.6"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/ws": "^8.18.1"