@snaptrude/plugin-core 0.9.13 → 0.9.15

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.
Files changed (101) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/api-manifest.full.json +8930 -0
  3. package/api-manifest.json +1002 -55
  4. package/dist/api/core/geom/create/index.d.ts +935 -100
  5. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  6. package/dist/api/core/geom/query/brep.d.ts +59 -2
  7. package/dist/api/core/geom/query/brep.d.ts.map +1 -1
  8. package/dist/api/core/geom/query/curve.d.ts +59 -35
  9. package/dist/api/core/geom/query/curve.d.ts.map +1 -1
  10. package/dist/api/core/geom/query/edge.d.ts +2 -2
  11. package/dist/api/core/geom/query/face.d.ts +105 -0
  12. package/dist/api/core/geom/query/face.d.ts.map +1 -1
  13. package/dist/api/core/geom/update/contour.d.ts +2 -0
  14. package/dist/api/core/geom/update/contour.d.ts.map +1 -1
  15. package/dist/api/core/geom/update/curve.d.ts +5 -5
  16. package/dist/api/core/geom/update/profile.d.ts +3 -1
  17. package/dist/api/core/geom/update/profile.d.ts.map +1 -1
  18. package/dist/api/core/handles/index.d.ts +4 -2
  19. package/dist/api/core/handles/index.d.ts.map +1 -1
  20. package/dist/api/core/index.d.ts +4 -4
  21. package/dist/api/core/index.d.ts.map +1 -1
  22. package/dist/api/core/layers.d.ts +377 -255
  23. package/dist/api/core/layers.d.ts.map +1 -1
  24. package/dist/api/core/proposals/index.d.ts +4 -3
  25. package/dist/api/core/proposals/index.d.ts.map +1 -1
  26. package/dist/api/core/storeys/index.d.ts +12 -0
  27. package/dist/api/core/storeys/index.d.ts.map +1 -1
  28. package/dist/api/core/storeys/layers.d.ts +408 -0
  29. package/dist/api/core/storeys/layers.d.ts.map +1 -0
  30. package/dist/api/core/tags.d.ts +3 -3
  31. package/dist/api/design/create/bulk-items.d.ts +44 -0
  32. package/dist/api/design/create/bulk-items.d.ts.map +1 -1
  33. package/dist/api/design/create/grids.d.ts +1 -1
  34. package/dist/api/design/create/index.d.ts +31 -3
  35. package/dist/api/design/create/index.d.ts.map +1 -1
  36. package/dist/api/design/family.d.ts +67 -10
  37. package/dist/api/design/family.d.ts.map +1 -1
  38. package/dist/api/design/query/geometry/index.d.ts +33 -5
  39. package/dist/api/design/query/geometry/index.d.ts.map +1 -1
  40. package/dist/api/design/query/grids.d.ts +3 -3
  41. package/dist/api/design/query/index.d.ts +47 -0
  42. package/dist/api/design/query/index.d.ts.map +1 -1
  43. package/dist/api/design/query/spaces.d.ts +5 -5
  44. package/dist/api/design/selection/index.d.ts +2 -2
  45. package/dist/api/design/update/index.d.ts +172 -0
  46. package/dist/api/design/update/index.d.ts.map +1 -1
  47. package/dist/api/entity/referenceLine.d.ts +1 -1
  48. package/dist/api/entity/space.d.ts +4 -4
  49. package/dist/api/entity/story.d.ts +4 -4
  50. package/dist/api/presentation/aiInspiration.d.ts +13 -13
  51. package/dist/api/presentation/camera.d.ts +265 -0
  52. package/dist/api/presentation/camera.d.ts.map +1 -0
  53. package/dist/api/presentation/index.d.ts +5 -0
  54. package/dist/api/presentation/index.d.ts.map +1 -1
  55. package/dist/api/presentation/placedViews.d.ts +1 -1
  56. package/dist/api/presentation/views.d.ts +3 -1
  57. package/dist/api/presentation/views.d.ts.map +1 -1
  58. package/dist/api/program/site.d.ts +4 -4
  59. package/dist/api/program/spreadsheet.d.ts +4 -4
  60. package/dist/handles.d.ts +13 -3
  61. package/dist/handles.d.ts.map +1 -1
  62. package/dist/index.cjs +3638 -2958
  63. package/dist/index.cjs.map +1 -1
  64. package/dist/index.d.ts +2 -0
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +3558 -2955
  67. package/dist/index.js.map +1 -1
  68. package/dist/massParameters.d.ts +287 -0
  69. package/dist/massParameters.d.ts.map +1 -0
  70. package/dist/massParameters.ops.d.ts +138 -0
  71. package/dist/massParameters.ops.d.ts.map +1 -0
  72. package/package.json +2 -1
  73. package/scripts/check-dist-fresh.mjs +22 -0
  74. package/scripts/generate-manifest.test.mjs +14 -3
  75. package/src/api/core/geom/create/index.ts +1030 -101
  76. package/src/api/core/geom/query/brep.ts +60 -2
  77. package/src/api/core/geom/query/curve.ts +26 -2
  78. package/src/api/core/geom/query/edge.ts +2 -2
  79. package/src/api/core/geom/query/face.ts +109 -4
  80. package/src/api/core/geom/update/contour.ts +2 -0
  81. package/src/api/core/geom/update/profile.ts +2 -0
  82. package/src/api/core/handles/index.ts +3 -2
  83. package/src/api/core/index.ts +4 -4
  84. package/src/api/core/layers.ts +380 -173
  85. package/src/api/core/proposals/index.ts +4 -3
  86. package/src/api/core/storeys/index.ts +14 -0
  87. package/src/api/core/storeys/layers.ts +339 -0
  88. package/src/api/design/create/bulk-items.ts +68 -0
  89. package/src/api/design/create/index.ts +30 -4
  90. package/src/api/design/family.ts +68 -10
  91. package/src/api/design/query/geometry/index.ts +35 -4
  92. package/src/api/design/query/index.ts +50 -0
  93. package/src/api/design/update/index.ts +186 -1
  94. package/src/api/presentation/camera.ts +289 -0
  95. package/src/api/presentation/index.ts +5 -0
  96. package/src/api/presentation/views.ts +3 -1
  97. package/src/handles.ts +18 -3
  98. package/src/index.ts +2 -0
  99. package/src/massParameters.ops.ts +246 -0
  100. package/src/massParameters.ts +427 -0
  101. package/test/massParameters.test.mjs +952 -0
