sceneview-mcp 4.3.4 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -595,6 +595,7 @@ export const SYMBOLS = {
595
595
  "TextNode",
596
596
  "TorusNode",
597
597
  "TubeNode",
598
+ "TubeNodeWithCaps",
598
599
  "VideoNode",
599
600
  "ViewNode",
600
601
  "engine",
@@ -6539,43 +6540,75 @@ export const SYMBOLS = {
6539
6540
  "DEFAULT_CLOSED",
6540
6541
  "DEFAULT_RADIAL_SEGMENTS",
6541
6542
  "DEFAULT_RADIUS",
6543
+ "capStyle",
6544
+ "capacity",
6542
6545
  "caps",
6543
6546
  "closed",
6547
+ "dEFAULT_CAP_STYLE",
6544
6548
  "dEFAULT_POINTS",
6545
6549
  "frames",
6550
+ "getCapStyle",
6551
+ "getCapacity",
6546
6552
  "getCaps",
6547
6553
  "getClosed",
6554
+ "getDEFAULT_CAP_STYLE",
6548
6555
  "getDEFAULT_POINTS",
6549
6556
  "getIndices",
6557
+ "getIndicesWithCaps",
6550
6558
  "getPoints",
6551
6559
  "getRadialSegments",
6560
+ "getRadii",
6552
6561
  "getRadius",
6553
6562
  "getVertices",
6563
+ "getVerticesWithCaps",
6554
6564
  "indices",
6565
+ "indicesWithCaps",
6555
6566
  "points",
6556
6567
  "radialSegments",
6568
+ "radii",
6557
6569
  "radius",
6558
6570
  "ringCount",
6571
+ "roundCapRings",
6559
6572
  "update",
6560
- "vertices"
6573
+ "updateWithCaps",
6574
+ "vertices",
6575
+ "verticesWithCaps"
6561
6576
  ]
6562
6577
  },
6563
6578
  "io.github.sceneview.geometries.Tube.Builder": {
6564
6579
  "module": "sceneview",
6565
6580
  "members": [
6566
6581
  "build",
6582
+ "capStyle",
6583
+ "capacity",
6567
6584
  "caps",
6568
6585
  "closed",
6586
+ "getCapStyle",
6587
+ "getCapacity",
6569
6588
  "getCaps",
6570
6589
  "getClosed",
6571
6590
  "getPoints",
6572
6591
  "getRadialSegments",
6592
+ "getRadii",
6573
6593
  "getRadius",
6574
6594
  "points",
6575
6595
  "radialSegments",
6596
+ "radii",
6576
6597
  "radius"
6577
6598
  ]
6578
6599
  },
