@vcad/mcp 0.10.0-main.124 → 0.10.0-main.126
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 +428 -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,30 @@ var init_CHANGELOG = __esm({
|
|
|
41354
41371
|
"render"
|
|
41355
41372
|
]
|
|
41356
41373
|
},
|
|
41374
|
+
{
|
|
41375
|
+
id: "2026-10-21-mac-sim-teardown-race",
|
|
41376
|
+
version: "0.10.0",
|
|
41377
|
+
date: "2026-10-21",
|
|
41378
|
+
category: "fix",
|
|
41379
|
+
title: "Stopping a simulation no longer leaves a stale frame",
|
|
41380
|
+
summary: "In the Mac app, a physics frame already in flight when the simulation was torn down could repopulate its state; such frames are now dropped.",
|
|
41381
|
+
features: [
|
|
41382
|
+
"simulation",
|
|
41383
|
+
"mac"
|
|
41384
|
+
]
|
|
41385
|
+
},
|
|
41386
|
+
{
|
|
41387
|
+
id: "2026-10-21-mac-open-vcode",
|
|
41388
|
+
version: "0.10.0",
|
|
41389
|
+
date: "2026-10-21",
|
|
41390
|
+
category: "fix",
|
|
41391
|
+
title: "Mac app opens compact-format .vcad files",
|
|
41392
|
+
summary: "The native Mac app now opens .vcad files in the compact text and loon formats, not just JSON, including the Sensor Mast example.",
|
|
41393
|
+
features: [
|
|
41394
|
+
"desktop",
|
|
41395
|
+
"file-io"
|
|
41396
|
+
]
|
|
41397
|
+
},
|
|
41357
41398
|
{
|
|
41358
41399
|
id: "2026-10-21-mac-app-updates",
|
|
41359
41400
|
version: "0.10.0",
|
|
@@ -51203,302 +51244,9 @@ var init_remote = __esm({
|
|
|
51203
51244
|
}
|
|
51204
51245
|
});
|
|
51205
51246
|
|
|
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
51247
|
// src/tools/loon-assets.ts
|
|
51500
|
-
import { existsSync as
|
|
51501
|
-
import { isAbsolute as
|
|
51248
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, statSync } from "node:fs";
|
|
51249
|
+
import { isAbsolute as isAbsolute2, normalize } from "node:path";
|
|
51502
51250
|
function key(p) {
|
|
51503
51251
|
return normalize(p).replace(/\\/g, "/").replace(/^\.\//, "");
|
|
51504
51252
|
}
|
|
@@ -51517,20 +51265,22 @@ function readAsset(path, { files, base_dir }) {
|
|
|
51517
51265
|
}
|
|
51518
51266
|
let file;
|
|
51519
51267
|
try {
|
|
51520
|
-
file =
|
|
51268
|
+
file = isAbsolute2(path) ? path : resolveWithinRoot(path, base_dir ?? process.cwd());
|
|
51521
51269
|
} catch (e) {
|
|
51522
51270
|
return { reason: e.message };
|
|
51523
51271
|
}
|
|
51524
|
-
if (!
|
|
51272
|
+
if (!existsSync2(file) || !statSync(file).isFile()) {
|
|
51525
51273
|
return {
|
|
51526
|
-
reason: base_dir ||
|
|
51274
|
+
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
51275
|
};
|
|
51528
51276
|
}
|
|
51529
|
-
if (
|
|
51530
|
-
return { bytes:
|
|
51277
|
+
if (statSync(file).size > MAX_ASSET_BYTES) return { reason: "file exceeds size limit" };
|
|
51278
|
+
return { bytes: readFileSync2(file) };
|
|
51531
51279
|
}
|
|
51532
51280
|
function resolveLoonAssets(doc, sources, engine) {
|
|
51533
51281
|
const report = { meshes: 0, steps: 0, unresolved: [] };
|
|
51282
|
+
const meshes = /* @__PURE__ */ new Map();
|
|
51283
|
+
const refs = /* @__PURE__ */ new Map();
|
|
51534
51284
|
for (const [id, node] of Object.entries(doc.nodes)) {
|
|
51535
51285
|
const op = node.op;
|
|
51536
51286
|
const isMesh = op.type === "mesh_import" || op.type === "MeshImport";
|
|
@@ -51561,21 +51311,12 @@ function resolveLoonAssets(doc, sources, engine) {
|
|
|
51561
51311
|
report.unresolved.push({ path, reason: "unsupported mesh format (STL only)" });
|
|
51562
51312
|
continue;
|
|
51563
51313
|
}
|
|
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++;
|
|
51314
|
+
meshes.set(id, got.bytes);
|
|
51315
|
+
refs.set(id, path);
|
|
51578
51316
|
}
|
|
51317
|
+
const { inlined, errors } = engine.inlineMeshImports(doc, meshes);
|
|
51318
|
+
report.meshes += inlined;
|
|
51319
|
+
for (const [id, reason] of errors) report.unresolved.push({ path: refs.get(id) ?? id, reason });
|
|
51579
51320
|
return report;
|
|
51580
51321
|
}
|
|
51581
51322
|
function hasFile({ files }, path) {
|
|
@@ -51592,7 +51333,6 @@ var MAX_ASSET_BYTES;
|
|
|
51592
51333
|
var init_loon_assets = __esm({
|
|
51593
51334
|
"src/tools/loon-assets.ts"() {
|
|
51594
51335
|
"use strict";
|
|
51595
|
-
init_import_urdf();
|
|
51596
51336
|
init_remote();
|
|
51597
51337
|
init_safe_path();
|
|
51598
51338
|
MAX_ASSET_BYTES = 100 * 1024 * 1024;
|
|
@@ -51601,7 +51341,7 @@ var init_loon_assets = __esm({
|
|
|
51601
51341
|
|
|
51602
51342
|
// src/tools/source-provenance.ts
|
|
51603
51343
|
import { createHash } from "node:crypto";
|
|
51604
|
-
import { readFileSync as
|
|
51344
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
51605
51345
|
function sourceHash(text) {
|
|
51606
51346
|
return createHash("sha256").update(text, "utf8").digest("hex");
|
|
51607
51347
|
}
|
|
@@ -51635,7 +51375,7 @@ function sourceStatus(doc) {
|
|
|
51635
51375
|
if (path) {
|
|
51636
51376
|
let onDisk = null;
|
|
51637
51377
|
try {
|
|
51638
|
-
onDisk =
|
|
51378
|
+
onDisk = readFileSync3(path, "utf8");
|
|
51639
51379
|
} catch {
|
|
51640
51380
|
return {
|
|
51641
51381
|
source_stale: true,
|
|
@@ -51671,8 +51411,8 @@ var init_source_provenance = __esm({
|
|
|
51671
51411
|
});
|
|
51672
51412
|
|
|
51673
51413
|
// src/tools/loon.ts
|
|
51674
|
-
import { readFileSync as
|
|
51675
|
-
import { delimiter, isAbsolute as
|
|
51414
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
51415
|
+
import { delimiter, isAbsolute as isAbsolute3, join as join2, resolve as resolve2, sep as sep2 } from "node:path";
|
|
51676
51416
|
function composeLoonProgram(input) {
|
|
51677
51417
|
const { source, use_loons, loons } = input;
|
|
51678
51418
|
const names = [
|
|
@@ -51691,13 +51431,13 @@ function importedNames(source) {
|
|
|
51691
51431
|
return names;
|
|
51692
51432
|
}
|
|
51693
51433
|
function readModule(base, name) {
|
|
51694
|
-
if (
|
|
51695
|
-
const root =
|
|
51434
|
+
if (isAbsolute3(name) || name.split(".").includes("..")) return null;
|
|
51435
|
+
const root = resolve2(base);
|
|
51696
51436
|
for (const ext of [".loon", ".oo"]) {
|
|
51697
|
-
const file =
|
|
51698
|
-
if (file !== root && !file.startsWith(root +
|
|
51437
|
+
const file = resolve2(join2(root, ...name.split(".")) + ext);
|
|
51438
|
+
if (file !== root && !file.startsWith(root + sep2)) continue;
|
|
51699
51439
|
try {
|
|
51700
|
-
return
|
|
51440
|
+
return readFileSync4(file, "utf8");
|
|
51701
51441
|
} catch {
|
|
51702
51442
|
}
|
|
51703
51443
|
}
|
|
@@ -51832,7 +51572,7 @@ function parametricNote(source, modules, engine, doc) {
|
|
|
51832
51572
|
for (const w of warnings) lines.push(`- ${w}`);
|
|
51833
51573
|
return lines.join("\n");
|
|
51834
51574
|
}
|
|
51835
|
-
var createCadLoonSchema,
|
|
51575
|
+
var createCadLoonSchema, toolDefs2;
|
|
51836
51576
|
var init_loon = __esm({
|
|
51837
51577
|
"src/tools/loon.ts"() {
|
|
51838
51578
|
"use strict";
|
|
@@ -51895,7 +51635,7 @@ var init_loon = __esm({
|
|
|
51895
51635
|
},
|
|
51896
51636
|
required: ["source"]
|
|
51897
51637
|
};
|
|
51898
|
-
|
|
51638
|
+
toolDefs2 = [
|
|
51899
51639
|
{
|
|
51900
51640
|
name: "create_cad_loon",
|
|
51901
51641
|
pack: null,
|
|
@@ -52790,8 +52530,8 @@ var init_artifact_store = __esm({
|
|
|
52790
52530
|
});
|
|
52791
52531
|
|
|
52792
52532
|
// src/tools/session.ts
|
|
52793
|
-
import { writeFileSync as writeFileSync2, readFileSync as
|
|
52794
|
-
import { dirname
|
|
52533
|
+
import { writeFileSync as writeFileSync2, readFileSync as readFileSync5 } from "node:fs";
|
|
52534
|
+
import { dirname, resolve as resolve3 } from "node:path";
|
|
52795
52535
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
52796
52536
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
52797
52537
|
function durabilityWarning() {
|
|
@@ -53008,7 +52748,7 @@ async function loadDocument(args, store, engine) {
|
|
|
53008
52748
|
const path2 = resolveWithinRoot(`${name}.vcad`, root);
|
|
53009
52749
|
let raw;
|
|
53010
52750
|
try {
|
|
53011
|
-
raw =
|
|
52751
|
+
raw = readFileSync5(path2, "utf8");
|
|
53012
52752
|
} catch {
|
|
53013
52753
|
return {
|
|
53014
52754
|
isError: true,
|
|
@@ -53067,10 +52807,10 @@ async function loadDocumentFromPath(path, store, engine) {
|
|
|
53067
52807
|
"`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
52808
|
);
|
|
53069
52809
|
}
|
|
53070
|
-
const abs =
|
|
52810
|
+
const abs = resolve3(path);
|
|
53071
52811
|
let raw;
|
|
53072
52812
|
try {
|
|
53073
|
-
raw =
|
|
52813
|
+
raw = readFileSync5(abs, "utf8");
|
|
53074
52814
|
} catch {
|
|
53075
52815
|
return fail2(`Cannot read ${abs} \u2014 no such file, or it is not readable.`);
|
|
53076
52816
|
}
|
|
@@ -53101,7 +52841,7 @@ async function loadDocumentFromPath(path, store, engine) {
|
|
|
53101
52841
|
"Loon evaluation is unavailable in this server build \u2014 load a .vcad document instead."
|
|
53102
52842
|
);
|
|
53103
52843
|
}
|
|
53104
|
-
const baseDir =
|
|
52844
|
+
const baseDir = dirname(abs);
|
|
53105
52845
|
const modules = composeLoonModules({ source: raw, base_dir: baseDir });
|
|
53106
52846
|
let doc;
|
|
53107
52847
|
try {
|
|
@@ -53144,7 +52884,7 @@ function openSavedSnapshot(snapshot2, name) {
|
|
|
53144
52884
|
parts: copy.roots?.length ?? 0
|
|
53145
52885
|
};
|
|
53146
52886
|
}
|
|
53147
|
-
var sessionScope, openDocumentSchema, getDocumentSchema, closeDocumentSchema, saveDocumentSchema, loadDocumentSchema,
|
|
52887
|
+
var sessionScope, openDocumentSchema, getDocumentSchema, closeDocumentSchema, saveDocumentSchema, loadDocumentSchema, toolDefs3;
|
|
53148
52888
|
var init_session2 = __esm({
|
|
53149
52889
|
"src/tools/session.ts"() {
|
|
53150
52890
|
"use strict";
|
|
@@ -53219,7 +52959,7 @@ var init_session2 = __esm({
|
|
|
53219
52959
|
}
|
|
53220
52960
|
}
|
|
53221
52961
|
};
|
|
53222
|
-
|
|
52962
|
+
toolDefs3 = [
|
|
53223
52963
|
{
|
|
53224
52964
|
name: "open_document",
|
|
53225
52965
|
pack: null,
|
|
@@ -53776,7 +53516,7 @@ function getPreviewVersion(doc, docId) {
|
|
|
53776
53516
|
]
|
|
53777
53517
|
};
|
|
53778
53518
|
}
|
|
53779
|
-
var GLB_CACHE_MAX, glbCache, PREVIEW_MAX_BASE64, DECIMATE_GRIDS, getPreviewGlbSchema, getPreviewVersionSchema,
|
|
53519
|
+
var GLB_CACHE_MAX, glbCache, PREVIEW_MAX_BASE64, DECIMATE_GRIDS, getPreviewGlbSchema, getPreviewVersionSchema, toolDefs4;
|
|
53780
53520
|
var init_preview = __esm({
|
|
53781
53521
|
"src/tools/preview.ts"() {
|
|
53782
53522
|
"use strict";
|
|
@@ -53813,7 +53553,7 @@ var init_preview = __esm({
|
|
|
53813
53553
|
},
|
|
53814
53554
|
required: ["document_id"]
|
|
53815
53555
|
};
|
|
53816
|
-
|
|
53556
|
+
toolDefs4 = [
|
|
53817
53557
|
{
|
|
53818
53558
|
name: "get_preview_glb",
|
|
53819
53559
|
pack: null,
|
|
@@ -54643,7 +54383,7 @@ function inspectCad(input, engine) {
|
|
|
54643
54383
|
]
|
|
54644
54384
|
};
|
|
54645
54385
|
}
|
|
54646
|
-
var inspectCadSchema,
|
|
54386
|
+
var inspectCadSchema, toolDefs5;
|
|
54647
54387
|
var init_inspect = __esm({
|
|
54648
54388
|
"src/tools/inspect.ts"() {
|
|
54649
54389
|
"use strict";
|
|
@@ -54666,7 +54406,7 @@ var init_inspect = __esm({
|
|
|
54666
54406
|
joint_state: jointStateSchemaProp
|
|
54667
54407
|
}
|
|
54668
54408
|
};
|
|
54669
|
-
|
|
54409
|
+
toolDefs5 = [
|
|
54670
54410
|
{
|
|
54671
54411
|
name: "inspect_cad",
|
|
54672
54412
|
pack: null,
|
|
@@ -55167,7 +54907,7 @@ function err(text) {
|
|
|
55167
54907
|
isError: true
|
|
55168
54908
|
};
|
|
55169
54909
|
}
|
|
55170
|
-
var r6, point, findPart, MeasureError, measureSchema,
|
|
54910
|
+
var r6, point, findPart, MeasureError, measureSchema, toolDefs6;
|
|
55171
54911
|
var init_measure = __esm({
|
|
55172
54912
|
"src/tools/measure.ts"() {
|
|
55173
54913
|
"use strict";
|
|
@@ -55203,7 +54943,7 @@ var init_measure = __esm({
|
|
|
55203
54943
|
},
|
|
55204
54944
|
required: ["document_id", "part_ids"]
|
|
55205
54945
|
};
|
|
55206
|
-
|
|
54946
|
+
toolDefs6 = [
|
|
55207
54947
|
{
|
|
55208
54948
|
name: "measure",
|
|
55209
54949
|
pack: null,
|
|
@@ -57879,7 +57619,7 @@ function applyEdits(args, engine) {
|
|
|
57879
57619
|
}
|
|
57880
57620
|
return result;
|
|
57881
57621
|
}
|
|
57882
|
-
var ALLOWED_OPS, MAX_BATCH_OPS, applyEditsSchema, BatchOpError, SYMBOLIC_REF,
|
|
57622
|
+
var ALLOWED_OPS, MAX_BATCH_OPS, applyEditsSchema, BatchOpError, SYMBOLIC_REF, toolDefs7;
|
|
57883
57623
|
var init_batch_edit = __esm({
|
|
57884
57624
|
"src/tools/batch-edit.ts"() {
|
|
57885
57625
|
"use strict";
|
|
@@ -57922,7 +57662,7 @@ var init_batch_edit = __esm({
|
|
|
57922
57662
|
cause;
|
|
57923
57663
|
};
|
|
57924
57664
|
SYMBOLIC_REF = /^@(\d+)$/;
|
|
57925
|
-
|
|
57665
|
+
toolDefs7 = [
|
|
57926
57666
|
{
|
|
57927
57667
|
name: "apply_edits",
|
|
57928
57668
|
pack: null,
|
|
@@ -58036,7 +57776,7 @@ async function branchFrom(args, store) {
|
|
|
58036
57776
|
hint: "Forked into a new session. Continue here, or branch_from the same checkpoint again to try another variant."
|
|
58037
57777
|
});
|
|
58038
57778
|
}
|
|
58039
|
-
var nextCheckpoint, checkpointDocumentSchema, branchFromSchema,
|
|
57779
|
+
var nextCheckpoint, checkpointDocumentSchema, branchFromSchema, toolDefs8;
|
|
58040
57780
|
var init_checkpoint = __esm({
|
|
58041
57781
|
"src/tools/checkpoint.ts"() {
|
|
58042
57782
|
"use strict";
|
|
@@ -58072,7 +57812,7 @@ var init_checkpoint = __esm({
|
|
|
58072
57812
|
},
|
|
58073
57813
|
required: ["checkpoint_id"]
|
|
58074
57814
|
};
|
|
58075
|
-
|
|
57815
|
+
toolDefs8 = [
|
|
58076
57816
|
{
|
|
58077
57817
|
name: "checkpoint_document",
|
|
58078
57818
|
pack: null,
|
|
@@ -58193,7 +57933,7 @@ async function continueDocument(args, store) {
|
|
|
58193
57933
|
}
|
|
58194
57934
|
return ok2(registerSession(doc), doc, "Shared part");
|
|
58195
57935
|
}
|
|
58196
|
-
var continueDocumentSchema,
|
|
57936
|
+
var continueDocumentSchema, toolDefs9;
|
|
58197
57937
|
var init_continue_doc = __esm({
|
|
58198
57938
|
"src/tools/continue-doc.ts"() {
|
|
58199
57939
|
"use strict";
|
|
@@ -58216,7 +57956,7 @@ var init_continue_doc = __esm({
|
|
|
58216
57956
|
}
|
|
58217
57957
|
}
|
|
58218
57958
|
};
|
|
58219
|
-
|
|
57959
|
+
toolDefs9 = [
|
|
58220
57960
|
{
|
|
58221
57961
|
name: "continue_document",
|
|
58222
57962
|
pack: null,
|
|
@@ -59394,7 +59134,7 @@ async function listOrders(input, store, user) {
|
|
|
59394
59134
|
}))
|
|
59395
59135
|
});
|
|
59396
59136
|
}
|
|
59397
|
-
var QUOTE_TTL_MS, quoteManufacturingSchema, SCS_ALLOY_LABELS, toUsd, getOrderStatusSchema, listOrdersSchema,
|
|
59137
|
+
var QUOTE_TTL_MS, quoteManufacturingSchema, SCS_ALLOY_LABELS, toUsd, getOrderStatusSchema, listOrdersSchema, toolDefs10;
|
|
59398
59138
|
var init_order = __esm({
|
|
59399
59139
|
"src/tools/order.ts"() {
|
|
59400
59140
|
"use strict";
|
|
@@ -59485,7 +59225,7 @@ var init_order = __esm({
|
|
|
59485
59225
|
},
|
|
59486
59226
|
required: []
|
|
59487
59227
|
};
|
|
59488
|
-
|
|
59228
|
+
toolDefs10 = [
|
|
59489
59229
|
{
|
|
59490
59230
|
name: "quote_manufacturing",
|
|
59491
59231
|
pack: "fabricate",
|
|
@@ -60406,7 +60146,7 @@ function err3(text) {
|
|
|
60406
60146
|
isError: true
|
|
60407
60147
|
};
|
|
60408
60148
|
}
|
|
60409
|
-
var CLEARANCE_CLAIM_PREFIX, MECH_DOMAIN2, CLEARANCE_ORACLE, STALE_EPS_MM, CONTACT_EPS_MM, checkClearanceSchema, pairKey,
|
|
60149
|
+
var CLEARANCE_CLAIM_PREFIX, MECH_DOMAIN2, CLEARANCE_ORACLE, STALE_EPS_MM, CONTACT_EPS_MM, checkClearanceSchema, pairKey, toolDefs11;
|
|
60410
60150
|
var init_clearance = __esm({
|
|
60411
60151
|
"src/tools/clearance.ts"() {
|
|
60412
60152
|
"use strict";
|
|
@@ -60481,7 +60221,7 @@ var init_clearance = __esm({
|
|
|
60481
60221
|
required: ["document_id"]
|
|
60482
60222
|
};
|
|
60483
60223
|
pairKey = (a, b) => a < b ? `${a}\0${b}` : `${b}\0${a}`;
|
|
60484
|
-
|
|
60224
|
+
toolDefs11 = [
|
|
60485
60225
|
{
|
|
60486
60226
|
name: "check_clearance",
|
|
60487
60227
|
pack: null,
|
|
@@ -60809,7 +60549,7 @@ async function placeOrder(input, store, eventStore, user, engine, sessionStore)
|
|
|
60809
60549
|
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
60550
|
});
|
|
60811
60551
|
}
|
|
60812
|
-
var DISABLED_MSG, AUTHZ_TTL_MS, toUsd2, usd, authorizeSpendSchema, placeOrderSchema,
|
|
60552
|
+
var DISABLED_MSG, AUTHZ_TTL_MS, toUsd2, usd, authorizeSpendSchema, placeOrderSchema, toolDefs12;
|
|
60813
60553
|
var init_ordering = __esm({
|
|
60814
60554
|
"src/tools/ordering.ts"() {
|
|
60815
60555
|
"use strict";
|
|
@@ -60855,7 +60595,7 @@ var init_ordering = __esm({
|
|
|
60855
60595
|
},
|
|
60856
60596
|
required: ["order_id", "authorization_id"]
|
|
60857
60597
|
};
|
|
60858
|
-
|
|
60598
|
+
toolDefs12 = [
|
|
60859
60599
|
{
|
|
60860
60600
|
name: "authorize_spend",
|
|
60861
60601
|
pack: "fabricate",
|
|
@@ -61002,7 +60742,7 @@ function searchMechanicalParts(input) {
|
|
|
61002
60742
|
]
|
|
61003
60743
|
};
|
|
61004
60744
|
}
|
|
61005
|
-
var MECH_PART_TYPES, PRICE_DISCLAIMER, cachedParts, searchMechanicalPartsSchema, num, normThread,
|
|
60745
|
+
var MECH_PART_TYPES, PRICE_DISCLAIMER, cachedParts, searchMechanicalPartsSchema, num, normThread, toolDefs13;
|
|
61006
60746
|
var init_mech_parts = __esm({
|
|
61007
60747
|
"src/tools/mech-parts.ts"() {
|
|
61008
60748
|
"use strict";
|
|
@@ -61055,7 +60795,7 @@ var init_mech_parts = __esm({
|
|
|
61055
60795
|
};
|
|
61056
60796
|
num = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
61057
60797
|
normThread = (t2) => t2.trim().toUpperCase().replace(/\s+/g, "");
|
|
61058
|
-
|
|
60798
|
+
toolDefs13 = [
|
|
61059
60799
|
{
|
|
61060
60800
|
name: "search_mechanical_parts",
|
|
61061
60801
|
pack: "bom",
|
|
@@ -61324,7 +61064,7 @@ async function bomCheckStock(args, ctx) {
|
|
|
61324
61064
|
const payload = { ...report, note: STOCK_NOTE };
|
|
61325
61065
|
return { content: [{ type: "text", text: JSON.stringify(payload) }], structuredContent: payload };
|
|
61326
61066
|
}
|
|
61327
|
-
var dbCache, LCSC_RE, JLC_SEARCH_URL, LCSC_DETAIL_URL, UA, PartStockClient, BASES, sharedClient, STOCK_NOTE, checkPartStockSchema, bomCheckStockSchema, bomResolver,
|
|
61067
|
+
var dbCache, LCSC_RE, JLC_SEARCH_URL, LCSC_DETAIL_URL, UA, PartStockClient, BASES, sharedClient, STOCK_NOTE, checkPartStockSchema, bomCheckStockSchema, bomResolver, toolDefs14;
|
|
61328
61068
|
var init_part_stock = __esm({
|
|
61329
61069
|
"src/tools/part-stock.ts"() {
|
|
61330
61070
|
"use strict";
|
|
@@ -61569,7 +61309,7 @@ var init_part_stock = __esm({
|
|
|
61569
61309
|
}
|
|
61570
61310
|
};
|
|
61571
61311
|
bomResolver = null;
|
|
61572
|
-
|
|
61312
|
+
toolDefs14 = [
|
|
61573
61313
|
{
|
|
61574
61314
|
name: "check_part_stock",
|
|
61575
61315
|
pack: "bom",
|
|
@@ -62016,7 +61756,7 @@ function renderCsv(bom) {
|
|
|
62016
61756
|
}
|
|
62017
61757
|
return rows.join("\r\n") + "\r\n";
|
|
62018
61758
|
}
|
|
62019
|
-
var PRICING_NOTE, memBoms, bomKey, toUsd3, usdToMinor, fmtUsd, BOM_ORACLE, str, lineProperties, bomCreateSchema, bomAddLineSchema, bomExportSchema, md, csv,
|
|
61759
|
+
var PRICING_NOTE, memBoms, bomKey, toUsd3, usdToMinor, fmtUsd, BOM_ORACLE, str, lineProperties, bomCreateSchema, bomAddLineSchema, bomExportSchema, md, csv, toolDefs15;
|
|
62020
61760
|
var init_bom = __esm({
|
|
62021
61761
|
"src/tools/bom.ts"() {
|
|
62022
61762
|
"use strict";
|
|
@@ -62136,7 +61876,7 @@ var init_bom = __esm({
|
|
|
62136
61876
|
const s = String(v);
|
|
62137
61877
|
return /[",\r\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s;
|
|
62138
61878
|
};
|
|
62139
|
-
|
|
61879
|
+
toolDefs15 = [
|
|
62140
61880
|
{
|
|
62141
61881
|
name: "bom_create",
|
|
62142
61882
|
pack: "bom",
|
|
@@ -62199,7 +61939,7 @@ async function unshareSession(input, store) {
|
|
|
62199
61939
|
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
61940
|
});
|
|
62201
61941
|
}
|
|
62202
|
-
var DISABLED, shareSessionSchema, unshareSessionSchema,
|
|
61942
|
+
var DISABLED, shareSessionSchema, unshareSessionSchema, toolDefs16;
|
|
62203
61943
|
var init_live_share = __esm({
|
|
62204
61944
|
"src/tools/live-share.ts"() {
|
|
62205
61945
|
"use strict";
|
|
@@ -62227,7 +61967,7 @@ var init_live_share = __esm({
|
|
|
62227
61967
|
},
|
|
62228
61968
|
required: ["document_id"]
|
|
62229
61969
|
};
|
|
62230
|
-
|
|
61970
|
+
toolDefs16 = [
|
|
62231
61971
|
{
|
|
62232
61972
|
name: "share_session",
|
|
62233
61973
|
pack: null,
|
|
@@ -62334,7 +62074,7 @@ function placePartTool(args, engine) {
|
|
|
62334
62074
|
]
|
|
62335
62075
|
};
|
|
62336
62076
|
}
|
|
62337
|
-
var searchPartsSchema, placePartSchema,
|
|
62077
|
+
var searchPartsSchema, placePartSchema, toolDefs17;
|
|
62338
62078
|
var init_parts2 = __esm({
|
|
62339
62079
|
"src/tools/parts.ts"() {
|
|
62340
62080
|
"use strict";
|
|
@@ -62391,7 +62131,7 @@ var init_parts2 = __esm({
|
|
|
62391
62131
|
},
|
|
62392
62132
|
required: ["document_id", "path"]
|
|
62393
62133
|
};
|
|
62394
|
-
|
|
62134
|
+
toolDefs17 = [
|
|
62395
62135
|
{
|
|
62396
62136
|
name: "search_parts",
|
|
62397
62137
|
pack: null,
|
|
@@ -62549,7 +62289,7 @@ function exportCad(input, engine) {
|
|
|
62549
62289
|
...scene.instances && scene.instances.length > 0 ? { instances: scene.instances.length } : {}
|
|
62550
62290
|
});
|
|
62551
62291
|
}
|
|
62552
|
-
var exportCadSchema,
|
|
62292
|
+
var exportCadSchema, toolDefs18;
|
|
62553
62293
|
var init_export = __esm({
|
|
62554
62294
|
"src/tools/export.ts"() {
|
|
62555
62295
|
"use strict";
|
|
@@ -62585,7 +62325,7 @@ var init_export = __esm({
|
|
|
62585
62325
|
},
|
|
62586
62326
|
required: ["filename"]
|
|
62587
62327
|
};
|
|
62588
|
-
|
|
62328
|
+
toolDefs18 = [
|
|
62589
62329
|
{
|
|
62590
62330
|
name: "export_cad",
|
|
62591
62331
|
pack: null,
|
|
@@ -62826,7 +62566,7 @@ function err5(text) {
|
|
|
62826
62566
|
isError: true
|
|
62827
62567
|
};
|
|
62828
62568
|
}
|
|
62829
|
-
var MAX_STEPS_PER_SIDE, JointRangeError, key2, Lattice, checkJointRangeSchema,
|
|
62569
|
+
var MAX_STEPS_PER_SIDE, JointRangeError, key2, Lattice, checkJointRangeSchema, toolDefs19;
|
|
62830
62570
|
var init_joint_range = __esm({
|
|
62831
62571
|
"src/tools/joint-range.ts"() {
|
|
62832
62572
|
"use strict";
|
|
@@ -62924,7 +62664,7 @@ var init_joint_range = __esm({
|
|
|
62924
62664
|
},
|
|
62925
62665
|
required: ["document_id"]
|
|
62926
62666
|
};
|
|
62927
|
-
|
|
62667
|
+
toolDefs19 = [
|
|
62928
62668
|
{
|
|
62929
62669
|
name: "check_joint_range",
|
|
62930
62670
|
pack: null,
|
|
@@ -63207,7 +62947,7 @@ function measureOuterDiameter(args, engine) {
|
|
|
63207
62947
|
structuredContent: { outer_diameter: body, document_id: documentId }
|
|
63208
62948
|
};
|
|
63209
62949
|
}
|
|
63210
|
-
var DEFAULT_LIMIT, r62, vec, ACCURACY_NOTE, inspectFacesSchema, outerDiameterSchema,
|
|
62950
|
+
var DEFAULT_LIMIT, r62, vec, ACCURACY_NOTE, inspectFacesSchema, outerDiameterSchema, toolDefs20;
|
|
63211
62951
|
var init_faces = __esm({
|
|
63212
62952
|
"src/tools/faces.ts"() {
|
|
63213
62953
|
"use strict";
|
|
@@ -63289,7 +63029,7 @@ var init_faces = __esm({
|
|
|
63289
63029
|
},
|
|
63290
63030
|
required: ["document_id"]
|
|
63291
63031
|
};
|
|
63292
|
-
|
|
63032
|
+
toolDefs20 = [
|
|
63293
63033
|
{
|
|
63294
63034
|
name: "inspect_faces",
|
|
63295
63035
|
pack: null,
|
|
@@ -63470,7 +63210,7 @@ function sensitivity(input, engine) {
|
|
|
63470
63210
|
claims: report.claims
|
|
63471
63211
|
});
|
|
63472
63212
|
}
|
|
63473
|
-
var listParametersSchema, setParametersSchema, parameterGradientSchema, sensitivitySchema,
|
|
63213
|
+
var listParametersSchema, setParametersSchema, parameterGradientSchema, sensitivitySchema, toolDefs21;
|
|
63474
63214
|
var init_parameters = __esm({
|
|
63475
63215
|
"src/tools/parameters.ts"() {
|
|
63476
63216
|
"use strict";
|
|
@@ -63568,7 +63308,7 @@ var init_parameters = __esm({
|
|
|
63568
63308
|
},
|
|
63569
63309
|
required: []
|
|
63570
63310
|
};
|
|
63571
|
-
|
|
63311
|
+
toolDefs21 = [
|
|
63572
63312
|
{
|
|
63573
63313
|
name: "list_parameters",
|
|
63574
63314
|
pack: null,
|
|
@@ -64110,7 +63850,7 @@ function err7(text) {
|
|
|
64110
63850
|
isError: true
|
|
64111
63851
|
};
|
|
64112
63852
|
}
|
|
64113
|
-
var vec3Schema, checkEnclosureFitSchema,
|
|
63853
|
+
var vec3Schema, checkEnclosureFitSchema, toolDefs22;
|
|
64114
63854
|
var init_enclosure = __esm({
|
|
64115
63855
|
"src/tools/enclosure.ts"() {
|
|
64116
63856
|
"use strict";
|
|
@@ -64170,7 +63910,7 @@ var init_enclosure = __esm({
|
|
|
64170
63910
|
},
|
|
64171
63911
|
required: ["document_id", "enclosure_document_id"]
|
|
64172
63912
|
};
|
|
64173
|
-
|
|
63913
|
+
toolDefs22 = [
|
|
64174
63914
|
{
|
|
64175
63915
|
name: "check_enclosure_fit",
|
|
64176
63916
|
pack: "ecad",
|
|
@@ -64186,12 +63926,12 @@ var init_enclosure = __esm({
|
|
|
64186
63926
|
// src/wasm/ecad-diff.ts
|
|
64187
63927
|
import { createRequire } from "node:module";
|
|
64188
63928
|
import { fileURLToPath } from "node:url";
|
|
64189
|
-
import { dirname as
|
|
63929
|
+
import { dirname as dirname2, resolve as resolve4 } from "node:path";
|
|
64190
63930
|
function load() {
|
|
64191
63931
|
if (cached2 !== void 0) return cached2;
|
|
64192
63932
|
try {
|
|
64193
|
-
const here =
|
|
64194
|
-
const pkg =
|
|
63933
|
+
const here = dirname2(fileURLToPath(import.meta.url));
|
|
63934
|
+
const pkg = resolve4(here, "../../../../crates/vcad-ecad-diff-wasm/pkg/vcad_ecad_diff_wasm.js");
|
|
64195
63935
|
const req = createRequire(import.meta.url);
|
|
64196
63936
|
cached2 = req(pkg);
|
|
64197
63937
|
} catch {
|
|
@@ -72809,7 +72549,7 @@ async function fixDrc(args, toolCtx) {
|
|
|
72809
72549
|
};
|
|
72810
72550
|
return { content: [{ type: "text", text: JSON.stringify(payload) }] };
|
|
72811
72551
|
}
|
|
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,
|
|
72552
|
+
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
72553
|
var init_ecad2 = __esm({
|
|
72814
72554
|
"src/tools/ecad.ts"() {
|
|
72815
72555
|
"use strict";
|
|
@@ -74561,7 +74301,7 @@ var init_ecad2 = __esm({
|
|
|
74561
74301
|
},
|
|
74562
74302
|
required: ["document_id"]
|
|
74563
74303
|
};
|
|
74564
|
-
|
|
74304
|
+
toolDefs23 = [
|
|
74565
74305
|
{
|
|
74566
74306
|
name: "create_schematic",
|
|
74567
74307
|
pack: "ecad",
|
|
@@ -75239,7 +74979,7 @@ async function solveConstraints(args) {
|
|
|
75239
74979
|
}
|
|
75240
74980
|
return solveAndReport(ctx.doc, ctx.documentId);
|
|
75241
74981
|
}
|
|
75242
|
-
var anchorDescription, addConstraintSchema, deleteConstraintSchema, listConstraintsSchema, solveConstraintsSchema,
|
|
74982
|
+
var anchorDescription, addConstraintSchema, deleteConstraintSchema, listConstraintsSchema, solveConstraintsSchema, toolDefs24;
|
|
75243
74983
|
var init_design_constraints = __esm({
|
|
75244
74984
|
"src/tools/design-constraints.ts"() {
|
|
75245
74985
|
"use strict";
|
|
@@ -75284,7 +75024,7 @@ var init_design_constraints = __esm({
|
|
|
75284
75024
|
},
|
|
75285
75025
|
required: ["document_id"]
|
|
75286
75026
|
};
|
|
75287
|
-
|
|
75027
|
+
toolDefs24 = [
|
|
75288
75028
|
{
|
|
75289
75029
|
name: "add_constraint",
|
|
75290
75030
|
pack: null,
|
|
@@ -75518,7 +75258,7 @@ function recordMeasurement(input) {
|
|
|
75518
75258
|
}
|
|
75519
75259
|
return jsonResult3(report);
|
|
75520
75260
|
}
|
|
75521
|
-
var MEASURABLE_KINDS, MEASURABLE_AXES, MEASURABLE_FEATURES, predictions, reports, predictPrintSchema, recordMeasurementSchema, jsonResult3,
|
|
75261
|
+
var MEASURABLE_KINDS, MEASURABLE_AXES, MEASURABLE_FEATURES, predictions, reports, predictPrintSchema, recordMeasurementSchema, jsonResult3, toolDefs25;
|
|
75522
75262
|
var init_print_check = __esm({
|
|
75523
75263
|
"src/tools/print-check.ts"() {
|
|
75524
75264
|
"use strict";
|
|
@@ -75621,7 +75361,7 @@ var init_print_check = __esm({
|
|
|
75621
75361
|
jsonResult3 = (value) => ({
|
|
75622
75362
|
content: [{ type: "text", text: JSON.stringify(value, null, 2) }]
|
|
75623
75363
|
});
|
|
75624
|
-
|
|
75364
|
+
toolDefs25 = [
|
|
75625
75365
|
{
|
|
75626
75366
|
name: "predict_print",
|
|
75627
75367
|
pack: "print",
|
|
@@ -76496,7 +76236,7 @@ async function renderStackup(args) {
|
|
|
76496
76236
|
});
|
|
76497
76237
|
return withRenderAssets({ content }, assets);
|
|
76498
76238
|
}
|
|
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,
|
|
76239
|
+
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
76240
|
var init_render2 = __esm({
|
|
76501
76241
|
"src/tools/render.ts"() {
|
|
76502
76242
|
"use strict";
|
|
@@ -76660,7 +76400,7 @@ var init_render2 = __esm({
|
|
|
76660
76400
|
},
|
|
76661
76401
|
required: ["document_id"]
|
|
76662
76402
|
};
|
|
76663
|
-
|
|
76403
|
+
toolDefs26 = [
|
|
76664
76404
|
{
|
|
76665
76405
|
name: "render_view",
|
|
76666
76406
|
pack: null,
|
|
@@ -76700,15 +76440,15 @@ var init_render2 = __esm({
|
|
|
76700
76440
|
// src/tools/verify.ts
|
|
76701
76441
|
import { execFile } from "child_process";
|
|
76702
76442
|
import {
|
|
76703
|
-
existsSync as
|
|
76443
|
+
existsSync as existsSync3,
|
|
76704
76444
|
mkdtempSync,
|
|
76705
76445
|
readdirSync as readdirSync2,
|
|
76706
|
-
readFileSync as
|
|
76446
|
+
readFileSync as readFileSync6,
|
|
76707
76447
|
rmSync,
|
|
76708
76448
|
writeFileSync as writeFileSync4
|
|
76709
76449
|
} from "fs";
|
|
76710
76450
|
import { tmpdir } from "os";
|
|
76711
|
-
import { dirname as
|
|
76451
|
+
import { dirname as dirname3, join as join3 } from "path";
|
|
76712
76452
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
76713
76453
|
import { promisify } from "util";
|
|
76714
76454
|
function textResult(payload, isError = false) {
|
|
@@ -76717,8 +76457,8 @@ function textResult(payload, isError = false) {
|
|
|
76717
76457
|
function findUpward(start, probe) {
|
|
76718
76458
|
let dir = start;
|
|
76719
76459
|
for (let i = 0; i < 12; i++) {
|
|
76720
|
-
if (
|
|
76721
|
-
const parent =
|
|
76460
|
+
if (existsSync3(join3(dir, probe))) return dir;
|
|
76461
|
+
const parent = dirname3(dir);
|
|
76722
76462
|
if (parent === dir) break;
|
|
76723
76463
|
dir = parent;
|
|
76724
76464
|
}
|
|
@@ -76726,24 +76466,24 @@ function findUpward(start, probe) {
|
|
|
76726
76466
|
}
|
|
76727
76467
|
function findMechevalRoot() {
|
|
76728
76468
|
const override = process.env.MECHEVAL_DIR;
|
|
76729
|
-
if (override &&
|
|
76469
|
+
if (override && existsSync3(join3(override, "tasks"))) {
|
|
76730
76470
|
return override;
|
|
76731
76471
|
}
|
|
76732
|
-
const here =
|
|
76472
|
+
const here = dirname3(fileURLToPath2(import.meta.url));
|
|
76733
76473
|
const repoRoot = findUpward(here, join3("mecheval", "tasks")) ?? findUpward(process.cwd(), join3("mecheval", "tasks"));
|
|
76734
76474
|
return repoRoot ? join3(repoRoot, "mecheval") : null;
|
|
76735
76475
|
}
|
|
76736
76476
|
function findGraderBin(mechevalRoot) {
|
|
76737
76477
|
const override = process.env.MECHEVAL_GRADE_BIN;
|
|
76738
|
-
if (override &&
|
|
76478
|
+
if (override && existsSync3(override)) return override;
|
|
76739
76479
|
for (const profile of ["release", "debug"]) {
|
|
76740
76480
|
const candidate = join3(
|
|
76741
|
-
|
|
76481
|
+
dirname3(mechevalRoot),
|
|
76742
76482
|
"target",
|
|
76743
76483
|
profile,
|
|
76744
76484
|
"mecheval-grade"
|
|
76745
76485
|
);
|
|
76746
|
-
if (
|
|
76486
|
+
if (existsSync3(candidate)) return candidate;
|
|
76747
76487
|
}
|
|
76748
76488
|
return null;
|
|
76749
76489
|
}
|
|
@@ -76763,7 +76503,7 @@ function listEvalTasks(args) {
|
|
|
76763
76503
|
for (const file of readdirSync2(tasksDir).sort()) {
|
|
76764
76504
|
if (!file.endsWith(".json")) continue;
|
|
76765
76505
|
try {
|
|
76766
|
-
const raw = JSON.parse(
|
|
76506
|
+
const raw = JSON.parse(readFileSync6(join3(tasksDir, file), "utf8"));
|
|
76767
76507
|
if (suiteFilter && String(raw.suite).toUpperCase() !== suiteFilter) {
|
|
76768
76508
|
continue;
|
|
76769
76509
|
}
|
|
@@ -76798,7 +76538,7 @@ async function verifyPart(args) {
|
|
|
76798
76538
|
return textResult({ error: `invalid task_id: ${taskId}` }, true);
|
|
76799
76539
|
}
|
|
76800
76540
|
const taskPath = join3(mechevalRoot, "tasks", `${taskId}.json`);
|
|
76801
|
-
if (!
|
|
76541
|
+
if (!existsSync3(taskPath)) {
|
|
76802
76542
|
return textResult(
|
|
76803
76543
|
{
|
|
76804
76544
|
error: `unknown task_id "${taskId}"`,
|
|
@@ -76866,7 +76606,7 @@ async function verifyPart(args) {
|
|
|
76866
76606
|
rmSync(scratch, { recursive: true, force: true });
|
|
76867
76607
|
}
|
|
76868
76608
|
}
|
|
76869
|
-
var execFileAsync, verifyPartSchema, listEvalTasksSchema,
|
|
76609
|
+
var execFileAsync, verifyPartSchema, listEvalTasksSchema, toolDefs27;
|
|
76870
76610
|
var init_verify = __esm({
|
|
76871
76611
|
"src/tools/verify.ts"() {
|
|
76872
76612
|
"use strict";
|
|
@@ -76897,7 +76637,7 @@ var init_verify = __esm({
|
|
|
76897
76637
|
}
|
|
76898
76638
|
}
|
|
76899
76639
|
};
|
|
76900
|
-
|
|
76640
|
+
toolDefs27 = [
|
|
76901
76641
|
{
|
|
76902
76642
|
name: "verify_part",
|
|
76903
76643
|
pack: "eval",
|
|
@@ -76957,7 +76697,7 @@ function verifySpec(input, engine) {
|
|
|
76957
76697
|
]
|
|
76958
76698
|
};
|
|
76959
76699
|
}
|
|
76960
|
-
var pointSpecSchema, verifySpecSchema,
|
|
76700
|
+
var pointSpecSchema, verifySpecSchema, toolDefs28;
|
|
76961
76701
|
var init_verify_spec = __esm({
|
|
76962
76702
|
"src/tools/verify-spec.ts"() {
|
|
76963
76703
|
"use strict";
|
|
@@ -77021,7 +76761,7 @@ var init_verify_spec = __esm({
|
|
|
77021
76761
|
},
|
|
77022
76762
|
required: ["document_id", "spec"]
|
|
77023
76763
|
};
|
|
77024
|
-
|
|
76764
|
+
toolDefs28 = [
|
|
77025
76765
|
{
|
|
77026
76766
|
name: "verify_spec",
|
|
77027
76767
|
pack: null,
|
|
@@ -77164,7 +76904,7 @@ function topologyOptimizeTool(args, engine) {
|
|
|
77164
76904
|
]
|
|
77165
76905
|
};
|
|
77166
76906
|
}
|
|
77167
|
-
var regionSchema, topologyOptimizeSchema, round5,
|
|
76907
|
+
var regionSchema, topologyOptimizeSchema, round5, toolDefs29;
|
|
77168
76908
|
var init_topopt = __esm({
|
|
77169
76909
|
"src/tools/topopt.ts"() {
|
|
77170
76910
|
"use strict";
|
|
@@ -77277,7 +77017,7 @@ var init_topopt = __esm({
|
|
|
77277
77017
|
}
|
|
77278
77018
|
};
|
|
77279
77019
|
round5 = (v) => Number(v.toPrecision(5));
|
|
77280
|
-
|
|
77020
|
+
toolDefs29 = [
|
|
77281
77021
|
{
|
|
77282
77022
|
name: "topology_optimize",
|
|
77283
77023
|
pack: null,
|
|
@@ -77301,7 +77041,7 @@ function textResult2(payload) {
|
|
|
77301
77041
|
]
|
|
77302
77042
|
};
|
|
77303
77043
|
}
|
|
77304
|
-
var paramValue, deviceSpecSchema, parametersSchema, simOptionsSchema, simulateChargedParticlesSchema, optimizeElectrodesSchema,
|
|
77044
|
+
var paramValue, deviceSpecSchema, parametersSchema, simOptionsSchema, simulateChargedParticlesSchema, optimizeElectrodesSchema, toolDefs30;
|
|
77305
77045
|
var init_particle = __esm({
|
|
77306
77046
|
"src/tools/particle.ts"() {
|
|
77307
77047
|
"use strict";
|
|
@@ -77435,7 +77175,7 @@ var init_particle = __esm({
|
|
|
77435
77175
|
}
|
|
77436
77176
|
}
|
|
77437
77177
|
};
|
|
77438
|
-
|
|
77178
|
+
toolDefs30 = [
|
|
77439
77179
|
{
|
|
77440
77180
|
name: "simulate_charged_particles",
|
|
77441
77181
|
pack: null,
|
|
@@ -77486,7 +77226,7 @@ function textResult3(payload) {
|
|
|
77486
77226
|
]
|
|
77487
77227
|
};
|
|
77488
77228
|
}
|
|
77489
|
-
var paramValue2, distSchema, stackupSpecSchema,
|
|
77229
|
+
var paramValue2, distSchema, stackupSpecSchema, toolDefs31;
|
|
77490
77230
|
var init_tolerance = __esm({
|
|
77491
77231
|
"src/tools/tolerance.ts"() {
|
|
77492
77232
|
"use strict";
|
|
@@ -77574,7 +77314,7 @@ var init_tolerance = __esm({
|
|
|
77574
77314
|
}
|
|
77575
77315
|
}
|
|
77576
77316
|
};
|
|
77577
|
-
|
|
77317
|
+
toolDefs31 = [
|
|
77578
77318
|
{
|
|
77579
77319
|
name: "analyze_tolerance_stackup",
|
|
77580
77320
|
pack: null,
|
|
@@ -77634,7 +77374,7 @@ function textResult4(payload) {
|
|
|
77634
77374
|
]
|
|
77635
77375
|
};
|
|
77636
77376
|
}
|
|
77637
|
-
var paramValue3, paramVec3, shapeSchema, boundarySchema, thermalSpecSchema, transientSchema,
|
|
77377
|
+
var paramValue3, paramVec3, shapeSchema, boundarySchema, thermalSpecSchema, transientSchema, toolDefs32;
|
|
77638
77378
|
var init_thermal = __esm({
|
|
77639
77379
|
"src/tools/thermal.ts"() {
|
|
77640
77380
|
"use strict";
|
|
@@ -77801,7 +77541,7 @@ var init_thermal = __esm({
|
|
|
77801
77541
|
}
|
|
77802
77542
|
}
|
|
77803
77543
|
};
|
|
77804
|
-
|
|
77544
|
+
toolDefs32 = [
|
|
77805
77545
|
{
|
|
77806
77546
|
name: "solve_thermal",
|
|
77807
77547
|
pack: null,
|
|
@@ -77863,7 +77603,7 @@ function textResult5(payload) {
|
|
|
77863
77603
|
]
|
|
77864
77604
|
};
|
|
77865
77605
|
}
|
|
77866
|
-
var vec32, shapeSchema2, flowSpecSchema,
|
|
77606
|
+
var vec32, shapeSchema2, flowSpecSchema, toolDefs33;
|
|
77867
77607
|
var init_flow = __esm({
|
|
77868
77608
|
"src/tools/flow.ts"() {
|
|
77869
77609
|
"use strict";
|
|
@@ -77997,7 +77737,7 @@ var init_flow = __esm({
|
|
|
77997
77737
|
}
|
|
77998
77738
|
}
|
|
77999
77739
|
};
|
|
78000
|
-
|
|
77740
|
+
toolDefs33 = [
|
|
78001
77741
|
{
|
|
78002
77742
|
name: "simulate_flow",
|
|
78003
77743
|
pack: null,
|
|
@@ -78079,7 +77819,7 @@ function frequencyGrid(ac) {
|
|
|
78079
77819
|
}
|
|
78080
77820
|
return out;
|
|
78081
77821
|
}
|
|
78082
|
-
var deviceSchema, devicesSchema,
|
|
77822
|
+
var deviceSchema, devicesSchema, toolDefs34;
|
|
78083
77823
|
var init_circuit = __esm({
|
|
78084
77824
|
"src/tools/circuit.ts"() {
|
|
78085
77825
|
"use strict";
|
|
@@ -78116,7 +77856,7 @@ var init_circuit = __esm({
|
|
|
78116
77856
|
items: deviceSchema,
|
|
78117
77857
|
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
77858
|
};
|
|
78119
|
-
|
|
77859
|
+
toolDefs34 = [
|
|
78120
77860
|
{
|
|
78121
77861
|
name: "simulate_circuit",
|
|
78122
77862
|
pack: null,
|
|
@@ -78307,7 +78047,7 @@ function textResult7(payload) {
|
|
|
78307
78047
|
]
|
|
78308
78048
|
};
|
|
78309
78049
|
}
|
|
78310
|
-
var regionSchema2,
|
|
78050
|
+
var regionSchema2, toolDefs35;
|
|
78311
78051
|
var init_structure = __esm({
|
|
78312
78052
|
"src/tools/structure.ts"() {
|
|
78313
78053
|
"use strict";
|
|
@@ -78334,7 +78074,7 @@ var init_structure = __esm({
|
|
|
78334
78074
|
}
|
|
78335
78075
|
}
|
|
78336
78076
|
};
|
|
78337
|
-
|
|
78077
|
+
toolDefs35 = [
|
|
78338
78078
|
{
|
|
78339
78079
|
name: "analyze_structure",
|
|
78340
78080
|
pack: null,
|
|
@@ -78553,7 +78293,7 @@ function textResult8(payload) {
|
|
|
78553
78293
|
]
|
|
78554
78294
|
};
|
|
78555
78295
|
}
|
|
78556
|
-
var paramValue4, rectRegion, bcSchema, electroShape, emSpecSchema,
|
|
78296
|
+
var paramValue4, rectRegion, bcSchema, electroShape, emSpecSchema, toolDefs36;
|
|
78557
78297
|
var init_em = __esm({
|
|
78558
78298
|
"src/tools/em.ts"() {
|
|
78559
78299
|
"use strict";
|
|
@@ -78709,7 +78449,7 @@ var init_em = __esm({
|
|
|
78709
78449
|
}
|
|
78710
78450
|
}
|
|
78711
78451
|
};
|
|
78712
|
-
|
|
78452
|
+
toolDefs36 = [
|
|
78713
78453
|
{
|
|
78714
78454
|
name: "simulate_em",
|
|
78715
78455
|
pack: null,
|
|
@@ -78822,7 +78562,7 @@ function textResult9(payload) {
|
|
|
78822
78562
|
]
|
|
78823
78563
|
};
|
|
78824
78564
|
}
|
|
78825
|
-
var paramValue5, pointSpec, antennaSpecSchema,
|
|
78565
|
+
var paramValue5, pointSpec, antennaSpecSchema, toolDefs37;
|
|
78826
78566
|
var init_antenna = __esm({
|
|
78827
78567
|
"src/tools/antenna.ts"() {
|
|
78828
78568
|
"use strict";
|
|
@@ -78871,7 +78611,7 @@ var init_antenna = __esm({
|
|
|
78871
78611
|
feed_mm: pointSpec
|
|
78872
78612
|
}
|
|
78873
78613
|
};
|
|
78874
|
-
|
|
78614
|
+
toolDefs37 = [
|
|
78875
78615
|
{
|
|
78876
78616
|
name: "analyze_antenna",
|
|
78877
78617
|
pack: null,
|
|
@@ -78948,7 +78688,7 @@ function textResult10(payload) {
|
|
|
78948
78688
|
]
|
|
78949
78689
|
};
|
|
78950
78690
|
}
|
|
78951
|
-
var photonicsSpecSchema,
|
|
78691
|
+
var photonicsSpecSchema, toolDefs38;
|
|
78952
78692
|
var init_photonics = __esm({
|
|
78953
78693
|
"src/tools/photonics.ts"() {
|
|
78954
78694
|
"use strict";
|
|
@@ -79034,7 +78774,7 @@ var init_photonics = __esm({
|
|
|
79034
78774
|
}
|
|
79035
78775
|
}
|
|
79036
78776
|
};
|
|
79037
|
-
|
|
78777
|
+
toolDefs38 = [
|
|
79038
78778
|
{
|
|
79039
78779
|
name: "simulate_photonics",
|
|
79040
78780
|
pack: null,
|
|
@@ -79100,7 +78840,7 @@ function textResult11(payload) {
|
|
|
79100
78840
|
]
|
|
79101
78841
|
};
|
|
79102
78842
|
}
|
|
79103
|
-
var paramValue6, shieldSpecSchema,
|
|
78843
|
+
var paramValue6, shieldSpecSchema, toolDefs39;
|
|
79104
78844
|
var init_neutronics = __esm({
|
|
79105
78845
|
"src/tools/neutronics.ts"() {
|
|
79106
78846
|
"use strict";
|
|
@@ -79171,7 +78911,7 @@ var init_neutronics = __esm({
|
|
|
79171
78911
|
}
|
|
79172
78912
|
}
|
|
79173
78913
|
};
|
|
79174
|
-
|
|
78914
|
+
toolDefs39 = [
|
|
79175
78915
|
{
|
|
79176
78916
|
name: "simulate_neutron_shield",
|
|
79177
78917
|
pack: null,
|
|
@@ -79213,7 +78953,7 @@ function textResult12(payload) {
|
|
|
79213
78953
|
]
|
|
79214
78954
|
};
|
|
79215
78955
|
}
|
|
79216
|
-
var simSpecSchema,
|
|
78956
|
+
var simSpecSchema, toolDefs40;
|
|
79217
78957
|
var init_qcd = __esm({
|
|
79218
78958
|
"src/tools/qcd.ts"() {
|
|
79219
78959
|
"use strict";
|
|
@@ -79303,7 +79043,7 @@ var init_qcd = __esm({
|
|
|
79303
79043
|
}
|
|
79304
79044
|
}
|
|
79305
79045
|
};
|
|
79306
|
-
|
|
79046
|
+
toolDefs40 = [
|
|
79307
79047
|
{
|
|
79308
79048
|
name: "simulate_lattice_gauge",
|
|
79309
79049
|
pack: null,
|
|
@@ -79445,7 +79185,7 @@ function predictPhysicsTool(args, engine) {
|
|
|
79445
79185
|
]
|
|
79446
79186
|
};
|
|
79447
79187
|
}
|
|
79448
|
-
var PHYSICS_DOMAIN, ORACLE, TIER_RESOLUTION, regionSchema3, predictPhysicsSchema, round52,
|
|
79188
|
+
var PHYSICS_DOMAIN, ORACLE, TIER_RESOLUTION, regionSchema3, predictPhysicsSchema, round52, toolDefs41;
|
|
79449
79189
|
var init_physics2 = __esm({
|
|
79450
79190
|
"src/tools/physics.ts"() {
|
|
79451
79191
|
"use strict";
|
|
@@ -79558,7 +79298,7 @@ var init_physics2 = __esm({
|
|
|
79558
79298
|
}
|
|
79559
79299
|
};
|
|
79560
79300
|
round52 = (v) => Number(v.toPrecision(5));
|
|
79561
|
-
|
|
79301
|
+
toolDefs41 = [
|
|
79562
79302
|
{
|
|
79563
79303
|
name: "predict_physics",
|
|
79564
79304
|
pack: null,
|
|
@@ -79802,7 +79542,7 @@ function applySetParam(doc, node, path, value) {
|
|
|
79802
79542
|
}
|
|
79803
79543
|
cursor[parts[parts.length - 1]] = value;
|
|
79804
79544
|
}
|
|
79805
|
-
var lastReports, mechanicalProcessEnum, pcbProcessEnum, processEnum, rulesetEnum, dfmCheckSchema, dfmExplainSchema, dfmSuggestFixSchema, dfmApplyFixSchema,
|
|
79545
|
+
var lastReports, mechanicalProcessEnum, pcbProcessEnum, processEnum, rulesetEnum, dfmCheckSchema, dfmExplainSchema, dfmSuggestFixSchema, dfmApplyFixSchema, toolDefs42;
|
|
79806
79546
|
var init_dfm2 = __esm({
|
|
79807
79547
|
"src/tools/dfm.ts"() {
|
|
79808
79548
|
"use strict";
|
|
@@ -79905,7 +79645,7 @@ var init_dfm2 = __esm({
|
|
|
79905
79645
|
},
|
|
79906
79646
|
required: ["issue_id"]
|
|
79907
79647
|
};
|
|
79908
|
-
|
|
79648
|
+
toolDefs42 = [
|
|
79909
79649
|
{
|
|
79910
79650
|
name: "dfm_check",
|
|
79911
79651
|
pack: "dfm",
|
|
@@ -80404,7 +80144,7 @@ function sheetMetalCost(input, engine) {
|
|
|
80404
80144
|
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
80145
|
});
|
|
80406
80146
|
}
|
|
80407
|
-
var sheetMetalCreateSchema, sheetMetalUnfoldSchema, sheetMetalMaterialsSchema, sheetMetalBendTableSchema, sheetMetalCheckSchema, sheetMetalNestSchema, sheetMetalSequenceSchema, sheetMetalSuggestFixSchema, sheetMetalCostSchema,
|
|
80147
|
+
var sheetMetalCreateSchema, sheetMetalUnfoldSchema, sheetMetalMaterialsSchema, sheetMetalBendTableSchema, sheetMetalCheckSchema, sheetMetalNestSchema, sheetMetalSequenceSchema, sheetMetalSuggestFixSchema, sheetMetalCostSchema, toolDefs43;
|
|
80408
80148
|
var init_sheet_metal2 = __esm({
|
|
80409
80149
|
"src/tools/sheet-metal.ts"() {
|
|
80410
80150
|
"use strict";
|
|
@@ -80665,7 +80405,7 @@ var init_sheet_metal2 = __esm({
|
|
|
80665
80405
|
},
|
|
80666
80406
|
required: ["document_id"]
|
|
80667
80407
|
};
|
|
80668
|
-
|
|
80408
|
+
toolDefs43 = [
|
|
80669
80409
|
{
|
|
80670
80410
|
name: "sheet_metal_create",
|
|
80671
80411
|
pack: "sheet_metal",
|
|
@@ -80908,7 +80648,7 @@ function flatPatternFromSolid(input, engine) {
|
|
|
80908
80648
|
]
|
|
80909
80649
|
};
|
|
80910
80650
|
}
|
|
80911
|
-
var flatPatternFromSolidSchema,
|
|
80651
|
+
var flatPatternFromSolidSchema, toolDefs44;
|
|
80912
80652
|
var init_flat_pattern = __esm({
|
|
80913
80653
|
"src/tools/flat-pattern.ts"() {
|
|
80914
80654
|
"use strict";
|
|
@@ -80949,7 +80689,7 @@ var init_flat_pattern = __esm({
|
|
|
80949
80689
|
},
|
|
80950
80690
|
required: ["document_id"]
|
|
80951
80691
|
};
|
|
80952
|
-
|
|
80692
|
+
toolDefs44 = [
|
|
80953
80693
|
{
|
|
80954
80694
|
name: "flat_pattern_from_solid",
|
|
80955
80695
|
pack: "sheet_metal",
|
|
@@ -81130,7 +80870,7 @@ function simulateStrike(input, engine) {
|
|
|
81130
80870
|
}
|
|
81131
80871
|
return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
|
|
81132
80872
|
}
|
|
81133
|
-
var cents, MATERIAL_ALIASES, simulateStrikeSchema, round23, round4,
|
|
80873
|
+
var cents, MATERIAL_ALIASES, simulateStrikeSchema, round23, round4, toolDefs45;
|
|
81134
80874
|
var init_acoustics = __esm({
|
|
81135
80875
|
"src/tools/acoustics.ts"() {
|
|
81136
80876
|
"use strict";
|
|
@@ -81204,7 +80944,7 @@ var init_acoustics = __esm({
|
|
|
81204
80944
|
};
|
|
81205
80945
|
round23 = (x) => Math.round(x * 100) / 100;
|
|
81206
80946
|
round4 = (x) => Math.round(x * 1e4) / 1e4;
|
|
81207
|
-
|
|
80947
|
+
toolDefs45 = [
|
|
81208
80948
|
{
|
|
81209
80949
|
name: "simulate_strike",
|
|
81210
80950
|
pack: "sheet_metal",
|
|
@@ -81219,16 +80959,16 @@ var init_acoustics = __esm({
|
|
|
81219
80959
|
|
|
81220
80960
|
// src/tools/import.ts
|
|
81221
80961
|
import { createHash as createHash6 } from "node:crypto";
|
|
81222
|
-
import { readFileSync as
|
|
81223
|
-
import { basename
|
|
80962
|
+
import { readFileSync as readFileSync7, existsSync as existsSync4, statSync as statSync2, mkdirSync as mkdirSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
80963
|
+
import { basename, join as join4, resolve as resolve5, sep as sep3 } from "node:path";
|
|
81224
80964
|
function exportRoot() {
|
|
81225
80965
|
return process.env.VCAD_MCP_EXPORT_DIR ?? process.cwd();
|
|
81226
80966
|
}
|
|
81227
80967
|
function isWithinExportRoot(path) {
|
|
81228
80968
|
if (path.includes("\0")) return false;
|
|
81229
|
-
const root =
|
|
81230
|
-
const abs =
|
|
81231
|
-
return abs === root || abs.startsWith(root +
|
|
80969
|
+
const root = resolve5(exportRoot());
|
|
80970
|
+
const abs = resolve5(path);
|
|
80971
|
+
return abs === root || abs.startsWith(root + sep3);
|
|
81232
80972
|
}
|
|
81233
80973
|
function stepNodePath(bytes, diskPath, label) {
|
|
81234
80974
|
if (diskPath) return { path: diskPath, portable: true };
|
|
@@ -81237,8 +80977,8 @@ function stepNodePath(bytes, diskPath, label) {
|
|
|
81237
80977
|
const dir = join4(exportRoot(), STEP_CACHE_DIR);
|
|
81238
80978
|
mkdirSync2(dir, { recursive: true });
|
|
81239
80979
|
const file = join4(dir, `${digest}.step`);
|
|
81240
|
-
if (!
|
|
81241
|
-
return { path:
|
|
80980
|
+
if (!existsSync4(file)) writeFileSync6(file, bytes);
|
|
80981
|
+
return { path: resolve5(file), portable: true };
|
|
81242
80982
|
} catch {
|
|
81243
80983
|
return { path: `step:${digest}/${label}`, portable: false };
|
|
81244
80984
|
}
|
|
@@ -81272,7 +81012,7 @@ function registerDocumentStepSources(doc, engine) {
|
|
|
81272
81012
|
continue;
|
|
81273
81013
|
}
|
|
81274
81014
|
try {
|
|
81275
|
-
const bytes =
|
|
81015
|
+
const bytes = readFileSync7(path);
|
|
81276
81016
|
const buf = new ArrayBuffer(bytes.byteLength);
|
|
81277
81017
|
new Uint8Array(buf).set(bytes);
|
|
81278
81018
|
engine.registerStepSource(path, buf);
|
|
@@ -81304,17 +81044,17 @@ function readStepInput(input) {
|
|
|
81304
81044
|
);
|
|
81305
81045
|
}
|
|
81306
81046
|
const filepath = resolveWithinRoot(filename, exportRoot());
|
|
81307
|
-
if (!
|
|
81047
|
+
if (!existsSync4(filepath)) {
|
|
81308
81048
|
throw new Error("STEP file not found");
|
|
81309
81049
|
}
|
|
81310
|
-
const stat =
|
|
81050
|
+
const stat = statSync2(filepath);
|
|
81311
81051
|
if (!stat.isFile()) {
|
|
81312
81052
|
throw new Error("STEP path is not a regular file");
|
|
81313
81053
|
}
|
|
81314
81054
|
if (stat.size > MAX_STEP_BYTES) {
|
|
81315
81055
|
throw new Error(`STEP file exceeds ${MAX_STEP_BYTES} byte limit`);
|
|
81316
81056
|
}
|
|
81317
|
-
return { bytes:
|
|
81057
|
+
return { bytes: readFileSync7(filepath), diskPath: resolve5(filepath) };
|
|
81318
81058
|
}
|
|
81319
81059
|
function defaultMaterials() {
|
|
81320
81060
|
return {
|
|
@@ -81363,7 +81103,7 @@ function importStep(input, engine) {
|
|
|
81363
81103
|
const arrayBuffer = new ArrayBuffer(fileBuffer.byteLength);
|
|
81364
81104
|
new Uint8Array(arrayBuffer).set(fileBuffer);
|
|
81365
81105
|
const sourceLabel = filename ?? "step-import";
|
|
81366
|
-
const partName = name ??
|
|
81106
|
+
const partName = name ?? basename(
|
|
81367
81107
|
sourceLabel,
|
|
81368
81108
|
/\.(step|stp)$/i.test(sourceLabel) ? sourceLabel.slice(-5) : ""
|
|
81369
81109
|
);
|
|
@@ -81400,7 +81140,7 @@ function importStep(input, engine) {
|
|
|
81400
81140
|
...skippedFaceSummary(report, importWarnings)
|
|
81401
81141
|
};
|
|
81402
81142
|
} else {
|
|
81403
|
-
const label =
|
|
81143
|
+
const label = basename(sourceLabel).replace(/[^\w.-]/g, "_") || "import.step";
|
|
81404
81144
|
const { path, portable } = stepNodePath(fileBuffer, diskPath, label);
|
|
81405
81145
|
let registered;
|
|
81406
81146
|
try {
|
|
@@ -81484,7 +81224,7 @@ function importStep(input, engine) {
|
|
|
81484
81224
|
]
|
|
81485
81225
|
};
|
|
81486
81226
|
}
|
|
81487
|
-
var MAX_STEP_BYTES, STEP_CACHE_DIR, importStepSchema,
|
|
81227
|
+
var MAX_STEP_BYTES, STEP_CACHE_DIR, importStepSchema, toolDefs46;
|
|
81488
81228
|
var init_import = __esm({
|
|
81489
81229
|
"src/tools/import.ts"() {
|
|
81490
81230
|
"use strict";
|
|
@@ -81521,7 +81261,7 @@ var init_import = __esm({
|
|
|
81521
81261
|
}
|
|
81522
81262
|
}
|
|
81523
81263
|
};
|
|
81524
|
-
|
|
81264
|
+
toolDefs46 = [
|
|
81525
81265
|
{
|
|
81526
81266
|
name: "import_step",
|
|
81527
81267
|
pack: null,
|
|
@@ -81534,6 +81274,230 @@ var init_import = __esm({
|
|
|
81534
81274
|
}
|
|
81535
81275
|
});
|
|
81536
81276
|
|
|
81277
|
+
// src/tools/import-urdf.ts
|
|
81278
|
+
import { readFileSync as readFileSync8, existsSync as existsSync5, statSync as statSync3 } from "node:fs";
|
|
81279
|
+
import { basename as basename2, dirname as dirname4, isAbsolute as isAbsolute4, resolve as resolve6, sep as sep4 } from "node:path";
|
|
81280
|
+
function resolveMeshPath(filename, urdfDir, packageRoots, confineRoot) {
|
|
81281
|
+
const confined = (p) => {
|
|
81282
|
+
const abs = resolve6(p);
|
|
81283
|
+
const root = resolve6(confineRoot);
|
|
81284
|
+
const rootSep = root.endsWith(sep4) ? root : root + sep4;
|
|
81285
|
+
if (abs !== root && !abs.startsWith(rootSep)) return null;
|
|
81286
|
+
return existsSync5(abs) && statSync3(abs).isFile() ? abs : null;
|
|
81287
|
+
};
|
|
81288
|
+
if (filename.includes("\0")) return null;
|
|
81289
|
+
const pkgMatch = filename.match(/^package:\/\/([^/]+)\/?(.*)$/);
|
|
81290
|
+
if (pkgMatch) {
|
|
81291
|
+
for (const root of packageRoots) {
|
|
81292
|
+
const hit = confined(resolve6(root, pkgMatch[1], pkgMatch[2]));
|
|
81293
|
+
if (hit) return hit;
|
|
81294
|
+
}
|
|
81295
|
+
return null;
|
|
81296
|
+
}
|
|
81297
|
+
const stripped = filename.startsWith("file://") ? filename.slice("file://".length) : filename;
|
|
81298
|
+
if (isAbsolute4(stripped)) return confined(stripped);
|
|
81299
|
+
if (urdfDir) return confined(resolve6(urdfDir, stripped));
|
|
81300
|
+
return null;
|
|
81301
|
+
}
|
|
81302
|
+
function inlineMeshImports(doc, engine, urdfDir, packageRoots, confineRoot) {
|
|
81303
|
+
const unresolved = [];
|
|
81304
|
+
const meshes = /* @__PURE__ */ new Map();
|
|
81305
|
+
const refs = /* @__PURE__ */ new Map();
|
|
81306
|
+
for (const [key3, node] of Object.entries(doc.nodes)) {
|
|
81307
|
+
const op = node.op;
|
|
81308
|
+
if (op.type !== "mesh_import" && op.type !== "MeshImport") continue;
|
|
81309
|
+
const ref = op.path ?? "";
|
|
81310
|
+
const filepath = resolveMeshPath(ref, urdfDir, packageRoots, confineRoot);
|
|
81311
|
+
if (!filepath) {
|
|
81312
|
+
unresolved.push({ path: ref, reason: "file not found" });
|
|
81313
|
+
} else if (!/\.stl$/i.test(filepath)) {
|
|
81314
|
+
unresolved.push({ path: ref, reason: "unsupported mesh format (only STL is inlined server-side)" });
|
|
81315
|
+
} else if (statSync3(filepath).size > MAX_MESH_BYTES) {
|
|
81316
|
+
unresolved.push({ path: ref, reason: "mesh exceeds size limit" });
|
|
81317
|
+
} else {
|
|
81318
|
+
meshes.set(key3, readFileSync8(filepath));
|
|
81319
|
+
refs.set(key3, ref);
|
|
81320
|
+
}
|
|
81321
|
+
}
|
|
81322
|
+
const { inlined, errors } = engine.inlineMeshImports(doc, meshes);
|
|
81323
|
+
for (const [key3, reason] of errors) unresolved.push({ path: refs.get(key3) ?? key3, reason });
|
|
81324
|
+
return { inlined, unresolved };
|
|
81325
|
+
}
|
|
81326
|
+
function importUrdf(input, engine) {
|
|
81327
|
+
const {
|
|
81328
|
+
path,
|
|
81329
|
+
content_base64,
|
|
81330
|
+
package_roots,
|
|
81331
|
+
name,
|
|
81332
|
+
floating_base,
|
|
81333
|
+
floating_base_link,
|
|
81334
|
+
spawn_height_mm
|
|
81335
|
+
} = input;
|
|
81336
|
+
if (!floating_base && (floating_base_link || spawn_height_mm !== void 0)) {
|
|
81337
|
+
throw new Error(
|
|
81338
|
+
"floating_base_link / spawn_height_mm require floating_base: true"
|
|
81339
|
+
);
|
|
81340
|
+
}
|
|
81341
|
+
const confineRoot = process.env.VCAD_MCP_EXPORT_DIR ?? process.cwd();
|
|
81342
|
+
let fileBuffer;
|
|
81343
|
+
let urdfDir = null;
|
|
81344
|
+
let sourceLabel;
|
|
81345
|
+
if (content_base64) {
|
|
81346
|
+
fileBuffer = Buffer.from(content_base64, "base64");
|
|
81347
|
+
if (fileBuffer.length === 0) {
|
|
81348
|
+
throw new Error("content_base64 decoded to zero bytes");
|
|
81349
|
+
}
|
|
81350
|
+
sourceLabel = "urdf-import";
|
|
81351
|
+
} else if (path) {
|
|
81352
|
+
if (isRemoteDeployment()) {
|
|
81353
|
+
throw new Error(
|
|
81354
|
+
"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."
|
|
81355
|
+
);
|
|
81356
|
+
}
|
|
81357
|
+
const filepath = resolveWithinRoot(path, confineRoot);
|
|
81358
|
+
if (!existsSync5(filepath)) {
|
|
81359
|
+
throw new Error(`URDF file not found: ${path}`);
|
|
81360
|
+
}
|
|
81361
|
+
const stat = statSync3(filepath);
|
|
81362
|
+
if (!stat.isFile()) {
|
|
81363
|
+
throw new Error("URDF path is not a regular file");
|
|
81364
|
+
}
|
|
81365
|
+
if (stat.size > MAX_URDF_BYTES) {
|
|
81366
|
+
throw new Error(`URDF file exceeds ${MAX_URDF_BYTES} byte limit`);
|
|
81367
|
+
}
|
|
81368
|
+
fileBuffer = readFileSync8(filepath);
|
|
81369
|
+
urdfDir = dirname4(filepath);
|
|
81370
|
+
sourceLabel = path;
|
|
81371
|
+
} else {
|
|
81372
|
+
throw new Error("Provide either `path` or `content_base64`");
|
|
81373
|
+
}
|
|
81374
|
+
if (fileBuffer.length > MAX_URDF_BYTES) {
|
|
81375
|
+
throw new Error(`URDF content exceeds ${MAX_URDF_BYTES} byte limit`);
|
|
81376
|
+
}
|
|
81377
|
+
const packageRoots = (package_roots ?? []).map(
|
|
81378
|
+
(r) => resolveWithinRoot(r, confineRoot)
|
|
81379
|
+
);
|
|
81380
|
+
const arrayBuffer = new ArrayBuffer(fileBuffer.byteLength);
|
|
81381
|
+
new Uint8Array(arrayBuffer).set(fileBuffer);
|
|
81382
|
+
const doc = JSON.parse(
|
|
81383
|
+
engine.importUrdf(arrayBuffer, {
|
|
81384
|
+
floatingBase: floating_base,
|
|
81385
|
+
floatingBaseLink: floating_base_link,
|
|
81386
|
+
spawnHeightMm: spawn_height_mm
|
|
81387
|
+
})
|
|
81388
|
+
);
|
|
81389
|
+
const commentedFloating = floating_base ? void 0 : engine.urdfCommentedFloatingJoint(arrayBuffer);
|
|
81390
|
+
const meshes = inlineMeshImports(doc, engine, urdfDir, packageRoots, confineRoot);
|
|
81391
|
+
const robotName = name ?? basename2(sourceLabel).replace(/\.(urdf|xml)$/i, "");
|
|
81392
|
+
const parts = Object.values(doc.partDefs ?? {}).map((p) => ({
|
|
81393
|
+
id: p.id,
|
|
81394
|
+
name: p.name
|
|
81395
|
+
}));
|
|
81396
|
+
const joints = (doc.joints ?? []).map((j) => ({
|
|
81397
|
+
id: j.id,
|
|
81398
|
+
name: j.name,
|
|
81399
|
+
kind: j.kind.type,
|
|
81400
|
+
parent_instance_id: j.parentInstanceId,
|
|
81401
|
+
child_instance_id: j.childInstanceId
|
|
81402
|
+
}));
|
|
81403
|
+
const documentId = registerSession(doc);
|
|
81404
|
+
const summary = {
|
|
81405
|
+
robot: robotName,
|
|
81406
|
+
parts: parts.length,
|
|
81407
|
+
joints: joints.length,
|
|
81408
|
+
instances: (doc.instances ?? []).length,
|
|
81409
|
+
ground_instance_id: doc.groundInstanceId ?? null,
|
|
81410
|
+
joint_list: joints,
|
|
81411
|
+
...floating_base ? {
|
|
81412
|
+
floating_base: {
|
|
81413
|
+
synthesized: joints.some((j) => j.kind === "Free"),
|
|
81414
|
+
spawn_height_mm: spawn_height_mm ?? 0,
|
|
81415
|
+
note: "The root link hangs off a 6-DOF Free joint; parentAnchor.z is the spawn height. The robot will fall under gravity."
|
|
81416
|
+
}
|
|
81417
|
+
} : {},
|
|
81418
|
+
...commentedFloating ? {
|
|
81419
|
+
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.`
|
|
81420
|
+
} : {},
|
|
81421
|
+
...meshes.inlined > 0 ? { meshes_inlined: meshes.inlined } : {},
|
|
81422
|
+
...meshes.unresolved.length > 0 ? {
|
|
81423
|
+
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.`,
|
|
81424
|
+
unresolved_meshes: meshes.unresolved
|
|
81425
|
+
} : {}
|
|
81426
|
+
};
|
|
81427
|
+
return {
|
|
81428
|
+
content: [
|
|
81429
|
+
{
|
|
81430
|
+
type: "text",
|
|
81431
|
+
text: JSON.stringify(
|
|
81432
|
+
{
|
|
81433
|
+
document_id: documentId,
|
|
81434
|
+
summary,
|
|
81435
|
+
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."
|
|
81436
|
+
},
|
|
81437
|
+
null,
|
|
81438
|
+
2
|
|
81439
|
+
)
|
|
81440
|
+
}
|
|
81441
|
+
]
|
|
81442
|
+
};
|
|
81443
|
+
}
|
|
81444
|
+
var MAX_URDF_BYTES, MAX_MESH_BYTES, importUrdfSchema, toolDefs47;
|
|
81445
|
+
var init_import_urdf = __esm({
|
|
81446
|
+
"src/tools/import-urdf.ts"() {
|
|
81447
|
+
"use strict";
|
|
81448
|
+
init_safe_path();
|
|
81449
|
+
init_remote();
|
|
81450
|
+
init_session2();
|
|
81451
|
+
init_tool_def();
|
|
81452
|
+
MAX_URDF_BYTES = 8 * 1024 * 1024;
|
|
81453
|
+
MAX_MESH_BYTES = 100 * 1024 * 1024;
|
|
81454
|
+
importUrdfSchema = {
|
|
81455
|
+
type: "object",
|
|
81456
|
+
properties: {
|
|
81457
|
+
path: {
|
|
81458
|
+
type: "string",
|
|
81459
|
+
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."
|
|
81460
|
+
},
|
|
81461
|
+
content_base64: {
|
|
81462
|
+
type: "string",
|
|
81463
|
+
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."
|
|
81464
|
+
},
|
|
81465
|
+
package_roots: {
|
|
81466
|
+
type: "array",
|
|
81467
|
+
items: { type: "string" },
|
|
81468
|
+
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."
|
|
81469
|
+
},
|
|
81470
|
+
name: {
|
|
81471
|
+
type: "string",
|
|
81472
|
+
description: "Robot name (default: filename without extension)"
|
|
81473
|
+
},
|
|
81474
|
+
floating_base: {
|
|
81475
|
+
type: "boolean",
|
|
81476
|
+
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.'
|
|
81477
|
+
},
|
|
81478
|
+
floating_base_link: {
|
|
81479
|
+
type: "string",
|
|
81480
|
+
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."
|
|
81481
|
+
},
|
|
81482
|
+
spawn_height_mm: {
|
|
81483
|
+
type: "number",
|
|
81484
|
+
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)."
|
|
81485
|
+
}
|
|
81486
|
+
}
|
|
81487
|
+
};
|
|
81488
|
+
toolDefs47 = [
|
|
81489
|
+
{
|
|
81490
|
+
name: "import_urdf",
|
|
81491
|
+
pack: null,
|
|
81492
|
+
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.",
|
|
81493
|
+
inputSchema: importUrdfSchema,
|
|
81494
|
+
handler: (a, c) => importUrdf(a, c.engine),
|
|
81495
|
+
behavior: behavior({ writesDoc: true, geometry: true, mount: true })
|
|
81496
|
+
}
|
|
81497
|
+
];
|
|
81498
|
+
}
|
|
81499
|
+
});
|
|
81500
|
+
|
|
81537
81501
|
// src/tools/import-pcb.ts
|
|
81538
81502
|
import { readFileSync as readFileSync9, existsSync as existsSync6, statSync as statSync4 } from "node:fs";
|
|
81539
81503
|
function importError(text) {
|
|
@@ -86951,8 +86915,8 @@ var init_server3 = __esm({
|
|
|
86951
86915
|
init_order_feed();
|
|
86952
86916
|
init_animate();
|
|
86953
86917
|
PKG_VERSION = (() => {
|
|
86954
|
-
if ("0.10.0-main.
|
|
86955
|
-
return "0.10.0-main.
|
|
86918
|
+
if ("0.10.0-main.126") {
|
|
86919
|
+
return "0.10.0-main.126";
|
|
86956
86920
|
}
|
|
86957
86921
|
try {
|
|
86958
86922
|
const req = createRequire2(import.meta.url);
|
|
@@ -86961,8 +86925,8 @@ var init_server3 = __esm({
|
|
|
86961
86925
|
return "0.0.0";
|
|
86962
86926
|
}
|
|
86963
86927
|
})();
|
|
86964
|
-
BUILD_SHA = "
|
|
86965
|
-
BUILD_TIME = "2026-10-
|
|
86928
|
+
BUILD_SHA = "cf7237b3fa4de3ec9ddd2eccbd0f33b802ea1089";
|
|
86929
|
+
BUILD_TIME = "2026-10-21T14:05:09.525Z";
|
|
86966
86930
|
SHORT_SHA = BUILD_SHA === "unknown" ? "unknown" : BUILD_SHA.slice(0, 7);
|
|
86967
86931
|
VERSION_WITH_BUILD = SHORT_SHA === "unknown" ? PKG_VERSION : `${PKG_VERSION}+${SHORT_SHA}`;
|
|
86968
86932
|
INSTANCE_ID = randomUUID7().slice(0, 8);
|
|
@@ -86989,31 +86953,32 @@ var init_server3 = __esm({
|
|
|
86989
86953
|
"openai/widgetAccessible": true
|
|
86990
86954
|
};
|
|
86991
86955
|
STATIC_TOOL_DEFS = [
|
|
86992
|
-
...
|
|
86956
|
+
...toolDefs3,
|
|
86957
|
+
...toolDefs7,
|
|
86993
86958
|
...toolDefs8,
|
|
86994
86959
|
...toolDefs9,
|
|
86995
86960
|
...toolDefs10,
|
|
86996
|
-
...
|
|
86961
|
+
...toolDefs12,
|
|
86962
|
+
...toolDefs15,
|
|
86997
86963
|
...toolDefs13,
|
|
86998
|
-
...toolDefs16,
|
|
86999
86964
|
...toolDefs14,
|
|
87000
|
-
...
|
|
86965
|
+
...toolDefs16,
|
|
87001
86966
|
...toolDefs17,
|
|
86967
|
+
...toolDefs4,
|
|
86968
|
+
...toolDefs2,
|
|
87002
86969
|
...toolDefs18,
|
|
87003
86970
|
...toolDefs5,
|
|
87004
|
-
...toolDefs3,
|
|
87005
|
-
...toolDefs19,
|
|
87006
86971
|
...toolDefs6,
|
|
87007
|
-
...
|
|
86972
|
+
...toolDefs19,
|
|
87008
86973
|
...toolDefs20,
|
|
87009
86974
|
...toolDefs21,
|
|
87010
|
-
...
|
|
86975
|
+
...toolDefs24,
|
|
87011
86976
|
...toolDefs25,
|
|
87012
86977
|
...toolDefs26,
|
|
87013
86978
|
...toolDefs27,
|
|
87014
86979
|
...toolDefs28,
|
|
86980
|
+
...toolDefs11,
|
|
87015
86981
|
...toolDefs29,
|
|
87016
|
-
...toolDefs12,
|
|
87017
86982
|
...toolDefs30,
|
|
87018
86983
|
...toolDefs31,
|
|
87019
86984
|
...toolDefs32,
|
|
@@ -87026,22 +86991,21 @@ var init_server3 = __esm({
|
|
|
87026
86991
|
...toolDefs39,
|
|
87027
86992
|
...toolDefs40,
|
|
87028
86993
|
...toolDefs41,
|
|
87029
|
-
...toolDefs42,
|
|
87030
86994
|
...toolDefs,
|
|
86995
|
+
...toolDefs42,
|
|
87031
86996
|
...toolDefs43,
|
|
87032
86997
|
...toolDefs44,
|
|
87033
86998
|
...toolDefs45,
|
|
87034
86999
|
...toolDefs46,
|
|
87035
87000
|
...toolDefs47,
|
|
87036
|
-
...toolDefs2,
|
|
87037
87001
|
...toolDefs48,
|
|
87038
87002
|
...toolDefs49,
|
|
87039
87003
|
...toolDefs50,
|
|
87040
87004
|
...toolDefs51,
|
|
87041
87005
|
...toolDefs52,
|
|
87042
87006
|
...toolDefs53,
|
|
87043
|
-
...toolDefs24,
|
|
87044
87007
|
...toolDefs23,
|
|
87008
|
+
...toolDefs22,
|
|
87045
87009
|
...toolDefs54,
|
|
87046
87010
|
...toolDefs55,
|
|
87047
87011
|
...toolDefs56
|