@@ -0,0 +1,287 @@
1
+ import * as z from "zod";
2
+ import { OperationRecord, ParameterPatchValue } from "./massParameters.ops";
3
+ export * from "./massParameters.ops";
4
+ /**
5
+ * Mass **creation-parameter records** — the recipe a parametric mass was built
6
+ * from, shared verbatim by plugin-core, the Snaptrude host, and the agent
7
+ * runtime. There is one schema, not three hand-kept copies.
8
+ *
9
+ * A record is present on a mass committed from a `core.geom.create` brep
10
+ * constructor that carries a recipe (the four primitives, extrusion,
11
+ * revolution, loft, sweep). A fillet, chamfer, shell or offset of a **recorded**
12
+ * solid keeps the record: `kind` stays the base constructor and the step is
13
+ * appended to the record's `operations` list (see {@linkcode OperationRecord}).
14
+ * The record is absent — `null` — for everything
15
+ * else: drawn masses, imported geometry, booleans, split parts,
16
+ * `brepFromFaces`/`brepFromMesh`, and any operation on a solid that carried no
17
+ * record. Geometry there is not a pure function of a legible parameter set, and
18
+ * a record must never be a lie.
19
+ *
20
+ * Read one with `design.query.getParameters`.
21
+ *
22
+ * Everything here is **pure JSON** by construction — plain objects, numbers and
23
+ * arrays only, one `{x, y, z}` point shape everywhere (no tuples, no class
24
+ * instances): records are persisted by enumerable-field reflection, cloned with
25
+ * `structuredClone`, and round-tripped through the collaboration wire.
26
+ */
27
+ /** A point in space. The single point shape used across every record. */
28
+ export type XYZ = {
29
+ x: number;
30
+ y: number;
31
+ z: number;
32
+ };
33
+ /**
34
+ * One boundary curve of a profile record.
35
+ *
36
+ * The two spline forms are either/or, never both: a curve authored through
37
+ * points carries `splineThrough` (patch the points and the fit re-runs), and a
38
+ * curve with no through-point provenance — read back off an edge, or authored
39
+ * from control vertices — carries `splinePoles` and is re-minted verbatim.
40
+ * There is no variant holding both, so a `throughPoints` edit can never leave
41
+ * stale poles behind.
42
+ */
43
+ export type CurveRecord = {
44
+ type: "line";
45
+ start: XYZ;
46
+ end: XYZ;
47
+ } | {
48
+ type: "arc";
49
+ start: XYZ;
50
+ end: XYZ;
51
+ centre: XYZ;
52
+ axis: XYZ;
53
+ } | {
54
+ type: "circle";
55
+ centre: XYZ;
56
+ axis: XYZ;
57
+ radius: number;
58
+ }
59
+ /** Authored via splineFromPoints / profileFromSplinePoints. The through-points
60
+ * ARE the recipe; regeneration re-runs the fit version named by
61
+ * `fitVersion`. Several chained runs in one contour re-fit as ONE loop; use
62
+ * splinePoles to keep their tangents. */
63
+ | {
64
+ type: "splineThrough";
65
+ fitVersion: 1;
66
+ throughPoints: XYZ[];
67
+ }
68
+ /** No through-points known (authored from control points, or read back off
69
+ * an edge). Rebuilt verbatim from these exact poles, knots and
70
+ * multiplicities. */
71
+ | {
72
+ type: "splinePoles";
73
+ degree: number;
74
+ knots: number[];
75
+ mults: number[];
76
+ poles: XYZ[];
77
+ };
78
+ /** A closed boundary loop, as an ordered list of curves. */
79
+ export type ProfileRecord = {
80
+ curves: CurveRecord[];
81
+ };
82
+ /** An outer loop plus its holes — the cross-section shape of a recipe. */
83
+ export type ContourRecord = {
84
+ outer: ProfileRecord;
85
+ holes: ProfileRecord[];
86
+ };
87
+ /** Optional loft behaviour switches, mirroring `core.geom.create.brepFromLoft`. */
88
+ export type LoftOptions = {
89
+ compatibility?: "strict" | "auto";
90
+ seamAlignment?: "authored" | "auto";
91
+ /** `"ruled"` (default) keeps the sides straight: every pair of sections
92
+ * joined by flat sides. `"smooth"` lofts every section in ONE pass, so the
93
+ * sides curve continuously through the intermediates. */
94
+ smoothing?: "ruled" | "smooth";
95
+ };
96
+ /**
97
+ * How a swept profile turns along its path, mirroring
98
+ * `core.geom.create.brepFromSweepAlongCurve`. `"upright"` keeps the profile's up
99
+ * aligned with world up, `"frenet"` lets it roll with the path's curvature, and
100
+ * `"fixed"` carries the authored frame along unchanged.
101
+ */
102
+ export type SweepOrientation = "frenet" | "fixed" | "upright";
103
+ /** Optional sweep-along-a-curve switches. Pure JSON: the creator's own bag also
104
+ * takes a `rail` curve, which is a live handle and never reaches a record. */
105
+ export type SweepAlongCurveRecordOptions = {
106
+ orientation?: SweepOrientation;
107
+ };
108
+ /** Optional sweep scale law and corner transition, mirroring `core.geom.create.brepFromSweep`. */
109
+ export type SweepOptions = {
110
+ startScale?: number;
111
+ endScale?: number;
112
+ scales?: number[];
113
+ transition?: "miter" | "round" | {
114
+ bevel: number;
115
+ };
116
+ };
117
+ /** A face's surface kind — the vocabulary of `core.geom.query.face.getSurfaceKind`. */
118
+ export type SurfaceKind = "plane" | "cylinder" | "cone" | "sphere" | "torus" | "spline";
119
+ /** An edge's curve kind. Both spline forms of {@linkcode CurveRecord} report `"spline"`. */
120
+ export type CurveKind = "line" | "arc" | "circle" | "spline";
121
+ /**
122
+ * A mass's creation recipe: the constructor `kind`, a schema `version`, the
123
+ * `values` that constructor was called with, and the kernel `operations`
124
+ * (fillet / chamfer / shell / offset) applied on top, in order. Points and axes
125
+ * are in the mass's own local frame when stored; `design.query.getParameters`
126
+ * returns them in world coordinates. `operations` is frame-free. One variant
127
+ * per constructor `kind`; its `values` are that constructor's own arguments.
128
+ *
129
+ * `kind` stays the base constructor even after operations: a shelled, filleted
130
+ * sphere is still `{ kind: "sphere", operations: [shell, fillet] }`.
131
+ */
132
+ export type MassParametersRecord = {
133
+ kind: "sphere";
134
+ version: 1;
135
+ values: {
136
+ centre: XYZ;
137
+ radius: number;
138
+ };
139
+ operations?: OperationRecord[];
140
+ } | {
141
+ kind: "cylinder";
142
+ version: 1;
143
+ values: {
144
+ base: XYZ;
145
+ axis: XYZ;
146
+ radius: number;
147
+ height: number;
148
+ };
149
+ operations?: OperationRecord[];
150
+ } | {
151
+ kind: "cone";
152
+ version: 1;
153
+ values: {
154
+ base: XYZ;
155
+ axis: XYZ;
156
+ baseRadius: number;
157
+ topRadius: number;
158
+ height: number;
159
+ };
160
+ operations?: OperationRecord[];
161
+ } | {
162
+ kind: "torus";
163
+ version: 1;
164
+ values: {
165
+ centre: XYZ;
166
+ axis: XYZ;
167
+ majorRadius: number;
168
+ minorRadius: number;
169
+ };
170
+ operations?: OperationRecord[];
171
+ } | {
172
+ kind: "extrusion";
173
+ version: 1;
174
+ values: {
175
+ contour: ContourRecord;
176
+ direction: XYZ;
177
+ amount: number;
178
+ /** Total rotation base → top about `direction`, through the base
179
+ * contour's centroid, in DEGREES — an angle, never converted. Absent
180
+ * or 0 is a straight extrusion. Positive turns the top CLOCKWISE seen
181
+ * from the far end of `direction` looking back at the base — for the
182
+ * usual upward extrusion, that is the plan view from above. */
183
+ twistInDegrees?: number;
184
+ /** Top outline scale about the same axis, a ratio — never converted.
185
+ * Absent or 1 is a straight extrusion. */
186
+ topScale?: number;
187
+ /** How many sections the twist/taper was built from, a count (2..64).
188
+ * Resolved and stamped at create time, so an existing mass regenerates
189
+ * from the record and never from a heuristic that may change; it is
190
+ * re-resolved (and an echoed value overridden) when an edit changes
191
+ * `twistInDegrees`, so a retwisted mass matches a fresh build of the
192
+ * same angle. Absent exactly when the mass is neither twisted nor
193
+ * tapered. */
194
+ levels?: number;
195
+ };
196
+ operations?: OperationRecord[];
197
+ } | {
198
+ kind: "revolution";
199
+ version: 1;
200
+ values: {
201
+ contour: ContourRecord;
202
+ axisOrigin: XYZ;
203
+ axisDirection: XYZ;
204
+ angleInDegrees: number;
205
+ };
206
+ operations?: OperationRecord[];
207
+ } | {
208
+ kind: "loft";
209
+ version: 1;
210
+ values: {
211
+ sections: ContourRecord[];
212
+ options?: LoftOptions;
213
+ };
214
+ operations?: OperationRecord[];
215
+ } | {
216
+ kind: "sweep";
217
+ version: 1;
218
+ values: {
219
+ profile: ContourRecord;
220
+ path: XYZ[];
221
+ options?: SweepOptions;
222
+ };
223
+ operations?: OperationRecord[];
224
+ } | {
225
+ kind: "sweepAlongCurve";
226
+ version: 1;
227
+ values: {
228
+ profile: ContourRecord;
229
+ path: CurveRecord[];
230
+ options?: SweepAlongCurveRecordOptions;
231
+ };
232
+ operations?: OperationRecord[];
233
+ };
234
+ /**
235
+ * The argument of `design.update.parameters`: either a **partial** of a
236
+ * record's `values` (plus an optional `operations` list) — keys you leave out
237
+ * stay as they are — or the **whole record** you read from
238
+ * `design.query.getParameters`, edited. `kind` and `version` are immutable.
239
+ */
240
+ export type MassParametersPatch = MassParametersRecord | Record<string, ParameterPatchValue>;
241
+ /** Maximum through-points in one authored spline curve record. */
242
+ export declare const MAX_SPLINE_THROUGH_POINTS = 256;
243
+ /** Maximum control points in one exact-NURBS spline curve record. */
244
+ export declare const MAX_SPLINE_POLES = 512;
245
+ /** Maximum path points in a sweep record. */
246
+ export declare const MAX_SWEEP_PATH_POINTS = 512;
247
+ /** Maximum path curves in a sweep-along-a-curve record. */
248
+ export declare const MAX_PATH_CURVES = 64;
249
+ /** Maximum cross-sections in a loft record. */
250
+ export declare const MAX_LOFT_SECTIONS = 32;
251
+ /** Maximum sections a twisted or tapered extrusion record is built from. */
252
+ export declare const MAX_TWIST_LEVELS = 64;
253
+ /** Maximum boundary curves in one profile loop record. */
254
+ export declare const MAX_PROFILE_CURVES = 256;
255
+ /** Maximum hole loops in one contour record. */
256
+ export declare const MAX_CONTOUR_HOLES = 64;
257
+ /** A point in space — `{ x, y, z }`, all finite. */
258
+ export declare const XYZ: z.ZodType<XYZ, XYZ>;
259
+ /** One boundary curve of a profile record. See {@linkcode CurveRecord}. */
260
+ export declare const CurveRecord: z.ZodType<CurveRecord, CurveRecord>;
261
+ /** A closed boundary loop. See {@linkcode ProfileRecord}. */
262
+ export declare const ProfileRecord: z.ZodType<ProfileRecord, ProfileRecord>;
263
+ /** An outer loop plus its holes. See {@linkcode ContourRecord}. */
264
+ export declare const ContourRecord: z.ZodType<ContourRecord, ContourRecord>;
265
+ /** Optional loft behaviour switches. See {@linkcode LoftOptions}. */
266
+ export declare const LoftOptions: z.ZodType<LoftOptions, LoftOptions>;
267
+ /** See {@linkcode SweepAlongCurveRecordOptions}. */
268
+ export declare const SweepAlongCurveRecordOptions: z.ZodType<SweepAlongCurveRecordOptions, SweepAlongCurveRecordOptions>;
269
+ /** Optional sweep scale law and corner transition. See {@linkcode SweepOptions}. */
270
+ export declare const SweepOptions: z.ZodType<SweepOptions, SweepOptions>;
271
+ /**
272
+ * A mass's creation recipe. See {@linkcode MassParametersRecord}.
273
+ *
274
+ * `version` is a literal `1`: a restore that reads an unknown version fails
275
+ * `safeParse` and the mass degrades to non-parametric — editability is lost,
276
+ * geometry never is, and load is never blocked. Future versions add a migration
277
+ * at the restore site.
278
+ */
279
+ export declare const MassParametersRecord: z.ZodType<MassParametersRecord, MassParametersRecord>;
280
+ /**
281
+ * The argument of `design.update.parameters`. See {@linkcode MassParametersPatch}.
282
+ * The full-record form is recognised by carrying both `kind` and `values`;
283
+ * which keys a kind actually has is checked host-side, where the error can name
284
+ * them.
285
+ */
286
+ export declare const MassParametersPatch: z.ZodType<MassParametersPatch, MassParametersPatch>;
287
+ //# sourceMappingURL=massParameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"massParameters.d.ts","sourceRoot":"","sources":["../src/massParameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAkB,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAM3F,cAAc,sBAAsB,CAAA;AAEpC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,yEAAyE;AACzE,MAAM,MAAM,GAAG,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AAC5D;;;0CAG0C;GACxC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,UAAU,EAAE,CAAC,CAAC;IAAC,aAAa,EAAE,GAAG,EAAE,CAAA;CAAE;AAChE;;sBAEsB;GACpB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,GAA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;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,mBAAmB,CAGlF,CAAA"}
@@ -0,0 +1,138 @@
1
+ import * as z from "zod";
2
+ import { ContourRecord, CurveRecord, LoftOptions, SweepAlongCurveRecordOptions, SweepOptions, XYZ } from "./massParameters";
3
+ import type { CurveKind, SurfaceKind } from "./massParameters";
4
+ /**
5
+ * The **operation half** of a mass creation-parameter record: which edge or
6
+ * face of the recipe's solid a kernel step used, the step itself, and the
7
+ * values a `design.update.parameters` patch may carry.
8
+ *
9
+ * Split out of `massParameters.ts` so that each file stays under the size limit
10
+ * at which the agent runtime still serves a type module in ONE whole read (the
11
+ * record module alone had grown past it). Do not merge the two back. It is
12
+ * re-exported from there and from the package root, so every import path keeps
13
+ * working.
14
+ *
15
+ * Everything here is **pure JSON** by construction, exactly as in
16
+ * {@linkcode MassParametersRecord}: plain objects, numbers and arrays only, one
17
+ * `{x, y, z}` point shape, no class instances.
18
+ */
19
+ /** Maximum kernel operations chained onto one recipe. */
20
+ export declare const MAX_OPERATIONS = 8;
21
+ /** Maximum edges one fillet/chamfer operation may select. */
22
+ export declare const MAX_OPERATION_EDGES = 64;
23
+ /** Maximum faces one shell operation may open. */
24
+ export declare const MAX_OPERATION_FACES = 32;
25
+ /** Maximum rows in a variable-fillet radius law. */
26
+ export declare const MAX_FILLET_LAW_SAMPLES = 32;
27
+ /**
28
+ * Which EDGE of the input solid an operation used: its index in
29
+ * `core.geom.query.brep.listEdges` order at authoring time, the indices of the
30
+ * two faces it lies between, and its curve kind. This is topology, not
31
+ * coordinates — it survives a scalar edit of the base recipe (which moves every
32
+ * edge) and trips on a reorder or a topology change. Read-only: to blend a
33
+ * different edge, re-select it on the new shape and re-apply the operation.
34
+ */
35
+ export type EdgeSelector = {
36
+ index: number;
37
+ faces: [number, number];
38
+ curve: CurveKind;
39
+ /** Where the edge sits INSIDE its solid: its midpoint in the record's own
40
+ * frame, divided by the solid's bounding-box extent — a ratio per axis,
41
+ * never a length, so it survives a scalar edit that scales the whole shape.
42
+ * Written only when the discriminators above cannot tell two edges apart. A
43
+ * tiebreak, never a coordinate fingerprint: a replay checks it within 0.02 of
44
+ * the solid's own box and refuses on a miss — it never searches for a better
45
+ * candidate. */
46
+ at?: XYZ;
47
+ };
48
+ /**
49
+ * Which FACE of the input solid an operation used: its index in
50
+ * `core.geom.query.brep.listFaces` order, its surface kind, and the number of
51
+ * edges in its outer loop. Read-only, like {@linkcode EdgeSelector}.
52
+ */
53
+ export type FaceSelector = {
54
+ index: number;
55
+ kind: SurfaceKind;
56
+ edgeCount: number;
57
+ /** The face's centroid under the same normalisation and the same tiebreak
58
+ * rule as {@linkcode EdgeSelector}'s `at` — written only where the
59
+ * discriminators above cannot separate two faces, which on a freeform solid
60
+ * (every face answers `"spline"`) is the common case. */
61
+ at?: XYZ;
62
+ };
63
+ /** The input solid's topology at authoring time — the counts a replay checks first. */
64
+ export type TopologyCounts = {
65
+ faceCount: number;
66
+ edgeCount: number;
67
+ };
68
+ /**
69
+ * One kernel operation applied to the base recipe's solid, in order. `input`
70
+ * pins the topology the operation was authored against, so a base edit that
71
+ * changes the topology is refused rather than mis-applied.
72
+ *
73
+ * Edit one by patching the whole list back:
74
+ * `design.update.parameters(mass, { operations })`.
75
+ */
76
+ export type OperationRecord = {
77
+ op: "fillet";
78
+ edges: EdgeSelector[];
79
+ radius: number;
80
+ /** Radius at the far end of the blend contour, internal length units — a
81
+ * linear variable blend from `radius`. One edge, and never with `radii`. */
82
+ endRadius?: number;
83
+ /** The blend's radius law instead: `position` is normalised arc length
84
+ * along the blend contour (a ratio 0..1, never converted), `radius` is
85
+ * internal length units. 2..32 rows, strictly increasing `position`.
86
+ * One edge, and never with `endRadius`. */
87
+ radii?: {
88
+ position: number;
89
+ radius: number;
90
+ }[];
91
+ input: TopologyCounts;
92
+ } | {
93
+ op: "chamfer";
94
+ edges: EdgeSelector[];
95
+ distance: number;
96
+ input: TopologyCounts;
97
+ } | {
98
+ op: "shell";
99
+ openFaces: FaceSelector[];
100
+ thickness: number;
101
+ input: TopologyCounts;
102
+ } | {
103
+ op: "offset";
104
+ distance: number;
105
+ input: TopologyCounts;
106
+ };
107
+ /**
108
+ * One value of a `MassParametersPatch` — whatever a record's `values` key (or
109
+ * `operations`) may hold. Each key you send replaces that value whole — a
110
+ * scalar, a point, a list or a record (`contour`, `profile`, `sections`,
111
+ * `path`, `options`, `operations`) alike — so send the complete value you read.
112
+ */
113
+ export type ParameterPatchValue = number | XYZ | XYZ[] | ContourRecord | ContourRecord[] | CurveRecord[] | LoftOptions | SweepOptions | SweepAlongCurveRecordOptions | OperationRecord[];
114
+ /** See {@linkcode EdgeSelector}. */
115
+ export declare const EdgeSelector: z.ZodType<EdgeSelector, EdgeSelector>;
116
+ /** See {@linkcode FaceSelector}. */
117
+ export declare const FaceSelector: z.ZodType<FaceSelector, FaceSelector>;
118
+ /** See {@linkcode TopologyCounts}. */
119
+ export declare const TopologyCounts: z.ZodType<TopologyCounts, TopologyCounts>;
120
+ /**
121
+ * See {@linkcode OperationRecord}.
122
+ *
123
+ * A variable fillet — `endRadius` or `radii` — names ONE edge: the law is a
124
+ * property of the blend contour that edge belongs to, and `position` is measured
125
+ * from that edge's start, so a second edge would have no origin. The two forms
126
+ * are mutually exclusive and `radii` rows run strictly forward.
127
+ */
128
+ export declare const OperationRecord: z.ZodType<OperationRecord, OperationRecord>;
129
+ /**
130
+ * One value of a parameter patch. See {@linkcode ParameterPatchValue}.
131
+ *
132
+ * Deliberately a CLOSED union of the shapes a record's `values` actually hold —
133
+ * no `z.unknown()`, nothing recursive: an unrecognised value is a VALIDATION at
134
+ * the wire, not a silent write of nonsense onto a mass. It only ever widens, so
135
+ * every value it accepted before it still accepts.
136
+ */
137
+ export declare const ParameterPatchValue: z.ZodType<ParameterPatchValue, ParameterPatchValue>;
138
+ //# sourceMappingURL=massParameters.ops.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mass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C,OAAO,CAAC,mBAAmB,EAAE,mBAAmB,CAanF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snaptrude/plugin-core",
3
- "version": "0.9.13",
3
+ "version": "0.9.15",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -32,6 +32,7 @@
32
32
  "build": "tsup --clean",
