@snaptrude/plugin-core 0.0.0-dev-20260908074328 → 0.0.0-dev-20260911064951

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 (55) hide show
  1. package/CHANGELOG.md +18 -16
  2. package/dist/api/core/io/import/index.d.ts +3 -1
  3. package/dist/api/core/io/import/index.d.ts.map +1 -1
  4. package/dist/api/design/create/bulk-items.d.ts +185 -0
  5. package/dist/api/design/create/bulk-items.d.ts.map +1 -0
  6. package/dist/api/design/create/index.d.ts +315 -50
  7. package/dist/api/design/create/index.d.ts.map +1 -1
  8. package/dist/api/design/create/opening-fields.d.ts +37 -0
  9. package/dist/api/design/create/opening-fields.d.ts.map +1 -0
  10. package/dist/api/design/delete/index.d.ts +6 -20
  11. package/dist/api/design/delete/index.d.ts.map +1 -1
  12. package/dist/api/design/dimensions.d.ts +427 -0
  13. package/dist/api/design/dimensions.d.ts.map +1 -0
  14. package/dist/api/design/doors/index.d.ts +20 -13
  15. package/dist/api/design/doors/index.d.ts.map +1 -1
  16. package/dist/api/design/index.d.ts +5 -0
  17. package/dist/api/design/index.d.ts.map +1 -1
  18. package/dist/api/design/query/index.d.ts +0 -2
  19. package/dist/api/design/query/index.d.ts.map +1 -1
  20. package/dist/api/design/query/spaces.d.ts +0 -61
  21. package/dist/api/design/query/spaces.d.ts.map +1 -1
  22. package/dist/api/entity/space.d.ts +0 -3
  23. package/dist/api/entity/space.d.ts.map +1 -1
  24. package/dist/api/presentation/annotate.d.ts +2 -2
  25. package/dist/api/presentation/placedViews.d.ts +1 -35
  26. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  27. package/dist/api/presentation/shapes.d.ts +2 -2
  28. package/dist/api/presentation/sheets.d.ts +2 -20
  29. package/dist/api/presentation/sheets.d.ts.map +1 -1
  30. package/dist/errors/codes.d.ts +3 -8
  31. package/dist/errors/codes.d.ts.map +1 -1
  32. package/dist/handles.d.ts +19 -0
  33. package/dist/handles.d.ts.map +1 -1
  34. package/dist/index.cjs +2031 -1940
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.js +2008 -1935
  37. package/dist/index.js.map +1 -1
  38. package/package.json +1 -1
  39. package/src/api/core/io/import/index.ts +11 -3
  40. package/src/api/design/create/bulk-items.ts +186 -0
  41. package/src/api/design/create/index.ts +341 -70
  42. package/src/api/design/create/opening-fields.ts +37 -0
  43. package/src/api/design/delete/index.ts +5 -20
  44. package/src/api/design/dimensions.ts +453 -0
  45. package/src/api/design/doors/index.ts +20 -13
  46. package/src/api/design/index.ts +5 -0
  47. package/src/api/design/query/index.ts +0 -2
  48. package/src/api/design/query/spaces.ts +0 -68
  49. package/src/api/entity/space.ts +0 -2
  50. package/src/api/presentation/placedViews.ts +1 -29
  51. package/src/api/presentation/sheets.ts +3 -19
  52. package/src/errors/codes.ts +2 -30
  53. package/src/handles.ts +24 -0
  54. package/test/errors.test.mjs +0 -4
  55. package/snaptrude-plugin-core-0.11.0.tgz +0 -0
