@theprototype/agent 1.64.0 → 1.90.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/LICENSE +1 -1
- package/catalog.json +7445 -3481
- package/package.json +9 -4
- package/src/browserEngine.js +34 -1
- package/src/catalog.js +194 -34
- package/src/listingBriefs.js +151 -0
- package/src/listingDiet.js +226 -0
- package/src/mcpServer.js +6 -4
- package/src/mcpTools.js +39 -8
- package/src/peerBridge.js +34 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theprototype/agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.90.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",
|
|
@@ -39,17 +39,22 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
|
-
"test": "node test/chat.test.mjs && node test/messages.test.mjs && node test/bridge.test.mjs && node test/link.test.mjs && node test/mcp.test.mjs && node test/repl.test.mjs && node test/wire.test.mjs && node test/catalog.test.mjs && node test/http.test.mjs",
|
|
42
|
+
"test": "node test/eval.test.mjs && node test/chat.test.mjs && node test/messages.test.mjs && node test/bridge.test.mjs && node test/link.test.mjs && node test/mcp.test.mjs && node test/repl.test.mjs && node test/wire.test.mjs && node test/catalog.test.mjs && node test/http.test.mjs",
|
|
43
43
|
"spike": "node src/spike.js",
|
|
44
44
|
"smoke": "node src/cli.js smoke",
|
|
45
45
|
"repl": "node src/cli.js repl",
|
|
46
|
-
"mcp": "node src/cli.js mcp"
|
|
46
|
+
"mcp": "node src/cli.js mcp",
|
|
47
|
+
"eval:results": "node eval/results.mjs",
|
|
48
|
+
"eval:shapes": "node eval/results.mjs --runs 1 --label shapes --script eval/controls-agent-shapes.json --only star-once,health-respawn,late-joiner,pickup-own --expect 1",
|
|
49
|
+
"eval:smoke": "node eval/results.mjs --runs 1 --label smoke --script eval/controls.json --only door-near,star-once,hit-sound,health-respawn,pickup-own,pause-p --expect 1",
|
|
50
|
+
"eval:recipes": "node eval/results.mjs --runs 1 --label recipes --script eval/controls-recipes.json --only pause-p,toggle-shared,pickup-own,star-once,health-respawn,late-joiner --expect 1",
|
|
51
|
+
"eval:controls2": "node eval/results.mjs --runs 1 --label controls2 --script eval/controls-eval2.json --only round-timer,late-joiner,key-door,lap-counter,spawner-cap,dialogue-own,inventory-respawn,day-night,two-plates --expect 1"
|
|
47
52
|
},
|
|
48
53
|
"dependencies": {
|
|
49
54
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
50
55
|
"peerjs": "^1.5.4",
|
|
51
56
|
"playwright-core": "1.64.1",
|
|
52
|
-
"ws": "^8.
|
|
57
|
+
"ws": "^8.23.1"
|
|
53
58
|
},
|
|
54
59
|
"optionalDependencies": {
|
|
55
60
|
"@roamhq/wrtc": "^0.10.0"
|
package/src/browserEngine.js
CHANGED
|
@@ -84,12 +84,19 @@ function compatShim() {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/** Runs IN THE PAGE: prefs a fresh agent profile needs before the app boots. */
|
|
87
|
-
function agentStorage(/** @type {{name: string, compat: boolean}} */ o) {
|
|
87
|
+
export function agentStorage(/** @type {{name: string, compat: boolean}} */ o) {
|
|
88
88
|
const set = (/** @type {string} */ k, /** @type {string} */ v) => {
|
|
89
89
|
try {
|
|
90
90
|
localStorage.setItem(k, v);
|
|
91
91
|
} catch {}
|
|
92
92
|
};
|
|
93
|
+
// A profile THIS PACKAGE made (empty storage at its first load, marked from then on) holds only what the
|
|
94
|
+
// agent brings, so its own files setting is "share what I add". A profile with anything in it that we did
|
|
95
|
+
// not mark is somebody's browser: its setting is left as it is (start() says so in the log).
|
|
96
|
+
try {
|
|
97
|
+
if (localStorage.length === 0) localStorage.setItem('tpAgent:profile', '1');
|
|
98
|
+
if (localStorage.getItem('tpAgent:profile') === '1' && localStorage.getItem('shared:shareNewFiles') === null) localStorage.setItem('shared:shareNewFiles', 'always');
|
|
99
|
+
} catch {}
|
|
93
100
|
set('agentApi', '1'); // 55 A2: the in-page agent API (the `&agent` hash says the same)
|
|
94
101
|
set('hasSeenDisclaimer', 'true');
|
|
95
102
|
set('hasSeenWelcome', 'true');
|
|
@@ -100,6 +107,27 @@ function agentStorage(/** @type {{name: string, compat: boolean}} */ o) {
|
|
|
100
107
|
if (o.compat) set('debugStores', 'true');
|
|
101
108
|
}
|
|
102
109
|
|
|
110
|
+
/** Runs IN THE PAGE: whether this profile is one the package made, and its files setting. */
|
|
111
|
+
function agentFilesSetting() {
|
|
112
|
+
try {
|
|
113
|
+
return { ours: localStorage.getItem('tpAgent:profile') === '1', setting: localStorage.getItem('shared:shareNewFiles') };
|
|
114
|
+
} catch {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* What to tell the operator about the agent page's files setting: nothing when files the agent brings are
|
|
121
|
+
* shared, a plain sentence when they are not (a browser profile the package did not make keeps its own
|
|
122
|
+
* setting; the package never changes it there).
|
|
123
|
+
* @param {{ours?: boolean, setting?: string | null} | null} f @returns {string}
|
|
124
|
+
*/
|
|
125
|
+
export function filesSettingNote(f) {
|
|
126
|
+
if (!f || f.setting === 'always') return '';
|
|
127
|
+
if (!f.ours) return 'this browser profile was not made by the agent package, so its files setting is left as it is: files the agent imports stay on this device unless that setting shares them';
|
|
128
|
+
return 'files the agent imports stay on this device: this profile\'s files setting is "' + (f.setting ?? 'ask') + '"';
|
|
129
|
+
}
|
|
130
|
+
|
|
103
131
|
/** The `window.tpAgent` contract major this bridge speaks (plans review #34: a breaking change to the
|
|
104
132
|
* contract bumps its major; the package version follows the app release it shipped with). */
|
|
105
133
|
export const CONTRACT_MAJOR = 1;
|
|
@@ -268,6 +296,9 @@ export class BrowserEngine extends EventEmitter {
|
|
|
268
296
|
this.apiVersion = await this.page.evaluate(() => String(/** @type {any} */ (window).tpAgent.version ?? ''));
|
|
269
297
|
this.contractNote = contractNote(this.apiVersion);
|
|
270
298
|
if (this.contractNote) this.log(this.contractNote);
|
|
299
|
+
const files = await this.page.evaluate(agentFilesSetting).catch(() => null);
|
|
300
|
+
const filesNote = filesSettingNote(files);
|
|
301
|
+
if (filesNote) console.error('[agent] ' + filesNote);
|
|
271
302
|
this.state = 'ready';
|
|
272
303
|
this.log('agent API ' + this.apiVersion + ' ready');
|
|
273
304
|
this.emit('ready');
|
|
@@ -374,6 +405,8 @@ export class BrowserEngine extends EventEmitter {
|
|
|
374
405
|
const m = /^data:([^;,]+)(;base64)?,/.exec(viaApi.data);
|
|
375
406
|
return m ? { data: viaApi.data.slice(m[0].length), mimeType: m[1], camera: viaApi.camera } : viaApi;
|
|
376
407
|
}
|
|
408
|
+
// 108 V1: the UV view is one object's UV map or nothing: never a picture of the page instead
|
|
409
|
+
if (String(opts?.view ?? '') === 'uv') return { error: viaApi?.error ?? 'view uv: this app build cannot draw the UV view' };
|
|
377
410
|
const canvas = await this.page.evaluateHandle(() => {
|
|
378
411
|
const all = [...document.querySelectorAll('canvas')].filter((c) => c.width > 0 && c.height > 0 && c.offsetParent !== null);
|
|
379
412
|
all.sort((a, b) => b.clientWidth * b.clientHeight - a.clientWidth * a.clientHeight);
|
package/src/catalog.js
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
// the bridge tools a tab answers itself. Nobody hand-writes a tool. The instructions (86 T3) are built
|
|
8
8
|
// from the same list, so a line about a tool appears only while that tool exists.
|
|
9
9
|
|
|
10
|
-
import { mapHostTools, bridgeTools, connectorOnlyTools } from './mcpTools.js';
|
|
10
|
+
import { mapHostTools, bridgeTools, connectorOnlyTools, BRIDGE_TOOL_NAMES } from './mcpTools.js';
|
|
11
|
+
import { DIET, CONSENT, askFirstSchema, brief, dietSchema, leanSchema, sentences, shareFields } from './listingDiet.js';
|
|
12
|
+
import { CONNECTOR_BRIEF, ACTION_BRIEF, DESCRIBED_ACTIONS, FIELDS_KEPT, WHOLE_FIELDS } from './listingBriefs.js';
|
|
11
13
|
|
|
12
14
|
/** Bump when the catalog's SHAPE changes (not when tools change). 2 = titles + annotations. */
|
|
13
15
|
export const CATALOG_FORMAT = 2;
|
|
@@ -49,11 +51,15 @@ export const TOOL_ANNOTATIONS = /** @type {Record<string, {title: string, read?:
|
|
|
49
51
|
create_text: { title: 'Add 3D text', destructive: false, openWorld: true },
|
|
50
52
|
list_fonts: { title: 'List fonts for 3D text', read: true },
|
|
51
53
|
create_path: { title: 'Add a path to walk along', destructive: false }, // 78 F4
|
|
54
|
+
create_vector: { title: 'Draw a flat vector shape', destructive: false }, // 64-vector
|
|
55
|
+
create_loft: { title: 'Sweep a profile along a path, or loft through sections', destructive: false }, // 108 M3
|
|
56
|
+
check_shapes: { title: 'Check a build in words', read: true }, // 108 M3
|
|
52
57
|
create_tube: { title: 'Make a tube along a path', destructive: false },
|
|
53
58
|
extrude_shape: { title: 'Extrude an outline', destructive: false },
|
|
54
59
|
create_mesh: { title: 'Make a mesh from data', destructive: false },
|
|
55
60
|
set_geometry: { title: 'Reshape objects', destructive: true },
|
|
56
61
|
edit_mesh: { title: 'Edit a mesh', destructive: true },
|
|
62
|
+
simplify_mesh: { title: 'Simplify a mesh', destructive: true }, // 102 M1
|
|
57
63
|
set_material: { title: 'Change materials and textures', destructive: true, openWorld: true },
|
|
58
64
|
list_materials: { title: 'Read materials', read: true },
|
|
59
65
|
get_material: { title: 'Read one material', read: true },
|
|
@@ -61,11 +67,16 @@ export const TOOL_ANNOTATIONS = /** @type {Record<string, {title: string, read?:
|
|
|
61
67
|
edit_shader: { title: 'Edit a shader', destructive: true },
|
|
62
68
|
assign_shader: { title: 'Copy or remove a shader', destructive: true },
|
|
63
69
|
describe_shader_nodes: { title: 'Look up shader node types', read: true },
|
|
70
|
+
preview_shader: { title: 'See a shader on a sample sphere', destructive: false }, // 108 M2
|
|
71
|
+
shader_code: { title: 'Write your own GLSL for a shader', destructive: true },
|
|
72
|
+
shader_glsl: { title: 'Read the GLSL a shader compiles to', read: true },
|
|
64
73
|
set_post: { title: 'Change the post effects', destructive: true },
|
|
65
74
|
get_post: { title: 'Read the post effects', read: true },
|
|
66
75
|
create_post_graph: { title: 'Add a custom post effect', destructive: false },
|
|
67
76
|
uv_unwrap: { title: 'Unwrap UVs', destructive: true },
|
|
68
77
|
set_uv: { title: 'Set texture tiling or face mapping', destructive: true },
|
|
78
|
+
uv_islands: { title: 'Read UV islands and overlap', read: true }, // 108 V1
|
|
79
|
+
transform_uv: { title: 'Move, turn, scale or flip a texture mapping', destructive: true }, // 108 V1
|
|
69
80
|
undo_last: { title: 'Undo your last change', destructive: true },
|
|
70
81
|
set_pivot: { title: 'Set the point an object turns about', destructive: true },
|
|
71
82
|
create_pivot: { title: 'Make a pivot group', destructive: false },
|
|
@@ -88,6 +99,10 @@ export const TOOL_ANNOTATIONS = /** @type {Record<string, {title: string, read?:
|
|
|
88
99
|
get_environment: { title: 'Read the sky and light', read: true },
|
|
89
100
|
place_spawn: { title: 'Set where Play starts', destructive: true },
|
|
90
101
|
set_play_camera: { title: 'Set the play camera and opening view', destructive: true },
|
|
102
|
+
// 61-nav G10: game_setup {npc}
|
|
103
|
+
set_npc: { title: 'Make an object an enemy', destructive: true },
|
|
104
|
+
// 92-dialogue GC6: game_setup {dialogue}
|
|
105
|
+
set_dialogue: { title: 'Give an object a talk', destructive: true },
|
|
91
106
|
// 85b 85-world
|
|
92
107
|
search_assets: { title: 'Find assets', read: true, openWorld: true },
|
|
93
108
|
place_asset: { title: 'Place an asset', destructive: false, openWorld: true },
|
|
@@ -106,7 +121,40 @@ export const TOOL_ANNOTATIONS = /** @type {Record<string, {title: string, read?:
|
|
|
106
121
|
logs: { title: 'Read the recent log', read: true },
|
|
107
122
|
playtest: { title: 'Play the game as a test player', destructive: false },
|
|
108
123
|
// 98 P2
|
|
109
|
-
take_photo: { title: 'Take a path-traced photo of the view', destructive: false }
|
|
124
|
+
take_photo: { title: 'Take a path-traced photo of the view', destructive: false },
|
|
125
|
+
// 104 B1
|
|
126
|
+
probe: { title: 'Read the ground and water under a point', read: true },
|
|
127
|
+
// 104 C1-C3: the person's own Explorer, interface and scenes (a person's tab only)
|
|
128
|
+
files: { title: "Work with the person's files", destructive: true },
|
|
129
|
+
show: { title: "Show the person something on their screen", destructive: false },
|
|
130
|
+
scene: { title: "Open the person's scenes", destructive: true },
|
|
131
|
+
// 107-ui-state: what the person sees, and the Statistics / Profiler numbers (connector: run {ui, stats})
|
|
132
|
+
ui_state: { title: "Read what the person's screen shows", read: true },
|
|
133
|
+
scene_stats: { title: 'Read the Statistics and Profiler numbers', destructive: false },
|
|
134
|
+
// 108 U1 (108-grants-read): the controls in the person's open panels, and a ring round one (connector: run {tree, point})
|
|
135
|
+
ui_tree: { title: "Read the controls in the person's open panels", read: true },
|
|
136
|
+
point_at: { title: "Ring one control on the person's screen", destructive: false },
|
|
137
|
+
// 107b K1: constraints (rig {list}) is a read the dispatcher allows under a read scope
|
|
138
|
+
rig: { title: 'Rig parts: aim, follow, limit and IK', destructive: true },
|
|
139
|
+
// 107b-timeline (roadmap 107 T1): the connector's timeline {action}
|
|
140
|
+
list_sequences: { title: 'Read the sequences', read: true },
|
|
141
|
+
create_sequence: { title: 'Make a sequence (cutscene)', destructive: false },
|
|
142
|
+
edit_sequence: { title: 'Change or delete a sequence', destructive: true },
|
|
143
|
+
list_clips: { title: "Read an object's clips or a clip file", read: true },
|
|
144
|
+
play_clip: { title: 'Play or stop a clip', destructive: true },
|
|
145
|
+
key_object: { title: 'Animate an object with keys', destructive: true },
|
|
146
|
+
edit_clip: { title: 'Put on, trim, join or re-key clip files', destructive: true },
|
|
147
|
+
show_timeline: { title: "Show a sequence or clip on the person's screen", destructive: false },
|
|
148
|
+
// 107b-nodes (N1): the connector's run {debug} and hud {select}, both on the person's own screen
|
|
149
|
+
flow_debug: { title: "Use the person's node Debugger", destructive: false },
|
|
150
|
+
select_hud: { title: "Select HUD elements in the person's HUD Editor", destructive: false },
|
|
151
|
+
// 107b-play (roadmap 107 P1): the connector's run {play, press}
|
|
152
|
+
play_mode: { title: "Start or stop Play on the person's screen", destructive: false },
|
|
153
|
+
press_game: { title: 'Press a game button as a player', destructive: true },
|
|
154
|
+
// 107b-perf (roadmap 107 R1): the connector's run {record}
|
|
155
|
+
perf_recording: { title: "Record and read this device's performance", destructive: false },
|
|
156
|
+
// 108 A1: the connector's run {assistant} (it runs on the person's own AI provider: open world)
|
|
157
|
+
assistant_task: { title: "Give a task to the person's Assistant", destructive: true, openWorld: true }
|
|
110
158
|
});
|
|
111
159
|
|
|
112
160
|
/** a title from a tool name: `create_objects` → `Create objects` @param {string} name */
|
|
@@ -135,27 +183,32 @@ const EDITS = 'EDITS';
|
|
|
135
183
|
* clients that do read them. `when` = the tool that must exist for the line to appear at all (default: the
|
|
136
184
|
* first of `on`). `guidanceGaps` (catalog:agent --check, the unit test) fails on an instruction line no
|
|
137
185
|
* description carries.
|
|
138
|
-
*
|
|
186
|
+
* 107 T0: `standing` = a line that holds for the whole conversation; the connector's instructions are those lines only.
|
|
187
|
+
* @type {{line: string, on: (string|'EDITS')[], when?: string, standing?: true}[]}
|
|
139
188
|
*/
|
|
140
189
|
export const GUIDANCE = [
|
|
141
190
|
{
|
|
142
191
|
line: 'You are building in the person\'s own open theprototype.app tab: a live, shared 3D scene. Every change shows for everyone in the session and can be undone.',
|
|
143
|
-
on: ['status', 'what_can_you_do']
|
|
192
|
+
on: ['status', 'what_can_you_do'],
|
|
193
|
+
standing: true
|
|
144
194
|
},
|
|
145
195
|
{
|
|
146
196
|
line: 'This may be a VOICE conversation: answer in one or two short spoken sentences and say what changed in plain words ("Added three trees by the fire"). Never read out uuids, lists of numbers or JSON.',
|
|
147
|
-
on: ['status', 'what_can_you_do', 'create_objects']
|
|
197
|
+
on: ['status', 'what_can_you_do', 'create_objects'],
|
|
198
|
+
standing: true
|
|
148
199
|
},
|
|
149
200
|
{
|
|
150
|
-
line: 'If a tool says the tab is closed or not connected, tell the person to open theprototype.app and
|
|
151
|
-
on: ['status', 'list_scene']
|
|
201
|
+
line: 'If a tool says the tab is closed or not connected, tell the person to open theprototype.app, open the AI window and turn on AI building, then wait; do not retry in a loop.',
|
|
202
|
+
on: ['status', 'list_scene'],
|
|
203
|
+
standing: true
|
|
152
204
|
},
|
|
153
|
-
{ line: 'Call status first: it says whether you may edit (a viewer can only look).', on: ['status'] },
|
|
154
|
-
{ line: 'When the person says "undo that" or "take that back", call undo_last; if it refuses, say who changed what.', on: ['undo_last'] },
|
|
205
|
+
{ line: 'Call status first: it says whether you may edit (a viewer can only look).', on: ['status'], standing: true },
|
|
206
|
+
{ line: 'When the person says "undo that" or "take that back", call undo_last; if it refuses, say who changed what.', on: ['undo_last'], standing: true },
|
|
155
207
|
{
|
|
156
208
|
line: 'You act as this person in their own tab: status "you" is them (their peer id, name and role); the other users are everyone else.',
|
|
157
209
|
on: ['status', 'where_are_users'],
|
|
158
|
-
when: 'join_session'
|
|
210
|
+
when: 'join_session',
|
|
211
|
+
standing: true
|
|
159
212
|
},
|
|
160
213
|
{ line: 'Call list_scene before editing so you use real uuids; batch many objects into one call.', on: ['list_scene', 'create_objects', 'update_objects'] },
|
|
161
214
|
{
|
|
@@ -173,7 +226,7 @@ export const GUIDANCE = [
|
|
|
173
226
|
{ line: 'When asked what you can do here, call what_can_you_do and say its "say" line.', on: ['what_can_you_do'] }
|
|
174
227
|
];
|
|
175
228
|
|
|
176
|
-
/** @param {{line: string, on: string[], when?: string}} g @param {Set<string>} has */
|
|
229
|
+
/** @param {{line: string, on: string[], when?: string, standing?: true}} g @param {Set<string>} has */
|
|
177
230
|
function applies(g, has) {
|
|
178
231
|
const when = g.when ?? g.on.find((n) => n !== EDITS) ?? '';
|
|
179
232
|
return when.startsWith('!') ? has.has(g.on[0]) && !has.has(when.slice(1)) : has.has(when);
|
|
@@ -183,11 +236,13 @@ function applies(g, has) {
|
|
|
183
236
|
* The server instructions for a voice-first client (claude.ai chat, phone and voice mode). Short,
|
|
184
237
|
* spoken-style, and only about tools in `names` — the GUIDANCE lines, verbatim.
|
|
185
238
|
* @param {string[]} names the tool names the client will see
|
|
239
|
+
* @param {boolean} [standing] 107 T0: only the lines that hold for the whole conversation (whose tab this is, voice,
|
|
240
|
+
* status first, undo, who "you" is); a line about how to use ONE tool is in that tool's description already
|
|
186
241
|
* @returns {string}
|
|
187
242
|
*/
|
|
188
|
-
export function connectorInstructions(names) {
|
|
243
|
+
export function connectorInstructions(names, standing = false) {
|
|
189
244
|
const has = new Set(names);
|
|
190
|
-
return GUIDANCE.filter((g) => applies(g, has))
|
|
245
|
+
return GUIDANCE.filter((g) => applies(g, has) && (!standing || g.standing))
|
|
191
246
|
.map((g) => g.line)
|
|
192
247
|
.join('\n');
|
|
193
248
|
}
|
|
@@ -264,20 +319,21 @@ export const CONNECTOR_FAMILIES = Object.freeze({
|
|
|
264
319
|
create_shape: {
|
|
265
320
|
title: 'Make a shape',
|
|
266
321
|
summary:
|
|
267
|
-
'Make shapes the basic objects cannot: a lathe (a vase, a bowl
|
|
268
|
-
actions: { lathe: 'create_lathe', tube: 'create_tube', extrude: 'extrude_shape', mesh: 'create_mesh', text: 'create_text', import: 'import_shape', path: 'create_path' }, // 78 F4: a new ACTION, no new connector tool name
|
|
322
|
+
'Make shapes the basic objects cannot: a lathe (a vase, a bowl), a tube along a path (a rail, a pipe), an extruded outline (a sign, a star), a mesh from your own vertices, 3D text, a Path to patrol, a flat vector shape or SVG, a sweep (a profile along a path) or loft (a surface through sections), an imported glTF / GLB / OBJ model.',
|
|
323
|
+
actions: { lathe: 'create_lathe', tube: 'create_tube', extrude: 'extrude_shape', mesh: 'create_mesh', text: 'create_text', import: 'import_shape', path: 'create_path', vector: 'create_vector', loft: 'create_loft' }, // 78 F4 / 64-vector / 108 M3: a new ACTION, no new connector tool name
|
|
269
324
|
batch: { key: 'shapes', tool: 'create_shapes' }
|
|
270
325
|
},
|
|
271
326
|
edit_shape: {
|
|
272
327
|
title: 'Reshape or model objects',
|
|
273
328
|
summary:
|
|
274
|
-
'Change the shape of objects that exist:
|
|
275
|
-
|
|
329
|
+
'Change the shape of objects that exist: resize or retype in place, model faces and vertices, replace mesh data, copy or mirror, set the point an object turns about, lower the triangle count, align, boolean, merge into one mesh; check = a build in words (floating, buried, open, out of scale).',
|
|
330
|
+
// 102 M1: simplify; 107b-small (S1): align / distribute, boolean, convert to mesh
|
|
331
|
+
actions: { params: 'set_geometry', mesh: 'edit_mesh', update: 'update_mesh', duplicate: 'duplicate', pivot: 'set_pivot', pivot_group: 'create_pivot', simplify: 'simplify_mesh', align: 'align_objects', boolean: 'boolean_objects', convert: 'convert_to_mesh', check: 'check_shapes' } // 108 M3: check (a read)
|
|
276
332
|
},
|
|
277
333
|
set_look: {
|
|
278
334
|
title: 'Materials, shaders, sky, light and post effects',
|
|
279
335
|
summary:
|
|
280
|
-
'How things look:
|
|
336
|
+
'How things look: materials and textures, node shaders (a picture on a sphere, your own GLSL, the GLSL they make), the sky, fog and lights, the scene\'s post effects, texture mapping and tiling, a pro look in one step, baked light; sky, light and post change the whole scene, so the host is asked first; 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.',
|
|
281
337
|
actions: {
|
|
282
338
|
material: 'set_material',
|
|
283
339
|
list_materials: 'list_materials',
|
|
@@ -286,11 +342,17 @@ export const CONNECTOR_FAMILIES = Object.freeze({
|
|
|
286
342
|
edit_shader: 'edit_shader',
|
|
287
343
|
assign_shader: 'assign_shader',
|
|
288
344
|
shader_nodes: 'describe_shader_nodes',
|
|
345
|
+
shader_preview: 'preview_shader', // 108 M2
|
|
346
|
+
shader_code: 'shader_code',
|
|
347
|
+
shader_glsl: 'shader_glsl',
|
|
289
348
|
post: 'set_post',
|
|
290
349
|
get_post: 'get_post',
|
|
291
350
|
post_graph: 'create_post_graph',
|
|
292
351
|
unwrap: 'uv_unwrap',
|
|
293
352
|
uv: 'set_uv',
|
|
353
|
+
// 108 V1 (lane 108-uv): UV islands in counts and bounds; move / rotate / scale / flip faces or islands
|
|
354
|
+
uv_islands: 'uv_islands',
|
|
355
|
+
uv_transform: 'transform_uv',
|
|
294
356
|
sky: 'set_sky',
|
|
295
357
|
light: 'set_light',
|
|
296
358
|
environment: 'get_environment',
|
|
@@ -305,35 +367,47 @@ export const CONNECTOR_FAMILIES = Object.freeze({
|
|
|
305
367
|
run: {
|
|
306
368
|
title: 'See and check what the game does',
|
|
307
369
|
summary:
|
|
308
|
-
"What the game does when it runs
|
|
309
|
-
|
|
370
|
+
"What the game does when it runs (inspect, validate, logs), a path-traced photo of the person's view, and what the person's own screen shows: ui = their selection, panels, camera, device and Quality (read-only), stats = the Statistics and Profiler numbers, debug = their node Debugger (breakpoints, step, watches); play = start / stop Play on their screen, press = press a HUD control or click an object as a player, with the nodes that fired; record = Profiler recordings of their device (start, read in words, compare, keep); assistant = hand a task to the person's own Assistant (their AI provider), the reply as data.",
|
|
371
|
+
// 107-ui-state: ui / stats are new ACTIONS on run, no new connector tool name
|
|
372
|
+
// 107b-nodes: debug = the person's node Debugger (breakpoints, step, watches); 107b-play: play / press; 107b-perf: record; 108 U1: tree / point
|
|
373
|
+
// 108 A1: assistant = the dispatcher's own assistant_task (a connector tab answers it)
|
|
374
|
+
actions: { inspect: 'inspect_runtime', validate: 'validate_scene', logs: 'logs', photo: 'take_photo', ui: 'ui_state', stats: 'scene_stats', debug: 'flow_debug', play: 'play_mode', press: 'press_game', record: 'perf_recording', tree: 'ui_tree', point: 'point_at', assistant: 'assistant_task' }
|
|
310
375
|
},
|
|
311
376
|
assets: {
|
|
312
377
|
title: 'Images and assets',
|
|
313
378
|
summary:
|
|
314
|
-
'Assets to build with: search
|
|
379
|
+
'Assets to build with: search models, prefabs, sounds, images, CC0 materials and HDRIs by words, place one, keep objects as a prefab, put an image, a sound or an HDR sky into the library, list the fonts.',
|
|
315
380
|
actions: { search: 'search_assets', place: 'place_asset', prefab: 'prefab', image: 'add_image', upload: 'upload_asset', fonts: 'list_fonts' }
|
|
316
381
|
},
|
|
317
382
|
// 85b (1.60, the tool budget's effects row)
|
|
318
383
|
effects: {
|
|
319
384
|
title: 'Terrain, scatter, water, particles and sound',
|
|
320
385
|
summary:
|
|
321
|
-
'The world around the build: terrain
|
|
386
|
+
'The world around the build: terrain, scatter (many trees, rocks or flowers over a terrain or mesh), water, particles (fire, smoke, rain … by preset), a positional sound, the scene\'s background music.',
|
|
322
387
|
actions: { terrain: 'terrain', scatter: 'scatter', water: 'water', particles: 'create_particles', sound: 'place_sound', music: 'set_music' }
|
|
323
388
|
},
|
|
324
389
|
// 85-scene (85b): 85 H1 / H2 + the panel shape 67's scene panels reuse
|
|
325
390
|
hud: {
|
|
326
391
|
title: 'Game HUD',
|
|
327
392
|
summary:
|
|
328
|
-
'The game\'s 2D screen overlay:
|
|
329
|
-
|
|
393
|
+
'The game\'s 2D screen overlay: screens of elements (timer, score text, bars, buttons, images) and panels (a menu, a scoreboard). Bind live values with hudtext / hudbar / hudtimer flow nodes whose element is an id. select = the person\'s HUD Editor on a screen.',
|
|
394
|
+
// 107b-nodes: select = the person's HUD Editor on a screen with elements picked
|
|
395
|
+
actions: { create: 'create_hud', list: 'list_hud', update: 'edit_hud', panel: 'hud_panel', select: 'select_hud' }
|
|
330
396
|
},
|
|
331
397
|
// 85-scene (85b): 85 H3 + H6; levels / portal / loading / checkpoint join with 91 / 93
|
|
332
398
|
game_setup: {
|
|
333
|
-
title: 'Game setup: spawn, play camera, levels, portals, checkpoints, loading',
|
|
399
|
+
title: 'Game setup: spawn, play camera, levels, portals, checkpoints, loading, enemies, title screen, pause, saves, dialogue',
|
|
334
400
|
summary:
|
|
335
|
-
'How the game starts
|
|
336
|
-
actions: { spawn: 'place_spawn', play_camera: 'set_play_camera', levels: 'set_levels', portal: 'set_portal', checkpoint: 'set_checkpoint', loading: 'set_loading' }
|
|
401
|
+
'How the game starts and runs: where Play starts, the play camera and the editor\'s opening view, the Levels table, portals, checkpoints, the loading screen, enemies, dialogue, the title screen, the pause menu, save slots.',
|
|
402
|
+
actions: { spawn: 'place_spawn', play_camera: 'set_play_camera', levels: 'set_levels', portal: 'set_portal', checkpoint: 'set_checkpoint', loading: 'set_loading', npc: 'set_npc', title: 'set_title_screen', pause: 'set_pause_menu', saves: 'set_save_slots', dialogue: 'set_dialogue' }
|
|
403
|
+
},
|
|
404
|
+
// 107b-timeline (roadmap 107 part 2 T1, owner-approved name; + owner 29 Nov: .tpanim viewing and editing, custom
|
|
405
|
+
// animations by tool). One new connector name; every action is the editor's own setter, one undo step a call.
|
|
406
|
+
timeline: {
|
|
407
|
+
title: 'Timeline, clips and keys',
|
|
408
|
+
summary:
|
|
409
|
+
"Cutscenes, keys with easing on a whole object, its clips, .tpanim files; open = the person's screen.",
|
|
410
|
+
actions: { list: 'list_sequences', create: 'create_sequence', edit: 'edit_sequence', keys: 'key_object', clips: 'list_clips', play: 'play_clip', clip_file: 'edit_clip', open: 'show_timeline' }
|
|
337
411
|
}
|
|
338
412
|
});
|
|
339
413
|
|
|
@@ -363,6 +437,14 @@ export const CONNECTOR_STANDALONE = Object.freeze([
|
|
|
363
437
|
'join_session',
|
|
364
438
|
'where_are_users',
|
|
365
439
|
'undo_last',
|
|
440
|
+
// 104 B1 (roadmap 104 row B1, owner-approved name): the ground / water / ray read
|
|
441
|
+
'probe',
|
|
442
|
+
// 104 C1-C3 (roadmap 104, owner rows C1-C3; the 85 budget table's slots for files / show and scene)
|
|
443
|
+
'files',
|
|
444
|
+
'show',
|
|
445
|
+
'scene',
|
|
446
|
+
// 107b K1 (roadmap 107 part 2 row K1, owner 29 Nov: rig motion by tool): constraints on objects, parts and bones
|
|
447
|
+
'rig',
|
|
366
448
|
// left out by the Worker's own policy (generate_mesh), kept listed so the Worker's EXCLUDED_TOOLS stays the scope call
|
|
367
449
|
'generate_mesh'
|
|
368
450
|
]);
|
|
@@ -424,7 +506,7 @@ export function connectorView(plain, excluded) {
|
|
|
424
506
|
let placed = false;
|
|
425
507
|
for (const t of plain) {
|
|
426
508
|
if (!familyOf.has(t.name)) {
|
|
427
|
-
list.push(t);
|
|
509
|
+
list.push(listedTool(t));
|
|
428
510
|
continue;
|
|
429
511
|
}
|
|
430
512
|
if (placed) continue;
|
|
@@ -446,7 +528,69 @@ export function connectorView(plain, excluded) {
|
|
|
446
528
|
}
|
|
447
529
|
}
|
|
448
530
|
const tools = withGuidance(list);
|
|
449
|
-
return { instructions: connectorInstructions(tools.map((t) => t.name)), families, tools };
|
|
531
|
+
return { instructions: connectorInstructions(tools.map((t) => t.name), true), families, tools };
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/** the call that answers a tool's full text (107 T0) @param {string} tool @param {string} [action] */
|
|
535
|
+
export const helpCall = (tool, action) => 'what_can_you_do {"tool": "' + tool + '"' + (action ? ', "action": "' + action + '"' : '') + '}';
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* 107 T0 — consent sentences are never shortened: every sentence of a tool's own description that tells the agent
|
|
539
|
+
* how a question to a person is answered (needsConfirm / confirmId) is in its listing word for word.
|
|
540
|
+
* @param {string} full the tool's own description @param {string} listed its short form @returns {string}
|
|
541
|
+
*/
|
|
542
|
+
export function withConsent(full, listed) {
|
|
543
|
+
const keep = sentences(String(full ?? '')).filter((s) => CONSENT.test(s) && !listed.includes(s));
|
|
544
|
+
return keep.length ? [listed, ...keep].join(' ') : listed;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/** tools whose whole description is about what the person is asked and decides (opening a scene over unsaved
|
|
548
|
+
* changes): consent text is not shortened, so they are listed as they are */
|
|
549
|
+
export const CONSENT_TOOLS = Object.freeze(['scene']);
|
|
550
|
+
|
|
551
|
+
/** the dispatcher's own tools whose long text the app keeps a copy of (src/lib/connector/bridgeHelp.js), so they may be listed short */
|
|
552
|
+
export const HELPED = Object.freeze(['status', 'screenshot', 'where_are_users']);
|
|
553
|
+
|
|
554
|
+
/** the other tools the tab's dispatcher answers itself (wait_for_edit, join_session …): the tab has no other text of
|
|
555
|
+
* them to hand back, so their listing stays whole */
|
|
556
|
+
const WHOLE = new Set([...BRIDGE_TOOL_NAMES, ...connectorOnlyTools().map((t) => t.name), 'what_can_you_do'].filter((n) => !HELPED.includes(n)));
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* 107 T0 — a standalone tool as the connector lists it: its written brief (listingBriefs.js), or its own text when
|
|
560
|
+
* that is short, else its first sentences; field descriptions shortened; and where anything was shortened, the call
|
|
561
|
+
* that answers the full text.
|
|
562
|
+
* @template {{name: string, description: string, inputSchema: any}} T @param {T} t @returns {T}
|
|
563
|
+
*/
|
|
564
|
+
export function listedTool(t) {
|
|
565
|
+
if (WHOLE.has(t.name) || CONSENT_TOOLS.includes(t.name)) return t;
|
|
566
|
+
const own = String(t.description ?? '').trim();
|
|
567
|
+
const size = new TextEncoder().encode(own).length;
|
|
568
|
+
const written = /** @type {Record<string, string>} */ (CONNECTOR_BRIEF)[t.name];
|
|
569
|
+
const short = withConsent(own, written ?? (size <= DIET.tool ? own : brief(own, DIET.tool - 80)));
|
|
570
|
+
const whole = new Set([...WHOLE_FIELDS].filter((f) => f.startsWith(t.name + '.')).map((f) => f.slice(t.name.length + 1)));
|
|
571
|
+
const inputSchema = dietSchema(t.inputSchema, DIET.ownField, '', DIET.inner, whole);
|
|
572
|
+
const cut = short !== own || JSON.stringify(inputSchema) !== JSON.stringify(t.inputSchema);
|
|
573
|
+
const pointer = 'All of it: ' + helpCall(t.name) + '.';
|
|
574
|
+
return { ...t, description: cut && !short.includes(helpCall(t.name)) ? short + ' ' + pointer : short, inputSchema };
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* The tier of a family action in the connector listing: 1 = its fields with short text (DESCRIBED_ACTIONS), 2 = field
|
|
579
|
+
* names, structure, enums only (leanSchema), 3 = no fields (askFirstSchema) when the names alone would cost
|
|
580
|
+
* DIET.askFirst bytes or more and FIELDS_KEPT does not hold it in tier 2 (107b-tier3).
|
|
581
|
+
* @param {{name: string, inputSchema: any}} t the fine tool @returns {1 | 2 | 3}
|
|
582
|
+
*/
|
|
583
|
+
export function actionTier(t) {
|
|
584
|
+
if (DESCRIBED_ACTIONS.has(t.name)) return 1;
|
|
585
|
+
if (FIELDS_KEPT.has(t.name)) return 2;
|
|
586
|
+
const cost = (/** @type {any} */ x) => new TextEncoder().encode(JSON.stringify(x)).length;
|
|
587
|
+
return cost(leanSchema(t.inputSchema)) - cost(askFirstSchema(t.inputSchema)) >= DIET.askFirst ? 3 : 2;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/** a family action's schema in the listing, by its tier @param {{name: string, inputSchema: any}} t */
|
|
591
|
+
function listedActionSchema(t) {
|
|
592
|
+
const tier = actionTier(t);
|
|
593
|
+
return tier === 1 ? dietSchema(t.inputSchema, DIET.field, '', DIET.inner) : tier === 2 ? leanSchema(t.inputSchema) : askFirstSchema(t.inputSchema);
|
|
450
594
|
}
|
|
451
595
|
|
|
452
596
|
/**
|
|
@@ -460,13 +604,28 @@ function familyTool(family, f, actions, batch = null) {
|
|
|
460
604
|
const properties = {
|
|
461
605
|
action: { type: 'string', enum: actions.map(([a]) => a), description: 'What to do. Put its fields in the object named after the action.' }
|
|
462
606
|
};
|
|
463
|
-
|
|
607
|
+
// 107 T0: each action's object carries ONE line and its fields with short descriptions; a field that means the
|
|
608
|
+
// same in several actions is written once, in the family's own text; the rest is what_can_you_do {tool, action}
|
|
609
|
+
/** @param {any} t */
|
|
610
|
+
const line = (t) => sayFamilyNames(withConsent(t.description, /** @type {Record<string, string>} */ (ACTION_BRIEF)[t.name] ?? brief(String(t.description ?? '').split('\n')[0], DIET.action)));
|
|
611
|
+
const dieted = shareFields(actions.map(([action, t]) => [action, listedActionSchema(t)]));
|
|
612
|
+
const lineOf = new Map(actions.map(([action, t]) => [action, line(t)]));
|
|
613
|
+
const tierOf = new Map(actions.map(([action, t]) => [action, actionTier(t)]));
|
|
614
|
+
for (const [action, schema] of dieted.actions) {
|
|
615
|
+
// a third-tier action with no consent field lists no `properties` at all (shareFields hands back an empty one)
|
|
616
|
+
const { properties: own, ...rest } = schema;
|
|
617
|
+
const keep = tierOf.get(action) !== 3 || Object.keys(own ?? {}).length;
|
|
618
|
+
properties[action] = { ...(keep ? schema : rest), description: lineOf.get(action) };
|
|
619
|
+
}
|
|
464
620
|
const example = actions[0][0];
|
|
621
|
+
// 107b-tier3: one sentence for the three tiers (fields with text / names only / none) and the help call
|
|
465
622
|
let description =
|
|
466
|
-
f.summary +
|
|
623
|
+
f.summary +
|
|
624
|
+
'\nCall it as {"action": "' + example + '", "' + example + '": {…its fields…}}. An action listed with field names only, or with no fields, wants ' + helpCall(family, example).replace('"' + example + '"}', '"<action>"}') + ' first: all its fields, types, limits and examples.';
|
|
625
|
+
if (dieted.shared.length) description += '\nThe same in every action that has it: ' + dieted.shared.map(([name, text]) => name + ' = ' + text).join('; ') + '.';
|
|
467
626
|
if (batch) {
|
|
468
|
-
const list = batch.tool.inputSchema?.properties?.[batch.key];
|
|
469
|
-
properties[batch.key] = { ...(list ?? { type: 'array' }), description:
|
|
627
|
+
const list = dietSchema(batch.tool.inputSchema?.properties?.[batch.key], DIET.field);
|
|
628
|
+
properties[batch.key] = { ...(list ?? { type: 'array' }), description: line(batch.tool) };
|
|
470
629
|
description += '\nMany at once: {"' + batch.key + '": [{"action": "' + example + '", "' + example + '": {…}}, …]} with no action — one call, one undo step.';
|
|
471
630
|
}
|
|
472
631
|
const all = batch ? [...actions, [batch.key, batch.tool]] : actions;
|
|
@@ -506,7 +665,8 @@ export function resolveFamilyCall(families, name, args) {
|
|
|
506
665
|
if (batchKey) return { tool: actions[batchKey], args: { [batchKey]: args[batchKey] } };
|
|
507
666
|
const action = typeof args?.action === 'string' ? args.action : '';
|
|
508
667
|
const tool = actions[action];
|
|
509
|
-
|
|
668
|
+
// 107-int-2 (claude:9 Q5): the refusal names the help call; the Worker's resolveCall says the same, word for word
|
|
669
|
+
if (!tool) return { error: name + ' needs an action: one of ' + Object.keys(actions).join(', ') + '. Its actions in full: ' + helpCall(name) + '.' };
|
|
510
670
|
const inner = args[action];
|
|
511
671
|
if (inner && typeof inner === 'object' && !Array.isArray(inner)) return { tool, args: withAnswerFields(inner, args) };
|
|
512
672
|
const { action: _a, ...rest } = args;
|