33
33
  "dev": "tsup --watch",
34
34
  "clean-dist": "rm -rf dist",
35
+ "pretest": "node scripts/check-dist-fresh.mjs",
35
36
  "test": "node --test test/*.test.mjs",
36
37
  "generate:manifest": "node scripts/generate-manifest.mjs",
37
38
  "generate:manifest:check": "node scripts/generate-manifest.mjs --check",
@@ -0,0 +1,22 @@
1
+ // `npm test` imports ../dist; refuse to run against a build older than the source.
2
+ // A check, not a rebuild: the host dev checkout symlinks this package, so a
3
+ // rebuild here would blank `dist` under a running editor.
4
+ import { readdirSync, statSync } from "node:fs";
5
+ import { join } from "node:path";
6
+
7
+ const newest = (dir) =>
8
+ readdirSync(dir, { withFileTypes: true }).reduce((max, entry) => {
9
+ const path = join(dir, entry.name);
10
+ return Math.max(max, entry.isDirectory() ? newest(path) : statSync(path).mtimeMs);
11
+ }, 0);
12
+
13
+ let built = 0;
14
+ try {
15
+ built = statSync("dist/index.js").mtimeMs;
16
+ } catch {
17
+ // no dist at all
18
+ }
19
+ if (newest("src") > built) {
20
+ console.error("dist is older than src — run `pnpm build` (tsup --clean) first, then test.");
21
+ process.exit(1);
22
+ }
@@ -103,8 +103,8 @@ test("promoted methods are present in the manifest", () => {
103
103
  "presentation.views.capture",
104
104
  "presentation.views.setActive",
105
105
  "presentation.views.create",
106
- "core.layers.setActive",
107
- "core.layers.update",
106
+ "core.storeys.layers.setActive",
107
+ "core.storeys.layers.update",
108
108
  "program.areas.update",
109
109
  // 2026-07-06 promotions — analysis namespace + program.site geo reads,
110
110
  // react hosts landed:
@@ -161,6 +161,10 @@ test("v2 family reads (all 5 families) are present with intent + prompts", () =>
161
161
  "core.buildings.get",
162
162
  "core.buildings.listStoreys",
163
163
  "core.buildings.getActive",
164
+ "core.storeys.layers.list",
165
+ "core.storeys.layers.get",
166
+ "core.storeys.layers.getActive",
167
+ // core.layers — the Layers panel (0.9.14)
164
168
  "core.layers.list",
165
169
  "core.layers.get",
166
170
  "core.layers.getActive",
@@ -200,8 +204,15 @@ test("v2 family writes are IN the discovery manifest (hosts landed, promoted)",
200
204
  "core.buildings.update",
201
205
  "core.buildings.copy",
202
206
  "core.buildings.delete",
203
- "core.layers.setActive",
207
+ "core.storeys.layers.setActive",
208
+ "core.storeys.layers.update",
209
+ // core.layers — the Layers panel (0.9.14)
210
+ "core.layers.create",
211
+ "core.layers.rename",
204
212
  "core.layers.update",
213
+ "core.layers.setActive",
214
+ "core.layers.delete",
215
+ "core.layers.assign",
205
216
  "core.tags.createCategory",
206
217
  "core.tags.updateCategory",
207
218
  "core.tags.deleteCategory",