6600
+ "io.github.sceneview.geometries.Tube.CapStyle": {
6601
+ "module": "sceneview",
6602
+ "members": [
6603
+ "Flat",
6604
+ "None",
6605
+ "Round",
6606
+ "entries",
6607
+ "getEntries",
6608
+ "valueOf",
6609
+ "values"
6610
+ ]
6611
+ },
6579
6612
  "io.github.sceneview.geometries.Tube.Frame": {
6580
6613
  "module": "sceneview",
6581
6614
  "members": [
@@ -8478,7 +8511,8 @@ export const SYMBOLS = {
8478
8511
  "members": [
8479
8512
  "geometry",
8480
8513
  "getGeometry",
8481
- "updateGeometry"
8514
+ "updateGeometry",
8515
+ "updateGeometryWithCaps"
8482
8516
  ]
8483
8517
  },
8484
8518
  "io.github.sceneview.node.VideoNode": {
@@ -4,8 +4,8 @@
4
4
  // build time so the MCP server, telemetry, and the install-snippet
5
5
  // generators all report the actually-published versions instead of
6
6
  // stale hardcoded constants. See #941.
7
- export const PACKAGE_VERSION = "4.3.4";
8
- export const LATEST_SCENEVIEW_RELEASE = "4.72.0";
7
+ export const PACKAGE_VERSION = "4.4.0";
8
+ export const LATEST_SCENEVIEW_RELEASE = "4.76.0";
9
9
  // The pub.dev coordinate for `flutter_sceneview`, read from the plugin's
10
10
  // README. Deliberately NOT LATEST_SCENEVIEW_RELEASE: pub.dev lags the SDK,
11
11
  // and a caret range against an unpublished version cannot be resolved.
@@ -10,7 +10,7 @@
10
10
  import { DEBUG_CATEGORIES } from "../debug-issue.js";
11
11
  import { PLATFORM_IDS } from "../platform-setup.js";
12
12
  import { SAMPLE_IDS, SAMPLES } from "../samples.js";
13
- import { WIDGET_3D_VIEWER_URI } from "../widgets.js";
13
+ import { WIDGET_3D_VIEWER_URI, WIDGET_SHOW_IN_SPACE_URI } from "../widgets.js";
14
14
  export const TOOL_DEFINITIONS = [
15
15
  {
16
16
  name: "get_sample",
@@ -824,10 +824,17 @@ export const TOOL_DEFINITIONS = [
824
824
  label: { type: "string" },
825
825
  sizeCm: { type: "array", items: { type: "number" }, minItems: 3, maxItems: 3 },
826
826
  placement: { type: "string", enum: ["floor", "table"] },
827
+ dimensionSource: { type: "string", enum: ["user", "estimated"] },
827
828
  },
828
- required: ["url", "label", "sizeCm", "placement"],
829
+ required: ["url", "label", "sizeCm", "placement", "dimensionSource"],
829
830
  additionalProperties: false,
830
831
  },
832
+ _meta: {
833
+ ui: { resourceUri: WIDGET_SHOW_IN_SPACE_URI },
834
+ "openai/outputTemplate": WIDGET_SHOW_IN_SPACE_URI,
835
+ "openai/toolInvocation/invoking": "Drawing size preview",
836
+ "openai/toolInvocation/invoked": "Size preview ready",
837
+ },
831
838
  annotations: {
832
839
  readOnlyHint: true,
833
840
  openWorldHint: false,
@@ -37,7 +37,7 @@ import { getSample, SAMPLES } from "../samples.js";
37
37
  import { formatSearchResults, searchModels } from "../search-models.js";
38
38
  import { buildSpatialAnswerSpec, spatialAnswerUrl } from "../spatial-answer-link.js";
39
39
  import { formatValidationReport, validateCode } from "../validator.js";
40
- import { WIDGET_3D_VIEWER_URI } from "../widgets.js";
40
+ import { WIDGET_3D_VIEWER_URI, WIDGET_SHOW_IN_SPACE_URI } from "../widgets.js";
41
41
  // ─── Legal disclaimer (identical to index.ts 4.0.0) ─────────────────────
42
42
  const DISCLAIMER = "\n\n---\n*Generated code suggestion. Review before use in production. See [TERMS.md](https://github.com/sceneview/sceneview/blob/main/mcp/TERMS.md).*";
43
43
  function withDisclaimer(content) {
@@ -948,7 +948,14 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
948
948
  text: `${spec.label}: ${sizeCm.join(" × ")} cm — ${url}\nOpens at real scale in the SceneView app on Android; without the app, the page shows the size.`,
949
949
  },
950
950
  ],
951
- structuredContent: { url, label: spec.label, sizeCm, placement: spec.placement },
951
+ structuredContent: {
952
+ url,
953
+ label: spec.label,
954
+ sizeCm,
955
+ placement: spec.placement,
956
+ dimensionSource: spec.dimensionSource,
957
+ },
958
+ _meta: { ui: { resourceUri: WIDGET_SHOW_IN_SPACE_URI } },
952
959
  };
953
960
  }
954
961
  catch (error) {
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Dependency-free isometric Canvas 2D preview. Every vertex uses metres, including
3
+ * the 1.75 m person and the explicitly labelled 0.75 m reference table. No GLB,
4
+ * WebGL context or WASM is needed to explain a box and its dimensions.
5
+ * Embedded only in the show_in_space resource; the host bridge and QR are shared.
6
+ */
7
+ export const SPACE_DRAWING_JS = `
8
+ var spaceData = null;
9
+ function drawSpace(data) {
10
+ spaceData = data;
11
+ var ctx = canvas.getContext("2d");
12
+ if (!ctx) throw new Error("This host cannot draw the size preview. Use the phone link below.");
13
+ var width = Math.max(1, canvas.clientWidth), height = Math.max(1, canvas.clientHeight);
14
+ // Keep dimensions and table legs left of the desktop AR card. The canvas
15
+ // retains its full height; on a phone the action is below the drawing.
16
+ var drawingWidth = width - (arEl.classList.contains("wide") ? 216 : 0);
17
+ var ratio = Math.min(window.devicePixelRatio || 1, 2);
18
+ canvas.width = Math.round(width * ratio); canvas.height = Math.round(height * ratio);
19
+ ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
20
+ ctx.clearRect(0, 0, width, height);
21
+
22
+ // sizeCm is always width, height, depth. Preserve proportions at every size.
23
+ var w = data.sizeCm[0] / 100, h = data.sizeCm[1] / 100, d = data.sizeCm[2] / 100;
24
+ var base = data.placement === "table" ? 0.75 : 0;
25
+ // Move towards the viewer as we move left, so the person's feet share
26
+ // the box's front floor line (x + z = d), rather than receding behind it.
27
+ var humanX = -0.85, humanZ = d - humanX;
28
+ function humanPoint(x, y) { return [humanX + x / Math.SQRT2, y, humanZ - x / Math.SQRT2]; }
29
+ function iso(x, y, z) { return [0.866 * (x - z), 0.4 * (x + z) - y]; }
30
+ var anchors = [iso.apply(null, humanPoint(-0.35, 0)), iso.apply(null, humanPoint(0.35, 1.96))];
31
+ // Fit the actual objects and floor, not an empty cuboid above the whole
32
+ // floor: that cuboid made both the box and the person unnecessarily small.
33
+ [0, w + 0.45].forEach(function (x) {
34
+ [base - 0.25, base + h + 0.25].forEach(function (y) {
35
+ [-0.3, d + 0.45].forEach(function (z) { anchors.push(iso(x, y, z)); });
36
+ });
37
+ });
38
+ var floor = [[humanX-0.3,0,-0.3],[w+0.4,0,-0.3],[w+0.4,0,d+0.4],
39
+ [0,0,d+0.4],[humanX-0.3,0,humanZ+0.3]];
40
+ floor.forEach(function (v) { anchors.push(iso.apply(null, v)); });
41
+ var minX = Math.min.apply(null, anchors.map(function (p) { return p[0]; }));
42
+ var maxX = Math.max.apply(null, anchors.map(function (p) { return p[0]; }));
43
+ var minY = Math.min.apply(null, anchors.map(function (p) { return p[1]; }));
44
+ var maxY = Math.max.apply(null, anchors.map(function (p) { return p[1]; }));
45
+ var scale = Math.min(Math.max(1, drawingWidth - 56) / (maxX - minX), Math.max(1, height - 36) / (maxY - minY));
46
+ function point(x, y, z) {
47
+ var p = iso(x, y, z);
48
+ return [drawingWidth / 2 + (p[0] - (minX + maxX) / 2) * scale,
49
+ height / 2 + (p[1] - (minY + maxY) / 2) * scale];
50
+ }
51
+ function path(vertices, fill, stroke, closed) {
52
+ ctx.beginPath();
53
+ vertices.forEach(function (v, i) {
54
+ var p = point(v[0], v[1], v[2]);
55
+ if (i) ctx.lineTo(p[0], p[1]); else ctx.moveTo(p[0], p[1]);
56
+ });
57
+ if (closed !== false) ctx.closePath();
58
+ if (fill) { ctx.fillStyle = fill; ctx.fill(); }
59
+ if (stroke) { ctx.strokeStyle = stroke; ctx.lineWidth = 1; ctx.stroke(); }
60
+ }
61
+ function label(text, p, color) {
62
+ ctx.font = "500 12px system-ui, sans-serif";
63
+ ctx.textAlign = "center"; ctx.textBaseline = "middle";
64
+ var tw = ctx.measureText(text).width + 14;
65
+ // Keep labels readable even on a narrow phone or for very small boxes.
66
+ p[0] = Math.max(tw / 2 + 3, Math.min(width - tw / 2 - 3, p[0]));
67
+ p[1] = Math.max(12, Math.min(height - 12, p[1]));
68
+ ctx.fillStyle = "#0b0f16"; ctx.fillRect(p[0] - tw / 2, p[1] - 10, tw, 20);
69
+ ctx.fillStyle = color || "#c9d9ff"; ctx.fillText(text, p[0], p[1]);
70
+ }
71
+ function dimension(a, b, text, offsetX, offsetY) {
72
+ var p = point.apply(null, a), q = point.apply(null, b);
73
+ var length = Math.hypot(q[0] - p[0], q[1] - p[1]) || 1;
74
+ var nx = -(q[1] - p[1]) / length * 4, ny = (q[0] - p[0]) / length * 4;
75
+ ctx.beginPath(); ctx.moveTo(p[0], p[1]); ctx.lineTo(q[0], q[1]);
76
+ [p, q].forEach(function (v) { ctx.moveTo(v[0] - nx, v[1] - ny); ctx.lineTo(v[0] + nx, v[1] + ny); });
77
+ ctx.strokeStyle = "#adc6ff"; ctx.lineWidth = 1; ctx.stroke();
78
+ label(text, [(p[0] + q[0]) / 2 + offsetX, (p[1] + q[1]) / 2 + offsetY]);
79
+ }
80
+
81
+ // Ground plane and quiet grid, shared by the person and the reference table.
82
+ path(floor, "#151d2b", "#2c384d");
83
+ for (var gx = 0; gx <= w; gx += Math.max(0.25, w / 12))
84
+ path([[gx,0,-0.3],[gx,0,d+0.4]], null, "#202c3f", false);
85
+ for (var gz = 0; gz <= d; gz += Math.max(0.25, d / 12))
86
+ path([[humanX-0.3,0,gz],[w+0.4,0,gz]], null, "#202c3f", false);
87
+ // A shared contact line makes the zero-height plane explicit.
88
+ path([humanPoint(-0.3,0),[0,0,d]], null, "#64748b", false);
89
+ if (base) {
90
+ [[-0.12,-0.12],[w+0.12,-0.12],[-0.12,d+0.12],[w+0.12,d+0.12]].forEach(function (v) {
91
+ path([[v[0],0,v[1]],[v[0],base,v[1]]], null, "#64748b", false);
92
+ });
93
+ path([[-0.16,base,-0.16],[w+0.16,base,-0.16],[w+0.16,base,d+0.16],[-0.16,base,d+0.16]], "#263348", "#64748b");
94
+ }
95
+ // A soft footprint and three translucent faces of the dimensioned volume.
96
+ path([[0,base,0],[w,base,0],[w,base,d],[0,base,d]], "rgba(0,0,0,0.35)");
97
+ path([[0,base,d],[w,base,d],[w,base+h,d],[0,base+h,d]], "rgba(0,91,193,0.32)", "#adc6ff");
98
+ path([[w,base,0],[w,base,d],[w,base+h,d],[w,base+h,0]], "rgba(80,141,229,0.24)", "#adc6ff");
99
+ path([[0,base+h,0],[w,base+h,0],[w,base+h,d],[0,base+h,d]], "rgba(173,198,255,0.25)", "#c9d9ff");
100
+ ctx.setLineDash([3,4]);
101
+ path([[0,base,d],[0,base,0],[w,base,0]], null, "#6b8abd", false);
102
+ path([[0,base,0],[0,base+h,0]], null, "#6b8abd", false);
103
+ ctx.setLineDash([]);
104
+
105
+ // Flat human outline: feet at zero, crown at 1.75 metres.
106
+ var body = [[-.16,1.47],[-.24,1.39],[-.32,.96],[-.24,.93],[-.14,1.23],[-.13,.85],[-.17,0],[-.06,0],[0,.75],[.06,0],[.17,0],[.13,.85],[.14,1.23],[.24,.93],[.32,.96],[.24,1.39],[.16,1.47]];
107
+ path(body.map(function (v) { return humanPoint(v[0], v[1]); }), "rgba(179,198,244,0.18)", "#8d9bb4");
108
+ var head = point(humanX,1.64,humanZ);
109
+ ctx.beginPath(); ctx.ellipse(head[0],head[1],0.1*Math.SQRT2*0.866*scale,0.11*scale,0,0,Math.PI*2);
110
+ ctx.fillStyle = "rgba(179,198,244,0.18)"; ctx.fill(); ctx.strokeStyle = "#8d9bb4"; ctx.stroke();
111
+ label("1.75 m", point(humanX,1.96,humanZ), "#b3c6f4");
112
+ dimension([0,base-.13,d+.2],[w,base-.13,d+.2], data.sizeCm[0] + " cm wide", 0, 12);
113
+ dimension([w+.2,base,0],[w+.2,base+h,0], data.sizeCm[1] + " cm tall", 38, 0);
114
+ dimension([-.18,base,0],[-.18,base,d], data.sizeCm[2] + " cm deep", -35, 8);
115
+
116
+ document.getElementById("engine").textContent = base ? "Table · 75 cm reference" : "Floor placement";
117
+ document.getElementById("hint").textContent = "Human reference · 1.75 m";
118
+ formatEl.textContent = "cm";
119
+ sizeEl.textContent = data.sizeCm.join(" × ") + " cm" + (data.dimensionSource === "estimated" ? " · estimated size" : "");
120
+ sizeEl.hidden = false;
121
+ canvas.setAttribute("aria-label", data.label + ": " + sizeEl.textContent + ". " + data.placement + " placement. Human reference: 1.75 metres.");
122
+ }
123
+ var spaceObserver = typeof ResizeObserver === "function" ? new ResizeObserver(function () {
124
+ if (spaceData && !disposed) drawSpace(spaceData);
125
+ }) : null;
126
+ if (spaceObserver) spaceObserver.observe(canvasWrap);
127
+ `;