@@ -124,41 +124,6 @@ export abstract class PluginDesignQuerySpacesApi {
124
124
  public abstract getEnclosure(
125
125
  space: ComponentHandle,
126
126
  ): PluginApiReturn<PluginSpaceEnclosure | null>
127
-
128
- /**
129
- * List the space's **engine-generated BIM components** — the walls, floors
130
- * and slabs the parametric engine derived from this space, grouped by kind.
131
- *
132
- * Unlike {@linkcode getEnclosure} (a geometric best-effort match), this read
133
- * reports the engine's own derivation records, so every returned handle is a
134
- * component the engine created *for this space*.
135
- *
136
- * The derived set is NOT stable across writes: a merge/split/rebuild of the
137
- * space graph retires members and creates successors — re-query after any
138
- * write that touches the space. This is the churn-recovery anchor: when a
139
- * cached derived handle goes stale, call this again to pick up the current
140
- * set.
141
- *
142
- * @param space - The space (room mass) to read
143
- * @returns the generated component handles, grouped by kind
144
- * ({@linkcode PluginSpaceGeneratedBim}); a group is `[]` when the engine
145
- * derived nothing of that kind
146
- * @throws If the space does not exist or the component is not a space/mass
147
- *
148
- * @examplePrompt Which walls did this room generate?
149
- * @examplePrompt List the BIM components derived from the selected space
150
- * @examplePrompt Get the floors and slabs that belong to this room
151
- *
152
- * # Example
153
- * ```ts
154
- * const [space] = await snaptrude.design.query.listSpaces()
155
- * const bim = await snaptrude.design.query.spaces.listGeneratedBim(space)
156
- * console.log(`${bim.walls.length} walls, ${bim.floors.length} floors`)
157
- * ```
158
- */
159
- public abstract listGeneratedBim(
160
- space: ComponentHandle,
161
- ): PluginApiReturn<PluginSpaceGeneratedBim>
162
127
  }
163
128
 
164
129
  /**
@@ -308,36 +273,3 @@ export const PluginSpaceEnclosure = z.object({
308
273
  adjacentSpaces: z.array(PluginAdjacentSpace),
309
274
  })
310
275
  export type PluginSpaceEnclosure = z.infer<typeof PluginSpaceEnclosure>
311
-
312
- /**
313
- * Arguments for {@linkcode PluginDesignQuerySpacesApi.listGeneratedBim}.
314
- *
315
- * | Property | Type | Description |
316
- * |---|---|---|
317
- * | `space` | {@linkcode ComponentHandle} | The space (room mass) to read |
318
- */
319
- export const PluginDesignQuerySpacesListGeneratedBimArgs = z.object({
320
- space: ComponentHandle,
321
- })
322
- export type PluginDesignQuerySpacesListGeneratedBimArgs = z.infer<
323
- typeof PluginDesignQuerySpacesListGeneratedBimArgs
324
- >
325
-
326
- /**
327
- * Result of {@linkcode PluginDesignQuerySpacesApi.listGeneratedBim} — the
328
- * space's engine-generated BIM component handles, grouped by kind. The set
329
- * changes whenever a write merges/splits/rebuilds the space graph — re-query
330
- * after writes rather than caching it.
331
- *
332
- * | Property | Type | Description |
333
- * |---|---|---|
334
- * | `walls` | {@linkcode ComponentHandle}`[]` | Walls the engine derived from the space |
335
- * | `floors` | {@linkcode ComponentHandle}`[]` | Floors the engine derived from the space |
336
- * | `slabs` | {@linkcode ComponentHandle}`[]` | Slabs the engine derived from the space |
337
- */
338
- export const PluginSpaceGeneratedBim = z.object({
339
- walls: z.array(ComponentHandle),
340
- floors: z.array(ComponentHandle),
341
- slabs: z.array(ComponentHandle),
342
- })
343
- export type PluginSpaceGeneratedBim = z.infer<typeof PluginSpaceGeneratedBim>
@@ -434,7 +434,6 @@ export type PluginSpaceUpdateArgs = z.infer<typeof PluginSpaceUpdateArgs>
434
434
  * | `massType` | `string?` | Updated mass type (if changed) |
435
435
  * | `spaceType` | `string?` | Updated space type (if changed) |
436
436
  * | `departmentId` | `string \| null?` | Updated department ID (if changed) |
437
- * | `rebuilt` | `boolean?` | `true` when a geometry update rebuilt the space's derived BIM — hosted children were re-created and the previous derived handles are retired (re-query them) |
438
437
  */
