@vcad/mcp 0.10.0-main.124 → 0.10.0-main.125
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/README.md +1 -1
- package/index.mjs +416 -464
- package/package.json +3 -3
package/index.mjs
CHANGED
|
@@ -12226,6 +12226,7 @@ var init_dist = __esm({
|
|
|
12226
12226
|
importUrdfBuffer: wasmModule7.importUrdfBuffer,
|
|
12227
12227
|
importUrdfBufferWithOptions: wasmModule7.importUrdfBufferWithOptions,
|
|
12228
12228
|
urdfCommentedFloatingJoint: wasmModule7.urdfCommentedFloatingJoint,
|
|
12229
|
+
inlineMeshImports: wasmModule7.inlineMeshImports,
|
|
12229
12230
|
exportProjectedViewToDxf: wasmModule7.exportProjectedViewToDxf,
|
|
12230
12231
|
offsetSectionMesh: wasmModule7.offsetSectionMesh,
|
|
12231
12232
|
renderTitleBlock: wasmModule7.renderTitleBlock,
|
|
@@ -12866,6 +12867,22 @@ var init_dist = __esm({
|
|
|
12866
12867
|
* a commented-out floating joint means the author expected the simulator
|
|
12867
12868
|
* to supply the free base.
|
|
12868
12869
|
*/
|
|
12870
|
+
/**
|
|
12871
|
+
* Inline STL meshes into `doc` in place: each `MeshImport` node keyed in
|
|
12872
|
+
* `meshes` (node id -> STL bytes) becomes an `ImportedMesh` (metres -> mm,
|
|
12873
|
+
* URDF scale applied) via the kernel's `vcad_eval::mesh_inline`. Returns the
|
|
12874
|
+
* inlined count and per-node failures; failed nodes stay `MeshImport`.
|
|
12875
|
+
*/
|
|
12876
|
+
inlineMeshImports(doc, meshes) {
|
|
12877
|
+
if (meshes.size === 0)
|
|
12878
|
+
return { inlined: 0, errors: [] };
|
|
12879
|
+
if (typeof this.kernel.inlineMeshImports !== "function") {
|
|
12880
|
+
throw new Error("mesh inlining not available - rebuild the kernel WASM");
|
|
12881
|
+
}
|
|
12882
|
+
const out = JSON.parse(this.kernel.inlineMeshImports(JSON.stringify(doc), [...meshes.keys()], [...meshes.values()]));
|
|
12883
|
+
doc.nodes = out.document.nodes;
|
|
12884
|
+
return { inlined: out.inlined, errors: out.errors };
|
|
12885
|
+
}
|
|
12869
12886
|
urdfCommentedFloatingJoint(data) {
|
|
12870
12887
|
if (typeof this.kernel.urdfCommentedFloatingJoint !== "function") {
|
|
12871
12888
|
return void 0;
|
|
@@ -41354,6 +41371,18 @@ var init_CHANGELOG = __esm({
|
|
|
41354
41371
|
"render"
|
|
41355
41372
|
]
|
|
41356
41373
|
},
|
|
41374
|
+
{
|
|
41375
|
+
id: "2026-10-21-mac-open-vcode",
|
|
41376
|
+
version: "0.10.0",
|
|
41377
|
+
date: "2026-10-21",
|
|
41378
|
+
category: "fix",
|
|
41379
|
+
title: "Mac app opens compact-format .vcad files",
|
|
41380
|
+
summary: "The native Mac app now opens .vcad files in the compact text and loon formats, not just JSON, including the Sensor Mast example.",
|
|
41381
|
+
features: [
|
|
41382
|
+
"desktop",
|
|
41383
|
+
"file-io"
|
|
41384
|
+
]
|
|
41385
|
+
},
|
|
41357
41386
|
{
|
|
41358
41387
|
id: "2026-10-21-mac-app-updates",
|
|
41359
41388
|
version: "0.10.0",
|
|
@@ -51203,302 +51232,9 @@ var init_remote = __esm({
|
|
|
51203
51232
|
}
|
|
51204
51233
|
});
|
|
51205
51234
|
|
|
51206
|
-
// src/tools/import-urdf.ts
|
|
51207
|
-
import { readFileSync as readFileSync2, existsSync as existsSync2, statSync } from "node:fs";
|
|
51208
|
-
import { basename, dirname, isAbsolute as isAbsolute2, resolve as resolve2, sep as sep2 } from "node:path";
|
|
51209
|
-
function parseStl2(buf) {
|
|
51210
|
-
const positions = [];
|
|
51211
|
-
const looksBinary = buf.length >= 84 && buf.length === 84 + buf.readUInt32LE(80) * 50;
|
|
51212
|
-
if (looksBinary) {
|
|
51213
|
-
const count = buf.readUInt32LE(80);
|
|
51214
|
-
for (let t2 = 0; t2 < count; t2++) {
|
|
51215
|
-
const base = 84 + t2 * 50 + 12;
|
|
51216
|
-
for (let v = 0; v < 3; v++) {
|
|
51217
|
-
const off = base + v * 12;
|
|
51218
|
-
positions.push(
|
|
51219
|
-
buf.readFloatLE(off) * 1e3,
|
|
51220
|
-
buf.readFloatLE(off + 4) * 1e3,
|
|
51221
|
-
buf.readFloatLE(off + 8) * 1e3
|
|
51222
|
-
);
|
|
51223
|
-
}
|
|
51224
|
-
}
|
|
51225
|
-
} else {
|
|
51226
|
-
const text = buf.toString("utf8");
|
|
51227
|
-
if (!/^\s*solid/.test(text)) {
|
|
51228
|
-
throw new Error("not a recognizable STL file (neither binary nor ASCII)");
|
|
51229
|
-
}
|
|
51230
|
-
const vertexRe = /vertex\s+([-+eE0-9.]+)\s+([-+eE0-9.]+)\s+([-+eE0-9.]+)/g;
|
|
51231
|
-
let m;
|
|
51232
|
-
while ((m = vertexRe.exec(text)) !== null) {
|
|
51233
|
-
positions.push(
|
|
51234
|
-
parseFloat(m[1]) * 1e3,
|
|
51235
|
-
parseFloat(m[2]) * 1e3,
|
|
51236
|
-
parseFloat(m[3]) * 1e3
|
|
51237
|
-
);
|
|
51238
|
-
}
|
|
51239
|
-
if (positions.length === 0 || positions.length % 9 !== 0) {
|
|
51240
|
-
throw new Error("malformed ASCII STL");
|
|
51241
|
-
}
|
|
51242
|
-
}
|
|
51243
|
-
const indices = new Array(positions.length / 3);
|
|
51244
|
-
for (let i = 0; i < indices.length; i++) indices[i] = i;
|
|
51245
|
-
return { positions, indices };
|
|
51246
|
-
}
|
|
51247
|
-
function resolveMeshPath(filename, urdfDir, packageRoots, confineRoot) {
|
|
51248
|
-
const confined = (p) => {
|
|
51249
|
-
const abs = resolve2(p);
|
|
51250
|
-
const root = resolve2(confineRoot);
|
|
51251
|
-
const rootSep = root.endsWith(sep2) ? root : root + sep2;
|
|
51252
|
-
if (abs !== root && !abs.startsWith(rootSep)) return null;
|
|
51253
|
-
return existsSync2(abs) && statSync(abs).isFile() ? abs : null;
|
|
51254
|
-
};
|
|
51255
|
-
if (filename.includes("\0")) return null;
|
|
51256
|
-
const pkgMatch = filename.match(/^package:\/\/([^/]+)\/?(.*)$/);
|
|
51257
|
-
if (pkgMatch) {
|
|
51258
|
-
for (const root of packageRoots) {
|
|
51259
|
-
const hit = confined(resolve2(root, pkgMatch[1], pkgMatch[2]));
|
|
51260
|
-
if (hit) return hit;
|
|
51261
|
-
}
|
|
51262
|
-
return null;
|
|
51263
|
-
}
|
|
51264
|
-
const stripped = filename.startsWith("file://") ? filename.slice("file://".length) : filename;
|
|
51265
|
-
if (isAbsolute2(stripped)) return confined(stripped);
|
|
51266
|
-
if (urdfDir) return confined(resolve2(urdfDir, stripped));
|
|
51267
|
-
return null;
|
|
51268
|
-
}
|
|
51269
|
-
function inlineMeshImports(doc, urdfDir, packageRoots, confineRoot) {
|
|
51270
|
-
let inlined = 0;
|
|
51271
|
-
const unresolved = [];
|
|
51272
|
-
for (const key3 of Object.keys(doc.nodes)) {
|
|
51273
|
-
const node = doc.nodes[key3];
|
|
51274
|
-
const opLoose = node.op;
|
|
51275
|
-
if (opLoose.type !== "mesh_import" && opLoose.type !== "MeshImport") {
|
|
51276
|
-
continue;
|
|
51277
|
-
}
|
|
51278
|
-
const ref = opLoose.path ?? "";
|
|
51279
|
-
const filepath = resolveMeshPath(ref, urdfDir, packageRoots, confineRoot);
|
|
51280
|
-
if (!filepath) {
|
|
51281
|
-
unresolved.push({ path: ref, reason: "file not found" });
|
|
51282
|
-
continue;
|
|
51283
|
-
}
|
|
51284
|
-
if (!/\.stl$/i.test(filepath)) {
|
|
51285
|
-
unresolved.push({
|
|
51286
|
-
path: ref,
|
|
51287
|
-
reason: "unsupported mesh format (only STL is inlined server-side)"
|
|
51288
|
-
});
|
|
51289
|
-
continue;
|
|
51290
|
-
}
|
|
51291
|
-
if (statSync(filepath).size > MAX_MESH_BYTES) {
|
|
51292
|
-
unresolved.push({ path: ref, reason: "mesh exceeds size limit" });
|
|
51293
|
-
continue;
|
|
51294
|
-
}
|
|
51295
|
-
let mesh;
|
|
51296
|
-
try {
|
|
51297
|
-
mesh = parseStl2(readFileSync2(filepath));
|
|
51298
|
-
} catch (e) {
|
|
51299
|
-
unresolved.push({ path: ref, reason: `parse error: ${e}` });
|
|
51300
|
-
continue;
|
|
51301
|
-
}
|
|
51302
|
-
const scale = opLoose.scale;
|
|
51303
|
-
let positions = mesh.positions;
|
|
51304
|
-
if (scale && (scale.x !== 1 || scale.y !== 1 || scale.z !== 1)) {
|
|
51305
|
-
positions = positions.map(
|
|
51306
|
-
(v, i) => i % 3 === 0 ? v * scale.x : i % 3 === 1 ? v * scale.y : v * scale.z
|
|
51307
|
-
);
|
|
51308
|
-
}
|
|
51309
|
-
doc.nodes[key3] = {
|
|
51310
|
-
id: node.id,
|
|
51311
|
-
name: node.name,
|
|
51312
|
-
op: {
|
|
51313
|
-
type: "ImportedMesh",
|
|
51314
|
-
positions,
|
|
51315
|
-
indices: mesh.indices,
|
|
51316
|
-
source: ref
|
|
51317
|
-
// biome-ignore lint/suspicious/noExplicitAny: bridging IR shape
|
|
51318
|
-
}
|
|
51319
|
-
};
|
|
51320
|
-
inlined++;
|
|
51321
|
-
}
|
|
51322
|
-
return { inlined, unresolved };
|
|
51323
|
-
}
|
|
51324
|
-
function importUrdf(input, engine) {
|
|
51325
|
-
const {
|
|
51326
|
-
path,
|
|
51327
|
-
content_base64,
|
|
51328
|
-
package_roots,
|
|
51329
|
-
name,
|
|
51330
|
-
floating_base,
|
|
51331
|
-
floating_base_link,
|
|
51332
|
-
spawn_height_mm
|
|
51333
|
-
} = input;
|
|
51334
|
-
if (!floating_base && (floating_base_link || spawn_height_mm !== void 0)) {
|
|
51335
|
-
throw new Error(
|
|
51336
|
-
"floating_base_link / spawn_height_mm require floating_base: true"
|
|
51337
|
-
);
|
|
51338
|
-
}
|
|
51339
|
-
const confineRoot = process.env.VCAD_MCP_EXPORT_DIR ?? process.cwd();
|
|
51340
|
-
let fileBuffer;
|
|
51341
|
-
let urdfDir = null;
|
|
51342
|
-
let sourceLabel;
|
|
51343
|
-
if (content_base64) {
|
|
51344
|
-
fileBuffer = Buffer.from(content_base64, "base64");
|
|
51345
|
-
if (fileBuffer.length === 0) {
|
|
51346
|
-
throw new Error("content_base64 decoded to zero bytes");
|
|
51347
|
-
}
|
|
51348
|
-
sourceLabel = "urdf-import";
|
|
51349
|
-
} else if (path) {
|
|
51350
|
-
if (isRemoteDeployment()) {
|
|
51351
|
-
throw new Error(
|
|
51352
|
-
"This hosted server has no access to your filesystem \u2014 pass the URDF XML as `content_base64` instead of `path`. Mesh references cannot be resolved in that mode (links fall back to placeholder geometry); run the MCP server locally for full mesh import."
|
|
51353
|
-
);
|
|
51354
|
-
}
|
|
51355
|
-
const filepath = resolveWithinRoot(path, confineRoot);
|
|
51356
|
-
if (!existsSync2(filepath)) {
|
|
51357
|
-
throw new Error(`URDF file not found: ${path}`);
|
|
51358
|
-
}
|
|
51359
|
-
const stat = statSync(filepath);
|
|
51360
|
-
if (!stat.isFile()) {
|
|
51361
|
-
throw new Error("URDF path is not a regular file");
|
|
51362
|
-
}
|
|
51363
|
-
if (stat.size > MAX_URDF_BYTES) {
|
|
51364
|
-
throw new Error(`URDF file exceeds ${MAX_URDF_BYTES} byte limit`);
|
|
51365
|
-
}
|
|
51366
|
-
fileBuffer = readFileSync2(filepath);
|
|
51367
|
-
urdfDir = dirname(filepath);
|
|
51368
|
-
sourceLabel = path;
|
|
51369
|
-
} else {
|
|
51370
|
-
throw new Error("Provide either `path` or `content_base64`");
|
|
51371
|
-
}
|
|
51372
|
-
if (fileBuffer.length > MAX_URDF_BYTES) {
|
|
51373
|
-
throw new Error(`URDF content exceeds ${MAX_URDF_BYTES} byte limit`);
|
|
51374
|
-
}
|
|
51375
|
-
const packageRoots = (package_roots ?? []).map(
|
|
51376
|
-
(r) => resolveWithinRoot(r, confineRoot)
|
|
51377
|
-
);
|
|
51378
|
-
const arrayBuffer = new ArrayBuffer(fileBuffer.byteLength);
|
|
51379
|
-
new Uint8Array(arrayBuffer).set(fileBuffer);
|
|
51380
|
-
const doc = JSON.parse(
|
|
51381
|
-
engine.importUrdf(arrayBuffer, {
|
|
51382
|
-
floatingBase: floating_base,
|
|
51383
|
-
floatingBaseLink: floating_base_link,
|
|
51384
|
-
spawnHeightMm: spawn_height_mm
|
|
51385
|
-
})
|
|
51386
|
-
);
|
|
51387
|
-
const commentedFloating = floating_base ? void 0 : engine.urdfCommentedFloatingJoint(arrayBuffer);
|
|
51388
|
-
const meshes = inlineMeshImports(doc, urdfDir, packageRoots, confineRoot);
|
|
51389
|
-
const robotName = name ?? basename(sourceLabel).replace(/\.(urdf|xml)$/i, "");
|
|
51390
|
-
const parts = Object.values(doc.partDefs ?? {}).map((p) => ({
|
|
51391
|
-
id: p.id,
|
|
51392
|
-
name: p.name
|
|
51393
|
-
}));
|
|
51394
|
-
const joints = (doc.joints ?? []).map((j) => ({
|
|
51395
|
-
id: j.id,
|
|
51396
|
-
name: j.name,
|
|
51397
|
-
kind: j.kind.type,
|
|
51398
|
-
parent_instance_id: j.parentInstanceId,
|
|
51399
|
-
child_instance_id: j.childInstanceId
|
|
51400
|
-
}));
|
|
51401
|
-
const documentId = registerSession(doc);
|
|
51402
|
-
const summary = {
|
|
51403
|
-
robot: robotName,
|
|
51404
|
-
parts: parts.length,
|
|
51405
|
-
joints: joints.length,
|
|
51406
|
-
instances: (doc.instances ?? []).length,
|
|
51407
|
-
ground_instance_id: doc.groundInstanceId ?? null,
|
|
51408
|
-
joint_list: joints,
|
|
51409
|
-
...floating_base ? {
|
|
51410
|
-
floating_base: {
|
|
51411
|
-
synthesized: joints.some((j) => j.kind === "Free"),
|
|
51412
|
-
spawn_height_mm: spawn_height_mm ?? 0,
|
|
51413
|
-
note: "The root link hangs off a 6-DOF Free joint; parentAnchor.z is the spawn height. The robot will fall under gravity."
|
|
51414
|
-
}
|
|
51415
|
-
} : {},
|
|
51416
|
-
...commentedFloating ? {
|
|
51417
|
-
floating_base_warning: `This URDF declares a floating joint (${commentedFloating}) inside a comment \u2014 the usual convention that the simulator supplies the free base. Imported as-is, the root link is grounded and the robot is welded to the world (it cannot walk or fall). Re-import with floating_base: true (and a spawn_height_mm just above standing height) for any locomotion task.`
|
|
51418
|
-
} : {},
|
|
51419
|
-
...meshes.inlined > 0 ? { meshes_inlined: meshes.inlined } : {},
|
|
51420
|
-
...meshes.unresolved.length > 0 ? {
|
|
51421
|
-
warning: `${meshes.unresolved.length} mesh reference(s) could not be inlined \u2014 those links use placeholder geometry. Joint topology and authored inertials are exact, so physics still behaves to first order.`,
|
|
51422
|
-
unresolved_meshes: meshes.unresolved
|
|
51423
|
-
} : {}
|
|
51424
|
-
};
|
|
51425
|
-
return {
|
|
51426
|
-
content: [
|
|
51427
|
-
{
|
|
51428
|
-
type: "text",
|
|
51429
|
-
text: JSON.stringify(
|
|
51430
|
-
{
|
|
51431
|
-
document_id: documentId,
|
|
51432
|
-
summary,
|
|
51433
|
-
note: "The robot is registered as a session document \u2014 pass document_id to create_robot_env to simulate it, render_view to see it, or any CAD tool to edit it."
|
|
51434
|
-
},
|
|
51435
|
-
null,
|
|
51436
|
-
2
|
|
51437
|
-
)
|
|
51438
|
-
}
|
|
51439
|
-
]
|
|
51440
|
-
};
|
|
51441
|
-
}
|
|
51442
|
-
var MAX_URDF_BYTES, MAX_MESH_BYTES, importUrdfSchema, toolDefs2;
|
|
51443
|
-
var init_import_urdf = __esm({
|
|
51444
|
-
"src/tools/import-urdf.ts"() {
|
|
51445
|
-
"use strict";
|
|
51446
|
-
init_safe_path();
|
|
51447
|
-
init_remote();
|
|
51448
|
-
init_session2();
|
|
51449
|
-
init_tool_def();
|
|
51450
|
-
MAX_URDF_BYTES = 8 * 1024 * 1024;
|
|
51451
|
-
MAX_MESH_BYTES = 100 * 1024 * 1024;
|
|
51452
|
-
importUrdfSchema = {
|
|
51453
|
-
type: "object",
|
|
51454
|
-
properties: {
|
|
51455
|
-
path: {
|
|
51456
|
-
type: "string",
|
|
51457
|
-
description: "Path to the .urdf file on the server filesystem, relative to the server working directory (or VCAD_MCP_EXPORT_DIR if set). Relative mesh references inside the URDF resolve against the URDF's own directory. On hosted servers pass content_base64 instead."
|
|
51458
|
-
},
|
|
51459
|
-
content_base64: {
|
|
51460
|
-
type: "string",
|
|
51461
|
-
description: "Base64-encoded URDF XML. Use instead of `path` when the server has no access to your filesystem (hosted/remote deployments). Mesh references cannot be resolved in this mode \u2014 links with meshes get placeholder geometry, but joints and inertials import exactly."
|
|
51462
|
-
},
|
|
51463
|
-
package_roots: {
|
|
51464
|
-
type: "array",
|
|
51465
|
-
items: { type: "string" },
|
|
51466
|
-
description: "Directories to search when resolving package://NAME/... mesh URIs, relative to the server working directory. Each root is checked for a NAME/ subdirectory; first match wins."
|
|
51467
|
-
},
|
|
51468
|
-
name: {
|
|
51469
|
-
type: "string",
|
|
51470
|
-
description: "Robot name (default: filename without extension)"
|
|
51471
|
-
},
|
|
51472
|
-
floating_base: {
|
|
51473
|
-
type: "boolean",
|
|
51474
|
-
description: 'Synthesize a floating (6-DOF) base when the URDF declares none. Most humanoid/quadruped URDFs ship the world link and its type="floating" joint commented out, on the convention that the simulator supplies the free base \u2014 without this the root link is grounded and the robot is welded to the world, which cannot walk or fall. Set this for any locomotion task. No-op when the URDF already has a floating joint.'
|
|
51475
|
-
},
|
|
51476
|
-
floating_base_link: {
|
|
51477
|
-
type: "string",
|
|
51478
|
-
description: "Link to attach the synthesized floating base to (default: the tree's root link, i.e. the one that is never a joint's child). Requires floating_base."
|
|
51479
|
-
},
|
|
51480
|
-
spawn_height_mm: {
|
|
51481
|
-
type: "number",
|
|
51482
|
-
description: "Initial base height in mm for the synthesized floating base (default 0). A Free joint's `state` is a scalar and meaningless for 6 DOF, so this is written as the joint's parentAnchor.z. Spawn just above the settled standing height so the robot drops onto the ground instead of starting interpenetrated (Booster K1: 620 mm against a 549.8 mm stand)."
|
|
51483
|
-
}
|
|
51484
|
-
}
|
|
51485
|
-
};
|
|
51486
|
-
toolDefs2 = [
|
|
51487
|
-
{
|
|
51488
|
-
name: "import_urdf",
|
|
51489
|
-
pack: null,
|
|
51490
|
-
description: "Import a URDF (Unified Robot Description Format) robot from a server-local file. Builds the full kinematic tree \u2014 one part per link, instances FK-placed from joint origins, joints (revolute/prismatic/fixed) with limits, and a grounded root link \u2014 ready for create_robot_env. STL mesh references are resolved against the URDF's directory and optional package_roots and inlined; unresolved meshes fall back to placeholder geometry with an explicit warning. For locomotion, pass floating_base: true \u2014 most humanoid/quadruped URDFs leave the world link and floating joint commented out, and without them the robot is welded to the world.",
|
|
51491
|
-
inputSchema: importUrdfSchema,
|
|
51492
|
-
handler: (a, c) => importUrdf(a, c.engine),
|
|
51493
|
-
behavior: behavior({ writesDoc: true, geometry: true, mount: true })
|
|
51494
|
-
}
|
|
51495
|
-
];
|
|
51496
|
-
}
|
|
51497
|
-
});
|
|
51498
|
-
|
|
51499
51235
|
// src/tools/loon-assets.ts
|
|
51500
|
-
import { existsSync as
|
|
51501
|
-
import { isAbsolute as
|
|
51236
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, statSync } from "node:fs";
|
|
51237
|
+
import { isAbsolute as isAbsolute2, normalize } from "node:path";
|
|
51502
51238
|
function key(p) {
|
|
51503
51239
|
return normalize(p).replace(/\\/g, "/").replace(/^\.\//, "");
|
|
51504
51240
|
}
|
|
@@ -51517,20 +51253,22 @@ function readAsset(path, { files, base_dir }) {
|
|
|
51517
51253
|
}
|
|
51518
51254
|
let file;
|
|
51519
51255
|
try {
|
|
51520
|
-
file =
|
|
51256
|
+
file = isAbsolute2(path) ? path : resolveWithinRoot(path, base_dir ?? process.cwd());
|
|
51521
51257
|
} catch (e) {
|
|
51522
51258
|
return { reason: e.message };
|
|
51523
51259
|
}
|
|
51524
|
-
if (!
|
|
51260
|
+
if (!existsSync2(file) || !statSync(file).isFile()) {
|
|
51525
51261
|
return {
|
|
51526
|
-
reason: base_dir ||
|
|
51262
|
+
reason: base_dir || isAbsolute2(path) ? `file not found (${file})` : "file not found \u2014 pass `base_dir` (the project directory) or the bytes in `files`"
|
|
51527
51263
|
};
|
|
51528
51264
|
}
|
|
51529
|
-
if (
|
|
51530
|
-
return { bytes:
|
|
51265
|
+
if (statSync(file).size > MAX_ASSET_BYTES) return { reason: "file exceeds size limit" };
|
|
51266
|
+
return { bytes: readFileSync2(file) };
|
|
51531
51267
|
}
|
|
51532
51268
|
function resolveLoonAssets(doc, sources, engine) {
|
|
51533
51269
|
const report = { meshes: 0, steps: 0, unresolved: [] };
|
|
51270
|
+
const meshes = /* @__PURE__ */ new Map();
|
|
51271
|
+
const refs = /* @__PURE__ */ new Map();
|
|
51534
51272
|
for (const [id, node] of Object.entries(doc.nodes)) {
|
|
51535
51273
|
const op = node.op;
|
|
51536
51274
|
const isMesh = op.type === "mesh_import" || op.type === "MeshImport";
|
|
@@ -51561,21 +51299,12 @@ function resolveLoonAssets(doc, sources, engine) {
|
|
|
51561
51299
|
report.unresolved.push({ path, reason: "unsupported mesh format (STL only)" });
|
|
51562
51300
|
continue;
|
|
51563
51301
|
}
|
|
51564
|
-
|
|
51565
|
-
|
|
51566
|
-
mesh = parseStl2(got.bytes);
|
|
51567
|
-
} catch (e) {
|
|
51568
|
-
report.unresolved.push({ path, reason: `STL parse error: ${e.message}` });
|
|
51569
|
-
continue;
|
|
51570
|
-
}
|
|
51571
|
-
const s = op.scale;
|
|
51572
|
-
const positions = s && (s.x !== 1 || s.y !== 1 || s.z !== 1) ? mesh.positions.map((v, i) => v * (i % 3 === 0 ? s.x : i % 3 === 1 ? s.y : s.z)) : mesh.positions;
|
|
51573
|
-
doc.nodes[id] = {
|
|
51574
|
-
...node,
|
|
51575
|
-
op: { type: "ImportedMesh", positions, indices: mesh.indices, source: path }
|
|
51576
|
-
};
|
|
51577
|
-
report.meshes++;
|
|
51302
|
+
meshes.set(id, got.bytes);
|
|
51303
|
+
refs.set(id, path);
|
|
51578
51304
|
}
|
|
51305
|
+
const { inlined, errors } = engine.inlineMeshImports(doc, meshes);
|
|
51306
|
+
report.meshes += inlined;
|
|
51307
|
+
for (const [id, reason] of errors) report.unresolved.push({ path: refs.get(id) ?? id, reason });
|
|
51579
51308
|
return report;
|
|
51580
51309
|
}
|
|
51581
51310
|
function hasFile({ files }, path) {
|
|
@@ -51592,7 +51321,6 @@ var MAX_ASSET_BYTES;
|
|
|
51592
51321
|
var init_loon_assets = __esm({
|
|
51593
51322
|
"src/tools/loon-assets.ts"() {
|
|
51594
51323
|
"use strict";
|
|
51595
|
-
init_import_urdf();
|
|
51596
51324
|
init_remote();
|
|
51597
51325
|
init_safe_path();
|
|
51598
51326
|
MAX_ASSET_BYTES = 100 * 1024 * 1024;
|
|
@@ -51601,7 +51329,7 @@ var init_loon_assets = __esm({
|
|
|
51601
51329
|
|
|
51602
51330
|
// src/tools/source-provenance.ts
|
|
51603
51331
|
import { createHash } from "node:crypto";
|
|
51604
|
-
import { readFileSync as
|
|
51332
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
51605
51333
|
function sourceHash(text) {
|
|
51606
51334
|
return createHash("sha256").update(text, "utf8").digest("hex");
|
|
51607
51335
|
}
|
|
@@ -51635,7 +51363,7 @@ function sourceStatus(doc) {
|
|
|
51635
51363
|
if (path) {
|
|
51636
51364
|
let onDisk = null;
|
|
51637
51365
|
try {
|
|
51638
|
-
onDisk =
|
|
51366
|
+
onDisk = readFileSync3(path, "utf8");
|
|
51639
51367
|
} catch {
|
|
51640
51368
|
return {
|
|
51641
51369
|
source_stale: true,
|
|
@@ -51671,8 +51399,8 @@ var init_source_provenance = __esm({
|
|
|
51671
51399
|
});
|
|
51672
51400
|
|
|
51673
51401
|
// src/tools/loon.ts
|
|
51674
|
-
import { readFileSync as
|
|
51675
|
-
import { delimiter, isAbsolute as
|
|
51402
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
51403
|
+
import { delimiter, isAbsolute as isAbsolute3, join as join2, resolve as resolve2, sep as sep2 } from "node:path";
|
|
51676
51404
|
function composeLoonProgram(input) {
|
|
51677
51405
|
const { source, use_loons, loons } = input;
|
|
51678
51406
|
const names = [
|
|
@@ -51691,13 +51419,13 @@ function importedNames(source) {
|
|
|
51691
51419
|
return names;
|
|
51692
51420
|
}
|
|
51693
51421
|
function readModule(base, name) {
|
|
51694
|
-
if (
|
|
51695
|
-
const root =
|
|
51422
|
+
if (isAbsolute3(name) || name.split(".").includes("..")) return null;
|
|
51423
|
+
const root = resolve2(base);
|
|
51696
51424
|
for (const ext of [".loon", ".oo"]) {
|
|
51697
|
-
const file =
|
|
51698
|
-
if (file !== root && !file.startsWith(root +
|
|
51425
|
+
const file = resolve2(join2(root, ...name.split(".")) + ext);
|
|
51426
|
+
if (file !== root && !file.startsWith(root + sep2)) continue;
|
|
51699
51427
|
try {
|
|
51700
|
-
return
|
|
51428
|
+
return readFileSync4(file, "utf8");
|
|
51701
51429
|
} catch {
|
|
51702
51430
|
}
|
|
51703
51431
|
}
|
|
@@ -51832,7 +51560,7 @@ function parametricNote(source, modules, engine, doc) {
|
|
|
51832
51560
|
for (const w of warnings) lines.push(`- ${w}`);
|
|
51833
51561
|
return lines.join("\n");
|
|
51834
51562
|
}
|
|
51835
|
-
var createCadLoonSchema,
|
|
51563
|
+
var createCadLoonSchema, toolDefs2;
|
|
51836
51564
|
var init_loon = __esm({
|
|
51837
51565
|
"src/tools/loon.ts"() {
|
|
51838
51566
|
"use strict";
|
|
@@ -51895,7 +51623,7 @@ var init_loon = __esm({
|
|
|
51895
51623
|
},
|
|
51896
51624
|
required: ["source"]
|
|
51897
51625
|
};
|
|
51898
|
-
|
|
51626
|
+
toolDefs2 = [
|
|
51899
51627
|
{
|
|
51900
51628
|
name: "create_cad_loon",
|
|
51901
51629
|
pack: null,
|
|
@@ -52790,8 +52518,8 @@ var init_artifact_store = __esm({
|
|
|
52790
52518
|
});
|
|
52791
52519
|
|
|
52792
52520
|
// src/tools/session.ts
|
|
52793
|
-
import { writeFileSync as writeFileSync2, readFileSync as
|
|
52794
|
-
import { dirname
|
|
52521
|
+
import { writeFileSync as writeFileSync2, readFileSync as readFileSync5 } from "node:fs";
|
|
52522
|
+
import { dirname, resolve as resolve3 } from "node:path";
|
|
52795
52523
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
52796
52524
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
52797
52525
|
function durabilityWarning() {
|
|
@@ -53008,7 +52736,7 @@ async function loadDocument(args, store, engine) {
|
|
|
53008
52736
|
const path2 = resolveWithinRoot(`${name}.vcad`, root);
|
|
53009
52737
|
let raw;
|
|
53010
52738
|
try {
|
|
53011
|
-
raw =
|
|
52739
|
+
raw = readFileSync5(path2, "utf8");
|
|
53012
52740
|
} catch {
|
|
53013
52741
|
return {
|
|
53014
52742
|
isError: true,
|
|
@@ -53067,10 +52795,10 @@ async function loadDocumentFromPath(path, store, engine) {
|
|
|
53067
52795
|
"`path` loads are local/stdio only \u2014 this server's filesystem is ephemeral. Pass the source inline to create_cad_loon, or save with save_document and reopen by `name`."
|
|
53068
52796
|
);
|
|
53069
52797
|
}
|
|
53070
|
-
const abs =
|
|
52798
|
+
const abs = resolve3(path);
|
|
53071
52799
|
let raw;
|
|
53072
52800
|
try {
|
|
53073
|
-
raw =
|
|
52801
|
+
raw = readFileSync5(abs, "utf8");
|
|
53074
52802
|
} catch {
|
|
53075
52803
|
return fail2(`Cannot read ${abs} \u2014 no such file, or it is not readable.`);
|
|
53076
52804
|
}
|
|
@@ -53101,7 +52829,7 @@ async function loadDocumentFromPath(path, store, engine) {
|
|
|
53101
52829
|
"Loon evaluation is unavailable in this server build \u2014 load a .vcad document instead."
|
|
53102
52830
|
);
|
|
53103
52831
|
}
|
|
53104
|
-
const baseDir =
|
|
52832
|
+
const baseDir = dirname(abs);
|
|
53105
52833
|
const modules = composeLoonModules({ source: raw, base_dir: baseDir });
|
|
53106
52834
|
let doc;
|
|
53107
52835
|
try {
|
|
@@ -53144,7 +52872,7 @@ function openSavedSnapshot(snapshot2, name) {
|
|
|
53144
52872
|
parts: copy.roots?.length ?? 0
|
|
53145
52873
|
};
|
|
53146
52874
|
}
|
|
53147
|
-
var sessionScope, openDocumentSchema, getDocumentSchema, closeDocumentSchema, saveDocumentSchema, loadDocumentSchema,
|
|
52875
|
+
var sessionScope, openDocumentSchema, getDocumentSchema, closeDocumentSchema, saveDocumentSchema, loadDocumentSchema, toolDefs3;
|
|
53148
52876
|
var init_session2 = __esm({
|
|
53149
52877
|
"src/tools/session.ts"() {
|
|
53150
52878
|
"use strict";
|
|
@@ -53219,7 +52947,7 @@ var init_session2 = __esm({
|
|
|
53219
52947
|
}
|
|
53220
52948
|
}
|
|
53221
52949
|
};
|
|
53222
|
-
|
|
52950
|
+
toolDefs3 = [
|
|
53223
52951
|
{
|
|
53224
52952
|
name: "open_document",
|
|
53225
52953
|
pack: null,
|
|
@@ -53776,7 +53504,7 @@ function getPreviewVersion(doc, docId) {
|
|
|
53776
53504
|
]
|
|
53777
53505
|
};
|
|
53778
53506
|
}
|
|
53779
|
-
var GLB_CACHE_MAX, glbCache, PREVIEW_MAX_BASE64, DECIMATE_GRIDS, getPreviewGlbSchema, getPreviewVersionSchema,
|
|
53507
|
+
var GLB_CACHE_MAX, glbCache, PREVIEW_MAX_BASE64, DECIMATE_GRIDS, getPreviewGlbSchema, getPreviewVersionSchema, toolDefs4;
|
|
53780
53508
|
var init_preview = __esm({
|
|
53781
53509
|
"src/tools/preview.ts"() {
|
|
53782
53510
|
"use strict";
|
|
@@ -53813,7 +53541,7 @@ var init_preview = __esm({
|
|
|
53813
53541
|
},
|
|
53814
53542
|
required: ["document_id"]
|
|
53815
53543
|
};
|
|
53816
|
-
|
|
53544
|
+
toolDefs4 = [
|
|
53817
53545
|
{
|
|
53818
53546
|
name: "get_preview_glb",
|
|
53819
53547
|
pack: null,
|
|
@@ -54643,7 +54371,7 @@ function inspectCad(input, engine) {
|
|
|
54643
54371
|
]
|
|
54644
54372
|
};
|
|
54645
54373
|
}
|
|
54646
|
-
var inspectCadSchema,
|
|
54374
|
+
var inspectCadSchema, toolDefs5;
|
|
54647
54375
|
var init_inspect = __esm({
|
|
54648
54376
|
"src/tools/inspect.ts"() {
|
|
54649
54377
|
"use strict";
|
|
@@ -54666,7 +54394,7 @@ var init_inspect = __esm({
|
|
|
54666
54394
|
joint_state: jointStateSchemaProp
|
|
54667
54395
|
}
|
|
54668
54396
|
};
|
|
54669
|
-
|
|
54397
|
+
toolDefs5 = [
|
|
54670
54398
|
{
|
|
54671
54399
|
name: "inspect_cad",
|
|
54672
54400
|
pack: null,
|
|
@@ -55167,7 +54895,7 @@ function err(text) {
|
|
|
55167
54895
|
isError: true
|
|
55168
54896
|
};
|
|
55169
54897
|
}
|
|
55170
|
-
var r6, point, findPart, MeasureError, measureSchema,
|
|
54898
|
+
var r6, point, findPart, MeasureError, measureSchema, toolDefs6;
|
|
55171
54899
|
var init_measure = __esm({
|
|
55172
54900
|
"src/tools/measure.ts"() {
|
|
55173
54901
|
"use strict";
|
|
@@ -55203,7 +54931,7 @@ var init_measure = __esm({
|
|
|
55203
54931
|
},
|
|
55204
54932
|
required: ["document_id", "part_ids"]
|
|
55205
54933
|
};
|
|
55206
|
-
|
|
54934
|
+
toolDefs6 = [
|
|
55207
54935
|
{
|
|
55208
54936
|
name: "measure",
|
|
55209
54937
|
pack: null,
|
|
@@ -57879,7 +57607,7 @@ function applyEdits(args, engine) {
|
|
|
57879
57607
|
}
|
|
57880
57608
|
return result;
|
|
57881
57609
|
}
|
|
57882
|
-
var ALLOWED_OPS, MAX_BATCH_OPS, applyEditsSchema, BatchOpError, SYMBOLIC_REF,
|
|
57610
|
+
var ALLOWED_OPS, MAX_BATCH_OPS, applyEditsSchema, BatchOpError, SYMBOLIC_REF, toolDefs7;
|
|
57883
57611
|
var init_batch_edit = __esm({
|
|
57884
57612
|
"src/tools/batch-edit.ts"() {
|
|
57885
57613
|
"use strict";
|
|
@@ -57922,7 +57650,7 @@ var init_batch_edit = __esm({
|
|
|
57922
57650
|
cause;
|
|
57923
57651
|
};
|
|
57924
57652
|
SYMBOLIC_REF = /^@(\d+)$/;
|
|
57925
|
-
|
|
57653
|
+
toolDefs7 = [
|
|
57926
57654
|
{
|
|
57927
57655
|
name: "apply_edits",
|
|
57928
57656
|
pack: null,
|
|
@@ -58036,7 +57764,7 @@ async function branchFrom(args, store) {
|
|
|
58036
57764
|
hint: "Forked into a new session. Continue here, or branch_from the same checkpoint again to try another variant."
|
|
58037
57765
|
});
|
|
58038
57766
|
}
|
|
58039
|
-
var nextCheckpoint, checkpointDocumentSchema, branchFromSchema,
|
|
57767
|
+
var nextCheckpoint, checkpointDocumentSchema, branchFromSchema, toolDefs8;
|
|
58040
57768
|
var init_checkpoint = __esm({
|
|
58041
57769
|
"src/tools/checkpoint.ts"() {
|
|
58042
57770
|
"use strict";
|
|
@@ -58072,7 +57800,7 @@ var init_checkpoint = __esm({
|
|
|
58072
57800
|
},
|
|
58073
57801
|
required: ["checkpoint_id"]
|
|
58074
57802
|
};
|
|
58075
|
-
|
|
57803
|
+
toolDefs8 = [
|
|
58076
57804
|
{
|
|
58077
57805
|
name: "checkpoint_document",
|
|
58078
57806
|
pack: null,
|
|
@@ -58193,7 +57921,7 @@ async function continueDocument(args, store) {
|
|
|
58193
57921
|
}
|
|
58194
57922
|
return ok2(registerSession(doc), doc, "Shared part");
|
|
58195
57923
|
}
|
|
58196
|
-
var continueDocumentSchema,
|
|
57924
|
+
var continueDocumentSchema, toolDefs9;
|
|
58197
57925
|
var init_continue_doc = __esm({
|
|
58198
57926
|
"src/tools/continue-doc.ts"() {
|
|
58199
57927
|
"use strict";
|
|
@@ -58216,7 +57944,7 @@ var init_continue_doc = __esm({
|
|
|
58216
57944
|
}
|
|
58217
57945
|
}
|
|
58218
57946
|
};
|
|
58219
|
-
|
|
57947
|
+
toolDefs9 = [
|
|
58220
57948
|
{
|
|
58221
57949
|
name: "continue_document",
|
|
58222
57950
|
pack: null,
|
|
@@ -59394,7 +59122,7 @@ async function listOrders(input, store, user) {
|
|
|
59394
59122
|
}))
|
|
59395
59123
|
});
|
|
59396
59124
|
}
|
|
59397
|
-
var QUOTE_TTL_MS, quoteManufacturingSchema, SCS_ALLOY_LABELS, toUsd, getOrderStatusSchema, listOrdersSchema,
|
|
59125
|
+
var QUOTE_TTL_MS, quoteManufacturingSchema, SCS_ALLOY_LABELS, toUsd, getOrderStatusSchema, listOrdersSchema, toolDefs10;
|
|
59398
59126
|
var init_order = __esm({
|
|
59399
59127
|
"src/tools/order.ts"() {
|
|
59400
59128
|
"use strict";
|
|
@@ -59485,7 +59213,7 @@ var init_order = __esm({
|
|
|
59485
59213
|
},
|
|
59486
59214
|
required: []
|
|
59487
59215
|
};
|
|
59488
|
-
|
|
59216
|
+
toolDefs10 = [
|
|
59489
59217
|
{
|
|
59490
59218
|
name: "quote_manufacturing",
|
|
59491
59219
|
pack: "fabricate",
|
|
@@ -60406,7 +60134,7 @@ function err3(text) {
|
|
|
60406
60134
|
isError: true
|
|
60407
60135
|
};
|
|
60408
60136
|
}
|
|
60409
|
-
var CLEARANCE_CLAIM_PREFIX, MECH_DOMAIN2, CLEARANCE_ORACLE, STALE_EPS_MM, CONTACT_EPS_MM, checkClearanceSchema, pairKey,
|
|
60137
|
+
var CLEARANCE_CLAIM_PREFIX, MECH_DOMAIN2, CLEARANCE_ORACLE, STALE_EPS_MM, CONTACT_EPS_MM, checkClearanceSchema, pairKey, toolDefs11;
|
|
60410
60138
|
var init_clearance = __esm({
|
|
60411
60139
|
"src/tools/clearance.ts"() {
|
|
60412
60140
|
"use strict";
|
|
@@ -60481,7 +60209,7 @@ var init_clearance = __esm({
|
|
|
60481
60209
|
required: ["document_id"]
|
|
60482
60210
|
};
|
|
60483
60211
|
pairKey = (a, b) => a < b ? `${a}\0${b}` : `${b}\0${a}`;
|
|
60484
|
-
|
|
60212
|
+
toolDefs11 = [
|
|
60485
60213
|
{
|
|
60486
60214
|
name: "check_clearance",
|
|
60487
60215
|
pack: null,
|
|
@@ -60809,7 +60537,7 @@ async function placeOrder(input, store, eventStore, user, engine, sessionStore)
|
|
|
60809
60537
|
note: "Paid via atomic wallet debit. Fab submission runs in a follow-up outbox slice; the order rests at PAID until then. Track with get_order_status." + (fabArtifact ? " The fab bundle is bound by reference (artifact_id); the worker fetches it from the artifact store, so the files never transit model context." : "")
|
|
60810
60538
|
});
|
|
60811
60539
|
}
|
|
60812
|
-
var DISABLED_MSG, AUTHZ_TTL_MS, toUsd2, usd, authorizeSpendSchema, placeOrderSchema,
|
|
60540
|
+
var DISABLED_MSG, AUTHZ_TTL_MS, toUsd2, usd, authorizeSpendSchema, placeOrderSchema, toolDefs12;
|
|
60813
60541
|
var init_ordering = __esm({
|
|
60814
60542
|
"src/tools/ordering.ts"() {
|
|
60815
60543
|
"use strict";
|
|
@@ -60855,7 +60583,7 @@ var init_ordering = __esm({
|
|
|
60855
60583
|
},
|
|
60856
60584
|
required: ["order_id", "authorization_id"]
|
|
60857
60585
|
};
|
|
60858
|
-
|
|
60586
|
+
toolDefs12 = [
|
|
60859
60587
|
{
|
|
60860
60588
|
name: "authorize_spend",
|
|
60861
60589
|
pack: "fabricate",
|
|
@@ -61002,7 +60730,7 @@ function searchMechanicalParts(input) {
|
|
|
61002
60730
|
]
|
|
61003
60731
|
};
|
|
61004
60732
|
}
|
|
61005
|
-
var MECH_PART_TYPES, PRICE_DISCLAIMER, cachedParts, searchMechanicalPartsSchema, num, normThread,
|
|
60733
|
+
var MECH_PART_TYPES, PRICE_DISCLAIMER, cachedParts, searchMechanicalPartsSchema, num, normThread, toolDefs13;
|
|
61006
60734
|
var init_mech_parts = __esm({
|
|
61007
60735
|
"src/tools/mech-parts.ts"() {
|
|
61008
60736
|
"use strict";
|
|
@@ -61055,7 +60783,7 @@ var init_mech_parts = __esm({
|
|
|
61055
60783
|
};
|
|
61056
60784
|
num = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
61057
60785
|
normThread = (t2) => t2.trim().toUpperCase().replace(/\s+/g, "");
|
|
61058
|
-
|
|
60786
|
+
toolDefs13 = [
|
|
61059
60787
|
{
|
|
61060
60788
|
name: "search_mechanical_parts",
|
|
61061
60789
|
pack: "bom",
|
|
@@ -61324,7 +61052,7 @@ async function bomCheckStock(args, ctx) {
|
|
|
61324
61052
|
const payload = { ...report, note: STOCK_NOTE };
|
|
61325
61053
|
return { content: [{ type: "text", text: JSON.stringify(payload) }], structuredContent: payload };
|
|
61326
61054
|
}
|
|
61327
|
-
var dbCache, LCSC_RE, JLC_SEARCH_URL, LCSC_DETAIL_URL, UA, PartStockClient, BASES, sharedClient, STOCK_NOTE, checkPartStockSchema, bomCheckStockSchema, bomResolver,
|
|
61055
|
+
var dbCache, LCSC_RE, JLC_SEARCH_URL, LCSC_DETAIL_URL, UA, PartStockClient, BASES, sharedClient, STOCK_NOTE, checkPartStockSchema, bomCheckStockSchema, bomResolver, toolDefs14;
|
|
61328
61056
|
var init_part_stock = __esm({
|
|
61329
61057
|
"src/tools/part-stock.ts"() {
|
|
61330
61058
|
"use strict";
|
|
@@ -61569,7 +61297,7 @@ var init_part_stock = __esm({
|
|
|
61569
61297
|
}
|
|
61570
61298
|
};
|
|
61571
61299
|
bomResolver = null;
|
|
61572
|
-
|
|
61300
|
+
toolDefs14 = [
|
|
61573
61301
|
{
|
|
61574
61302
|
name: "check_part_stock",
|
|
61575
61303
|
pack: "bom",
|
|
@@ -62016,7 +61744,7 @@ function renderCsv(bom) {
|
|
|
62016
61744
|
}
|
|
62017
61745
|
return rows.join("\r\n") + "\r\n";
|
|
62018
61746
|
}
|
|
62019
|
-
var PRICING_NOTE, memBoms, bomKey, toUsd3, usdToMinor, fmtUsd, BOM_ORACLE, str, lineProperties, bomCreateSchema, bomAddLineSchema, bomExportSchema, md, csv,
|
|
61747
|
+
var PRICING_NOTE, memBoms, bomKey, toUsd3, usdToMinor, fmtUsd, BOM_ORACLE, str, lineProperties, bomCreateSchema, bomAddLineSchema, bomExportSchema, md, csv, toolDefs15;
|
|
62020
61748
|
var init_bom = __esm({
|
|
62021
61749
|
"src/tools/bom.ts"() {
|
|
62022
61750
|
"use strict";
|
|
@@ -62136,7 +61864,7 @@ var init_bom = __esm({
|
|
|
62136
61864
|
const s = String(v);
|
|
62137
61865
|
return /[",\r\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s;
|
|
62138
61866
|
};
|
|
62139
|
-
|
|
61867
|
+
toolDefs15 = [
|
|
62140
61868
|
{
|
|
62141
61869
|
name: "bom_create",
|
|
62142
61870
|
pack: "bom",
|
|
@@ -62199,7 +61927,7 @@ async function unshareSession(input, store) {
|
|
|
62199
61927
|
note: "Live link revoked \u2014 the link now 404s and no further live updates are broadcast for this session. (A viewer already connected keeps only the events they had already received; their socket isn't force-closed.)"
|
|
62200
61928
|
});
|
|
62201
61929
|
}
|
|
62202
|
-
var DISABLED, shareSessionSchema, unshareSessionSchema,
|
|
61930
|
+
var DISABLED, shareSessionSchema, unshareSessionSchema, toolDefs16;
|
|
62203
61931
|
var init_live_share = __esm({
|
|
62204
61932
|
"src/tools/live-share.ts"() {
|
|
62205
61933
|
"use strict";
|
|
@@ -62227,7 +61955,7 @@ var init_live_share = __esm({
|
|
|
62227
61955
|
},
|
|
62228
61956
|
required: ["document_id"]
|
|
62229
61957
|
};
|
|
62230
|
-
|
|
61958
|
+
toolDefs16 = [
|
|
62231
61959
|
{
|
|
62232
61960
|
name: "share_session",
|
|
62233
61961
|
pack: null,
|
|
@@ -62334,7 +62062,7 @@ function placePartTool(args, engine) {
|
|
|
62334
62062
|
]
|
|
62335
62063
|
};
|
|
62336
62064
|
}
|
|
62337
|
-
var searchPartsSchema, placePartSchema,
|
|
62065
|
+
var searchPartsSchema, placePartSchema, toolDefs17;
|
|
62338
62066
|
var init_parts2 = __esm({
|
|
62339
62067
|
"src/tools/parts.ts"() {
|
|
62340
62068
|
"use strict";
|
|
@@ -62391,7 +62119,7 @@ var init_parts2 = __esm({
|
|
|
62391
62119
|
},
|
|
62392
62120
|
required: ["document_id", "path"]
|
|
62393
62121
|
};
|
|
62394
|
-
|
|
62122
|
+
toolDefs17 = [
|
|
62395
62123
|
{
|
|
62396
62124
|
name: "search_parts",
|
|
62397
62125
|
pack: null,
|
|
@@ -62549,7 +62277,7 @@ function exportCad(input, engine) {
|
|
|
62549
62277
|
...scene.instances && scene.instances.length > 0 ? { instances: scene.instances.length } : {}
|
|
62550
62278
|
});
|
|
62551
62279
|
}
|
|
62552
|
-
var exportCadSchema,
|
|
62280
|
+
var exportCadSchema, toolDefs18;
|
|
62553
62281
|
var init_export = __esm({
|
|
62554
62282
|
"src/tools/export.ts"() {
|
|
62555
62283
|
"use strict";
|
|
@@ -62585,7 +62313,7 @@ var init_export = __esm({
|
|
|
62585
62313
|
},
|
|
62586
62314
|
required: ["filename"]
|
|
62587
62315
|
};
|
|
62588
|
-
|
|
62316
|
+
toolDefs18 = [
|
|
62589
62317
|
{
|
|
62590
62318
|
name: "export_cad",
|
|
62591
62319
|
pack: null,
|
|
@@ -62826,7 +62554,7 @@ function err5(text) {
|
|
|
62826
62554
|
isError: true
|
|
62827
62555
|
};
|
|
62828
62556
|
}
|
|
62829
|
-
var MAX_STEPS_PER_SIDE, JointRangeError, key2, Lattice, checkJointRangeSchema,
|
|
62557
|
+
var MAX_STEPS_PER_SIDE, JointRangeError, key2, Lattice, checkJointRangeSchema, toolDefs19;
|
|
62830
62558
|
var init_joint_range = __esm({
|
|
62831
62559
|
"src/tools/joint-range.ts"() {
|
|
62832
62560
|
"use strict";
|
|
@@ -62924,7 +62652,7 @@ var init_joint_range = __esm({
|
|
|
62924
62652
|
},
|
|
62925
62653
|
required: ["document_id"]
|
|
62926
62654
|
};
|
|
62927
|
-
|
|
62655
|
+
toolDefs19 = [
|
|
62928
62656
|
{
|
|
62929
62657
|
name: "check_joint_range",
|
|
62930
62658
|
pack: null,
|
|
@@ -63207,7 +62935,7 @@ function measureOuterDiameter(args, engine) {
|
|
|
63207
62935
|
structuredContent: { outer_diameter: body, document_id: documentId }
|
|
63208
62936
|
};
|
|
63209
62937
|
}
|
|
63210
|
-
var DEFAULT_LIMIT, r62, vec, ACCURACY_NOTE, inspectFacesSchema, outerDiameterSchema,
|
|
62938
|
+
var DEFAULT_LIMIT, r62, vec, ACCURACY_NOTE, inspectFacesSchema, outerDiameterSchema, toolDefs20;
|
|
63211
62939
|
var init_faces = __esm({
|
|
63212
62940
|
"src/tools/faces.ts"() {
|
|
63213
62941
|
"use strict";
|
|
@@ -63289,7 +63017,7 @@ var init_faces = __esm({
|
|
|
63289
63017
|
},
|
|
63290
63018
|
required: ["document_id"]
|
|
63291
63019
|
};
|
|
63292
|
-
|
|
63020
|
+
toolDefs20 = [
|
|
63293
63021
|
{
|
|
63294
63022
|
name: "inspect_faces",
|
|
63295
63023
|
pack: null,
|
|
@@ -63470,7 +63198,7 @@ function sensitivity(input, engine) {
|
|
|
63470
63198
|
claims: report.claims
|
|
63471
63199
|
});
|
|
63472
63200
|
}
|
|
63473
|
-
var listParametersSchema, setParametersSchema, parameterGradientSchema, sensitivitySchema,
|
|
63201
|
+
var listParametersSchema, setParametersSchema, parameterGradientSchema, sensitivitySchema, toolDefs21;
|
|
63474
63202
|
var init_parameters = __esm({
|
|
63475
63203
|
"src/tools/parameters.ts"() {
|
|
63476
63204
|
"use strict";
|
|
@@ -63568,7 +63296,7 @@ var init_parameters = __esm({
|
|
|
63568
63296
|
},
|
|
63569
63297
|
required: []
|
|
63570
63298
|
};
|
|
63571
|
-
|
|
63299
|
+
toolDefs21 = [
|
|
63572
63300
|
{
|
|
63573
63301
|
name: "list_parameters",
|
|
63574
63302
|
pack: null,
|
|
@@ -64110,7 +63838,7 @@ function err7(text) {
|
|
|
64110
63838
|
isError: true
|
|
64111
63839
|
};
|
|
64112
63840
|
}
|
|
64113
|
-
var vec3Schema, checkEnclosureFitSchema,
|
|
63841
|
+
var vec3Schema, checkEnclosureFitSchema, toolDefs22;
|
|
64114
63842
|
var init_enclosure = __esm({
|
|
64115
63843
|
"src/tools/enclosure.ts"() {
|
|
64116
63844
|
"use strict";
|
|
@@ -64170,7 +63898,7 @@ var init_enclosure = __esm({
|
|
|
64170
63898
|
},
|
|
64171
63899
|
required: ["document_id", "enclosure_document_id"]
|
|
64172
63900
|
};
|
|
64173
|
-
|
|
63901
|
+
toolDefs22 = [
|
|
64174
63902
|
{
|
|
64175
63903
|
name: "check_enclosure_fit",
|
|
64176
63904
|
pack: "ecad",
|
|
@@ -64186,12 +63914,12 @@ var init_enclosure = __esm({
|
|
|
64186
63914
|
// src/wasm/ecad-diff.ts
|
|
64187
63915
|
import { createRequire } from "node:module";
|
|
64188
63916
|
import { fileURLToPath } from "node:url";
|
|
64189
|
-
import { dirname as
|
|
63917
|
+
import { dirname as dirname2, resolve as resolve4 } from "node:path";
|
|
64190
63918
|
function load() {
|
|
64191
63919
|
if (cached2 !== void 0) return cached2;
|
|
64192
63920
|
try {
|
|
64193
|
-
const here =
|
|
64194
|
-
const pkg =
|
|
63921
|
+
const here = dirname2(fileURLToPath(import.meta.url));
|
|
63922
|
+
const pkg = resolve4(here, "../../../../crates/vcad-ecad-diff-wasm/pkg/vcad_ecad_diff_wasm.js");
|
|
64195
63923
|
const req = createRequire(import.meta.url);
|
|
64196
63924
|
cached2 = req(pkg);
|
|
64197
63925
|
} catch {
|
|
@@ -72809,7 +72537,7 @@ async function fixDrc(args, toolCtx) {
|
|
|
72809
72537
|
};
|
|
72810
72538
|
return { content: [{ type: "text", text: JSON.stringify(payload) }] };
|
|
72811
72539
|
}
|
|
72812
|
-
var PCB_LAYER_SET, COPPER_LAYERS, COPPER_LAYER_SET, POSITION_TOLERANCE, PIN_SEP, pinKey, powerFlagsSchema, sheetInstanceSchema, sheetDefinitionSchema, createSchematicSchema, updateSchematicSchema, inspectSchematicSchema, docInputProperties, placeComponentsSchema, routeNetsSchema, runDrcSchema, runErcSchema, critiqueRouteSchema, routeDiffPairSchema, lengthMatchTracesSchema, exportGerberSchema, validateForFabSchema, fabPrepSchema, exportKicadSchema, addCoilSchema, boardFromSolidSchema, addCoilArraySchema, windingLayoutSchema, calcImpedanceSchema, sizeImpedanceSchema, sizePdnSchema, calcCoilSchema, sizeCoilSchema, calcRfSchema, COIL_GEOMETRY, MU0, RAIL_PIN_NAMES, PIN_TYPES, CHIP_SIZE_CODES, CONNECTIVITY_GUARD_MAX_NETS, POWER_NET_RE, DRC_CATEGORY, DRC_DELTA_SAMPLE_CAP, DRC_DELTA_FULL_BOARD_MAX, LINT_CRYSTAL_MAX_MM, LINT_DECAP_MAX_MM, LINT_CONNECTOR_EDGE_MAX_MM, LINT_HIGH_CURRENT_SEP_MIN_MM, LINT_GROUND_NET_RE, LINT_SUPPLY_NET_RE, SENSITIVE_NET_RE, HIGH_CURRENT_CLASS_RE, refPrefix, dist2d, round22, sumSq, round33, vec2Schema, setBoardOutlineSchema, FOOTPRINT_FAMILIES, listFootprintsSchema, searchFootprintsSchema, getPadPositionsSchema, getFootprintSchema, ROTATION_CONVENTION, describePcbSchema, DESCRIBE_NET_NAME_CAP, addTraceSchema, addViaSchema, OZ_TO_MM, setStackupSchema, setPlacementSchema, addZoneSchema, deleteElementProps, deleteZoneSchema, deleteTraceSchema, deleteViaSchema, COPPER_KINDS, GET_COPPER_CAP, getCopperSchema, TIE_POSITION_TOL, addNetTieSchema, deleteNetTieSchema, undoSchema, setDesignRulesSchema, sizeTraceForCurrentSchema, addViaArraySchema, MAX_VIA_ARRAY, addMotorWindingSchema, calcMotorSchema, SILICON_STEEL_KNEE_T, sig6, BEARING_FRICTION_MNM, checkSelfStartSchema, solidFromBoardSchema, FR4_DENSITY_KG_M3, COPPER_DENSITY_KG_M3, DEFAULT_COPPER_THICKNESS_MM, loopArea, MOUNTING_FP_RE, KEEPOUT_ECHO_CAP, INLINE_DOC_ECHO_CAP, searchElectronicPartsSchema, resolvePartSchema, findAlternativesSchema, verifySubstitutionSchema, buildReceiptSchema, verifyReceiptSchema, FIX_EPS, FIX_DRC_NEVER, fixDrcSchema,
|
|
72540
|
+
var PCB_LAYER_SET, COPPER_LAYERS, COPPER_LAYER_SET, POSITION_TOLERANCE, PIN_SEP, pinKey, powerFlagsSchema, sheetInstanceSchema, sheetDefinitionSchema, createSchematicSchema, updateSchematicSchema, inspectSchematicSchema, docInputProperties, placeComponentsSchema, routeNetsSchema, runDrcSchema, runErcSchema, critiqueRouteSchema, routeDiffPairSchema, lengthMatchTracesSchema, exportGerberSchema, validateForFabSchema, fabPrepSchema, exportKicadSchema, addCoilSchema, boardFromSolidSchema, addCoilArraySchema, windingLayoutSchema, calcImpedanceSchema, sizeImpedanceSchema, sizePdnSchema, calcCoilSchema, sizeCoilSchema, calcRfSchema, COIL_GEOMETRY, MU0, RAIL_PIN_NAMES, PIN_TYPES, CHIP_SIZE_CODES, CONNECTIVITY_GUARD_MAX_NETS, POWER_NET_RE, DRC_CATEGORY, DRC_DELTA_SAMPLE_CAP, DRC_DELTA_FULL_BOARD_MAX, LINT_CRYSTAL_MAX_MM, LINT_DECAP_MAX_MM, LINT_CONNECTOR_EDGE_MAX_MM, LINT_HIGH_CURRENT_SEP_MIN_MM, LINT_GROUND_NET_RE, LINT_SUPPLY_NET_RE, SENSITIVE_NET_RE, HIGH_CURRENT_CLASS_RE, refPrefix, dist2d, round22, sumSq, round33, vec2Schema, setBoardOutlineSchema, FOOTPRINT_FAMILIES, listFootprintsSchema, searchFootprintsSchema, getPadPositionsSchema, getFootprintSchema, ROTATION_CONVENTION, describePcbSchema, DESCRIBE_NET_NAME_CAP, addTraceSchema, addViaSchema, OZ_TO_MM, setStackupSchema, setPlacementSchema, addZoneSchema, deleteElementProps, deleteZoneSchema, deleteTraceSchema, deleteViaSchema, COPPER_KINDS, GET_COPPER_CAP, getCopperSchema, TIE_POSITION_TOL, addNetTieSchema, deleteNetTieSchema, undoSchema, setDesignRulesSchema, sizeTraceForCurrentSchema, addViaArraySchema, MAX_VIA_ARRAY, addMotorWindingSchema, calcMotorSchema, SILICON_STEEL_KNEE_T, sig6, BEARING_FRICTION_MNM, checkSelfStartSchema, solidFromBoardSchema, FR4_DENSITY_KG_M3, COPPER_DENSITY_KG_M3, DEFAULT_COPPER_THICKNESS_MM, loopArea, MOUNTING_FP_RE, KEEPOUT_ECHO_CAP, INLINE_DOC_ECHO_CAP, searchElectronicPartsSchema, resolvePartSchema, findAlternativesSchema, verifySubstitutionSchema, buildReceiptSchema, verifyReceiptSchema, FIX_EPS, FIX_DRC_NEVER, fixDrcSchema, toolDefs23;
|
|
72813
72541
|
var init_ecad2 = __esm({
|
|
72814
72542
|
"src/tools/ecad.ts"() {
|
|
72815
72543
|
"use strict";
|
|
@@ -74561,7 +74289,7 @@ var init_ecad2 = __esm({
|
|
|
74561
74289
|
},
|
|
74562
74290
|
required: ["document_id"]
|
|
74563
74291
|
};
|
|
74564
|
-
|
|
74292
|
+
toolDefs23 = [
|
|
74565
74293
|
{
|
|
74566
74294
|
name: "create_schematic",
|
|
74567
74295
|
pack: "ecad",
|
|
@@ -75239,7 +74967,7 @@ async function solveConstraints(args) {
|
|
|
75239
74967
|
}
|
|
75240
74968
|
return solveAndReport(ctx.doc, ctx.documentId);
|
|
75241
74969
|
}
|
|
75242
|
-
var anchorDescription, addConstraintSchema, deleteConstraintSchema, listConstraintsSchema, solveConstraintsSchema,
|
|
74970
|
+
var anchorDescription, addConstraintSchema, deleteConstraintSchema, listConstraintsSchema, solveConstraintsSchema, toolDefs24;
|
|
75243
74971
|
var init_design_constraints = __esm({
|
|
75244
74972
|
"src/tools/design-constraints.ts"() {
|
|
75245
74973
|
"use strict";
|
|
@@ -75284,7 +75012,7 @@ var init_design_constraints = __esm({
|
|
|
75284
75012
|
},
|
|
75285
75013
|
required: ["document_id"]
|
|
75286
75014
|
};
|
|
75287
|
-
|
|
75015
|
+
toolDefs24 = [
|
|
75288
75016
|
{
|
|
75289
75017
|
name: "add_constraint",
|
|
75290
75018
|
pack: null,
|
|
@@ -75518,7 +75246,7 @@ function recordMeasurement(input) {
|
|
|
75518
75246
|
}
|
|
75519
75247
|
return jsonResult3(report);
|
|
75520
75248
|
}
|
|
75521
|
-
var MEASURABLE_KINDS, MEASURABLE_AXES, MEASURABLE_FEATURES, predictions, reports, predictPrintSchema, recordMeasurementSchema, jsonResult3,
|
|
75249
|
+
var MEASURABLE_KINDS, MEASURABLE_AXES, MEASURABLE_FEATURES, predictions, reports, predictPrintSchema, recordMeasurementSchema, jsonResult3, toolDefs25;
|
|
75522
75250
|
var init_print_check = __esm({
|
|
75523
75251
|
"src/tools/print-check.ts"() {
|
|
75524
75252
|
"use strict";
|
|
@@ -75621,7 +75349,7 @@ var init_print_check = __esm({
|
|
|
75621
75349
|
jsonResult3 = (value) => ({
|
|
75622
75350
|
content: [{ type: "text", text: JSON.stringify(value, null, 2) }]
|
|
75623
75351
|
});
|
|
75624
|
-
|
|
75352
|
+
toolDefs25 = [
|
|
75625
75353
|
{
|
|
75626
75354
|
name: "predict_print",
|
|
75627
75355
|
pack: "print",
|
|
@@ -76496,7 +76224,7 @@ async function renderStackup(args) {
|
|
|
76496
76224
|
});
|
|
76497
76225
|
return withRenderAssets({ content }, assets);
|
|
76498
76226
|
}
|
|
76499
|
-
var renderViewSchema, SVG_SCALE, DEFAULT_WIDTH_PX, MAX_NODES, MAX_PATTERN_INSTANCES, MAX_RENDER_TRIANGLES, MAX_RASTER_SVG_BYTES, MAX_INLINE_SVG_BYTES, renderPcbSchema, PCB_MARGIN_MM, RATSNEST_COLOR, renderRatsnestSchema, renderStackupSchema,
|
|
76227
|
+
var renderViewSchema, SVG_SCALE, DEFAULT_WIDTH_PX, MAX_NODES, MAX_PATTERN_INSTANCES, MAX_RENDER_TRIANGLES, MAX_RASTER_SVG_BYTES, MAX_INLINE_SVG_BYTES, renderPcbSchema, PCB_MARGIN_MM, RATSNEST_COLOR, renderRatsnestSchema, renderStackupSchema, toolDefs26;
|
|
76500
76228
|
var init_render2 = __esm({
|
|
76501
76229
|
"src/tools/render.ts"() {
|
|
76502
76230
|
"use strict";
|
|
@@ -76660,7 +76388,7 @@ var init_render2 = __esm({
|
|
|
76660
76388
|
},
|
|
76661
76389
|
required: ["document_id"]
|
|
76662
76390
|
};
|
|
76663
|
-
|
|
76391
|
+
toolDefs26 = [
|
|
76664
76392
|
{
|
|
76665
76393
|
name: "render_view",
|
|
76666
76394
|
pack: null,
|
|
@@ -76700,15 +76428,15 @@ var init_render2 = __esm({
|
|
|
76700
76428
|
// src/tools/verify.ts
|
|
76701
76429
|
import { execFile } from "child_process";
|
|
76702
76430
|
import {
|
|
76703
|
-
existsSync as
|
|
76431
|
+
existsSync as existsSync3,
|
|
76704
76432
|
mkdtempSync,
|
|
76705
76433
|
readdirSync as readdirSync2,
|
|
76706
|
-
readFileSync as
|
|
76434
|
+
readFileSync as readFileSync6,
|
|
76707
76435
|
rmSync,
|
|
76708
76436
|
writeFileSync as writeFileSync4
|
|
76709
76437
|
} from "fs";
|
|
76710
76438
|
import { tmpdir } from "os";
|
|
76711
|
-
import { dirname as
|
|
76439
|
+
import { dirname as dirname3, join as join3 } from "path";
|
|
76712
76440
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
76713
76441
|
import { promisify } from "util";
|
|
76714
76442
|
function textResult(payload, isError = false) {
|
|
@@ -76717,8 +76445,8 @@ function textResult(payload, isError = false) {
|
|
|
76717
76445
|
function findUpward(start, probe) {
|
|
76718
76446
|
let dir = start;
|
|
76719
76447
|
for (let i = 0; i < 12; i++) {
|
|
76720
|
-
if (
|
|
76721
|
-
const parent =
|
|
76448
|
+
if (existsSync3(join3(dir, probe))) return dir;
|
|
76449
|
+
const parent = dirname3(dir);
|
|
76722
76450
|
if (parent === dir) break;
|
|
76723
76451
|
dir = parent;
|
|
76724
76452
|
}
|
|
@@ -76726,24 +76454,24 @@ function findUpward(start, probe) {
|
|
|
76726
76454
|
}
|
|
76727
76455
|
function findMechevalRoot() {
|
|
76728
76456
|
const override = process.env.MECHEVAL_DIR;
|
|
76729
|
-
if (override &&
|
|
76457
|
+
if (override && existsSync3(join3(override, "tasks"))) {
|
|
76730
76458
|
return override;
|
|
76731
76459
|
}
|
|
76732
|
-
const here =
|
|
76460
|
+
const here = dirname3(fileURLToPath2(import.meta.url));
|
|
76733
76461
|
const repoRoot = findUpward(here, join3("mecheval", "tasks")) ?? findUpward(process.cwd(), join3("mecheval", "tasks"));
|
|
76734
76462
|
return repoRoot ? join3(repoRoot, "mecheval") : null;
|
|
76735
76463
|
}
|
|
76736
76464
|
function findGraderBin(mechevalRoot) {
|
|
76737
76465
|
const override = process.env.MECHEVAL_GRADE_BIN;
|
|
76738
|
-
if (override &&
|
|
76466
|
+
if (override && existsSync3(override)) return override;
|
|
76739
76467
|
for (const profile of ["release", "debug"]) {
|
|
76740
76468
|
const candidate = join3(
|
|
76741
|
-
|
|
76469
|
+
dirname3(mechevalRoot),
|
|
76742
76470
|
"target",
|
|
76743
76471
|
profile,
|
|
76744
76472
|
"mecheval-grade"
|
|
76745
76473
|
);
|
|
76746
|
-
if (
|
|
76474
|
+
if (existsSync3(candidate)) return candidate;
|
|
76747
76475
|
}
|
|
76748
76476
|
return null;
|
|
76749
76477
|
}
|
|
@@ -76763,7 +76491,7 @@ function listEvalTasks(args) {
|
|
|
76763
76491
|
for (const file of readdirSync2(tasksDir).sort()) {
|
|
76764
76492
|
if (!file.endsWith(".json")) continue;
|
|
76765
76493
|
try {
|
|
76766
|
-
const raw = JSON.parse(
|
|
76494
|
+
const raw = JSON.parse(readFileSync6(join3(tasksDir, file), "utf8"));
|
|
76767
76495
|
if (suiteFilter && String(raw.suite).toUpperCase() !== suiteFilter) {
|
|
76768
76496
|
continue;
|
|
76769
76497
|
}
|
|
@@ -76798,7 +76526,7 @@ async function verifyPart(args) {
|
|
|
76798
76526
|
return textResult({ error: `invalid task_id: ${taskId}` }, true);
|
|
76799
76527
|
}
|
|
76800
76528
|
const taskPath = join3(mechevalRoot, "tasks", `${taskId}.json`);
|
|
76801
|
-
if (!
|
|
76529
|
+
if (!existsSync3(taskPath)) {
|
|
76802
76530
|
return textResult(
|
|
76803
76531
|
{
|
|
76804
76532
|
error: `unknown task_id "${taskId}"`,
|
|
@@ -76866,7 +76594,7 @@ async function verifyPart(args) {
|
|
|
76866
76594
|
rmSync(scratch, { recursive: true, force: true });
|
|
76867
76595
|
}
|
|
76868
76596
|
}
|
|
76869
|
-
var execFileAsync, verifyPartSchema, listEvalTasksSchema,
|
|
76597
|
+
var execFileAsync, verifyPartSchema, listEvalTasksSchema, toolDefs27;
|
|
76870
76598
|
var init_verify = __esm({
|
|
76871
76599
|
"src/tools/verify.ts"() {
|
|
76872
76600
|
"use strict";
|
|
@@ -76897,7 +76625,7 @@ var init_verify = __esm({
|
|
|
76897
76625
|
}
|
|
76898
76626
|
}
|
|
76899
76627
|
};
|
|
76900
|
-
|
|
76628
|
+
toolDefs27 = [
|
|
76901
76629
|
{
|
|
76902
76630
|
name: "verify_part",
|
|
76903
76631
|
pack: "eval",
|
|
@@ -76957,7 +76685,7 @@ function verifySpec(input, engine) {
|
|
|
76957
76685
|
]
|
|
76958
76686
|
};
|
|
76959
76687
|
}
|
|
76960
|
-
var pointSpecSchema, verifySpecSchema,
|
|
76688
|
+
var pointSpecSchema, verifySpecSchema, toolDefs28;
|
|
76961
76689
|
var init_verify_spec = __esm({
|
|
76962
76690
|
"src/tools/verify-spec.ts"() {
|
|
76963
76691
|
"use strict";
|
|
@@ -77021,7 +76749,7 @@ var init_verify_spec = __esm({
|
|
|
77021
76749
|
},
|
|
77022
76750
|
required: ["document_id", "spec"]
|
|
77023
76751
|
};
|
|
77024
|
-
|
|
76752
|
+
toolDefs28 = [
|
|
77025
76753
|
{
|
|
77026
76754
|
name: "verify_spec",
|
|
77027
76755
|
pack: null,
|
|
@@ -77164,7 +76892,7 @@ function topologyOptimizeTool(args, engine) {
|
|
|
77164
76892
|
]
|
|
77165
76893
|
};
|
|
77166
76894
|
}
|
|
77167
|
-
var regionSchema, topologyOptimizeSchema, round5,
|
|
76895
|
+
var regionSchema, topologyOptimizeSchema, round5, toolDefs29;
|
|
77168
76896
|
var init_topopt = __esm({
|
|
77169
76897
|
"src/tools/topopt.ts"() {
|
|
77170
76898
|
"use strict";
|
|
@@ -77277,7 +77005,7 @@ var init_topopt = __esm({
|
|
|
77277
77005
|
}
|
|
77278
77006
|
};
|
|
77279
77007
|
round5 = (v) => Number(v.toPrecision(5));
|
|
77280
|
-
|
|
77008
|
+
toolDefs29 = [
|
|
77281
77009
|
{
|
|
77282
77010
|
name: "topology_optimize",
|
|
77283
77011
|
pack: null,
|
|
@@ -77301,7 +77029,7 @@ function textResult2(payload) {
|
|
|
77301
77029
|
]
|
|
77302
77030
|
};
|
|
77303
77031
|
}
|
|
77304
|
-
var paramValue, deviceSpecSchema, parametersSchema, simOptionsSchema, simulateChargedParticlesSchema, optimizeElectrodesSchema,
|
|
77032
|
+
var paramValue, deviceSpecSchema, parametersSchema, simOptionsSchema, simulateChargedParticlesSchema, optimizeElectrodesSchema, toolDefs30;
|
|
77305
77033
|
var init_particle = __esm({
|
|
77306
77034
|
"src/tools/particle.ts"() {
|
|
77307
77035
|
"use strict";
|
|
@@ -77435,7 +77163,7 @@ var init_particle = __esm({
|
|
|
77435
77163
|
}
|
|
77436
77164
|
}
|
|
77437
77165
|
};
|
|
77438
|
-
|
|
77166
|
+
toolDefs30 = [
|
|
77439
77167
|
{
|
|
77440
77168
|
name: "simulate_charged_particles",
|
|
77441
77169
|
pack: null,
|
|
@@ -77486,7 +77214,7 @@ function textResult3(payload) {
|
|
|
77486
77214
|
]
|
|
77487
77215
|
};
|
|
77488
77216
|
}
|
|
77489
|
-
var paramValue2, distSchema, stackupSpecSchema,
|
|
77217
|
+
var paramValue2, distSchema, stackupSpecSchema, toolDefs31;
|
|
77490
77218
|
var init_tolerance = __esm({
|
|
77491
77219
|
"src/tools/tolerance.ts"() {
|
|
77492
77220
|
"use strict";
|
|
@@ -77574,7 +77302,7 @@ var init_tolerance = __esm({
|
|
|
77574
77302
|
}
|
|
77575
77303
|
}
|
|
77576
77304
|
};
|
|
77577
|
-
|
|
77305
|
+
toolDefs31 = [
|
|
77578
77306
|
{
|
|
77579
77307
|
name: "analyze_tolerance_stackup",
|
|
77580
77308
|
pack: null,
|
|
@@ -77634,7 +77362,7 @@ function textResult4(payload) {
|
|
|
77634
77362
|
]
|
|
77635
77363
|
};
|
|
77636
77364
|
}
|
|
77637
|
-
var paramValue3, paramVec3, shapeSchema, boundarySchema, thermalSpecSchema, transientSchema,
|
|
77365
|
+
var paramValue3, paramVec3, shapeSchema, boundarySchema, thermalSpecSchema, transientSchema, toolDefs32;
|
|
77638
77366
|
var init_thermal = __esm({
|
|
77639
77367
|
"src/tools/thermal.ts"() {
|
|
77640
77368
|
"use strict";
|
|
@@ -77801,7 +77529,7 @@ var init_thermal = __esm({
|
|
|
77801
77529
|
}
|
|
77802
77530
|
}
|
|
77803
77531
|
};
|
|
77804
|
-
|
|
77532
|
+
toolDefs32 = [
|
|
77805
77533
|
{
|
|
77806
77534
|
name: "solve_thermal",
|
|
77807
77535
|
pack: null,
|
|
@@ -77863,7 +77591,7 @@ function textResult5(payload) {
|
|
|
77863
77591
|
]
|
|
77864
77592
|
};
|
|
77865
77593
|
}
|
|
77866
|
-
var vec32, shapeSchema2, flowSpecSchema,
|
|
77594
|
+
var vec32, shapeSchema2, flowSpecSchema, toolDefs33;
|
|
77867
77595
|
var init_flow = __esm({
|
|
77868
77596
|
"src/tools/flow.ts"() {
|
|
77869
77597
|
"use strict";
|
|
@@ -77997,7 +77725,7 @@ var init_flow = __esm({
|
|
|
77997
77725
|
}
|
|
77998
77726
|
}
|
|
77999
77727
|
};
|
|
78000
|
-
|
|
77728
|
+
toolDefs33 = [
|
|
78001
77729
|
{
|
|
78002
77730
|
name: "simulate_flow",
|
|
78003
77731
|
pack: null,
|
|
@@ -78079,7 +77807,7 @@ function frequencyGrid(ac) {
|
|
|
78079
77807
|
}
|
|
78080
77808
|
return out;
|
|
78081
77809
|
}
|
|
78082
|
-
var deviceSchema, devicesSchema,
|
|
77810
|
+
var deviceSchema, devicesSchema, toolDefs34;
|
|
78083
77811
|
var init_circuit = __esm({
|
|
78084
77812
|
"src/tools/circuit.ts"() {
|
|
78085
77813
|
"use strict";
|
|
@@ -78116,7 +77844,7 @@ var init_circuit = __esm({
|
|
|
78116
77844
|
items: deviceSchema,
|
|
78117
77845
|
description: "Netlist as data. Node ids are dense integers with 0 = ground; the device's index in this array is its device id (used by sourceId / freeDevices / outNode references)."
|
|
78118
77846
|
};
|
|
78119
|
-
|
|
77847
|
+
toolDefs34 = [
|
|
78120
77848
|
{
|
|
78121
77849
|
name: "simulate_circuit",
|
|
78122
77850
|
pack: null,
|
|
@@ -78307,7 +78035,7 @@ function textResult7(payload) {
|
|
|
78307
78035
|
]
|
|
78308
78036
|
};
|
|
78309
78037
|
}
|
|
78310
|
-
var regionSchema2,
|
|
78038
|
+
var regionSchema2, toolDefs35;
|
|
78311
78039
|
var init_structure = __esm({
|
|
78312
78040
|
"src/tools/structure.ts"() {
|
|
78313
78041
|
"use strict";
|
|
@@ -78334,7 +78062,7 @@ var init_structure = __esm({
|
|
|
78334
78062
|
}
|
|
78335
78063
|
}
|
|
78336
78064
|
};
|
|
78337
|
-
|
|
78065
|
+
toolDefs35 = [
|
|
78338
78066
|
{
|
|
78339
78067
|
name: "analyze_structure",
|
|
78340
78068
|
pack: null,
|
|
@@ -78553,7 +78281,7 @@ function textResult8(payload) {
|
|
|
78553
78281
|
]
|
|
78554
78282
|
};
|
|
78555
78283
|
}
|
|
78556
|
-
var paramValue4, rectRegion, bcSchema, electroShape, emSpecSchema,
|
|
78284
|
+
var paramValue4, rectRegion, bcSchema, electroShape, emSpecSchema, toolDefs36;
|
|
78557
78285
|
var init_em = __esm({
|
|
78558
78286
|
"src/tools/em.ts"() {
|
|
78559
78287
|
"use strict";
|
|
@@ -78709,7 +78437,7 @@ var init_em = __esm({
|
|
|
78709
78437
|
}
|
|
78710
78438
|
}
|
|
78711
78439
|
};
|
|
78712
|
-
|
|
78440
|
+
toolDefs36 = [
|
|
78713
78441
|
{
|
|
78714
78442
|
name: "simulate_em",
|
|
78715
78443
|
pack: null,
|
|
@@ -78822,7 +78550,7 @@ function textResult9(payload) {
|
|
|
78822
78550
|
]
|
|
78823
78551
|
};
|
|
78824
78552
|
}
|
|
78825
|
-
var paramValue5, pointSpec, antennaSpecSchema,
|
|
78553
|
+
var paramValue5, pointSpec, antennaSpecSchema, toolDefs37;
|
|
78826
78554
|
var init_antenna = __esm({
|
|
78827
78555
|
"src/tools/antenna.ts"() {
|
|
78828
78556
|
"use strict";
|
|
@@ -78871,7 +78599,7 @@ var init_antenna = __esm({
|
|
|
78871
78599
|
feed_mm: pointSpec
|
|
78872
78600
|
}
|
|
78873
78601
|
};
|
|
78874
|
-
|
|
78602
|
+
toolDefs37 = [
|
|
78875
78603
|
{
|
|
78876
78604
|
name: "analyze_antenna",
|
|
78877
78605
|
pack: null,
|
|
@@ -78948,7 +78676,7 @@ function textResult10(payload) {
|
|
|
78948
78676
|
]
|
|
78949
78677
|
};
|
|
78950
78678
|
}
|
|
78951
|
-
var photonicsSpecSchema,
|
|
78679
|
+
var photonicsSpecSchema, toolDefs38;
|
|
78952
78680
|
var init_photonics = __esm({
|
|
78953
78681
|
"src/tools/photonics.ts"() {
|
|
78954
78682
|
"use strict";
|
|
@@ -79034,7 +78762,7 @@ var init_photonics = __esm({
|
|
|
79034
78762
|
}
|
|
79035
78763
|
}
|
|
79036
78764
|
};
|
|
79037
|
-
|
|
78765
|
+
toolDefs38 = [
|
|
79038
78766
|
{
|
|
79039
78767
|
name: "simulate_photonics",
|
|
79040
78768
|
pack: null,
|
|
@@ -79100,7 +78828,7 @@ function textResult11(payload) {
|
|
|
79100
78828
|
]
|
|
79101
78829
|
};
|
|
79102
78830
|
}
|
|
79103
|
-
var paramValue6, shieldSpecSchema,
|
|
78831
|
+
var paramValue6, shieldSpecSchema, toolDefs39;
|
|
79104
78832
|
var init_neutronics = __esm({
|
|
79105
78833
|
"src/tools/neutronics.ts"() {
|
|
79106
78834
|
"use strict";
|
|
@@ -79171,7 +78899,7 @@ var init_neutronics = __esm({
|
|
|
79171
78899
|
}
|
|
79172
78900
|
}
|
|
79173
78901
|
};
|
|
79174
|
-
|
|
78902
|
+
toolDefs39 = [
|
|
79175
78903
|
{
|
|
79176
78904
|
name: "simulate_neutron_shield",
|
|
79177
78905
|
pack: null,
|
|
@@ -79213,7 +78941,7 @@ function textResult12(payload) {
|
|
|
79213
78941
|
]
|
|
79214
78942
|
};
|
|
79215
78943
|
}
|
|
79216
|
-
var simSpecSchema,
|
|
78944
|
+
var simSpecSchema, toolDefs40;
|
|
79217
78945
|
var init_qcd = __esm({
|
|
79218
78946
|
"src/tools/qcd.ts"() {
|
|
79219
78947
|
"use strict";
|
|
@@ -79303,7 +79031,7 @@ var init_qcd = __esm({
|
|
|
79303
79031
|
}
|
|
79304
79032
|
}
|
|
79305
79033
|
};
|
|
79306
|
-
|
|
79034
|
+
toolDefs40 = [
|
|
79307
79035
|
{
|
|
79308
79036
|
name: "simulate_lattice_gauge",
|
|
79309
79037
|
pack: null,
|
|
@@ -79445,7 +79173,7 @@ function predictPhysicsTool(args, engine) {
|
|
|
79445
79173
|
]
|
|
79446
79174
|
};
|
|
79447
79175
|
}
|
|
79448
|
-
var PHYSICS_DOMAIN, ORACLE, TIER_RESOLUTION, regionSchema3, predictPhysicsSchema, round52,
|
|
79176
|
+
var PHYSICS_DOMAIN, ORACLE, TIER_RESOLUTION, regionSchema3, predictPhysicsSchema, round52, toolDefs41;
|
|
79449
79177
|
var init_physics2 = __esm({
|
|
79450
79178
|
"src/tools/physics.ts"() {
|
|
79451
79179
|
"use strict";
|
|
@@ -79558,7 +79286,7 @@ var init_physics2 = __esm({
|
|
|
79558
79286
|
}
|
|
79559
79287
|
};
|
|
79560
79288
|
round52 = (v) => Number(v.toPrecision(5));
|
|
79561
|
-
|
|
79289
|
+
toolDefs41 = [
|
|
79562
79290
|
{
|
|
79563
79291
|
name: "predict_physics",
|
|
79564
79292
|
pack: null,
|
|
@@ -79802,7 +79530,7 @@ function applySetParam(doc, node, path, value) {
|
|
|
79802
79530
|
}
|
|
79803
79531
|
cursor[parts[parts.length - 1]] = value;
|
|
79804
79532
|
}
|
|
79805
|
-
var lastReports, mechanicalProcessEnum, pcbProcessEnum, processEnum, rulesetEnum, dfmCheckSchema, dfmExplainSchema, dfmSuggestFixSchema, dfmApplyFixSchema,
|
|
79533
|
+
var lastReports, mechanicalProcessEnum, pcbProcessEnum, processEnum, rulesetEnum, dfmCheckSchema, dfmExplainSchema, dfmSuggestFixSchema, dfmApplyFixSchema, toolDefs42;
|
|
79806
79534
|
var init_dfm2 = __esm({
|
|
79807
79535
|
"src/tools/dfm.ts"() {
|
|
79808
79536
|
"use strict";
|
|
@@ -79905,7 +79633,7 @@ var init_dfm2 = __esm({
|
|
|
79905
79633
|
},
|
|
79906
79634
|
required: ["issue_id"]
|
|
79907
79635
|
};
|
|
79908
|
-
|
|
79636
|
+
toolDefs42 = [
|
|
79909
79637
|
{
|
|
79910
79638
|
name: "dfm_check",
|
|
79911
79639
|
pack: "dfm",
|
|
@@ -80404,7 +80132,7 @@ function sheetMetalCost(input, engine) {
|
|
|
80404
80132
|
summary: `${result.breakdown.currency} ${result.breakdown.total_each.toFixed(2)} each @ qty ${result.breakdown.quantity} (mass ${result.breakdown.mass_kg_each.toFixed(3)} kg, ${result.breakdown.cut_length_m.toFixed(2)} m cut, ${result.breakdown.bends} bend(s)).`
|
|
80405
80133
|
});
|
|
80406
80134
|
}
|
|
80407
|
-
var sheetMetalCreateSchema, sheetMetalUnfoldSchema, sheetMetalMaterialsSchema, sheetMetalBendTableSchema, sheetMetalCheckSchema, sheetMetalNestSchema, sheetMetalSequenceSchema, sheetMetalSuggestFixSchema, sheetMetalCostSchema,
|
|
80135
|
+
var sheetMetalCreateSchema, sheetMetalUnfoldSchema, sheetMetalMaterialsSchema, sheetMetalBendTableSchema, sheetMetalCheckSchema, sheetMetalNestSchema, sheetMetalSequenceSchema, sheetMetalSuggestFixSchema, sheetMetalCostSchema, toolDefs43;
|
|
80408
80136
|
var init_sheet_metal2 = __esm({
|
|
80409
80137
|
"src/tools/sheet-metal.ts"() {
|
|
80410
80138
|
"use strict";
|
|
@@ -80665,7 +80393,7 @@ var init_sheet_metal2 = __esm({
|
|
|
80665
80393
|
},
|
|
80666
80394
|
required: ["document_id"]
|
|
80667
80395
|
};
|
|
80668
|
-
|
|
80396
|
+
toolDefs43 = [
|
|
80669
80397
|
{
|
|
80670
80398
|
name: "sheet_metal_create",
|
|
80671
80399
|
pack: "sheet_metal",
|
|
@@ -80908,7 +80636,7 @@ function flatPatternFromSolid(input, engine) {
|
|
|
80908
80636
|
]
|
|
80909
80637
|
};
|
|
80910
80638
|
}
|
|
80911
|
-
var flatPatternFromSolidSchema,
|
|
80639
|
+
var flatPatternFromSolidSchema, toolDefs44;
|
|
80912
80640
|
var init_flat_pattern = __esm({
|
|
80913
80641
|
"src/tools/flat-pattern.ts"() {
|
|
80914
80642
|
"use strict";
|
|
@@ -80949,7 +80677,7 @@ var init_flat_pattern = __esm({
|
|
|
80949
80677
|
},
|
|
80950
80678
|
required: ["document_id"]
|
|
80951
80679
|
};
|
|
80952
|
-
|
|
80680
|
+
toolDefs44 = [
|
|
80953
80681
|
{
|
|
80954
80682
|
name: "flat_pattern_from_solid",
|
|
80955
80683
|
pack: "sheet_metal",
|
|
@@ -81130,7 +80858,7 @@ function simulateStrike(input, engine) {
|
|
|
81130
80858
|
}
|
|
81131
80859
|
return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
|
|
81132
80860
|
}
|
|
81133
|
-
var cents, MATERIAL_ALIASES, simulateStrikeSchema, round23, round4,
|
|
80861
|
+
var cents, MATERIAL_ALIASES, simulateStrikeSchema, round23, round4, toolDefs45;
|
|
81134
80862
|
var init_acoustics = __esm({
|
|
81135
80863
|
"src/tools/acoustics.ts"() {
|
|
81136
80864
|
"use strict";
|
|
@@ -81204,7 +80932,7 @@ var init_acoustics = __esm({
|
|
|
81204
80932
|
};
|
|
81205
80933
|
round23 = (x) => Math.round(x * 100) / 100;
|
|
81206
80934
|
round4 = (x) => Math.round(x * 1e4) / 1e4;
|
|
81207
|
-
|
|
80935
|
+
toolDefs45 = [
|
|
81208
80936
|
{
|
|
81209
80937
|
name: "simulate_strike",
|
|
81210
80938
|
pack: "sheet_metal",
|
|
@@ -81219,16 +80947,16 @@ var init_acoustics = __esm({
|
|
|
81219
80947
|
|
|
81220
80948
|
// src/tools/import.ts
|
|
81221
80949
|
import { createHash as createHash6 } from "node:crypto";
|
|
81222
|
-
import { readFileSync as
|
|
81223
|
-
import { basename
|
|
80950
|
+
import { readFileSync as readFileSync7, existsSync as existsSync4, statSync as statSync2, mkdirSync as mkdirSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
80951
|
+
import { basename, join as join4, resolve as resolve5, sep as sep3 } from "node:path";
|
|
81224
80952
|
function exportRoot() {
|
|
81225
80953
|
return process.env.VCAD_MCP_EXPORT_DIR ?? process.cwd();
|
|
81226
80954
|
}
|
|
81227
80955
|
function isWithinExportRoot(path) {
|
|
81228
80956
|
if (path.includes("\0")) return false;
|
|
81229
|
-
const root =
|
|
81230
|
-
const abs =
|
|
81231
|
-
return abs === root || abs.startsWith(root +
|
|
80957
|
+
const root = resolve5(exportRoot());
|
|
80958
|
+
const abs = resolve5(path);
|
|
80959
|
+
return abs === root || abs.startsWith(root + sep3);
|
|
81232
80960
|
}
|
|
81233
80961
|
function stepNodePath(bytes, diskPath, label) {
|
|
81234
80962
|
if (diskPath) return { path: diskPath, portable: true };
|
|
@@ -81237,8 +80965,8 @@ function stepNodePath(bytes, diskPath, label) {
|
|
|
81237
80965
|
const dir = join4(exportRoot(), STEP_CACHE_DIR);
|
|
81238
80966
|
mkdirSync2(dir, { recursive: true });
|
|
81239
80967
|
const file = join4(dir, `${digest}.step`);
|
|
81240
|
-
if (!
|
|
81241
|
-
return { path:
|
|
80968
|
+
if (!existsSync4(file)) writeFileSync6(file, bytes);
|
|
80969
|
+
return { path: resolve5(file), portable: true };
|
|
81242
80970
|
} catch {
|
|
81243
80971
|
return { path: `step:${digest}/${label}`, portable: false };
|
|
81244
80972
|
}
|
|
@@ -81272,7 +81000,7 @@ function registerDocumentStepSources(doc, engine) {
|
|
|
81272
81000
|
continue;
|
|
81273
81001
|
}
|
|
81274
81002
|
try {
|
|
81275
|
-
const bytes =
|
|
81003
|
+
const bytes = readFileSync7(path);
|
|
81276
81004
|
const buf = new ArrayBuffer(bytes.byteLength);
|
|
81277
81005
|
new Uint8Array(buf).set(bytes);
|
|
81278
81006
|
engine.registerStepSource(path, buf);
|
|
@@ -81304,17 +81032,17 @@ function readStepInput(input) {
|
|
|
81304
81032
|
);
|
|
81305
81033
|
}
|
|
81306
81034
|
const filepath = resolveWithinRoot(filename, exportRoot());
|
|
81307
|
-
if (!
|
|
81035
|
+
if (!existsSync4(filepath)) {
|
|
81308
81036
|
throw new Error("STEP file not found");
|
|
81309
81037
|
}
|
|
81310
|
-
const stat =
|
|
81038
|
+
const stat = statSync2(filepath);
|
|
81311
81039
|
if (!stat.isFile()) {
|
|
81312
81040
|
throw new Error("STEP path is not a regular file");
|
|
81313
81041
|
}
|
|
81314
81042
|
if (stat.size > MAX_STEP_BYTES) {
|
|
81315
81043
|
throw new Error(`STEP file exceeds ${MAX_STEP_BYTES} byte limit`);
|
|
81316
81044
|
}
|
|
81317
|
-
return { bytes:
|
|
81045
|
+
return { bytes: readFileSync7(filepath), diskPath: resolve5(filepath) };
|
|
81318
81046
|
}
|
|
81319
81047
|
function defaultMaterials() {
|
|
81320
81048
|
return {
|
|
@@ -81363,7 +81091,7 @@ function importStep(input, engine) {
|
|
|
81363
81091
|
const arrayBuffer = new ArrayBuffer(fileBuffer.byteLength);
|
|
81364
81092
|
new Uint8Array(arrayBuffer).set(fileBuffer);
|
|
81365
81093
|
const sourceLabel = filename ?? "step-import";
|
|
81366
|
-
const partName = name ??
|
|
81094
|
+
const partName = name ?? basename(
|
|
81367
81095
|
sourceLabel,
|
|
81368
81096
|
/\.(step|stp)$/i.test(sourceLabel) ? sourceLabel.slice(-5) : ""
|
|
81369
81097
|
);
|
|
@@ -81400,7 +81128,7 @@ function importStep(input, engine) {
|
|
|
81400
81128
|
...skippedFaceSummary(report, importWarnings)
|
|
81401
81129
|
};
|
|
81402
81130
|
} else {
|
|
81403
|
-
const label =
|
|
81131
|
+
const label = basename(sourceLabel).replace(/[^\w.-]/g, "_") || "import.step";
|
|
81404
81132
|
const { path, portable } = stepNodePath(fileBuffer, diskPath, label);
|
|
81405
81133
|
let registered;
|
|
81406
81134
|
try {
|
|
@@ -81484,7 +81212,7 @@ function importStep(input, engine) {
|
|
|
81484
81212
|
]
|
|
81485
81213
|
};
|
|
81486
81214
|
}
|
|
81487
|
-
var MAX_STEP_BYTES, STEP_CACHE_DIR, importStepSchema,
|
|
81215
|
+
var MAX_STEP_BYTES, STEP_CACHE_DIR, importStepSchema, toolDefs46;
|
|
81488
81216
|
var init_import = __esm({
|
|
81489
81217
|
"src/tools/import.ts"() {
|
|
81490
81218
|
"use strict";
|
|
@@ -81521,7 +81249,7 @@ var init_import = __esm({
|
|
|
81521
81249
|
}
|
|
81522
81250
|
}
|
|
81523
81251
|
};
|
|
81524
|
-
|
|
81252
|
+
toolDefs46 = [
|
|
81525
81253
|
{
|
|
81526
81254
|
name: "import_step",
|
|
81527
81255
|
pack: null,
|
|
@@ -81534,6 +81262,230 @@ var init_import = __esm({
|
|
|
81534
81262
|
}
|
|
81535
81263
|
});
|
|
81536
81264
|
|
|
81265
|
+
// src/tools/import-urdf.ts
|
|
81266
|
+
import { readFileSync as readFileSync8, existsSync as existsSync5, statSync as statSync3 } from "node:fs";
|
|
81267
|
+
import { basename as basename2, dirname as dirname4, isAbsolute as isAbsolute4, resolve as resolve6, sep as sep4 } from "node:path";
|
|
81268
|
+
function resolveMeshPath(filename, urdfDir, packageRoots, confineRoot) {
|
|
81269
|
+
const confined = (p) => {
|
|
81270
|
+
const abs = resolve6(p);
|
|
81271
|
+
const root = resolve6(confineRoot);
|
|
81272
|
+
const rootSep = root.endsWith(sep4) ? root : root + sep4;
|
|
81273
|
+
if (abs !== root && !abs.startsWith(rootSep)) return null;
|
|
81274
|
+
return existsSync5(abs) && statSync3(abs).isFile() ? abs : null;
|
|
81275
|
+
};
|
|
81276
|
+
if (filename.includes("\0")) return null;
|
|
81277
|
+
const pkgMatch = filename.match(/^package:\/\/([^/]+)\/?(.*)$/);
|
|
81278
|
+
if (pkgMatch) {
|
|
81279
|
+
for (const root of packageRoots) {
|
|
81280
|
+
const hit = confined(resolve6(root, pkgMatch[1], pkgMatch[2]));
|
|
81281
|
+
if (hit) return hit;
|
|
81282
|
+
}
|
|
81283
|
+
return null;
|
|
81284
|
+
}
|
|
81285
|
+
const stripped = filename.startsWith("file://") ? filename.slice("file://".length) : filename;
|
|
81286
|
+
if (isAbsolute4(stripped)) return confined(stripped);
|
|
81287
|
+
if (urdfDir) return confined(resolve6(urdfDir, stripped));
|
|
81288
|
+
return null;
|
|
81289
|
+
}
|
|
81290
|
+
function inlineMeshImports(doc, engine, urdfDir, packageRoots, confineRoot) {
|
|
81291
|
+
const unresolved = [];
|
|
81292
|
+
const meshes = /* @__PURE__ */ new Map();
|
|
81293
|
+
const refs = /* @__PURE__ */ new Map();
|
|
81294
|
+
for (const [key3, node] of Object.entries(doc.nodes)) {
|
|
81295
|
+
const op = node.op;
|
|
81296
|
+
if (op.type !== "mesh_import" && op.type !== "MeshImport") continue;
|
|
81297
|
+
const ref = op.path ?? "";
|
|
81298
|
+
const filepath = resolveMeshPath(ref, urdfDir, packageRoots, confineRoot);
|
|
81299
|
+
if (!filepath) {
|
|
81300
|
+
unresolved.push({ path: ref, reason: "file not found" });
|
|
81301
|
+
} else if (!/\.stl$/i.test(filepath)) {
|
|
81302
|
+
unresolved.push({ path: ref, reason: "unsupported mesh format (only STL is inlined server-side)" });
|
|
81303
|
+
} else if (statSync3(filepath).size > MAX_MESH_BYTES) {
|
|
81304
|
+
unresolved.push({ path: ref, reason: "mesh exceeds size limit" });
|
|
81305
|
+
} else {
|
|
81306
|
+
meshes.set(key3, readFileSync8(filepath));
|
|
81307
|
+
refs.set(key3, ref);
|
|
81308
|
+
}
|
|
81309
|
+
}
|
|
81310
|
+
const { inlined, errors } = engine.inlineMeshImports(doc, meshes);
|
|
81311
|
+
for (const [key3, reason] of errors) unresolved.push({ path: refs.get(key3) ?? key3, reason });
|
|
81312
|
+
return { inlined, unresolved };
|
|
81313
|
+
}
|
|
81314
|
+
function importUrdf(input, engine) {
|
|
81315
|
+
const {
|
|
81316
|
+
path,
|
|
81317
|
+
content_base64,
|
|
81318
|
+
package_roots,
|
|
81319
|
+
name,
|
|
81320
|
+
floating_base,
|
|
81321
|
+
floating_base_link,
|
|
81322
|
+
spawn_height_mm
|
|
81323
|
+
} = input;
|
|
81324
|
+
if (!floating_base && (floating_base_link || spawn_height_mm !== void 0)) {
|
|
81325
|
+
throw new Error(
|
|
81326
|
+
"floating_base_link / spawn_height_mm require floating_base: true"
|
|
81327
|
+
);
|
|
81328
|
+
}
|
|
81329
|
+
const confineRoot = process.env.VCAD_MCP_EXPORT_DIR ?? process.cwd();
|
|
81330
|
+
let fileBuffer;
|
|
81331
|
+
let urdfDir = null;
|
|
81332
|
+
let sourceLabel;
|
|
81333
|
+
if (content_base64) {
|
|
81334
|
+
fileBuffer = Buffer.from(content_base64, "base64");
|
|
81335
|
+
if (fileBuffer.length === 0) {
|
|
81336
|
+
throw new Error("content_base64 decoded to zero bytes");
|
|
81337
|
+
}
|
|
81338
|
+
sourceLabel = "urdf-import";
|
|
81339
|
+
} else if (path) {
|
|
81340
|
+
if (isRemoteDeployment()) {
|
|
81341
|
+
throw new Error(
|
|
81342
|
+
"This hosted server has no access to your filesystem \u2014 pass the URDF XML as `content_base64` instead of `path`. Mesh references cannot be resolved in that mode (links fall back to placeholder geometry); run the MCP server locally for full mesh import."
|
|
81343
|
+
);
|
|
81344
|
+
}
|
|
81345
|
+
const filepath = resolveWithinRoot(path, confineRoot);
|
|
81346
|
+
if (!existsSync5(filepath)) {
|
|
81347
|
+
throw new Error(`URDF file not found: ${path}`);
|
|
81348
|
+
}
|
|
81349
|
+
const stat = statSync3(filepath);
|
|
81350
|
+
if (!stat.isFile()) {
|
|
81351
|
+
throw new Error("URDF path is not a regular file");
|
|
81352
|
+
}
|
|
81353
|
+
if (stat.size > MAX_URDF_BYTES) {
|
|
81354
|
+
throw new Error(`URDF file exceeds ${MAX_URDF_BYTES} byte limit`);
|
|
81355
|
+
}
|
|
81356
|
+
fileBuffer = readFileSync8(filepath);
|
|
81357
|
+
urdfDir = dirname4(filepath);
|
|
81358
|
+
sourceLabel = path;
|
|
81359
|
+
} else {
|
|
81360
|
+
throw new Error("Provide either `path` or `content_base64`");
|
|
81361
|
+
}
|
|
81362
|
+
if (fileBuffer.length > MAX_URDF_BYTES) {
|
|
81363
|
+
throw new Error(`URDF content exceeds ${MAX_URDF_BYTES} byte limit`);
|
|
81364
|
+
}
|
|
81365
|
+
const packageRoots = (package_roots ?? []).map(
|
|
81366
|
+
(r) => resolveWithinRoot(r, confineRoot)
|
|
81367
|
+
);
|
|
81368
|
+
const arrayBuffer = new ArrayBuffer(fileBuffer.byteLength);
|
|
81369
|
+
new Uint8Array(arrayBuffer).set(fileBuffer);
|
|
81370
|
+
const doc = JSON.parse(
|
|
81371
|
+
engine.importUrdf(arrayBuffer, {
|
|
81372
|
+
floatingBase: floating_base,
|
|
81373
|
+
floatingBaseLink: floating_base_link,
|
|
81374
|
+
spawnHeightMm: spawn_height_mm
|
|
81375
|
+
})
|
|
81376
|
+
);
|
|
81377
|
+
const commentedFloating = floating_base ? void 0 : engine.urdfCommentedFloatingJoint(arrayBuffer);
|
|
81378
|
+
const meshes = inlineMeshImports(doc, engine, urdfDir, packageRoots, confineRoot);
|
|
81379
|
+
const robotName = name ?? basename2(sourceLabel).replace(/\.(urdf|xml)$/i, "");
|
|
81380
|
+
const parts = Object.values(doc.partDefs ?? {}).map((p) => ({
|
|
81381
|
+
id: p.id,
|
|
81382
|
+
name: p.name
|
|
81383
|
+
}));
|
|
81384
|
+
const joints = (doc.joints ?? []).map((j) => ({
|
|
81385
|
+
id: j.id,
|
|
81386
|
+
name: j.name,
|
|
81387
|
+
kind: j.kind.type,
|
|
81388
|
+
parent_instance_id: j.parentInstanceId,
|
|
81389
|
+
child_instance_id: j.childInstanceId
|
|
81390
|
+
}));
|
|
81391
|
+
const documentId = registerSession(doc);
|
|
81392
|
+
const summary = {
|
|
81393
|
+
robot: robotName,
|
|
81394
|
+
parts: parts.length,
|
|
81395
|
+
joints: joints.length,
|
|
81396
|
+
instances: (doc.instances ?? []).length,
|
|
81397
|
+
ground_instance_id: doc.groundInstanceId ?? null,
|
|
81398
|
+
joint_list: joints,
|
|
81399
|
+
...floating_base ? {
|
|
81400
|
+
floating_base: {
|
|
81401
|
+
synthesized: joints.some((j) => j.kind === "Free"),
|
|
81402
|
+
spawn_height_mm: spawn_height_mm ?? 0,
|
|
81403
|
+
note: "The root link hangs off a 6-DOF Free joint; parentAnchor.z is the spawn height. The robot will fall under gravity."
|
|
81404
|
+
}
|
|
81405
|
+
} : {},
|
|
81406
|
+
...commentedFloating ? {
|
|
81407
|
+
floating_base_warning: `This URDF declares a floating joint (${commentedFloating}) inside a comment \u2014 the usual convention that the simulator supplies the free base. Imported as-is, the root link is grounded and the robot is welded to the world (it cannot walk or fall). Re-import with floating_base: true (and a spawn_height_mm just above standing height) for any locomotion task.`
|
|
81408
|
+
} : {},
|
|
81409
|
+
...meshes.inlined > 0 ? { meshes_inlined: meshes.inlined } : {},
|
|
81410
|
+
...meshes.unresolved.length > 0 ? {
|
|
81411
|
+
warning: `${meshes.unresolved.length} mesh reference(s) could not be inlined \u2014 those links use placeholder geometry. Joint topology and authored inertials are exact, so physics still behaves to first order.`,
|
|
81412
|
+
unresolved_meshes: meshes.unresolved
|
|
81413
|
+
} : {}
|
|
81414
|
+
};
|
|
81415
|
+
return {
|
|
81416
|
+
content: [
|
|
81417
|
+
{
|
|
81418
|
+
type: "text",
|
|
81419
|
+
text: JSON.stringify(
|
|
81420
|
+
{
|
|
81421
|
+
document_id: documentId,
|
|
81422
|
+
summary,
|
|
81423
|
+
note: "The robot is registered as a session document \u2014 pass document_id to create_robot_env to simulate it, render_view to see it, or any CAD tool to edit it."
|
|
81424
|
+
},
|
|
81425
|
+
null,
|
|
81426
|
+
2
|
|
81427
|
+
)
|
|
81428
|
+
}
|
|
81429
|
+
]
|
|
81430
|
+
};
|
|
81431
|
+
}
|
|
81432
|
+
var MAX_URDF_BYTES, MAX_MESH_BYTES, importUrdfSchema, toolDefs47;
|
|
81433
|
+
var init_import_urdf = __esm({
|
|
81434
|
+
"src/tools/import-urdf.ts"() {
|
|
81435
|
+
"use strict";
|
|
81436
|
+
init_safe_path();
|
|
81437
|
+
init_remote();
|
|
81438
|
+
init_session2();
|
|
81439
|
+
init_tool_def();
|
|
81440
|
+
MAX_URDF_BYTES = 8 * 1024 * 1024;
|
|
81441
|
+
MAX_MESH_BYTES = 100 * 1024 * 1024;
|
|
81442
|
+
importUrdfSchema = {
|
|
81443
|
+
type: "object",
|
|
81444
|
+
properties: {
|
|
81445
|
+
path: {
|
|
81446
|
+
type: "string",
|
|
81447
|
+
description: "Path to the .urdf file on the server filesystem, relative to the server working directory (or VCAD_MCP_EXPORT_DIR if set). Relative mesh references inside the URDF resolve against the URDF's own directory. On hosted servers pass content_base64 instead."
|
|
81448
|
+
},
|
|
81449
|
+
content_base64: {
|
|
81450
|
+
type: "string",
|
|
81451
|
+
description: "Base64-encoded URDF XML. Use instead of `path` when the server has no access to your filesystem (hosted/remote deployments). Mesh references cannot be resolved in this mode \u2014 links with meshes get placeholder geometry, but joints and inertials import exactly."
|
|
81452
|
+
},
|
|
81453
|
+
package_roots: {
|
|
81454
|
+
type: "array",
|
|
81455
|
+
items: { type: "string" },
|
|
81456
|
+
description: "Directories to search when resolving package://NAME/... mesh URIs, relative to the server working directory. Each root is checked for a NAME/ subdirectory; first match wins."
|
|
81457
|
+
},
|
|
81458
|
+
name: {
|
|
81459
|
+
type: "string",
|
|
81460
|
+
description: "Robot name (default: filename without extension)"
|
|
81461
|
+
},
|
|
81462
|
+
floating_base: {
|
|
81463
|
+
type: "boolean",
|
|
81464
|
+
description: 'Synthesize a floating (6-DOF) base when the URDF declares none. Most humanoid/quadruped URDFs ship the world link and its type="floating" joint commented out, on the convention that the simulator supplies the free base \u2014 without this the root link is grounded and the robot is welded to the world, which cannot walk or fall. Set this for any locomotion task. No-op when the URDF already has a floating joint.'
|
|
81465
|
+
},
|
|
81466
|
+
floating_base_link: {
|
|
81467
|
+
type: "string",
|
|
81468
|
+
description: "Link to attach the synthesized floating base to (default: the tree's root link, i.e. the one that is never a joint's child). Requires floating_base."
|
|
81469
|
+
},
|
|
81470
|
+
spawn_height_mm: {
|
|
81471
|
+
type: "number",
|
|
81472
|
+
description: "Initial base height in mm for the synthesized floating base (default 0). A Free joint's `state` is a scalar and meaningless for 6 DOF, so this is written as the joint's parentAnchor.z. Spawn just above the settled standing height so the robot drops onto the ground instead of starting interpenetrated (Booster K1: 620 mm against a 549.8 mm stand)."
|
|
81473
|
+
}
|
|
81474
|
+
}
|
|
81475
|
+
};
|
|
81476
|
+
toolDefs47 = [
|
|
81477
|
+
{
|
|
81478
|
+
name: "import_urdf",
|
|
81479
|
+
pack: null,
|
|
81480
|
+
description: "Import a URDF (Unified Robot Description Format) robot from a server-local file. Builds the full kinematic tree \u2014 one part per link, instances FK-placed from joint origins, joints (revolute/prismatic/fixed) with limits, and a grounded root link \u2014 ready for create_robot_env. STL mesh references are resolved against the URDF's directory and optional package_roots and inlined; unresolved meshes fall back to placeholder geometry with an explicit warning. For locomotion, pass floating_base: true \u2014 most humanoid/quadruped URDFs leave the world link and floating joint commented out, and without them the robot is welded to the world.",
|
|
81481
|
+
inputSchema: importUrdfSchema,
|
|
81482
|
+
handler: (a, c) => importUrdf(a, c.engine),
|
|
81483
|
+
behavior: behavior({ writesDoc: true, geometry: true, mount: true })
|
|
81484
|
+
}
|
|
81485
|
+
];
|
|
81486
|
+
}
|
|
81487
|
+
});
|
|
81488
|
+
|
|
81537
81489
|
// src/tools/import-pcb.ts
|
|
81538
81490
|
import { readFileSync as readFileSync9, existsSync as existsSync6, statSync as statSync4 } from "node:fs";
|
|
81539
81491
|
function importError(text) {
|
|
@@ -86951,8 +86903,8 @@ var init_server3 = __esm({
|
|
|
86951
86903
|
init_order_feed();
|
|
86952
86904
|
init_animate();
|
|
86953
86905
|
PKG_VERSION = (() => {
|
|
86954
|
-
if ("0.10.0-main.
|
|
86955
|
-
return "0.10.0-main.
|
|
86906
|
+
if ("0.10.0-main.125") {
|
|
86907
|
+
return "0.10.0-main.125";
|
|
86956
86908
|
}
|
|
86957
86909
|
try {
|
|
86958
86910
|
const req = createRequire2(import.meta.url);
|
|
@@ -86961,8 +86913,8 @@ var init_server3 = __esm({
|
|
|
86961
86913
|
return "0.0.0";
|
|
86962
86914
|
}
|
|
86963
86915
|
})();
|
|
86964
|
-
BUILD_SHA = "
|
|
86965
|
-
BUILD_TIME = "2026-10-21T13:
|
|
86916
|
+
BUILD_SHA = "0faa082d15ca8fd803090dfc416f68c12b5a3971";
|
|
86917
|
+
BUILD_TIME = "2026-10-21T13:48:35.626Z";
|
|
86966
86918
|
SHORT_SHA = BUILD_SHA === "unknown" ? "unknown" : BUILD_SHA.slice(0, 7);
|
|
86967
86919
|
VERSION_WITH_BUILD = SHORT_SHA === "unknown" ? PKG_VERSION : `${PKG_VERSION}+${SHORT_SHA}`;
|
|
86968
86920
|
INSTANCE_ID = randomUUID7().slice(0, 8);
|
|
@@ -86989,31 +86941,32 @@ var init_server3 = __esm({
|
|
|
86989
86941
|
"openai/widgetAccessible": true
|
|
86990
86942
|
};
|
|
86991
86943
|
STATIC_TOOL_DEFS = [
|
|
86992
|
-
...
|
|
86944
|
+
...toolDefs3,
|
|
86945
|
+
...toolDefs7,
|
|
86993
86946
|
...toolDefs8,
|
|
86994
86947
|
...toolDefs9,
|
|
86995
86948
|
...toolDefs10,
|
|
86996
|
-
...
|
|
86949
|
+
...toolDefs12,
|
|
86950
|
+
...toolDefs15,
|
|
86997
86951
|
...toolDefs13,
|
|
86998
|
-
...toolDefs16,
|
|
86999
86952
|
...toolDefs14,
|
|
87000
|
-
...
|
|
86953
|
+
...toolDefs16,
|
|
87001
86954
|
...toolDefs17,
|
|
86955
|
+
...toolDefs4,
|
|
86956
|
+
...toolDefs2,
|
|
87002
86957
|
...toolDefs18,
|
|
87003
86958
|
...toolDefs5,
|
|
87004
|
-
...toolDefs3,
|
|
87005
|
-
...toolDefs19,
|
|
87006
86959
|
...toolDefs6,
|
|
87007
|
-
...
|
|
86960
|
+
...toolDefs19,
|
|
87008
86961
|
...toolDefs20,
|
|
87009
86962
|
...toolDefs21,
|
|
87010
|
-
...
|
|
86963
|
+
...toolDefs24,
|
|
87011
86964
|
...toolDefs25,
|
|
87012
86965
|
...toolDefs26,
|
|
87013
86966
|
...toolDefs27,
|
|
87014
86967
|
...toolDefs28,
|
|
86968
|
+
...toolDefs11,
|
|
87015
86969
|
...toolDefs29,
|
|
87016
|
-
...toolDefs12,
|
|
87017
86970
|
...toolDefs30,
|
|
87018
86971
|
...toolDefs31,
|
|
87019
86972
|
...toolDefs32,
|
|
@@ -87026,22 +86979,21 @@ var init_server3 = __esm({
|
|
|
87026
86979
|
...toolDefs39,
|
|
87027
86980
|
...toolDefs40,
|
|
87028
86981
|
...toolDefs41,
|
|
87029
|
-
...toolDefs42,
|
|
87030
86982
|
...toolDefs,
|
|
86983
|
+
...toolDefs42,
|
|
87031
86984
|
...toolDefs43,
|
|
87032
86985
|
...toolDefs44,
|
|
87033
86986
|
...toolDefs45,
|
|
87034
86987
|
...toolDefs46,
|
|
87035
86988
|
...toolDefs47,
|
|
87036
|
-
...toolDefs2,
|
|
87037
86989
|
...toolDefs48,
|
|
87038
86990
|
...toolDefs49,
|
|
87039
86991
|
...toolDefs50,
|
|
87040
86992
|
...toolDefs51,
|
|
87041
86993
|
...toolDefs52,
|
|
87042
86994
|
...toolDefs53,
|
|
87043
|
-
...toolDefs24,
|
|
87044
86995
|
...toolDefs23,
|
|
86996
|
+
...toolDefs22,
|
|
87045
86997
|
...toolDefs54,
|
|
87046
86998
|
...toolDefs55,
|
|
87047
86999
|
...toolDefs56
|