@theprototype/agent 1.59.0 → 1.61.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/catalog.json +7032 -2608
- package/package.json +1 -1
- package/src/browserEngine.js +10 -2
- package/src/catalog.js +117 -17
- package/src/mcpServer.js +9 -2
- package/src/mcpTools.js +22 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theprototype/agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.61.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/browserEngine.js
CHANGED
|
@@ -339,7 +339,8 @@ export class BrowserEngine extends EventEmitter {
|
|
|
339
339
|
/**
|
|
340
340
|
* A PNG of the scene: tpAgent.screenshot (A5: a clean frame from a temporary camera), else
|
|
341
341
|
* the renderer canvas as the page draws it (`fallback: true`, chrome-free but with helpers).
|
|
342
|
-
*
|
|
342
|
+
* A refused shot answers `{error}` (the reason), with no picture.
|
|
343
|
+
* @param {any} opts @returns {Promise<{data: string, mimeType: string, fallback?: boolean, note?: string} | {error: string}>}
|
|
343
344
|
*/
|
|
344
345
|
async screenshot(opts = {}) {
|
|
345
346
|
if (this.state !== 'ready' || !this.page) throw new Error('the agent page is not ready (state ' + this.state + ')');
|
|
@@ -347,8 +348,14 @@ export class BrowserEngine extends EventEmitter {
|
|
|
347
348
|
.evaluate(async (o) => {
|
|
348
349
|
const api = /** @type {any} */ (window).tpAgent;
|
|
349
350
|
if (!api || typeof api.screenshot !== 'function') return null;
|
|
351
|
+
const asked = Date.now();
|
|
350
352
|
let r = await api.screenshot(o);
|
|
351
|
-
if (!r)
|
|
353
|
+
if (!r) {
|
|
354
|
+
// mcp-diorama2 (26): a REFUSED shot (view camera with no uuid, a bad view) says why in lastShot —
|
|
355
|
+
// the reason goes back to the agent instead of a live-canvas picture it did not ask for
|
|
356
|
+
const last = typeof api.lastShot === 'function' ? api.lastShot() : null;
|
|
357
|
+
return last && typeof last.error === 'string' && last.at >= asked ? { refused: last.error } : null;
|
|
358
|
+
}
|
|
352
359
|
if (typeof Blob !== 'undefined' && r instanceof Blob) {
|
|
353
360
|
r = await new Promise((res, rej) => {
|
|
354
361
|
const fr = new FileReader();
|
|
@@ -362,6 +369,7 @@ export class BrowserEngine extends EventEmitter {
|
|
|
362
369
|
return typeof r === 'string' ? { data: r, mimeType: 'image/png', camera } : null;
|
|
363
370
|
}, opts)
|
|
364
371
|
.catch((/** @type {any} */ e) => ({ error: firstLine(e) }));
|
|
372
|
+
if (viaApi && typeof viaApi.refused === 'string') return { error: viaApi.refused };
|
|
365
373
|
if (viaApi && typeof viaApi.data === 'string') {
|
|
366
374
|
const m = /^data:([^;,]+)(;base64)?,/.exec(viaApi.data);
|
|
367
375
|
return m ? { data: viaApi.data.slice(m[0].length), mimeType: m[1], camera: viaApi.camera } : viaApi;
|
package/src/catalog.js
CHANGED
|
@@ -36,6 +36,8 @@ export const TOOL_ANNOTATIONS = /** @type {Record<string, {title: string, read?:
|
|
|
36
36
|
save_scene: { title: 'Save the scene', destructive: false },
|
|
37
37
|
import_model: { title: 'Import a 3D model', destructive: false },
|
|
38
38
|
import_file: { title: 'Import a file', destructive: false },
|
|
39
|
+
import_shape: { title: 'Import a model file (glTF / GLB / OBJ)', destructive: false, openWorld: true },
|
|
40
|
+
upload_asset: { title: 'Upload a sound or an HDR sky', destructive: false },
|
|
39
41
|
update_objects: { title: 'Change objects', destructive: true },
|
|
40
42
|
update_flow_nodes: { title: 'Change or remove flow nodes', destructive: true },
|
|
41
43
|
edit_behaviour: { title: 'Edit a code behaviour', destructive: true },
|
|
@@ -44,6 +46,8 @@ export const TOOL_ANNOTATIONS = /** @type {Record<string, {title: string, read?:
|
|
|
44
46
|
delete_objects: { title: 'Delete objects', destructive: true },
|
|
45
47
|
clear_scene: { title: 'Clear the scene', destructive: true },
|
|
46
48
|
create_lathe: { title: 'Make a lathed shape', destructive: false },
|
|
49
|
+
create_text: { title: 'Add 3D text', destructive: false, openWorld: true },
|
|
50
|
+
list_fonts: { title: 'List fonts for 3D text', read: true },
|
|
47
51
|
create_tube: { title: 'Make a tube along a path', destructive: false },
|
|
48
52
|
extrude_shape: { title: 'Extrude an outline', destructive: false },
|
|
49
53
|
create_mesh: { title: 'Make a mesh from data', destructive: false },
|
|
@@ -70,7 +74,36 @@ export const TOOL_ANNOTATIONS = /** @type {Record<string, {title: string, read?:
|
|
|
70
74
|
connect: { title: 'Join a session', destructive: false, openWorld: true },
|
|
71
75
|
// 86-fix N2: the connector's join — the person confirms in the tab; joining may replace what the tab shows
|
|
72
76
|
join_session: { title: 'Join a session (asks the person)', destructive: true, openWorld: true },
|
|
73
|
-
where_are_users: { title: 'Where the people are', read: true }
|
|
77
|
+
where_are_users: { title: 'Where the people are', read: true },
|
|
78
|
+
// 85-scene (85b)
|
|
79
|
+
create_hud: { title: 'Add a HUD', destructive: false },
|
|
80
|
+
edit_hud: { title: 'Change the HUD', destructive: true },
|
|
81
|
+
list_hud: { title: 'Read the HUD', read: true },
|
|
82
|
+
hud_panel: { title: 'Add a HUD panel', destructive: false },
|
|
83
|
+
set_sky: { title: 'Change the sky and fog', destructive: true },
|
|
84
|
+
set_light: { title: 'Change the scene light', destructive: true },
|
|
85
|
+
// mcp-diorama2: this device's quality preset, asked of the person on their own screen
|
|
86
|
+
set_quality: { title: 'Ask for higher quality on this device', destructive: true },
|
|
87
|
+
get_environment: { title: 'Read the sky and light', read: true },
|
|
88
|
+
place_spawn: { title: 'Set where Play starts', destructive: true },
|
|
89
|
+
set_play_camera: { title: 'Set the play camera and opening view', destructive: true },
|
|
90
|
+
// 85b 85-world
|
|
91
|
+
search_assets: { title: 'Find assets', read: true, openWorld: true },
|
|
92
|
+
place_asset: { title: 'Place an asset', destructive: false, openWorld: true },
|
|
93
|
+
prefab: { title: 'Save or place a prefab', destructive: false },
|
|
94
|
+
create_particles: { title: 'Add particles', destructive: true },
|
|
95
|
+
scatter: { title: 'Scatter over a surface', destructive: true },
|
|
96
|
+
terrain: { title: 'Make or shape terrain', destructive: true },
|
|
97
|
+
water: { title: 'Add or change water', destructive: true },
|
|
98
|
+
place_sound: { title: 'Place a sound', destructive: false, openWorld: true },
|
|
99
|
+
set_music: { title: 'Set the background music', destructive: true, openWorld: true },
|
|
100
|
+
update_mesh: { title: 'Change a mesh made from data', destructive: true },
|
|
101
|
+
duplicate: { title: 'Copy or mirror an object', destructive: false },
|
|
102
|
+
// 85b R1-R4
|
|
103
|
+
inspect_runtime: { title: 'See what the game is doing', read: true },
|
|
104
|
+
validate_scene: { title: 'Check the game for problems', read: true },
|
|
105
|
+
logs: { title: 'Read the recent log', read: true },
|
|
106
|
+
playtest: { title: 'Play the game as a test player', destructive: false }
|
|
74
107
|
});
|
|
75
108
|
|
|
76
109
|
/** a title from a tool name: `create_objects` → `Create objects` @param {string} name */
|
|
@@ -123,7 +156,7 @@ export const GUIDANCE = [
|
|
|
123
156
|
},
|
|
124
157
|
{ 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
158
|
{
|
|
126
|
-
line: 'For "in front of me", "here" or "this",
|
|
159
|
+
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
160
|
on: ['where_are_users', 'create_objects']
|
|
128
161
|
},
|
|
129
162
|
{ 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'] },
|
|
@@ -219,29 +252,29 @@ export function buildCatalog(hostTools, opts = {}) {
|
|
|
219
252
|
* which carries the fine tool's own schema and description, so nothing about a tool is lost by grouping it.
|
|
220
253
|
* mcp-shapes: a family may also have a BATCH — `batch: {key, tool}` — called as `{<key>: [...]}` with no action
|
|
221
254
|
* (create_shape {shapes: [{action, mesh: {...}}, ...]}); the families map carries it as action `<key>`.
|
|
222
|
-
*
|
|
223
|
-
* set_look
|
|
224
|
-
* which the connector leaves out).
|
|
255
|
+
* 85b built edit_shape `update` (G6b update_mesh), assets search / place / prefab and the effects family (85-world),
|
|
256
|
+
* set_look sky / light / environment (environment = the read), hud and game_setup (85-scene). Reserved, not built
|
|
257
|
+
* yet: create_shape from_image (73's image-to-3D is generate_mesh, which the connector leaves out).
|
|
225
258
|
* @type {Readonly<Record<string, {title: string, summary: string, actions: Record<string, string>, batch?: {key: string, tool: string}}>>}
|
|
226
259
|
*/
|
|
227
260
|
export const CONNECTOR_FAMILIES = Object.freeze({
|
|
228
261
|
create_shape: {
|
|
229
262
|
title: 'Make a shape',
|
|
230
263
|
summary:
|
|
231
|
-
'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),
|
|
232
|
-
actions: { lathe: 'create_lathe', tube: 'create_tube', extrude: 'extrude_shape', mesh: 'create_mesh' },
|
|
264
|
+
'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), a mesh from your own vertices (anything else), or text = 3D words (a sign, a title: flat, or solid with depth and a bevel; any bundled or Google Fonts font); import = a glTF / GLB / OBJ model file (base64, chunks or an https url) whose named parts come back as children animate_parts can move.',
|
|
265
|
+
actions: { lathe: 'create_lathe', tube: 'create_tube', extrude: 'extrude_shape', mesh: 'create_mesh', text: 'create_text', import: 'import_shape' },
|
|
233
266
|
batch: { key: 'shapes', tool: 'create_shapes' }
|
|
234
267
|
},
|
|
235
268
|
edit_shape: {
|
|
236
269
|
title: 'Reshape or model objects',
|
|
237
270
|
summary:
|
|
238
|
-
'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.',
|
|
239
|
-
actions: { params: 'set_geometry', mesh: 'edit_mesh', pivot: 'set_pivot', pivot_group: 'create_pivot' }
|
|
271
|
+
'Change the shape of objects that exist: params = new size / segments / type in place (on a 3D text: its words, font, size, depth, bevel, align, wrap width, anchor, colours), 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), duplicate = copies of an object in a row, or its mirror image (a left arm → the right one), pivot = the point an object turns about, pivot_group = a group at a joint so several parts swing together.',
|
|
272
|
+
actions: { params: 'set_geometry', mesh: 'edit_mesh', update: 'update_mesh', duplicate: 'duplicate', pivot: 'set_pivot', pivot_group: 'create_pivot' }
|
|
240
273
|
},
|
|
241
274
|
set_look: {
|
|
242
|
-
title: 'Materials, shaders,
|
|
275
|
+
title: 'Materials, shaders, sky, light and post effects',
|
|
243
276
|
summary:
|
|
244
|
-
'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
|
|
277
|
+
'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; quality = ask the person to raise THIS device\'s quality (a card on their screen, Allow / Keep) when a phone hides the post effects to stay smooth.',
|
|
245
278
|
actions: {
|
|
246
279
|
material: 'set_material',
|
|
247
280
|
list_materials: 'list_materials',
|
|
@@ -254,13 +287,47 @@ export const CONNECTOR_FAMILIES = Object.freeze({
|
|
|
254
287
|
get_post: 'get_post',
|
|
255
288
|
post_graph: 'create_post_graph',
|
|
256
289
|
unwrap: 'uv_unwrap',
|
|
257
|
-
uv: 'set_uv'
|
|
290
|
+
uv: 'set_uv',
|
|
291
|
+
sky: 'set_sky',
|
|
292
|
+
light: 'set_light',
|
|
293
|
+
environment: 'get_environment',
|
|
294
|
+
quality: 'set_quality'
|
|
258
295
|
}
|
|
259
296
|
},
|
|
297
|
+
// 85b R1-R4 (lane 85-runtime): playtest is agent-page only (B4b), so the connector's `run` has no playtest;
|
|
298
|
+
// play / stop stay control_simulation's (K1: start Play only when the person asks)
|
|
299
|
+
run: {
|
|
300
|
+
title: 'See and check what the game does',
|
|
301
|
+
summary:
|
|
302
|
+
"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.",
|
|
303
|
+
actions: { inspect: 'inspect_runtime', validate: 'validate_scene', logs: 'logs' }
|
|
304
|
+
},
|
|
260
305
|
assets: {
|
|
261
306
|
title: 'Images and assets',
|
|
262
|
-
summary:
|
|
263
|
-
|
|
307
|
+
summary:
|
|
308
|
+
'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; upload = put a SOUND or an HDR SKY you hold as base64 bytes (your own music, a file you fetched) into the library and get its hash for effects sound / music or set_look sky; fonts = the fonts 3D text can use (bundled, the library\'s, the scene\'s).',
|
|
309
|
+
actions: { search: 'search_assets', place: 'place_asset', prefab: 'prefab', image: 'add_image', upload: 'upload_asset', fonts: 'list_fonts' }
|
|
310
|
+
},
|
|
311
|
+
// 85b (1.60, the tool budget's effects row)
|
|
312
|
+
effects: {
|
|
313
|
+
title: 'Terrain, scatter, water, particles and sound',
|
|
314
|
+
summary:
|
|
315
|
+
'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.',
|
|
316
|
+
actions: { terrain: 'terrain', scatter: 'scatter', water: 'water', particles: 'create_particles', sound: 'place_sound', music: 'set_music' }
|
|
317
|
+
},
|
|
318
|
+
// 85-scene (85b): 85 H1 / H2 + the panel shape 67's scene panels reuse
|
|
319
|
+
hud: {
|
|
320
|
+
title: 'Game HUD',
|
|
321
|
+
summary:
|
|
322
|
+
'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.',
|
|
323
|
+
actions: { create: 'create_hud', list: 'list_hud', update: 'edit_hud', panel: 'hud_panel' }
|
|
324
|
+
},
|
|
325
|
+
// 85-scene (85b): 85 H3 + H6; levels / portal / loading / checkpoint join with 91 / 93
|
|
326
|
+
game_setup: {
|
|
327
|
+
title: 'Game setup: spawn and play camera',
|
|
328
|
+
summary:
|
|
329
|
+
'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.',
|
|
330
|
+
actions: { spawn: 'place_spawn', play_camera: 'set_play_camera' }
|
|
264
331
|
}
|
|
265
332
|
});
|
|
266
333
|
|
|
@@ -306,8 +373,29 @@ export function familyNames() {
|
|
|
306
373
|
|
|
307
374
|
/** a text with every fine family-member name said the connector's way @param {string} text */
|
|
308
375
|
export function sayFamilyNames(text) {
|
|
309
|
-
|
|
310
|
-
|
|
376
|
+
return sayToolNames(String(text), familyNames());
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* mcp-diorama2 (item 4) — THE ONE REWRITE RULE for "a fine tool name in a text → the connector's family wording",
|
|
381
|
+
* shared by the catalog (descriptions) and the Worker (tool results; cloud worker-mcp/src/catalog.js keeps a copy and
|
|
382
|
+
* a test pins the two). The 1.60 rewrite replaced every WORD that is also a tool name, so status answered a key named
|
|
383
|
+
* "run {action: 'logs'}" and a tip said "a campfire with run {action: 'logs'}". It touches TOOL REFERENCES only:
|
|
384
|
+
* - a name with an underscore (set_geometry, create_mesh) is an identifier, never English — rewritten in prose;
|
|
385
|
+
* - a one-word name (logs, scatter, terrain, water, prefab) is rewritten only written as code: `logs`;
|
|
386
|
+
* - never a JSON key ("logs": …) and never a JSON string that IS the name ("tool": "create_mesh" is data).
|
|
387
|
+
* @param {string} text @param {Map<string, string>} say fine name → wording
|
|
388
|
+
*/
|
|
389
|
+
export function sayToolNames(text, say) {
|
|
390
|
+
if (!say.size) return text;
|
|
391
|
+
const re = new RegExp('\\b(' + [...say.keys()].sort((a, b) => b.length - a.length).join('|') + ')\\b', 'g');
|
|
392
|
+
return text.replace(re, (m, _name, at, whole) => {
|
|
393
|
+
const before = whole[at - 1];
|
|
394
|
+
const after = whole[at + m.length];
|
|
395
|
+
if (before === '"' && after === '"') return m; // a JSON key or a value that is exactly the name: data
|
|
396
|
+
if (!m.includes('_') && !(before === '`' && after === '`')) return m; // an English word
|
|
397
|
+
return say.get(m) ?? m;
|
|
398
|
+
});
|
|
311
399
|
}
|
|
312
400
|
|
|
313
401
|
/**
|
|
@@ -386,6 +474,18 @@ function familyTool(family, f, actions, batch = null) {
|
|
|
386
474
|
return { name: family, title: f.title, description, inputSchema: { type: 'object', properties, ...(batch ? {} : { required: ['action'] }) }, annotations };
|
|
387
475
|
}
|
|
388
476
|
|
|
477
|
+
/**
|
|
478
|
+
* mcp-diorama2 (item 17) — the question's fields travel with the action's object: an agent repeats
|
|
479
|
+
* {action: 'sky', sky: {…}, confirmId, wait} as the needsConfirm note says, and keeping only `sky` dropped the
|
|
480
|
+
* confirmId, so every repeat opened a NEW question and the host's Allow never reached the call.
|
|
481
|
+
* @param {any} inner @param {any} args
|
|
482
|
+
*/
|
|
483
|
+
export function withAnswerFields(inner, args) {
|
|
484
|
+
const out = { ...inner };
|
|
485
|
+
for (const k of ['confirmId', 'wait']) if (args?.[k] !== undefined && out[k] === undefined) out[k] = args[k];
|
|
486
|
+
return out;
|
|
487
|
+
}
|
|
488
|
+
|
|
389
489
|
/**
|
|
390
490
|
* The Worker's half, kept here so core's unit tests cover it with the same tables: a family call → the fine tool
|
|
391
491
|
* and its arguments. A missing per-action object falls back to the call's other fields (a model that flattened them).
|
|
@@ -402,7 +502,7 @@ export function resolveFamilyCall(families, name, args) {
|
|
|
402
502
|
const tool = actions[action];
|
|
403
503
|
if (!tool) return { error: name + ' needs an action: one of ' + Object.keys(actions).join(', ') + '.' };
|
|
404
504
|
const inner = args[action];
|
|
405
|
-
if (inner && typeof inner === 'object' && !Array.isArray(inner)) return { tool, args: inner };
|
|
505
|
+
if (inner && typeof inner === 'object' && !Array.isArray(inner)) return { tool, args: withAnswerFields(inner, args) };
|
|
406
506
|
const { action: _a, ...rest } = args;
|
|
407
507
|
for (const a of Object.keys(actions)) delete rest[a];
|
|
408
508
|
return { tool, args: rest };
|
package/src/mcpServer.js
CHANGED
|
@@ -223,11 +223,18 @@ export function createBridgeServer(opts) {
|
|
|
223
223
|
if (name === 'screenshot' && reserved.includes('screenshot')) {
|
|
224
224
|
if (!engineReady()) return textResult({ error: 'the agent page is not up yet (' + engine.state + ')' }, true);
|
|
225
225
|
const { view, uuid, uuids, from, camera, aspect, zoom, margin, size } = a;
|
|
226
|
-
const
|
|
226
|
+
const postEffects = a.postEffects === true ? true : undefined;
|
|
227
|
+
const extra = { ...(a.hud === true ? { hud: true } : {}), ...(typeof a.avatars === 'boolean' ? { avatars: a.avatars } : {}) };
|
|
228
|
+
const shot = await engine.screenshot({ view, uuid, uuids, from, camera, aspect, zoom, margin, size, ...(postEffects ? { postEffects } : {}), ...extra });
|
|
229
|
+
if ('error' in shot) return textResult({ error: shot.error }, true);
|
|
227
230
|
/** @type {any[]} */
|
|
228
231
|
const content = [{ type: 'image', data: shot.data, mimeType: shot.mimeType || 'image/png' }];
|
|
229
232
|
if (shot.note) content.push({ type: 'text', text: shot.note });
|
|
230
|
-
if (shot.camera)
|
|
233
|
+
if (shot.camera) {
|
|
234
|
+
// mcp-diorama2: the post stack's verdict rides beside the camera (lastShot carries both)
|
|
235
|
+
const { postEffects: pe, reason, detail, how, ...cam } = shot.camera;
|
|
236
|
+
content.push({ type: 'text', text: JSON.stringify({ camera: cam, ...(postEffects && pe ? { postEffects: pe, ...(reason ? { reason } : {}), ...(detail ? { detail } : {}), ...(how ? { how } : {}) } : {}) }) });
|
|
237
|
+
}
|
|
231
238
|
return { content };
|
|
232
239
|
}
|
|
233
240
|
if (name === 'wait_for_edit' && reserved.includes('wait_for_edit')) {
|
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. 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).',
|
|
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). top = the objects drawing the most triangles / draw calls (lighten those first); vsync says whether frameP95 sits on the display\'s refresh (a steady 16.7 ms on a 60 Hz screen is the display\'s cap, not a slow scene) or frames miss it — a frame on the refresh never turns the tier amber or red. callsBySource splits the draw calls: objects (yours), otherInView (people, grid, sky, helpers), shadows, post (effects), otherViews (camera previews, reflections).',
|
|
81
81
|
inputSchema: { type: 'object', properties: {} }
|
|
82
82
|
}
|
|
83
83
|
];
|
|
@@ -86,12 +86,12 @@ export function bridgeTools(engine = 'browser') {
|
|
|
86
86
|
{
|
|
87
87
|
name: 'screenshot',
|
|
88
88
|
description:
|
|
89
|
-
'See the scene: a PNG of a clean frame (no gizmos) from a temporary camera, never moving anyone\'s view. view: current | top | front | iso | focus (focus needs uuid or uuids); from = an angle or {yaw, pitch}; camera = a free {position, target}. 4:3 unless aspect says otherwise (current follows the person\'s window). Answers with the camera it used.',
|
|
89
|
+
'See the scene: a PNG of a clean frame (no gizmos, no people) from a temporary camera, never moving anyone\'s view. view: current | top | front | iso | focus | camera (focus needs uuid or uuids; camera looks through the scene camera uuid, its lens and framing); from = an angle or {yaw, pitch}; camera = a free {position, target}. 4:3 unless aspect says otherwise (current follows the person\'s window). Answers with the camera it used. postEffects: true draws the scene\'s post effects too; hud: true the game HUD on top; avatars: true keeps the people in (current keeps them unless false).',
|
|
90
90
|
inputSchema: {
|
|
91
91
|
type: 'object',
|
|
92
92
|
properties: {
|
|
93
|
-
view: { type: 'string', enum: ['current', 'top', 'front', 'iso', 'focus'] },
|
|
94
|
-
uuid: { type: 'string', description: 'object to frame' },
|
|
93
|
+
view: { type: 'string', enum: ['current', 'top', 'front', 'iso', 'focus', 'camera'] },
|
|
94
|
+
uuid: { type: 'string', description: 'object to frame, or the camera to look through (view camera)' },
|
|
95
95
|
uuids: { type: 'array', items: { type: 'string' }, description: 'objects to frame together' },
|
|
96
96
|
from: {
|
|
97
97
|
description: 'the angle around the subject, instead of view: front, back, left, right, top, below, iso, or {yaw, pitch} in degrees (yaw 0 = front, 90 = right; pitch 90 = from above)',
|
|
@@ -112,13 +112,20 @@ export function bridgeTools(engine = 'browser') {
|
|
|
112
112
|
aspect: { description: 'width to height: "4:3" (default), "1:1", "16:9" or a number. view current defaults to the person\'s window', anyOf: [{ type: 'string' }, { type: 'number' }] },
|
|
113
113
|
zoom: { type: 'number', description: 'above 1 is closer, 0.1 to 10' },
|
|
114
114
|
margin: { type: 'number', description: 'room around the subject: 1 touches the frame, default 1.15' },
|
|
115
|
-
size: { type: 'number', description: 'longest side in pixels' }
|
|
115
|
+
size: { type: 'number', description: 'longest side in pixels' },
|
|
116
|
+
hud: { type: 'boolean', description: 'true = draw the game HUD this screen shows on top (score, timer, menus), laid out as on screen' },
|
|
117
|
+
avatars: { type: 'boolean', description: 'true = keep the people (avatars, an agent\'s camera marker) in the frame; default leaves them out, except view current' },
|
|
118
|
+
postEffects: {
|
|
119
|
+
type: 'boolean',
|
|
120
|
+
description:
|
|
121
|
+
'true = draw it through the scene\'s post effects (bloom, vignette, colour grade …) as this screen shows them. The answer says postEffects "applied", or "unavailable" with a reason ("quality tier" = this device turned them off to keep its frame rate, usual on a phone — `how` says where the person raises it, or ask the person for higher quality: set_look action "quality" — set_quality for a local agent)'
|
|
122
|
+
}
|
|
116
123
|
}
|
|
117
124
|
}
|
|
118
125
|
},
|
|
119
126
|
{
|
|
120
127
|
name: 'wait_for_edit',
|
|
121
|
-
description: 'Wait until someone in the session changes the scene (or the timeout passes), so you can react to the humans.',
|
|
128
|
+
description: 'Wait until someone in the session changes the scene or PINGS a spot (or the timeout passes), so you can react to the humans. A ping answers {changed: true, ping: {id, position, normal, on}}: build there with at: {ping: id}.',
|
|
122
129
|
inputSchema: {
|
|
123
130
|
type: 'object',
|
|
124
131
|
properties: { timeout_ms: { type: 'number', description: 'default 30000, at most 120000' } }
|
|
@@ -150,8 +157,15 @@ export const WHERE_ARE_USERS_TOOL = {
|
|
|
150
157
|
description:
|
|
151
158
|
'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
159
|
'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
|
-
|
|
160
|
+
'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". ' +
|
|
161
|
+
'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 ' +
|
|
162
|
+
'recent ones (2 minutes). For "put it here", build with create_objects / update_objects at: {ping: "latest"} (align: "surface" for a wall). ' +
|
|
163
|
+
'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"). ' +
|
|
164
|
+
'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.',
|
|
165
|
+
inputSchema: {
|
|
166
|
+
type: 'object',
|
|
167
|
+
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' } }
|
|
168
|
+
}
|
|
155
169
|
};
|
|
156
170
|
|
|
157
171
|
/** @returns {any[]} */
|