439
438
  export const PluginSpaceUpdateResult = z.object({
440
439
  spaceId: z.string(),
@@ -443,7 +442,6 @@ export const PluginSpaceUpdateResult = z.object({
443
442
  spaceType: z.string().optional(),
444
443
  areaClass: PluginAreaClass.optional(),
445
444
  departmentId: z.string().nullable().optional(),
446
- rebuilt: z.boolean().optional(),
447
445
  })
448
446
 
449
447
  export type PluginSpaceUpdateResult = z.infer<typeof PluginSpaceUpdateResult>
@@ -1,6 +1,6 @@
1
1
  import * as z from "zod"
2
2
  import { PluginApiReturn } from "../../types"
3
- import { PluginSheetPosition, PluginViewLod } from "./sheets"
3
+ import { PluginSheetPosition } from "./sheets"
4
4
 
5
5
  /**
6
6
  * Placed views — the view shapes already laid out on the Present canvas.
@@ -613,23 +613,6 @@ export abstract class PluginPresentationPlacedViewsApi {
613
613
  shapeId: string,
614
614
  enabled: boolean,
615
615
  ): PluginApiReturn<void>
616
-
617
- /**
618
- * Set the level of detail a placed view renders at — `"design"` (the
619
- * Design-mode massing representation) or `"bim"` (the detailed BIM
620
- * representation). Views only. Undoable. Requires Present mode to be open.
621
- *
622
- * @param shapeId - The placed view shape.
623
- * @param lod - Target level of detail.
624
- * @throws If Present mode is not open or `shapeId` is not a placed view.
625
- *
626
- * @examplePrompt Switch this placed view to the BIM level of detail
627
- * @examplePrompt Show the massing version of the placed plan
628
- */
629
- public abstract setLod(
630
- shapeId: string,
631
- lod: PluginViewLod,
632
- ): PluginApiReturn<void>
633
616
  }
634
617
 
635
618
  /** A point in crop space — fractions (0–1) of the uncropped view. */
@@ -674,8 +657,6 @@ export type PluginPlacedViewCrop = z.infer<typeof PluginPlacedViewCrop>
674
657
  * | `rotation` | `number` | Rotation in radians, `[0, 2π)` (nonzero only for 3D views — 2D views cannot rotate; set with `setRotation`) |
675
658
  * | `crop` | {@linkcode PluginPlacedViewCrop}` \| null` | Crop window (`null` when uncropped) |
676
659
  * | `isUnlinked` | `boolean` | Whether the source proposal was removed (an unlinked view no longer refreshes) |
677
- * | `lod` | {@linkcode PluginViewLod}? | Level of detail the view renders at (`"design"` massing / `"bim"` detail); absent on views that predate LOD variants (set with `setLod`) |
678
- * | `inactiveBuildingMask` | `boolean`? | Whether inactive proposal buildings are masked (the `setMask` toggle); absent when never set (masked by default) |
679
660
  */
680
661
  export const PluginPlacedView = z.object({
681
662
  shapeId: z.string(),
@@ -689,8 +670,6 @@ export const PluginPlacedView = z.object({
689
670
  rotation: z.number(),
690
671
  crop: PluginPlacedViewCrop.nullable(),
691
672
  isUnlinked: z.boolean(),
692
- lod: PluginViewLod.optional(),
693
- inactiveBuildingMask: z.boolean().optional(),
694
673
  })
695
674
  export type PluginPlacedView = z.infer<typeof PluginPlacedView>
696
675
 
@@ -1139,10 +1118,3 @@ export const PluginPlacedViewsSetMaskArgs = z.object({
1139
1118
  enabled: z.boolean(),
1140
1119
  })
1141
1120
  export type PluginPlacedViewsSetMaskArgs = z.infer<typeof PluginPlacedViewsSetMaskArgs>
1142
-
1143
- /** Arguments for {@link PluginPresentationPlacedViewsApi.setLod}. */
1144
- export const PluginPlacedViewsSetLodArgs = z.object({
1145
- shapeId: z.string().min(1),
1146
- lod: PluginViewLod,
1147
- })
1148
- export type PluginPlacedViewsSetLodArgs = z.infer<typeof PluginPlacedViewsSetLodArgs>
@@ -172,10 +172,9 @@ export abstract class PluginPresentationSheetsApi {
172
172
  * @param sheetId - The id of the sheet to place onto.
173
173
  * @param viewId - The id of the saved view to place.
174
174
  * @param options - Optional `position` ({@linkcode PluginSheetPosition}) —
175
- * where to place it (sheet centre when omitted) — `scale` — a standard
175
+ * where to place it (sheet centre when omitted) — and `scale` — a standard
176
176
  * scale value for the project's unit system (2D/site-plan views only;
177
- * auto-fit when omitted) — and `lod` ({@linkcode PluginViewLod}) — the LOD
178
- * of the placed view (default: the product's Design default).
177
+ * auto-fit when omitted).
179
178
  * @returns A {@linkcode PluginPresentationSheetsPlaceResult} with the created
180
179
  * `shapeId`.
181
180
  * @throws If Present mode is not open, the sheet/view id is invalid, `scale`
@@ -198,11 +197,7 @@ export abstract class PluginPresentationSheetsApi {
198
197
  public abstract place(
199
198
  sheetId: string,
200
199
  viewId: string,
201
- options?: {
202
- position?: PluginSheetPosition
203
- scale?: number
204
- lod?: PluginViewLod
205
- },
200
+ options?: { position?: PluginSheetPosition; scale?: number },
206
201
  ): PluginApiReturn<PluginPresentationSheetsPlaceResult>
207
202
 
208
203
  /**
@@ -413,15 +408,6 @@ export const PluginSheetPosition = z.object({
413
408
  })
414
409
  export type PluginSheetPosition = z.infer<typeof PluginSheetPosition>
415
410
 
416
- /**
417
- * The level of detail a placed view renders at: `"design"` (the Design-mode
418
- * massing representation) or `"bim"` (the detailed BIM representation).
419
- * Shared by `sheets.place` and `placedViews.*` (defined here because
420
- * `placedViews` already imports from this module).
421
- */
422
- export const PluginViewLod = z.enum(["design", "bim"])
423
- export type PluginViewLod = z.infer<typeof PluginViewLod>
424
-
425
411
  /** Result of {@linkcode PluginPresentationSheetsApi.list}. */
426
412
  export const PluginPresentationSheetsListResult = z.object({
427
413
  sheets: z.array(PluginPresentationSheet),
@@ -483,14 +469,12 @@ export type PluginPresentationSheetsSetMarginArgs = z.infer<
483
469
  * | `viewId` | `string` | The saved view to place |
484
470
  * | `position` | {@linkcode PluginSheetPosition}` \| undefined` | Where to place it (sheet centre when omitted) |
485
471
  * | `scale` | `number \| undefined` | Standard scale value for the project's unit system (2D/site-plan views only; auto-fit to the closest standard scale when omitted) |
486
- * | `lod` | {@linkcode PluginViewLod}` \| undefined` | LOD of the placed view (default: the product's Design default) |
487
472
  */
488
473
  export const PluginPresentationSheetsPlaceArgs = z.object({
489
474
  sheetId: z.string(),
490
475
  viewId: z.string(),
491
476
  position: PluginSheetPosition.optional(),
492
477
  scale: z.number().positive().optional(),
493
- lod: PluginViewLod.optional(),
494
478
  })
495
479
  export type PluginPresentationSheetsPlaceArgs = z.infer<
496
480
  typeof PluginPresentationSheetsPlaceArgs
@@ -5,13 +5,8 @@
5
5
  * APPEND-ONLY: codes are a published contract; never rename or remove one.
6
6
  * Handle-resolution failures deliberately collapse to ONE code
7
7
  * (`HANDLE_INVALID`) so error responses cannot be used as an existence /
8
- * ownership oracle (PLUGIN_HANDLE_MIGRATION_HLD §6) — with one deliberate
9
- * exception: `HANDLE_STALE` marks a handle the caller legitimately held that a
10
- * parametric resolution (merge / split / rebuild) has since retired — a
11
- * lifetime fact about the caller's own write-scoped handle, not an oracle
12
- * (forged / never-issued ids still collapse to `HANDLE_INVALID`).
13
- * `HANDLE_KIND_MISMATCH` stays distinct because the kind is information the
14
- * caller already holds.
8
+ * ownership oracle (PLUGIN_HANDLE_MIGRATION_HLD §6). `HANDLE_KIND_MISMATCH`
9
+ * stays distinct because the kind is information the caller already holds.
15
10
  */
16
11
  export const PLUGIN_ERROR_CODES = [
17
12
  "VALIDATION",
@@ -37,10 +32,6 @@ export const PLUGIN_ERROR_CODES = [
37
32
  "NO_ACTIVE_STRUCTURE",
38
33
  "NO_ELIGIBLE_ELEMENTS",
39
34
  "PROPOSAL_SWITCH_BLOCKED",
40
- "HANDLE_STALE",
41
- "KIND_HIDDEN_IN_MODE",
42
- "MERGED_INTO_EXISTING",
43
- "BLOCKED_IN_BIM",
44
35
  "INTERNAL",
45
36
  "UNKNOWN",
46
37
  ] as const
@@ -132,25 +123,6 @@ export const CODE_META: Record<PluginErrorCode, CodeMeta> = {
132
123
  category: "execution",
133
124
  hintTemplate: "Wait for the in-canvas agent run to finish, then retry.",
134
125
  },
135
- HANDLE_STALE: {
136
- category: "handle",
137
- hintTemplate:
138
- "The entity was retired by a parametric resolution (merge/split/rebuild); re-query for its successor.",
139
- },
140
- KIND_HIDDEN_IN_MODE: {
141
- category: "execution",
142
- hintTemplate:
143
- "This entity kind has no representation in the current mode/LOD; switch mode or target a visible kind.",
144
- },
145
- MERGED_INTO_EXISTING: {
146
- category: "execution",
147
- hintTemplate:
148
- "The created geometry merged into an existing entity; use the surviving handles from details.",
149
- },
150
- BLOCKED_IN_BIM: {
151
- category: "execution",
152
- hintTemplate: "This operation is unavailable in BIM mode; switch to Design and retry.",
153
- },
154
126
  INTERNAL: {
155
127
  category: "internal",
156
128
  hintTemplate: "Host-side fault. Report with errorId.",
package/src/handles.ts CHANGED
@@ -115,6 +115,19 @@ export type UnderlayHandle = EntityId<"underlay">
115
115
  */
116
116
  export type TerrainHandle = EntityId<"terrain">
117
117
 
118
+ /**
119
+ * A **dimension line** — one measurement annotation left behind by the Measuring
120
+ * Tape tool (NOT a width/height/depth property; see `design.dimensions`).
121
+ * Entity-style: the token IS the raw engine dimension id (`dim_…`), resolved live
122
+ * host-side from the dimension-line registry (`getDimensionLineMap()`) — not via
123
+ * `ComponentUtility.FindComponentById`, which does not index dimension lines (a
124
+ * dimension line is not a Component). No arena, no quota, stable across
125
+ * undo/redo and across reloads (the record persists with the project). Returned
126
+ * by `design.dimensions.create` and consumed by every other
127
+ * `design.dimensions.*` method.
128
+ */
129
+ export type DimensionHandle = EntityId<"dimension">
130
+
118
131
  /**
119
132
  * A handle to an **asynchronous import job** (today: a DWG → Forge conversion, which
120
133
  * can take minutes). Returned immediately by `core.io.import.dwg`; poll it via
@@ -233,6 +246,17 @@ export const ImportJobHandle = z
233
246
  .min(1)
234
247
  .transform((s) => s as ImportJobHandle)
235
248
 
249
+ /**
250
+ * {@linkcode DimensionHandle} is an entity-style handle — the raw `dim_…` engine
251
+ * id, validated only as a non-empty string (no `"<kind>_"` prefix enforcement),
252
+ * resolved live host-side against the dimension-line registry (existence
253
+ * enforced there, as `HANDLE_INVALID`).
254
+ */
255
+ export const DimensionHandle = z
256
+ .string()
257
+ .min(1)
258
+ .transform((s) => s as DimensionHandle)
259
+
236
260
  // Value-kind handle schemas (all-handle model, §11).
237
261
  export const Vec3Handle = handleSchema("vec3")
238
262
  export const QuatHandle = handleSchema("quat")
@@ -178,10 +178,6 @@ test("PLUGIN_ERROR_CODES matches the reviewed snapshot (append-only contract)",
178
178
  "NO_ACTIVE_STRUCTURE",
179
179
  "NO_ELIGIBLE_ELEMENTS",
180
180
  "PROPOSAL_SWITCH_BLOCKED",
181
- "HANDLE_STALE",
182
- "KIND_HIDDEN_IN_MODE",
183
- "MERGED_INTO_EXISTING",
184
- "BLOCKED_IN_BIM",
185
181
  "INTERNAL",
186
182
  "UNKNOWN",
187
183
  ])
Binary file