@theprototype/agent 1.56.0 → 1.60.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theprototype/agent",
3
- "version": "1.56.0",
3
+ "version": "1.60.0",
4
4
  "description": "Let an AI agent (Claude Code, Claude Desktop, any MCP host) join a theprototype.app session from its link and build the 3D scene with you.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/catalog.js CHANGED
@@ -70,7 +70,33 @@ export const TOOL_ANNOTATIONS = /** @type {Record<string, {title: string, read?:
70
70
  connect: { title: 'Join a session', destructive: false, openWorld: true },
71
71
  // 86-fix N2: the connector's join — the person confirms in the tab; joining may replace what the tab shows
72
72
  join_session: { title: 'Join a session (asks the person)', destructive: true, openWorld: true },
73
- where_are_users: { title: 'Where the people are', read: true }
73
+ where_are_users: { title: 'Where the people are', read: true },
74
+ // 85-scene (85b)
75
+ create_hud: { title: 'Add a HUD', destructive: false },
76
+ edit_hud: { title: 'Change the HUD', destructive: true },
77
+ list_hud: { title: 'Read the HUD', read: true },
78
+ hud_panel: { title: 'Add a HUD panel', destructive: false },
79
+ set_sky: { title: 'Change the sky and fog', destructive: true },
80
+ set_light: { title: 'Change the scene light', destructive: true },
81
+ get_environment: { title: 'Read the sky and light', read: true },
82
+ place_spawn: { title: 'Set where Play starts', destructive: true },
83
+ set_play_camera: { title: 'Set the play camera and opening view', destructive: true },
84
+ // 85b 85-world
85
+ search_assets: { title: 'Find assets', read: true, openWorld: true },
86
+ place_asset: { title: 'Place an asset', destructive: false, openWorld: true },
87
+ prefab: { title: 'Save or place a prefab', destructive: false },
88
+ create_particles: { title: 'Add particles', destructive: true },
89
+ scatter: { title: 'Scatter over a surface', destructive: true },
90
+ terrain: { title: 'Make or shape terrain', destructive: true },
91
+ water: { title: 'Add or change water', destructive: true },
92
+ place_sound: { title: 'Place a sound', destructive: false, openWorld: true },
93
+ set_music: { title: 'Set the background music', destructive: true, openWorld: true },
94
+ update_mesh: { title: 'Change a mesh made from data', destructive: true },
95
+ // 85b R1-R4
96
+ inspect_runtime: { title: 'See what the game is doing', read: true },
97
+ validate_scene: { title: 'Check the game for problems', read: true },
98
+ logs: { title: 'Read the recent log', read: true },
99
+ playtest: { title: 'Play the game as a test player', destructive: false }
74
100
  });
75
101
 
76
102
  /** a title from a tool name: `create_objects` → `Create objects` @param {string} name */
@@ -123,7 +149,7 @@ export const GUIDANCE = [
123
149
  },
124
150
  { line: 'Call list_scene before editing so you use real uuids; batch many objects into one call.', on: ['list_scene', 'create_objects', 'update_objects'] },
125
151
  {
126
- line: 'For "in front of me", "here" or "this", call where_are_users and build at the spots it gives, facing the person.',
152
+ line: 'For "in front of me", call where_are_users and build at the spots it gives, facing the person (face_user: true). For "here" or "this", build at the person\'s latest ping: at: {ping: "latest"}; ask them to ping (Ctrl+Alt+click, or Ping in the menu) if they have none.',
127
153
  on: ['where_are_users', 'create_objects']
128
154
  },
129
155
  { line: 'For "give me a flashlight" or another prop, make the object, then attach_to_user to the person who asked.', on: ['attach_to_user'] },
