@adminide-stack/yantra-mobile 12.0.121 → 12.0.123-alpha.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/lib/features/apps/appArt.js +1 -1
- package/lib/features/apps/appArt.js.map +1 -1
- package/lib/features/apps/mobileAppCatalog.js +15 -11
- package/lib/features/apps/mobileAppCatalog.js.map +1 -1
- package/lib/features/canvas/CanvasAgentChatPane.js +82 -20
- package/lib/features/canvas/CanvasAgentChatPane.js.map +1 -1
- package/lib/features/canvas/CanvasBoardsGrid.js +291 -100
- package/lib/features/canvas/CanvasBoardsGrid.js.map +1 -1
- package/lib/features/canvas/CanvasEditToolsPanel.js +105 -12
- package/lib/features/canvas/CanvasEditToolsPanel.js.map +1 -1
- package/lib/features/canvas/CanvasExperience.js +266 -68
- package/lib/features/canvas/CanvasExperience.js.map +1 -1
- package/lib/features/canvas/CanvasGeneratePanel.js +204 -66
- package/lib/features/canvas/CanvasGeneratePanel.js.map +1 -1
- package/lib/features/canvas/CanvasLibrarySheet.js +31 -13
- package/lib/features/canvas/CanvasLibrarySheet.js.map +1 -1
- package/lib/features/canvas/CanvasModelPicker.js +176 -0
- package/lib/features/canvas/CanvasModelPicker.js.map +1 -0
- package/lib/features/canvas/CanvasTasksPanel.js +325 -29
- package/lib/features/canvas/CanvasTasksPanel.js.map +1 -1
- package/lib/features/canvas/CanvasTemplatesPanel.js +5 -4
- package/lib/features/canvas/CanvasTemplatesPanel.js.map +1 -1
- package/lib/features/canvas/CanvasToolDock.js +137 -61
- package/lib/features/canvas/CanvasToolDock.js.map +1 -1
- package/lib/features/canvas/FrameExtractorExperience.js +33 -2
- package/lib/features/canvas/FrameExtractorExperience.js.map +1 -1
- package/lib/features/canvas/GeneratorReferenceSlots.js +197 -0
- package/lib/features/canvas/GeneratorReferenceSlots.js.map +1 -0
- package/lib/features/canvas/NativeCanvasViewer.js +89 -11
- package/lib/features/canvas/NativeCanvasViewer.js.map +1 -1
- package/lib/features/canvas/PromoContextFields.js +55 -2
- package/lib/features/canvas/PromoContextFields.js.map +1 -1
- package/lib/features/canvas/SetStudioExperience.js +323 -13
- package/lib/features/canvas/SetStudioExperience.js.map +1 -1
- package/lib/features/canvas/VideoEditExperience.js +1 -53
- package/lib/features/canvas/VideoEditExperience.js.map +1 -1
- package/lib/features/canvas/VideoEditorExperience.js +697 -506
- package/lib/features/canvas/VideoEditorExperience.js.map +1 -1
- package/lib/features/canvas/VideoGeneratorExperience.js +22 -5
- package/lib/features/canvas/VideoGeneratorExperience.js.map +1 -1
- package/lib/features/canvas/canvasAgentChat.js +125 -11
- package/lib/features/canvas/canvasAgentChat.js.map +1 -1
- package/lib/features/canvas/canvasCore.js +117 -12
- package/lib/features/canvas/canvasCore.js.map +1 -1
- package/lib/features/canvas/canvasEditOps.js +148 -111
- package/lib/features/canvas/canvasEditOps.js.map +1 -1
- package/lib/features/canvas/canvasTaskSync.js +235 -0
- package/lib/features/canvas/canvasTaskSync.js.map +1 -0
- package/lib/features/canvas/canvasTasks.js +98 -11
- package/lib/features/canvas/canvasTasks.js.map +1 -1
- package/lib/features/canvas/createTiles.js +247 -0
- package/lib/features/canvas/createTiles.js.map +1 -0
- package/lib/features/canvas/deepLinks.js +83 -0
- package/lib/features/canvas/deepLinks.js.map +1 -0
- package/lib/features/canvas/frameExtract.js +13 -1
- package/lib/features/canvas/frameExtract.js.map +1 -1
- package/lib/features/canvas/generationModels.js +36 -8
- package/lib/features/canvas/generationModels.js.map +1 -1
- package/lib/features/canvas/generatorCommands.js +106 -0
- package/lib/features/canvas/generatorCommands.js.map +1 -0
- package/lib/features/canvas/generatorReferences.js +82 -0
- package/lib/features/canvas/generatorReferences.js.map +1 -0
- package/lib/features/canvas/homeWork.js +74 -0
- package/lib/features/canvas/homeWork.js.map +1 -0
- package/lib/features/canvas/linksRpc.js +130 -0
- package/lib/features/canvas/linksRpc.js.map +1 -0
- package/lib/features/canvas/mediaRecheck.js +176 -0
- package/lib/features/canvas/mediaRecheck.js.map +1 -0
- package/lib/features/canvas/mediaUrls.js +258 -0
- package/lib/features/canvas/mediaUrls.js.map +1 -0
- package/lib/features/canvas/nativeViewerRegistry.js.map +1 -1
- package/lib/features/canvas/promoProjectImport.js +80 -13
- package/lib/features/canvas/promoProjectImport.js.map +1 -1
- package/lib/features/canvas/promoVideo.js +106 -15
- package/lib/features/canvas/promoVideo.js.map +1 -1
- package/lib/features/canvas/reframe.js +228 -0
- package/lib/features/canvas/reframe.js.map +1 -0
- package/lib/features/canvas/serverTasks.js +697 -0
- package/lib/features/canvas/serverTasks.js.map +1 -0
- package/lib/features/canvas/set/SetViewportWebView.js +207 -28
- package/lib/features/canvas/set/SetViewportWebView.js.map +1 -1
- package/lib/features/canvas/set/agent/prompt.js +66 -0
- package/lib/features/canvas/set/agent/prompt.js.map +1 -0
- package/lib/features/canvas/set/agent/setOps.js +203 -0
- package/lib/features/canvas/set/agent/setOps.js.map +1 -0
- package/lib/features/canvas/set/agent/setTurn.js +128 -0
- package/lib/features/canvas/set/agent/setTurn.js.map +1 -0
- package/lib/features/canvas/set/agent/snapshot.js +43 -0
- package/lib/features/canvas/set/agent/snapshot.js.map +1 -0
- package/lib/features/canvas/set/agent/tools.js +580 -0
- package/lib/features/canvas/set/agent/tools.js.map +1 -0
- package/lib/features/canvas/set/setProject.js +43 -4
- package/lib/features/canvas/set/setProject.js.map +1 -1
- package/lib/features/canvas/set/supplyLibrary.js +397 -0
- package/lib/features/canvas/set/supplyLibrary.js.map +1 -0
- package/lib/features/canvas/storageLibrary.js +113 -52
- package/lib/features/canvas/storageLibrary.js.map +1 -1
- package/lib/features/canvas/studioCatalog.js +15 -2
- package/lib/features/canvas/studioCatalog.js.map +1 -1
- package/lib/features/canvas/studioLooks.js +1 -8
- package/lib/features/canvas/studioLooks.js.map +1 -1
- package/lib/features/canvas/useBoardMediaRefresh.js +66 -0
- package/lib/features/canvas/useBoardMediaRefresh.js.map +1 -0
- package/lib/features/canvas/useMediaSource.js +84 -0
- package/lib/features/canvas/useMediaSource.js.map +1 -0
- package/lib/features/canvas/video3d.js +11 -10
- package/lib/features/canvas/video3d.js.map +1 -1
- package/lib/features/canvas/videoEditor/BlurBoxOverlay.js +46 -0
- package/lib/features/canvas/videoEditor/BlurBoxOverlay.js.map +1 -0
- package/lib/features/canvas/videoEditor/ExportTaskCard.js +134 -0
- package/lib/features/canvas/videoEditor/ExportTaskCard.js.map +1 -0
- package/lib/features/canvas/videoEditor/agent/AgentCutPane.js +45 -7
- package/lib/features/canvas/videoEditor/agent/AgentCutPane.js.map +1 -1
- package/lib/features/canvas/videoEditor/agent/agentLoop.js +4 -2
- package/lib/features/canvas/videoEditor/agent/agentLoop.js.map +1 -1
- package/lib/features/canvas/videoEditor/agent/attachments.js +304 -0
- package/lib/features/canvas/videoEditor/agent/attachments.js.map +1 -0
- package/lib/features/canvas/videoEditor/agent/brainClient.js +3 -2
- package/lib/features/canvas/videoEditor/agent/brainClient.js.map +1 -1
- package/lib/features/canvas/videoEditor/agent/cutTools.js +207 -7
- package/lib/features/canvas/videoEditor/agent/cutTools.js.map +1 -1
- package/lib/features/canvas/videoEditor/blurBox.js +34 -0
- package/lib/features/canvas/videoEditor/blurBox.js.map +1 -0
- package/lib/features/canvas/videoEditor/compileTimeline.js +668 -0
- package/lib/features/canvas/videoEditor/compileTimeline.js.map +1 -0
- package/lib/features/canvas/videoEditor/editorModel.js +56 -22
- package/lib/features/canvas/videoEditor/editorModel.js.map +1 -1
- package/lib/features/canvas/videoEditor/exportPipeline.js +77 -0
- package/lib/features/canvas/videoEditor/exportPipeline.js.map +1 -0
- package/lib/features/canvas/videoEditor/exportRenderer.js +19 -12
- package/lib/features/canvas/videoEditor/exportRenderer.js.map +1 -1
- package/lib/features/canvas/videoEditor/exportTask.js +216 -0
- package/lib/features/canvas/videoEditor/exportTask.js.map +1 -0
- package/lib/features/canvas/videoEditor/formWidgets.js +142 -0
- package/lib/features/canvas/videoEditor/formWidgets.js.map +1 -0
- package/lib/features/canvas/videoEditor/produce/ProduceVideoSheet.js +195 -0
- package/lib/features/canvas/videoEditor/produce/ProduceVideoSheet.js.map +1 -0
- package/lib/features/canvas/videoEditor/produce/produceScenes.js +158 -0
- package/lib/features/canvas/videoEditor/produce/produceScenes.js.map +1 -0
- package/lib/features/canvas/videoEditor/remoteMediaClient.js +17 -5
- package/lib/features/canvas/videoEditor/remoteMediaClient.js.map +1 -1
- package/lib/features/canvas/videoEditor/renderTimeline.js +207 -0
- package/lib/features/canvas/videoEditor/renderTimeline.js.map +1 -0
- package/lib/features/canvas/videoEditor/renewLinks.js +64 -0
- package/lib/features/canvas/videoEditor/renewLinks.js.map +1 -0
- package/lib/features/canvas/videoEditor/sceneLayers.js +101 -0
- package/lib/features/canvas/videoEditor/sceneLayers.js.map +1 -0
- package/lib/features/canvas/videoEditor/tools/ToolsDrawer.js +283 -0
- package/lib/features/canvas/videoEditor/tools/ToolsDrawer.js.map +1 -0
- package/lib/features/canvas/videoEditor/tools/catalog.js +576 -0
- package/lib/features/canvas/videoEditor/tools/catalog.js.map +1 -0
- package/lib/features/canvas/videoEditor/videoProjectsStore.js +27 -3
- package/lib/features/canvas/videoEditor/videoProjectsStore.js.map +1 -1
- package/lib/features/webbuilder/WebBuilderExperience.js +29 -1
- package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
- package/lib/features/webbuilder/buildFragments.js +8 -4
- package/lib/features/webbuilder/buildFragments.js.map +1 -1
- package/lib/features/webbuilder/codezenHandoff.js +108 -0
- package/lib/features/webbuilder/codezenHandoff.js.map +1 -0
- package/lib/features/webbuilder/workflow.js.map +1 -1
- package/lib/hooks/useChatApi.js +1 -2
- package/lib/hooks/useChatApi.js.map +1 -1
- package/lib/screens/CanvasBoard/index.js +12 -1
- package/lib/screens/CanvasBoard/index.js.map +1 -1
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/components/HomeSuggestions.js +3 -3
- package/lib/screens/Home/components/HomeSuggestions.js.map +1 -1
- package/lib/screens/WebBuilder/index.js +4 -2
- package/lib/screens/WebBuilder/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/index.js +29 -2
- package/lib/screens/WebBuilderNative/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js +30 -6
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
- package/package.json +4 -4
- /package/lib/assets/apps/{paper2poster.webp → poster.webp} +0 -0
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
import {KIT_ENTRIES}from'../supplyLibrary.js';import {SET_ASPECTS,MESH_TARGET_HEIGHT_M,newObjectId,vec3,lightingOf,DEFAULT_CAMERA}from'../setProject.js';import {describeSet,describeObjects}from'./snapshot.js';import {uniqueName,cameraFromShot,tidySet,removeObjects,updateObjects,placeObjects}from'./setOps.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
class ToolInputError extends Error {
|
|
21
|
+
}
|
|
22
|
+
const argsOf = (raw) => raw && typeof raw === "object" ? raw : {};
|
|
23
|
+
const isNum = (v) => typeof v === "number" && Number.isFinite(v);
|
|
24
|
+
const str = (v) => typeof v === "string" ? v.trim() : "";
|
|
25
|
+
const list = (v) => Array.isArray(v) ? v : [];
|
|
26
|
+
const point = (v) => {
|
|
27
|
+
if (!v || typeof v !== "object") return void 0;
|
|
28
|
+
const raw = v;
|
|
29
|
+
const out = {};
|
|
30
|
+
if (isNum(raw.x)) out.x = raw.x;
|
|
31
|
+
if (isNum(raw.y)) out.y = raw.y;
|
|
32
|
+
if (isNum(raw.z)) out.z = raw.z;
|
|
33
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
34
|
+
};
|
|
35
|
+
function sizing(raw) {
|
|
36
|
+
const scaleXyz = point(raw.scale_xyz);
|
|
37
|
+
return __spreadValues(__spreadValues(__spreadValues({}, scaleXyz ? {
|
|
38
|
+
scaleXyz
|
|
39
|
+
} : {}), isNum(raw.scale) ? {
|
|
40
|
+
scale: raw.scale
|
|
41
|
+
} : {}), isNum(raw.height_m) ? {
|
|
42
|
+
heightM: raw.height_m
|
|
43
|
+
} : {});
|
|
44
|
+
}
|
|
45
|
+
function toPlacement(raw) {
|
|
46
|
+
const o = argsOf(raw);
|
|
47
|
+
const kit = str(o.kit) || str(o.kit_id) || str(o.kitId);
|
|
48
|
+
if (!kit) return null;
|
|
49
|
+
const position = point(o.position);
|
|
50
|
+
const rotation = point(o.rotation);
|
|
51
|
+
return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
52
|
+
kit
|
|
53
|
+
}, str(o.name) ? {
|
|
54
|
+
name: str(o.name)
|
|
55
|
+
} : {}), position ? {
|
|
56
|
+
position
|
|
57
|
+
} : {}), rotation ? {
|
|
58
|
+
rotation
|
|
59
|
+
} : {}), isNum(o.rotation_y) ? {
|
|
60
|
+
rotationY: o.rotation_y
|
|
61
|
+
} : {}), sizing(o)), str(o.color) ? {
|
|
62
|
+
color: str(o.color)
|
|
63
|
+
} : {}), o.locked === true ? {
|
|
64
|
+
locked: true
|
|
65
|
+
} : {});
|
|
66
|
+
}
|
|
67
|
+
function toUpdate(raw) {
|
|
68
|
+
const o = argsOf(raw);
|
|
69
|
+
const id = str(o.id);
|
|
70
|
+
if (!id) return null;
|
|
71
|
+
const position = point(o.position);
|
|
72
|
+
const rotation = point(o.rotation);
|
|
73
|
+
return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
74
|
+
id
|
|
75
|
+
}, str(o.name) ? {
|
|
76
|
+
name: str(o.name)
|
|
77
|
+
} : {}), position ? {
|
|
78
|
+
position
|
|
79
|
+
} : {}), rotation ? {
|
|
80
|
+
rotation
|
|
81
|
+
} : {}), isNum(o.rotation_y) ? {
|
|
82
|
+
rotationY: o.rotation_y
|
|
83
|
+
} : {}), sizing(o)), str(o.color) ? {
|
|
84
|
+
color: str(o.color)
|
|
85
|
+
} : {}), typeof o.hidden === "boolean" ? {
|
|
86
|
+
hidden: o.hidden
|
|
87
|
+
} : {}), typeof o.locked === "boolean" ? {
|
|
88
|
+
locked: o.locked
|
|
89
|
+
} : {});
|
|
90
|
+
}
|
|
91
|
+
const KIT_IDS = KIT_ENTRIES.map((entry) => entry.id).join(", ");
|
|
92
|
+
const plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
93
|
+
function tool(name, description, properties, required = []) {
|
|
94
|
+
return {
|
|
95
|
+
type: "function",
|
|
96
|
+
function: {
|
|
97
|
+
name,
|
|
98
|
+
description,
|
|
99
|
+
parameters: {
|
|
100
|
+
type: "object",
|
|
101
|
+
properties,
|
|
102
|
+
required
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const VEC3 = {
|
|
108
|
+
type: "object",
|
|
109
|
+
description: "Metres. x is right, y is up, z is toward the default camera.",
|
|
110
|
+
properties: {
|
|
111
|
+
x: {
|
|
112
|
+
type: "number"
|
|
113
|
+
},
|
|
114
|
+
y: {
|
|
115
|
+
type: "number"
|
|
116
|
+
},
|
|
117
|
+
z: {
|
|
118
|
+
type: "number"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const SIZING = {
|
|
123
|
+
height_m: {
|
|
124
|
+
type: "number",
|
|
125
|
+
description: "The height this piece should end up, in metres. The simplest way to size anything."
|
|
126
|
+
},
|
|
127
|
+
scale: {
|
|
128
|
+
type: "number",
|
|
129
|
+
description: "Uniform multiplier on the kit size. Ignored when height_m is given."
|
|
130
|
+
},
|
|
131
|
+
scale_xyz: __spreadProps(__spreadValues({}, VEC3), {
|
|
132
|
+
description: "Non-uniform scale, when a piece has to be stretched (a plank into a 2m shelf)."
|
|
133
|
+
})
|
|
134
|
+
};
|
|
135
|
+
const PLACEMENT = {
|
|
136
|
+
type: "object",
|
|
137
|
+
properties: __spreadProps(__spreadValues({
|
|
138
|
+
kit: {
|
|
139
|
+
type: "string",
|
|
140
|
+
description: `Supply library id: ${KIT_IDS}.`
|
|
141
|
+
},
|
|
142
|
+
name: {
|
|
143
|
+
type: "string",
|
|
144
|
+
description: 'What this is in the shot ("Counter", "Barista"), not the shape.'
|
|
145
|
+
},
|
|
146
|
+
position: __spreadProps(__spreadValues({}, VEC3), {
|
|
147
|
+
description: "Where the BASE of the piece sits. Floor level is y 0; on a table is y 0.77."
|
|
148
|
+
}),
|
|
149
|
+
rotation_y: {
|
|
150
|
+
type: "number",
|
|
151
|
+
description: "Turn around the vertical axis, in degrees."
|
|
152
|
+
}
|
|
153
|
+
}, SIZING), {
|
|
154
|
+
color: {
|
|
155
|
+
type: "string",
|
|
156
|
+
description: 'Hex tint, e.g. "#c9b79c". Omit to keep the kit colour.'
|
|
157
|
+
},
|
|
158
|
+
locked: {
|
|
159
|
+
type: "boolean",
|
|
160
|
+
description: "Lock set dressing the user should not drag by accident - floors and walls."
|
|
161
|
+
}
|
|
162
|
+
}),
|
|
163
|
+
required: ["kit"]
|
|
164
|
+
};
|
|
165
|
+
const SET_AGENT_TOOLS = [tool("block_set", 'Place stock geometry. mode "replace" blocks a whole new set in one call (use this for a fresh brief); mode "add" keeps what is there and adds to it.', {
|
|
166
|
+
mode: {
|
|
167
|
+
type: "string",
|
|
168
|
+
enum: ["replace", "add"],
|
|
169
|
+
description: 'Default "add".'
|
|
170
|
+
},
|
|
171
|
+
objects: {
|
|
172
|
+
type: "array",
|
|
173
|
+
items: PLACEMENT,
|
|
174
|
+
description: "The pieces to place, in the order they matter."
|
|
175
|
+
}
|
|
176
|
+
}, ["objects"]), tool("update_objects", "Move, turn, resize, recolour, hide or lock objects already in the set. Every field is optional: send only what changes.", {
|
|
177
|
+
updates: {
|
|
178
|
+
type: "array",
|
|
179
|
+
items: {
|
|
180
|
+
type: "object",
|
|
181
|
+
properties: __spreadProps(__spreadValues({
|
|
182
|
+
id: {
|
|
183
|
+
type: "string",
|
|
184
|
+
description: "Object id, copied from the snapshot."
|
|
185
|
+
},
|
|
186
|
+
name: {
|
|
187
|
+
type: "string"
|
|
188
|
+
},
|
|
189
|
+
position: VEC3,
|
|
190
|
+
rotation_y: {
|
|
191
|
+
type: "number"
|
|
192
|
+
}
|
|
193
|
+
}, SIZING), {
|
|
194
|
+
color: {
|
|
195
|
+
type: "string"
|
|
196
|
+
},
|
|
197
|
+
hidden: {
|
|
198
|
+
type: "boolean"
|
|
199
|
+
},
|
|
200
|
+
locked: {
|
|
201
|
+
type: "boolean"
|
|
202
|
+
}
|
|
203
|
+
}),
|
|
204
|
+
required: ["id"]
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}, ["updates"]), tool("remove_objects", "Take objects out of the set.", {
|
|
208
|
+
ids: {
|
|
209
|
+
type: "array",
|
|
210
|
+
items: {
|
|
211
|
+
type: "string"
|
|
212
|
+
},
|
|
213
|
+
description: "Object ids."
|
|
214
|
+
}
|
|
215
|
+
}, ["ids"]), tool("set_camera", "Put the camera on a shot. Describe it as distance, height and lens rather than coordinates where you can - distance is measured on the ground from the target.", {
|
|
216
|
+
target: __spreadProps(__spreadValues({}, VEC3), {
|
|
217
|
+
description: "What the camera looks at. Aim at the interesting height: a standing figure's chest is ~1.2m."
|
|
218
|
+
}),
|
|
219
|
+
distance: {
|
|
220
|
+
type: "number",
|
|
221
|
+
description: "Metres from the target: wide room 5-7, full figure 4, product 1.2-1.8, portrait 1.3."
|
|
222
|
+
},
|
|
223
|
+
height: {
|
|
224
|
+
type: "number",
|
|
225
|
+
description: "Lens height in metres: 1.6 standing, 1.2 seated, below 0.8 is a low angle."
|
|
226
|
+
},
|
|
227
|
+
azimuth_deg: {
|
|
228
|
+
type: "number",
|
|
229
|
+
description: "Where the camera stands around the target. 0 is straight in front (+Z), 90 is to the right (+X)."
|
|
230
|
+
},
|
|
231
|
+
lens_mm: {
|
|
232
|
+
type: "number",
|
|
233
|
+
description: "35mm-equivalent focal length: 24 wide, 35 normal, 50 product, 85 portrait."
|
|
234
|
+
},
|
|
235
|
+
fov: {
|
|
236
|
+
type: "number",
|
|
237
|
+
description: "Vertical field of view in degrees, if you would rather set it directly."
|
|
238
|
+
},
|
|
239
|
+
position: __spreadProps(__spreadValues({}, VEC3), {
|
|
240
|
+
description: "An exact camera position; overrides distance/height/azimuth."
|
|
241
|
+
})
|
|
242
|
+
}), tool("set_light", "Aim the key light and set the ambient fill.", {
|
|
243
|
+
azimuth_deg: {
|
|
244
|
+
type: "number",
|
|
245
|
+
description: "Direction around the set, in degrees."
|
|
246
|
+
},
|
|
247
|
+
elevation_deg: {
|
|
248
|
+
type: "number",
|
|
249
|
+
description: "Height above the horizon: 40+ is flattering, 15-25 throws long shadows."
|
|
250
|
+
},
|
|
251
|
+
key: {
|
|
252
|
+
type: "number",
|
|
253
|
+
description: "Key intensity, 0-10. 2.6 is a normal key."
|
|
254
|
+
},
|
|
255
|
+
ambient: {
|
|
256
|
+
type: "number",
|
|
257
|
+
description: "Fill intensity, 0-5. Raise it for a soft overcast look."
|
|
258
|
+
}
|
|
259
|
+
}), tool("set_world", "The backdrop behind the set, and the ground under it.", {
|
|
260
|
+
background: {
|
|
261
|
+
type: "string",
|
|
262
|
+
description: "Hex backdrop colour, used when there is no panorama."
|
|
263
|
+
},
|
|
264
|
+
show_ground: {
|
|
265
|
+
type: "boolean",
|
|
266
|
+
description: "The ground plane that catches contact shadows. Almost always true."
|
|
267
|
+
},
|
|
268
|
+
rotation_deg: {
|
|
269
|
+
type: "number",
|
|
270
|
+
description: "Turn a generated panorama to place its sun or landmark."
|
|
271
|
+
}
|
|
272
|
+
}), tool("set_format", "The aspect the render is framed to, and the set's name.", {
|
|
273
|
+
aspect: {
|
|
274
|
+
type: "string",
|
|
275
|
+
enum: [...SET_ASPECTS],
|
|
276
|
+
description: "Decide this before blocking: it changes where things go."
|
|
277
|
+
},
|
|
278
|
+
title: {
|
|
279
|
+
type: "string",
|
|
280
|
+
description: "A short name for the set."
|
|
281
|
+
}
|
|
282
|
+
}), tool("generate_object", "Turn a prompt, or a still already on the board, into a real 3D object and place it. Takes 45-120 seconds - use it for the one or two pieces the shot is about.", {
|
|
283
|
+
prompt: {
|
|
284
|
+
type: "string",
|
|
285
|
+
description: 'The object alone, plainly described: "a chipped enamel coffee mug". No scene, no background.'
|
|
286
|
+
},
|
|
287
|
+
still_id: {
|
|
288
|
+
type: "string",
|
|
289
|
+
description: "A still from the board to generate from instead of a prompt."
|
|
290
|
+
},
|
|
291
|
+
name: {
|
|
292
|
+
type: "string",
|
|
293
|
+
description: "What it is in the shot."
|
|
294
|
+
},
|
|
295
|
+
position: __spreadProps(__spreadValues({}, VEC3), {
|
|
296
|
+
description: "Where its base sits. Defaults to the camera target."
|
|
297
|
+
}),
|
|
298
|
+
height_m: {
|
|
299
|
+
type: "number",
|
|
300
|
+
description: `The height it should end up. Generated meshes arrive normalised to ${MESH_TARGET_HEIGHT_M}m, so always say.`
|
|
301
|
+
}
|
|
302
|
+
}), tool("generate_world", "Paint the 360 panorama behind the set. A few seconds.", {
|
|
303
|
+
prompt: {
|
|
304
|
+
type: "string",
|
|
305
|
+
description: 'The place, plainly: "a rain-slicked city street at night, neon signage". No subject.'
|
|
306
|
+
}
|
|
307
|
+
}, ["prompt"]), tool("get_set", "Read the set back as it stands now.", {})];
|
|
308
|
+
function committed(ctx, project, said, label, detail) {
|
|
309
|
+
const tidy = tidySet(project);
|
|
310
|
+
ctx.commit(tidy);
|
|
311
|
+
return __spreadValues({
|
|
312
|
+
result: `${said}
|
|
313
|
+
|
|
314
|
+
${describeObjects(tidy)}`,
|
|
315
|
+
label
|
|
316
|
+
}, detail ? {
|
|
317
|
+
detail
|
|
318
|
+
} : {});
|
|
319
|
+
}
|
|
320
|
+
function blockSet(args, ctx) {
|
|
321
|
+
const specs = list(args.objects).map(toPlacement).filter((s) => s !== null);
|
|
322
|
+
if (specs.length === 0) throw new ToolInputError(`no placeable objects - every entry needs a "kit" from: ${KIT_IDS}`);
|
|
323
|
+
const mode = args.mode === "replace" ? "replace" : "add";
|
|
324
|
+
const {
|
|
325
|
+
project,
|
|
326
|
+
placed,
|
|
327
|
+
unknownKits
|
|
328
|
+
} = placeObjects(ctx.project(), specs, mode);
|
|
329
|
+
if (placed.length === 0) throw new ToolInputError(`none of those kit ids exist (${unknownKits.join(", ")}); use one of: ${KIT_IDS}`);
|
|
330
|
+
const dropped = unknownKits.length > 0 ? ` Dropped ${plural(unknownKits.length, "entry")} with an unknown kit (${unknownKits.join(", ")}); the library is: ${KIT_IDS}.` : "";
|
|
331
|
+
const verb = mode === "replace" ? "Replaced the set with" : "Added";
|
|
332
|
+
const camera = project.camera;
|
|
333
|
+
const untouched = camera.position.x === DEFAULT_CAMERA.position.x && camera.position.y === DEFAULT_CAMERA.position.y && camera.position.z === DEFAULT_CAMERA.position.z;
|
|
334
|
+
const nextStep = untouched ? " The camera has NOT been set - it is still on the default angle. Call set_camera now; the shot is not blocked until you do." : "";
|
|
335
|
+
return committed(ctx, project, `${verb} ${plural(placed.length, "object")}.${dropped}${nextStep}`, `${mode === "replace" ? "Blocked" : "Added"} ${plural(placed.length, "object")}`, placed.slice(0, 6).map((o) => o.name).join(", "));
|
|
336
|
+
}
|
|
337
|
+
function updateTool(args, ctx) {
|
|
338
|
+
const specs = list(args.updates).map(toUpdate).filter((s) => s !== null);
|
|
339
|
+
if (specs.length === 0) throw new ToolInputError('no updates - every entry needs the "id" of an object in the set');
|
|
340
|
+
const {
|
|
341
|
+
project,
|
|
342
|
+
updated,
|
|
343
|
+
missing
|
|
344
|
+
} = updateObjects(ctx.project(), specs);
|
|
345
|
+
if (updated.length === 0) throw new ToolInputError(`no object in the set has ${missing.length === 1 ? `id ${missing[0]}` : `any of those ids (${missing.join(", ")})`}`);
|
|
346
|
+
const note = missing.length > 0 ? ` No object has ${missing.length === 1 ? `id ${missing[0]}` : `ids ${missing.join(", ")}`}.` : "";
|
|
347
|
+
return committed(ctx, project, `Updated ${plural(updated.length, "object")}.${note}`, `Updated ${plural(updated.length, "object")}`, updated.map((o) => o.name).slice(0, 6).join(", "));
|
|
348
|
+
}
|
|
349
|
+
function removeTool(args, ctx) {
|
|
350
|
+
const ids = list(args.ids).map((v) => str(v)).filter(Boolean);
|
|
351
|
+
if (ids.length === 0) throw new ToolInputError("no ids given");
|
|
352
|
+
const {
|
|
353
|
+
project,
|
|
354
|
+
removed,
|
|
355
|
+
missing
|
|
356
|
+
} = removeObjects(ctx.project(), ids);
|
|
357
|
+
if (removed.length === 0) throw new ToolInputError(`no object in the set has ${missing.length === 1 ? `id ${missing[0]}` : `any of those ids (${missing.join(", ")})`}`);
|
|
358
|
+
const note = missing.length > 0 ? ` ${plural(missing.length, "id")} matched nothing.` : "";
|
|
359
|
+
return committed(ctx, project, `Removed ${plural(removed.length, "object")}.${note}`, `Removed ${plural(removed.length, "object")}`, removed.map((o) => o.name).join(", "));
|
|
360
|
+
}
|
|
361
|
+
function cameraTool(args, ctx) {
|
|
362
|
+
var _a;
|
|
363
|
+
const spec = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, point(args.target) ? {
|
|
364
|
+
target: point(args.target)
|
|
365
|
+
} : {}), point(args.position) ? {
|
|
366
|
+
position: point(args.position)
|
|
367
|
+
} : {}), isNum(args.distance) ? {
|
|
368
|
+
distance: args.distance
|
|
369
|
+
} : {}), isNum(args.height) ? {
|
|
370
|
+
height: args.height
|
|
371
|
+
} : {}), isNum(args.azimuth_deg) ? {
|
|
372
|
+
azimuthDeg: args.azimuth_deg
|
|
373
|
+
} : {}), isNum(args.lens_mm) ? {
|
|
374
|
+
lensMm: args.lens_mm
|
|
375
|
+
} : {}), isNum(args.fov) ? {
|
|
376
|
+
fov: args.fov
|
|
377
|
+
} : {});
|
|
378
|
+
if (Object.keys(spec).length === 0) throw new ToolInputError("nothing to change - give a distance, a height, an azimuth, a lens or a target");
|
|
379
|
+
const project = ctx.project();
|
|
380
|
+
const camera = cameraFromShot(project.camera, spec);
|
|
381
|
+
const next = tidySet(__spreadProps(__spreadValues({}, project), {
|
|
382
|
+
camera
|
|
383
|
+
}));
|
|
384
|
+
ctx.commit(next);
|
|
385
|
+
(_a = ctx.applyCamera) == null ? void 0 : _a.call(ctx, next.camera);
|
|
386
|
+
const mm = isNum(args.lens_mm) ? `${Math.round(args.lens_mm)}mm` : `${Math.round(next.camera.fov)}\xB0`;
|
|
387
|
+
const away = Math.hypot(next.camera.position.x - next.camera.target.x, next.camera.position.z - next.camera.target.z);
|
|
388
|
+
return {
|
|
389
|
+
result: `Camera at ${[next.camera.position.x, next.camera.position.y, next.camera.position.z].map((v) => Math.round(v * 100) / 100).join(",")} looking at ${[next.camera.target.x, next.camera.target.y, next.camera.target.z].map((v) => Math.round(v * 100) / 100).join(",")}, ${Math.round(next.camera.fov)}\xB0 fov.`,
|
|
390
|
+
label: "Set the camera",
|
|
391
|
+
detail: `${mm} \xB7 ${Math.round(away * 10) / 10}m out \xB7 ${Math.round(next.camera.position.y * 100) / 100}m up`
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function lightTool(args, ctx) {
|
|
395
|
+
const project = ctx.project();
|
|
396
|
+
const lighting = __spreadValues({}, lightingOf(project));
|
|
397
|
+
let touched = false;
|
|
398
|
+
if (isNum(args.azimuth_deg)) {
|
|
399
|
+
lighting.keyAzimuthDeg = (args.azimuth_deg % 360 + 360) % 360;
|
|
400
|
+
touched = true;
|
|
401
|
+
}
|
|
402
|
+
if (isNum(args.elevation_deg)) {
|
|
403
|
+
lighting.keyElevationDeg = Math.min(89, Math.max(1, args.elevation_deg));
|
|
404
|
+
touched = true;
|
|
405
|
+
}
|
|
406
|
+
if (isNum(args.key)) {
|
|
407
|
+
lighting.keyIntensity = Math.min(10, Math.max(0, args.key));
|
|
408
|
+
touched = true;
|
|
409
|
+
}
|
|
410
|
+
if (isNum(args.ambient)) {
|
|
411
|
+
lighting.ambientIntensity = Math.min(5, Math.max(0, args.ambient));
|
|
412
|
+
touched = true;
|
|
413
|
+
}
|
|
414
|
+
if (!touched) throw new ToolInputError("nothing to change - give an azimuth, an elevation, a key or an ambient");
|
|
415
|
+
ctx.commit(__spreadProps(__spreadValues({}, project), {
|
|
416
|
+
lighting
|
|
417
|
+
}));
|
|
418
|
+
return {
|
|
419
|
+
result: `Key light from ${Math.round(lighting.keyAzimuthDeg)}\xB0 at ${Math.round(lighting.keyElevationDeg)}\xB0 above the horizon, intensity ${lighting.keyIntensity}, ambient ${lighting.ambientIntensity}.`,
|
|
420
|
+
label: "Set the light",
|
|
421
|
+
detail: `${Math.round(lighting.keyAzimuthDeg)}\xB0 / ${Math.round(lighting.keyElevationDeg)}\xB0`
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
function worldTool(args, ctx) {
|
|
425
|
+
const project = ctx.project();
|
|
426
|
+
const world = __spreadValues({}, project.world);
|
|
427
|
+
let touched = false;
|
|
428
|
+
if (/^#[0-9a-f]{3,8}$/i.test(str(args.background))) {
|
|
429
|
+
world.background = str(args.background);
|
|
430
|
+
touched = true;
|
|
431
|
+
}
|
|
432
|
+
if (typeof args.show_ground === "boolean") {
|
|
433
|
+
world.showGround = args.show_ground;
|
|
434
|
+
touched = true;
|
|
435
|
+
}
|
|
436
|
+
if (isNum(args.rotation_deg)) {
|
|
437
|
+
world.rotationDeg = (args.rotation_deg % 360 + 360) % 360;
|
|
438
|
+
touched = true;
|
|
439
|
+
}
|
|
440
|
+
if (!touched) throw new ToolInputError("nothing to change - give a background colour, show_ground, or a rotation");
|
|
441
|
+
ctx.commit(__spreadProps(__spreadValues({}, project), {
|
|
442
|
+
world
|
|
443
|
+
}));
|
|
444
|
+
return {
|
|
445
|
+
result: `Backdrop ${world.background}, ground ${world.showGround ? "on" : "off"}, panorama turned ${Math.round(world.rotationDeg)}\xB0.`,
|
|
446
|
+
label: "Set the world"
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
function formatTool(args, ctx) {
|
|
450
|
+
const project = ctx.project();
|
|
451
|
+
const aspect = str(args.aspect);
|
|
452
|
+
const title = str(args.title);
|
|
453
|
+
if (aspect && !SET_ASPECTS.includes(aspect)) {
|
|
454
|
+
throw new ToolInputError(`aspect must be one of ${SET_ASPECTS.join(", ")}`);
|
|
455
|
+
}
|
|
456
|
+
if (!aspect && !title) throw new ToolInputError("nothing to change - give an aspect or a title");
|
|
457
|
+
ctx.commit(__spreadValues(__spreadValues(__spreadValues({}, project), aspect ? {
|
|
458
|
+
aspect
|
|
459
|
+
} : {}), title ? {
|
|
460
|
+
title
|
|
461
|
+
} : {}));
|
|
462
|
+
return {
|
|
463
|
+
result: `Framed ${aspect || project.aspect}${title ? `, called "${title}"` : ""}.`,
|
|
464
|
+
label: aspect ? `Framed ${aspect}` : "Renamed the set"
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
async function generateObjectTool(args, ctx) {
|
|
468
|
+
var _a, _b;
|
|
469
|
+
const prompt = str(args.prompt);
|
|
470
|
+
const stillId = str(args.still_id);
|
|
471
|
+
const still = stillId ? ctx.stills.find((s) => s.id === stillId) : void 0;
|
|
472
|
+
if (stillId && !still) {
|
|
473
|
+
throw new ToolInputError(ctx.stills.length > 0 ? `no still with id ${stillId}; the board has ${ctx.stills.map((s) => s.id).join(", ")}` : "there are no stills on the board to generate from");
|
|
474
|
+
}
|
|
475
|
+
if (!prompt && !still) throw new ToolInputError("give a prompt describing the object, or a still_id from the board");
|
|
476
|
+
const name = str(args.name) || (prompt ? prompt.slice(0, 28) : (_a = still == null ? void 0 : still.label) != null ? _a : "Object");
|
|
477
|
+
ctx.progress(`Generating ${name}\u2026`);
|
|
478
|
+
const result = await ctx.services.generateObject(__spreadValues(__spreadProps(__spreadValues(__spreadValues({}, prompt ? {
|
|
479
|
+
prompt
|
|
480
|
+
} : {}), still ? {
|
|
481
|
+
imageUrl: still.src
|
|
482
|
+
} : {}), {
|
|
483
|
+
onProgress: (message) => ctx.progress(`${name}: ${message}`)
|
|
484
|
+
}), ctx.signal ? {
|
|
485
|
+
signal: ctx.signal
|
|
486
|
+
} : {}));
|
|
487
|
+
if (!result.modelUrl) throw new Error("the generator returned no model");
|
|
488
|
+
const project = ctx.project();
|
|
489
|
+
const height = isNum(args.height_m) && args.height_m > 0 ? args.height_m : null;
|
|
490
|
+
const factor = height ? height / MESH_TARGET_HEIGHT_M : 1;
|
|
491
|
+
const position = point(args.position);
|
|
492
|
+
const next = __spreadProps(__spreadValues({}, project), {
|
|
493
|
+
objects: [...project.objects, __spreadProps(__spreadValues(__spreadValues({
|
|
494
|
+
id: newObjectId(),
|
|
495
|
+
name: uniqueName(project.objects.map((o) => o.name), name),
|
|
496
|
+
source: "mesh",
|
|
497
|
+
modelUrl: result.modelUrl
|
|
498
|
+
}, result.previewUrl ? {
|
|
499
|
+
previewUrl: result.previewUrl
|
|
500
|
+
} : {}), still ? {
|
|
501
|
+
sourceImageUrl: still.src
|
|
502
|
+
} : {}), {
|
|
503
|
+
position: {
|
|
504
|
+
x: isNum(position == null ? void 0 : position.x) ? position.x : project.camera.target.x,
|
|
505
|
+
y: isNum(position == null ? void 0 : position.y) ? position.y : 0,
|
|
506
|
+
z: isNum(position == null ? void 0 : position.z) ? position.z : project.camera.target.z
|
|
507
|
+
},
|
|
508
|
+
rotation: vec3(),
|
|
509
|
+
scale: vec3(factor, factor, factor)
|
|
510
|
+
})]
|
|
511
|
+
});
|
|
512
|
+
return committed(ctx, next, `Generated "${name}" and placed it${height ? ` at ${height}m tall` : ` at its default ${MESH_TARGET_HEIGHT_M}m - set height_m if that is wrong`}.`, `Generated ${name}`, (_b = result.modelUrl.split("/").pop()) == null ? void 0 : _b.slice(0, 40));
|
|
513
|
+
}
|
|
514
|
+
async function generateWorldTool(args, ctx) {
|
|
515
|
+
const prompt = str(args.prompt);
|
|
516
|
+
if (!prompt) throw new ToolInputError("give a prompt describing the place");
|
|
517
|
+
ctx.progress("Painting the world\u2026");
|
|
518
|
+
const result = await ctx.services.generateWorld(prompt);
|
|
519
|
+
if (!result.imageUrl) throw new Error("the generator returned no panorama");
|
|
520
|
+
const project = ctx.project();
|
|
521
|
+
ctx.commit(__spreadProps(__spreadValues({}, project), {
|
|
522
|
+
world: __spreadValues(__spreadProps(__spreadValues({}, project.world), {
|
|
523
|
+
imageUrl: result.imageUrl,
|
|
524
|
+
prompt
|
|
525
|
+
}), result.model ? {
|
|
526
|
+
model: result.model
|
|
527
|
+
} : {})
|
|
528
|
+
}));
|
|
529
|
+
return {
|
|
530
|
+
result: `The set now stands in: ${prompt}.`,
|
|
531
|
+
label: "Generated the world",
|
|
532
|
+
detail: prompt.slice(0, 60)
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
async function executeSetTool(name, rawArgs, ctx) {
|
|
536
|
+
var _a;
|
|
537
|
+
const args = argsOf(rawArgs);
|
|
538
|
+
try {
|
|
539
|
+
switch (name) {
|
|
540
|
+
case "block_set":
|
|
541
|
+
return blockSet(args, ctx);
|
|
542
|
+
case "update_objects":
|
|
543
|
+
return updateTool(args, ctx);
|
|
544
|
+
case "remove_objects":
|
|
545
|
+
return removeTool(args, ctx);
|
|
546
|
+
case "set_camera":
|
|
547
|
+
return cameraTool(args, ctx);
|
|
548
|
+
case "set_light":
|
|
549
|
+
return lightTool(args, ctx);
|
|
550
|
+
case "set_world":
|
|
551
|
+
return worldTool(args, ctx);
|
|
552
|
+
case "set_format":
|
|
553
|
+
return formatTool(args, ctx);
|
|
554
|
+
case "generate_object":
|
|
555
|
+
return await generateObjectTool(args, ctx);
|
|
556
|
+
case "generate_world":
|
|
557
|
+
return await generateWorldTool(args, ctx);
|
|
558
|
+
case "get_set":
|
|
559
|
+
return {
|
|
560
|
+
result: describeSet(ctx.project(), ctx.stills),
|
|
561
|
+
label: "Read the set"
|
|
562
|
+
};
|
|
563
|
+
default:
|
|
564
|
+
return {
|
|
565
|
+
result: `error: unknown tool "${name}"`,
|
|
566
|
+
label: `Unknown tool ${name}`
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
} catch (err) {
|
|
570
|
+
if (err instanceof Error && err.name === "AbortError") throw err;
|
|
571
|
+
if ((_a = ctx.signal) == null ? void 0 : _a.aborted) throw err;
|
|
572
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
573
|
+
const kind = err instanceof ToolInputError ? "bad arguments" : "failed";
|
|
574
|
+
return {
|
|
575
|
+
result: `error (${kind}): ${message}`,
|
|
576
|
+
label: `${name.replace(/_/g, " ")} ${kind}`,
|
|
577
|
+
detail: message.length > 80 ? `${message.slice(0, 79)}\u2026` : message
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
}export{SET_AGENT_TOOLS,executeSetTool};//# sourceMappingURL=tools.js.map
|