@mulmoclaude/shapescript-plugin 2.4.0 → 2.5.1

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.
@@ -3,7 +3,7 @@ import type { ToolPlugin } from "gui-chat-protocol/vue";
3
3
  import type { PresentShapeScriptData, PresentShapeScriptArgs } from "../core/types";
4
4
  import View from "./View.vue";
5
5
  import Preview from "./Preview.vue";
6
- export declare const SYSTEM_PROMPT = "Use the presentShapeScript tool to create interactive 3D visualizations when the user requests:\n- 3D models or shapes\n- Mathematical visualizations (surfaces, functions, geometric patterns)\n- Molecular or atomic structures\n- Data visualization in 3D (scatter plots, surface plots)\n- Architectural layouts\n- Game boards or 3D game states\n- Any spatial or geometric concepts\n\n## Supported ShapeScript Features:\n\n### Variables & Expressions:\n- Define variables: define radius 2, define spacing 1.5\n- Use expressions: position (i * 2) 0 0, size (radius * 1.5)\n- Math operators: +, -, *, /, % with proper precedence\n- Parentheses for grouping: (2 + 3) * 4\n\n### Control Flow:\n\nFor loops with variables (use loop variable in calculations):\nfor i in 1 to 5 {\n cube {\n position (i * 2 - 6) 0 0\n size 1\n }\n}\n\nFor loops with step:\nfor i in 0 to 10 step 2 {\n sphere { position 0 i 0 }\n}\n\nIf/else conditionals:\nif x > 0 {\n sphere\n} else {\n cube\n}\n\nSwitch statements for multiple cases\n\n### Built-in Functions:\n- Math: round, floor, ceil, abs, sign, sqrt, pow, min, max\n- Trig: sin, cos, tan, asin, acos, atan, atan2 (radians!)\n- Vector: dot, cross, length, normalize, sum\n\nCalls: C-like max(0 (j - 1)) with NO space before the parenthesis, or bare max 0 (j - 1) / sqrt 9 as upstream.\nSeparate arguments with spaces. Commas work here but not in the upstream app.\nCustom functions return a value (define hyp(a b) { sqrt(a * a + b * b) }) or the shapes they build (define face(d) { polygon { \u2026 } }).\nOne statement per line; the upstream app rejects two statements on one line.\n\n### Best Practices:\n1. Use variables for repeated values\n2. Use loop variables (i) for positioning and calculations\n3. Use trig functions for circular/spiral patterns\n4. Use conditionals for parametric designs\n5. Keep code readable with meaningful variable names\n\n### Common Patterns:\n\nLinear arrangement:\nfor i in 1 to 5 {\n cube { position (i * 2) 0 0 }\n}\n\nCircular pattern:\ndefine count 12\nfor i in 1 to count {\n define angle ((i / count) * 6.283)\n cube { position (cos(angle) * 3) 0 (sin(angle) * 3) }\n}\n\nParametric surface:\nfor x in -5 to 5 {\n for z in -5 to 5 {\n define y (sin(x * 0.5) * cos(z * 0.5))\n cube {\n position (x * 0.3) y (z * 0.3)\n size 0.2\n }\n }\n}\n\n### Primitives & CSG:\nShapes: cube, sphere, icosphere, cylinder, cone, torus, circle, square, roundrect, polygon\nCSG: union, difference, intersection, xor, stencil\nProperties: position, orientation (alias rotation), size, detail, smoothing, name\nMaterials: color (1\u20134 values, hex #FF0000, names like red/orange/gray, hsb(...)), opacity, metallicity, roughness, glow,\nmaterial NAME (from define NAME material { \u2026 }); background R G B sets the scene colour.\nScope: shape blocks, groups, builders and custom blocks reset transforms/materials at their closing brace;\nfor / if / switch bodies do not (a translate in a loop carries on after it).\n\n### Units (upstream ShapeScript conventions):\n- size = DIAMETER for sphere/cylinder/cone/circle/polygon/torus, edge length for cube/square. A bare sphere fits the unit cube.\n- orientation / rotate = HALF-TURNS as roll yaw pitch (Z, Y, X): 0.5 = 90\u00B0. A lone value is a roll. Trig functions still use radians.\n- Path point/curve coordinates are absolute; curve is a B\u00E9zier control point; rotate/translate/scale inside a path move the frame.\n- A path can carry its own position/orientation/size; give loft/extrude path children (not fill{}), as the upstream app requires.\n\nBuilders: extrude, fill, lathe, loft, hull. Example:\nloft {\n square\n translate 0 0 2\n circle\n}\nStencil preserves the first shape's volume and paints the intersecting surface.\nConstants: pi, true, false (avoid tau, upstream lacks it; write 2 * pi). Tuple/string access: values[0], values[-1], vector.x, value.count.\nRanges are values (define r 1 to 5 step 2; for i in r; if 3 in r). A bare path draws as a line; fill/extrude it for a surface.\nPolygon supports sides (3\u2013256). String literals and join/split/trim are supported. print records output for you.\nUse the tool schema for exact syntax and builder limits. This is a modeling subset of upstream ShapeScript;\nimports, svgpath and object values are refused by name;\ntext \"Hello\" makes glyph outlines (built-in font; font is ignored) from x 0 on baseline y 0, one unit per line \u2014 fill or\nextrude it for faces/solids, text { size 0.3 \"Two\" \"lines\" } for size and lines, t.bounds.width to centre it;\nminkowski { a b } sums shapes, inset(mesh d) offsets a mesh value's faces (together they round edges),\nextrude { section along path } sweeps a section, and an open extrude path makes a wall (close it for a solid);\nshapes are values (define ico icosphere { detail 0 }; ico.polygons, .bounds, .volume), for/if work as expressions,\nfunctions may build shapes, and mesh { polygon { point \u2026 } } builds a mesh from explicit faces;\ntextures, cameras and lights are accepted but not drawn (the result reports them).\nIf presentShapeScript returns an error diagnostic, correct the script and retry; no visualization was created.\n\nKeep visualizations clear, well-organized, and use expressions and control flow.";
6
+ export declare const SYSTEM_PROMPT = "Use the presentShapeScript tool to create interactive 3D visualizations when the user requests:\n- 3D models or shapes\n- Mathematical visualizations (surfaces, functions, geometric patterns)\n- Molecular or atomic structures\n- Data visualization in 3D (scatter plots, surface plots)\n- Architectural layouts\n- Game boards or 3D game states\n- Any spatial or geometric concepts\n\n## Supported ShapeScript Features:\n\n### Variables & Expressions:\n- Define variables: define radius 2, define spacing 1.5\n- Use expressions: position (i * 2) 0 0, size (radius * 1.5)\n- Math operators: +, -, *, /, % with proper precedence\n- Parentheses for grouping: (2 + 3) * 4\n\n### Control Flow:\n\nFor loops with variables (use loop variable in calculations):\nfor i in 1 to 5 {\n cube {\n position (i * 2 - 6) 0 0\n size 1\n }\n}\n\nFor loops with step:\nfor i in 0 to 10 step 2 {\n sphere { position 0 i 0 }\n}\n\nIf/else conditionals:\nif x > 0 {\n sphere\n} else {\n cube\n}\n\nSwitch statements for multiple cases\n\n### Built-in Functions:\n- Math: round, floor, ceil, abs, sign, sqrt, pow, min, max\n- Trig: sin, cos, tan, asin, acos, atan, atan2 (radians!)\n- Vector: dot, cross, length, normalize, sum\n\nCalls: C-like max(0 (j - 1)) with NO space before the parenthesis, or bare max 0 (j - 1) / sqrt 9 as upstream.\nSeparate arguments with spaces. Commas work here but not in the upstream app.\nCustom functions return a value (define hyp(a b) { sqrt(a * a + b * b) }) or the shapes they build (define face(d) { polygon { \u2026 } }).\nONE STATEMENT PER LINE: sphere { position 0 1 0 size 2 } is refused, here and in the upstream app \u2014 put each\nproperty, point and shape on its own line (a block may open on its statement's line).\n\n### Best Practices:\n1. Use variables for repeated values\n2. Use loop variables (i) for positioning and calculations\n3. Use trig functions for circular/spiral patterns\n4. Use conditionals for parametric designs\n5. Keep code readable with meaningful variable names\n\n### Common Patterns:\n\nLinear arrangement:\nfor i in 1 to 5 {\n cube { position (i * 2) 0 0 }\n}\n\nCircular pattern:\ndefine count 12\nfor i in 1 to count {\n define angle ((i / count) * 6.283)\n cube { position (cos(angle) * 3) 0 (sin(angle) * 3) }\n}\n\nParametric surface:\nfor x in -5 to 5 {\n for z in -5 to 5 {\n define y (sin(x * 0.5) * cos(z * 0.5))\n cube {\n position (x * 0.3) y (z * 0.3)\n size 0.2\n }\n }\n}\n\n### Primitives & CSG:\nShapes: cube, sphere, icosphere, cylinder, cone, torus, circle, square, roundrect, polygon\nCSG: union, difference, intersection, xor, stencil\nProperties: position, orientation (alias rotation), size, detail, smoothing, name\nMaterials: color (1\u20134 values, hex #FF0000, names like red/orange/gray, hsb(...)), opacity, metallicity, roughness, glow,\nmaterial NAME (from define NAME material { \u2026 }); background R G B sets the scene colour.\nScope: shape blocks, groups, builders and custom blocks reset transforms/materials at their closing brace;\nfor / if / switch bodies do not (a translate in a loop carries on after it).\n\n### Units (upstream ShapeScript conventions):\n- size = DIAMETER for sphere/cylinder/cone/circle/polygon/torus, edge length for cube/square. A bare sphere fits the unit cube.\n- orientation / rotate = HALF-TURNS as roll yaw pitch (Z, Y, X): 0.5 = 90\u00B0. A lone value is a roll. Trig functions still use radians.\n- Path point/curve coordinates are absolute; curve is a B\u00E9zier control point; rotate/translate/scale inside a path move the frame.\n- A path can carry its own position/orientation/size; give loft/extrude path children (not fill{}), as the upstream app requires.\n\nBuilders: extrude, fill, lathe, loft, hull. Example:\nloft {\n square\n translate 0 0 2\n circle\n}\nStencil preserves the first shape's volume and paints the intersecting surface.\nConstants: pi, true, false (no tau; write 2 * pi). Tuple/string access: values[0], values[-1], vector.x, value.count.\nRanges are values (define r 1 to 5 step 2; for i in r; if 3 in r). A bare path draws as a line; fill/extrude it for a surface.\nPolygon supports sides (3\u2013256). String literals and join/split/trim are supported. print records output for you.\nUse the tool schema for exact syntax and builder limits. This is a modeling subset of upstream ShapeScript;\nimports, svgpath and object values are refused by name;\ntext \"Hello\" makes glyph outlines (built-in font; font is ignored) from x 0 on baseline y 0, one unit per line \u2014 fill or\nextrude it for faces/solids, a text block with size and one \"line\" per line, t.bounds.width to centre it;\nminkowski { a b } sums shapes, inset(mesh d) offsets a mesh value's faces (together they round edges),\nextrude { section along path } sweeps a section, and an open extrude path makes a wall (close it for a solid);\nshapes are values (define ico icosphere { detail 0 }; ico.polygons, .bounds, .volume), for/if work as expressions,\nfunctions may build shapes, and mesh { polygon { \u2026 } } with one point per line builds a mesh from explicit faces;\ntextures, cameras and lights are accepted but not drawn (the result reports them).\nIf presentShapeScript returns an error diagnostic, correct the script and retry; no visualization was created.\n\nKeep visualizations clear, well-organized, and use expressions and control flow.";
7
7
  export declare const plugin: ToolPlugin<PresentShapeScriptData, unknown, PresentShapeScriptArgs>;
8
8
  export type { PresentShapeScriptData, PresentShapeScriptArgs, PresentShapeScriptResult, PresentShapeScriptRenderedResult, PresentShapeScriptErrorResult, PresentShapeScriptExecutionResult, ShapeScriptDiagnostic, } from "../core/types";
9
9
  export { TOOL_NAME, TOOL_DEFINITION } from "../core/definition";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uB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