@@ -217,28 +243,31 @@ export function buildCatalog(hostTools, opts = {}) {
217
243
  * {...}}` back into the fine tool before relaying): the tab, local agents and `serve` keep the fine names.
218
244
  * `actions` maps an action to the fine tool it runs. The action's fields go in an object named after the action,
219
245
  * which carries the fine tool's own schema and description, so nothing about a tool is lost by grouping it.
220
- * Reserved, not built yet: edit_shape `update` (G6b update_mesh), assets search / place / prefab (85-world, 85b),
221
- * set_look environment / sky / light (85-scene, 85b), create_shape from_image (73's image-to-3D is generate_mesh,
222
- * which the connector leaves out).
223
- * @type {Readonly<Record<string, {title: string, summary: string, actions: Record<string, string>}>>}
246
+ * mcp-shapes: a family may also have a BATCH — `batch: {key, tool}` — called as `{<key>: [...]}` with no action
247
+ * (create_shape {shapes: [{action, mesh: {...}}, ...]}); the families map carries it as action `<key>`.
248
+ * 85b built edit_shape `update` (G6b update_mesh), assets search / place / prefab and the effects family (85-world),
249
+ * set_look sky / light / environment (environment = the read), hud and game_setup (85-scene). Reserved, not built
250
+ * yet: create_shape from_image (73's image-to-3D is generate_mesh, which the connector leaves out).
251
+ * @type {Readonly<Record<string, {title: string, summary: string, actions: Record<string, string>, batch?: {key: string, tool: string}}>>}
224
252
  */
225
253
  export const CONNECTOR_FAMILIES = Object.freeze({
226
254
  create_shape: {
227
255
  title: 'Make a shape',
228
256
  summary:
229
257
  'Make shapes the basic objects cannot: a lathe (a vase, a bowl, a lamp from a profile turned around an axis), a tube along a path (a rail, a pipe, a cable), an extruded outline (a sign, a star, a wall with a hole), or a mesh from your own vertices (anything else).',
230
- actions: { lathe: 'create_lathe', tube: 'create_tube', extrude: 'extrude_shape', mesh: 'create_mesh' }
258
+ actions: { lathe: 'create_lathe', tube: 'create_tube', extrude: 'extrude_shape', mesh: 'create_mesh' },
259
+ batch: { key: 'shapes', tool: 'create_shapes' }
231
260
  },
232
261
  edit_shape: {
233
262
  title: 'Reshape or model objects',
234
263
  summary:
235
- 'Change the shape of objects that exist: params = new size / segments / type in place, mesh = model faces and vertices (extrude, inset, bevel, subdivide, weld, smooth, dissolve, make a face), pivot = the point an object turns about, pivot_group = a group at a joint so several parts swing together.',
236
- actions: { params: 'set_geometry', mesh: 'edit_mesh', pivot: 'set_pivot', pivot_group: 'create_pivot' }
264
+ 'Change the shape of objects that exist: params = new size / segments / type in place, mesh = model faces and vertices (extrude, inset, bevel, subdivide, weld, smooth, dissolve, make a face), update = new vertices / faces for a mesh made from data (replace it, or patch a range), pivot = the point an object turns about, pivot_group = a group at a joint so several parts swing together.',
265
+ actions: { params: 'set_geometry', mesh: 'edit_mesh', update: 'update_mesh', pivot: 'set_pivot', pivot_group: 'create_pivot' }
237
266
  },
238
267
  set_look: {
239
- title: 'Materials, shaders, UVs and post effects',
268
+ title: 'Materials, shaders, sky, light and post effects',
240
269
  summary:
241
- 'How things look: material = colour, roughness, metal, glow, see-through and textures (a library image, a CC0 material by name or an https image); list_materials / get_material read them; shader / edit_shader / assign_shader / shader_nodes = node shaders on objects; post / get_post / post_graph = the scene\'s post effects (bloom, colour grade, vignette; the host is asked first); unwrap / uv = texture mapping and tiling.',
270
+ 'How things look: material = colour, roughness, metal, glow, see-through and textures (a library image, a CC0 material by name or an https image); list_materials / get_material read them; shader / edit_shader / assign_shader / shader_nodes = node shaders on objects; sky = the sky image, background, fog and exposure; light = the sun, ambient and environment lights; environment reads both; post / get_post / post_graph = the scene\'s post effects (bloom, colour grade, vignette); sky, light and post change the whole scene, so the host is asked first; unwrap / uv = texture mapping and tiling.',
242
271
  actions: {
243
272
  material: 'set_material',
244
273
  list_materials: 'list_materials',
@@ -251,13 +280,46 @@ export const CONNECTOR_FAMILIES = Object.freeze({
251
280
  get_post: 'get_post',
252
281
  post_graph: 'create_post_graph',
253
282
  unwrap: 'uv_unwrap',
254
- uv: 'set_uv'
283
+ uv: 'set_uv',
284
+ sky: 'set_sky',
285
+ light: 'set_light',
286
+ environment: 'get_environment'
255
287
  }
256
288
  },
289
+ // 85b R1-R4 (lane 85-runtime): playtest is agent-page only (B4b), so the connector's `run` has no playtest;
290
+ // play / stop stay control_simulation's (K1: start Play only when the person asks)
291
+ run: {
292
+ title: 'See and check what the game does',
293
+ summary:
294
+ "What the game does when it runs: inspect = when each event and action last fired, the game state and variables, errors, and why a node did not fire (pass node or object); validate = what would not work when someone presses Play, each with its fix; logs = the tab's recent errors, warnings and toasts.",
295
+ actions: { inspect: 'inspect_runtime', validate: 'validate_scene', logs: 'logs' }
296
+ },
257
297
  assets: {
258
298
  title: 'Images and assets',
259
- summary: 'The shared library: image = put an image into it (an https URL, base64 data, or a canvas you describe) and get its hash for textures.',
260
- actions: { image: 'add_image' }
299
+ summary:
300
+ 'Assets to build with: search = find models, prefabs, sounds, images, CC0 materials and HDRIs by words (library, packs, Poly Haven); place = put a found model or prefab into the scene; prefab = keep objects as a reusable prefab, or place copies of one; image = put an image into the library (an https URL, base64 data, or a canvas you describe) and get its hash for textures.',
301
+ actions: { search: 'search_assets', place: 'place_asset', prefab: 'prefab', image: 'add_image' }
302
+ },
303
+ // 85b (1.60, the tool budget's effects row)
304
+ effects: {
305
+ title: 'Terrain, scatter, water, particles and sound',
306
+ summary:
307
+ 'The world around the build: terrain = make or shape ground (noise hills, sculpt, paint layers); scatter = many trees, rocks or flowers over a terrain or mesh, with slope / height rules; water = a pool, lake or ocean, or make an object water; particles = fire, smoke, sparkles, fireflies, rain, snow … by preset; sound = a positional sound (looping, or on click / enter); music = the scene\'s background track.',
308
+ actions: { terrain: 'terrain', scatter: 'scatter', water: 'water', particles: 'create_particles', sound: 'place_sound', music: 'set_music' }
309
+ },
310
+ // 85-scene (85b): 85 H1 / H2 + the panel shape 67's scene panels reuse
311
+ hud: {
312
+ title: 'Game HUD',
313
+ summary:
314
+ 'The game\'s 2D screen overlay: create = screens of elements (timer, score text, bars, buttons, images) and their ids; list = what is there and what each element is bound to; update = change, move or remove elements and screens; panel = a backdrop with rows (a menu, a scoreboard). Bind live values with hudtext / hudbar / hudtimer flow nodes whose element is an id.',
315
+ actions: { create: 'create_hud', list: 'list_hud', update: 'edit_hud', panel: 'hud_panel' }
316
+ },
317
+ // 85-scene (85b): 85 H3 + H6; levels / portal / loading / checkpoint join with 91 / 93
318
+ game_setup: {
319
+ title: 'Game setup: spawn and play camera',
320
+ summary:
321
+ 'How the game starts: spawn = where Play starts and which way the player faces; play_camera = first person walking or flying (speed, jump, eye height) and openingView = where the editor camera starts when the scene opens.',
322
+ actions: { spawn: 'place_spawn', play_camera: 'set_play_camera' }
261
323
  }
262
324
  });
263
325
 
@@ -294,8 +356,10 @@ export const CONNECTOR_STANDALONE = Object.freeze([
294
356
  /** fine tool → `family {action}` wording, for text the connector's model reads @returns {Map<string, string>} */
295
357
  export function familyNames() {
296
358
  const out = new Map();
297
- for (const [family, f] of Object.entries(CONNECTOR_FAMILIES))
359
+ for (const [family, f] of Object.entries(CONNECTOR_FAMILIES)) {
298
360
  for (const [action, tool] of Object.entries(f.actions)) out.set(tool, family + " {action: '" + action + "'}");
361
+ if (f.batch) out.set(f.batch.tool, family + ' {' + f.batch.key + ': […]}');
362
+ }
299
363
  return out;
300
364
  }
301
365
 
@@ -314,7 +378,7 @@ export function sayFamilyNames(text) {
314
378
  export function connectorView(plain, excluded) {
315
379
  const byName = new Map(plain.map((t) => [t.name, t]));
316
380
  const familyOf = new Map();
317
- for (const [family, f] of Object.entries(CONNECTOR_FAMILIES)) for (const tool of Object.values(f.actions)) familyOf.set(tool, family);
381
+ for (const [family, f] of Object.entries(CONNECTOR_FAMILIES)) for (const tool of [...Object.values(f.actions), ...(f.batch ? [f.batch.tool] : [])]) familyOf.set(tool, family);
318
382
  const stray = plain.map((t) => t.name).filter((n) => !CONNECTOR_STANDALONE.includes(n) && !familyOf.has(n) && !excluded.includes(n));
319
383
  if (stray.length)
320
384
  throw new Error('tools with no place in the connector (tools/agent/src/catalog.js CONNECTOR_FAMILIES / CONNECTOR_STANDALONE / CONNECTOR_BLOCKED_TOOLS): ' + stray.join(', '));
@@ -334,8 +398,16 @@ export function connectorView(plain, excluded) {
334
398
  for (const [family, f] of Object.entries(CONNECTOR_FAMILIES)) {
335
399
  const actions = Object.entries(f.actions).filter(([, tool]) => byName.has(tool));
336
400
  if (!actions.length) continue;
337
- families[family] = Object.fromEntries(actions);
338
- list.push(familyTool(family, f, actions.map(([action, tool]) => [action, /** @type {any} */ (byName.get(tool))])));
401
+ const batch = f.batch && byName.has(f.batch.tool) ? f.batch : null;
402
+ families[family] = { ...Object.fromEntries(actions), ...(batch ? { [batch.key]: batch.tool } : {}) };
403
+ list.push(
404
+ familyTool(
405
+ family,
406
+ f,
407
+ actions.map(([action, tool]) => [action, /** @type {any} */ (byName.get(tool))]),
408
+ batch ? { key: batch.key, tool: /** @type {any} */ (byName.get(batch.tool)) } : null
409
+ )
410
+ );
339
411
  }
340
412
  }
341
413
  const tools = withGuidance(list);
@@ -344,25 +416,33 @@ export function connectorView(plain, excluded) {
344
416
 
345
417
  /**
346
418
  * One family as one MCP tool. `{action, <action>: {...}}`; the per-action object has the fine tool's own schema.
419
+ * A batch (mcp-shapes) adds its list at the top level — `{<key>: [...]}`, no action — so `action` is then optional.
347
420
  * @param {string} family @param {{title: string, summary: string}} f @param {[string, any][]} actions
421
+ * @param {{key: string, tool: any} | null} [batch]
348
422
  */
349
- function familyTool(family, f, actions) {
423
+ function familyTool(family, f, actions, batch = null) {
350
424
  /** @type {Record<string, any>} */
351
425
  const properties = {
352
426
  action: { type: 'string', enum: actions.map(([a]) => a), description: 'What to do. Put its fields in the object named after the action.' }
353
427
  };
354
428
  for (const [action, t] of actions) properties[action] = { ...t.inputSchema, description: sayFamilyNames(t.description) };
355
429
  const example = actions[0][0];
356
- const description =
430
+ let description =
357
431
  f.summary + '\nCall it as {"action": "' + example + '", "' + example + '": {…its fields…}}; each action\'s fields and limits are in its object below.';
358
- const edits = actions.filter(([, t]) => !t.annotations.readOnlyHint);
432
+ if (batch) {
433
+ const list = batch.tool.inputSchema?.properties?.[batch.key];
434
+ properties[batch.key] = { ...(list ?? { type: 'array' }), description: sayFamilyNames(batch.tool.description) };
435
+ description += '\nMany at once: {"' + batch.key + '": [{"action": "' + example + '", "' + example + '": {…}}, …]} with no action — one call, one undo step.';
436
+ }
437
+ const all = batch ? [...actions, [batch.key, batch.tool]] : actions;
438
+ const edits = all.filter(([, t]) => !t.annotations.readOnlyHint);
359
439
  const annotations = {
360
440
  title: f.title,
361
441
  readOnlyHint: false,
362
442
  destructiveHint: edits.some(([, t]) => t.annotations.destructiveHint !== false),
363
- openWorldHint: actions.some(([, t]) => t.annotations.openWorldHint === true)
443
+ openWorldHint: all.some(([, t]) => t.annotations.openWorldHint === true)
364
444
  };
365
- return { name: family, title: f.title, description, inputSchema: { type: 'object', properties, required: ['action'] }, annotations };
445
+ return { name: family, title: f.title, description, inputSchema: { type: 'object', properties, ...(batch ? {} : { required: ['action'] }) }, annotations };
366
446
  }
367
447
 
368
448
  /**
@@ -374,6 +454,9 @@ function familyTool(family, f, actions) {
374
454
  export function resolveFamilyCall(families, name, args) {
375
455
  const actions = families?.[name];
376
456
  if (!actions) return null;
457
+ // mcp-shapes: a batch is called with its list and no action (create_shape {shapes: [...]})
458
+ const batchKey = typeof args?.action !== 'string' ? Object.keys(actions).find((k) => Array.isArray(args?.[k])) : undefined;
459
+ if (batchKey) return { tool: actions[batchKey], args: { [batchKey]: args[batchKey] } };
377
460
  const action = typeof args?.action === 'string' ? args.action : '';
378
461
  const tool = actions[action];
379
462
  if (!tool) return { error: name + ' needs an action: one of ' + Object.keys(actions).join(', ') + '.' };
package/src/mcpTools.js CHANGED
@@ -77,7 +77,7 @@ export function bridgeTools(engine = 'browser') {
77
77
  {
78
78
  name: 'status',
79
79
  description:
80
- 'Where the agent is: connection state, whether the host has let it in, its role (viewer edits stay local), the app version, and why any tool is missing.',
80
+ 'Where the agent is: connection state, whether the host has let it in, its role (viewer edits stay local), the app version, and why any tool is missing. sceneBudget says how heavy the scene is: objects, triangles (per frame drawn; the scene\'s own count while the view is idle, then no draw calls), draw calls, textures, lights you placed, frame time p95, tier green / amber / red on the desktop or vr profile, and over = each budget past green (build lighter, or stop adding, while it is not green).',
81
81
  inputSchema: { type: 'object', properties: {} }
82
82
  }
83
83
  ];
@@ -150,8 +150,15 @@ export const WHERE_ARE_USERS_TOOL = {
150
150
  description:
151
151
  'Where each person in the session is and which way they look (their desktop camera, or the VR headset): position, facing as a compass yaw ' +
152
152
  'plus forward and right vectors, the floor under them, and ready-made spots 1.5 m and 3 m in front of them at floor level. ' +
153
- 'The entry with "you": true is the person you act as. Use it for "in front of me", "around me", "behind me", "to my left".',
154
- inputSchema: { type: 'object', properties: {} }
153
+ 'The entry with "you": true is the person you act as. Use it for "in front of me", "around me", "behind me", "to my left". ' +
154
+ 'A person can PING a spot (Ctrl+Alt+click, Ping in a menu, the VR stick click): each row carries their latestPing, and pings: true lists the ' +
155
+ 'recent ones (2 minutes). For "put it here", build with create_objects / update_objects at: {ping: "latest"} (align: "surface" for a wall). ' +
156
+ 'Each row also has body (eye, height, shoulder, hip, knee, reach, room — "a table at hip height") and, in VR, hands (left, right, apart — "as wide as my hands"). ' +
157
+ 'Nothing you make may appear inside a person in VR (0.45 m around the head, through the body): that call is refused and says so.',
158
+ inputSchema: {
159
+ type: 'object',
160
+ properties: { pings: { type: 'boolean', description: 'also list the recent pings (85b S2): id, who, how long ago, position, surface normal, the object it is on' } }
161
+ }
155
162
  };
156
163
 
157
164
  /** @returns {any[]} */