@snaptrude/plugin-core 0.6.0 → 0.7.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/api-manifest.json +206 -704
  3. package/dist/api/core/index.d.ts +5 -0
  4. package/dist/api/core/index.d.ts.map +1 -1
  5. package/dist/api/core/proposals/index.d.ts +475 -0
  6. package/dist/api/core/proposals/index.d.ts.map +1 -0
  7. package/dist/api/design/create/index.d.ts +209 -0
  8. package/dist/api/design/create/index.d.ts.map +1 -1
  9. package/dist/api/design/doors/index.d.ts +159 -0
  10. package/dist/api/design/doors/index.d.ts.map +1 -1
  11. package/dist/api/design/furniture/index.d.ts +34 -5
  12. package/dist/api/design/furniture/index.d.ts.map +1 -1
  13. package/dist/api/design/index.d.ts +83 -0
  14. package/dist/api/design/index.d.ts.map +1 -1
  15. package/dist/api/design/lock.d.ts +26 -0
  16. package/dist/api/design/lock.d.ts.map +1 -1
  17. package/dist/api/design/materials/index.d.ts +159 -2
  18. package/dist/api/design/materials/index.d.ts.map +1 -1
  19. package/dist/api/design/query/index.d.ts +115 -5
  20. package/dist/api/design/query/index.d.ts.map +1 -1
  21. package/dist/api/design/selection/index.d.ts +2 -2
  22. package/dist/api/design/transform/index.d.ts +83 -2
  23. package/dist/api/design/transform/index.d.ts.map +1 -1
  24. package/dist/api/design/update/index.d.ts +168 -0
  25. package/dist/api/design/update/index.d.ts.map +1 -1
  26. package/dist/api/design/windows/index.d.ts +113 -2
  27. package/dist/api/design/windows/index.d.ts.map +1 -1
  28. package/dist/api/entity/story.d.ts +101 -7
  29. package/dist/api/entity/story.d.ts.map +1 -1
  30. package/dist/api/presentation/aiInspiration.d.ts +1967 -7
  31. package/dist/api/presentation/aiInspiration.d.ts.map +1 -1
  32. package/dist/api/presentation/import.d.ts +49 -4
  33. package/dist/api/presentation/import.d.ts.map +1 -1
  34. package/dist/api/presentation/index.d.ts +2 -3
  35. package/dist/api/presentation/index.d.ts.map +1 -1
  36. package/dist/api/presentation/views.d.ts +210 -5
  37. package/dist/api/presentation/views.d.ts.map +1 -1
  38. package/dist/api/program/areas.d.ts +42 -12
  39. package/dist/api/program/areas.d.ts.map +1 -1
  40. package/dist/api/program/index.d.ts +3 -11
  41. package/dist/api/program/index.d.ts.map +1 -1
  42. package/dist/api/program/layout.d.ts +186 -11
  43. package/dist/api/program/layout.d.ts.map +1 -1
  44. package/dist/errors/codes.d.ts +34 -0
  45. package/dist/errors/codes.d.ts.map +1 -0
  46. package/dist/errors/envelope.d.ts +56 -0
  47. package/dist/errors/envelope.d.ts.map +1 -0
  48. package/dist/errors/index.d.ts +6 -0
  49. package/dist/errors/index.d.ts.map +1 -0
  50. package/dist/errors/plugin-error.d.ts +69 -0
  51. package/dist/errors/plugin-error.d.ts.map +1 -0
  52. package/dist/host-utils.d.ts +4 -0
  53. package/dist/host-utils.d.ts.map +1 -1
  54. package/dist/index.cjs +1993 -1033
  55. package/dist/index.cjs.map +1 -1
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +1874 -1030
  59. package/dist/index.js.map +1 -1
  60. package/package.json +2 -1
  61. package/scripts/generate-manifest.test.mjs +77 -0
  62. package/src/api/core/index.ts +5 -0
  63. package/src/api/core/proposals/index.ts +509 -0
  64. package/src/api/design/create/index.ts +249 -0
  65. package/src/api/design/doors/index.ts +168 -0
  66. package/src/api/design/furniture/index.ts +36 -5
  67. package/src/api/design/index.ts +87 -0
  68. package/src/api/design/lock.ts +27 -0
  69. package/src/api/design/materials/index.ts +182 -2
  70. package/src/api/design/query/index.ts +81 -0
  71. package/src/api/design/transform/index.ts +74 -2
  72. package/src/api/design/update/index.ts +167 -0
  73. package/src/api/design/windows/index.ts +128 -2
  74. package/src/api/entity/story.ts +105 -7
  75. package/src/api/presentation/aiInspiration.ts +761 -7
  76. package/src/api/presentation/import.ts +45 -4
  77. package/src/api/presentation/index.ts +2 -3
  78. package/src/api/presentation/views.ts +221 -5
  79. package/src/api/program/areas.ts +34 -12
  80. package/src/api/program/index.ts +3 -11
  81. package/src/api/program/layout.ts +195 -11
  82. package/src/errors/codes.ts +136 -0
  83. package/src/errors/envelope.ts +75 -0
  84. package/src/errors/index.ts +21 -0
  85. package/src/errors/plugin-error.ts +134 -0
  86. package/src/host-utils.ts +4 -0
  87. package/src/index.ts +1 -0
  88. package/test/errors.test.mjs +184 -0
  89. package/api-manifest.full.json +0 -5600
@@ -4,9 +4,10 @@ import { PluginApiReturn } from "../../types"
4
4
  /**
5
5
  * Presentation import — bring external reference assets onto the Present canvas.
6
6
  *
7
- * `import.image` places a reference image and `import.pdf` places a PDF (each
8
- * page vectorized to SVG) onto the current Present sheet, returning the created
9
- * canvas shape ids. Requires Present mode to be open.
7
+ * `import.image` places a reference image, `import.pdf` places a PDF (each
8
+ * page vectorized to SVG), and `import.svg` places a validated SVG onto
9
+ * the current Present sheet, returning the created canvas shape ids. Requires
10
+ * Present mode to be open.
10
11
  *
11
12
  * The host engine takes a browser `File`, which a plugin worker cannot supply,
12
13
  * so these accept a `url`/`dataUrl` that the host adapts into a `File`.
@@ -72,11 +73,51 @@ export abstract class PluginPresentationImportApi {
72
73
  source: { url?: string; dataUrl?: string },
73
74
  options?: { position?: { x: number; y: number } },
74
75
  ): PluginApiReturn<PluginPresentationImportResult>
76
+
77
+ /**
78
+ * Import an SVG onto the current Present sheet as a vector asset.
79
+ *
80
+ * An SVG-validating variant of {@linkcode PluginPresentationImportApi.image}:
81
+ * `import.image` already passes SVG sources through, but this method first
82
+ * validates that the source really is an SVG and forces the vector mime
83
+ * type. Throws if the source is not an SVG.
84
+ *
85
+ * **Rendering is vector up to a complexity cap.** Simple SVGs (up to ~1500
86
+ * SVG element nodes and ~2 MB) render true-vector and stay crisp at every
87
+ * zoom. Beyond that cap the shared canvas renderer **intentionally falls
88
+ * back to a 1920px raster** to protect canvas performance, so very complex
89
+ * SVGs can look rasterized when zoomed in. The stored asset is the original
90
+ * SVG either way; only the on-canvas rendering falls back.
91
+ *
92
+ * @param source - The SVG to import: exactly one of `url` or `dataUrl`.
93
+ * @param options - Optional `position` — where to place the SVG on the sheet.
94
+ * @returns A {@linkcode PluginPresentationImportResult} with the created
95
+ * `shapeIds`.
96
+ * @throws If Present mode is not open, the source is not an SVG, or it cannot
97
+ * be loaded.
98
+ *
99
+ * @examplePrompt Import this SVG diagram onto the present canvas
100
+ * @examplePrompt Add a vector logo to my presentation board
101
+ * @examplePrompt Place this SVG floor plan on the current sheet as vectors
102
+ * @examplePrompt Bring a crisp vector graphic into Present mode
103
+ *
104
+ * # Example
105
+ * ```ts
106
+ * const { shapeIds } = await snaptrude.presentation.import.svg({
107
+ * url: "https://example.com/diagram.svg",
108
+ * })
109
+ * ```
110
+ */
111
+ public abstract svg(
112
+ source: { url?: string; dataUrl?: string },
113
+ options?: { position?: { x: number; y: number } },
114
+ ): PluginApiReturn<PluginPresentationImportResult>
75
115
  }
76
116
 
77
117
  /**
78
118
  * Arguments for {@linkcode PluginPresentationImportApi.image} /
79
- * {@linkcode PluginPresentationImportApi.pdf}. Provide exactly one source.
119
+ * {@linkcode PluginPresentationImportApi.pdf} /
120
+ * {@linkcode PluginPresentationImportApi.svg}. Provide exactly one source.
80
121
  *
81
122
  * | Property | Type | Description |
82
123
  * |---|---|---|
@@ -33,10 +33,9 @@ export abstract class PluginPresentationApi {
33
33
  public abstract import: PluginPresentationImportApi
34
34
  /**
35
35
  * Present-mode AI Inspiration image/video generation. See
36
- * {@linkcode PluginPresentationAIInspirationApi}. _(authored ahead — optional
37
- * until the host lands; the host implementation today is a stub.)_
36
+ * {@linkcode PluginPresentationAIInspirationApi}.
38
37
  */
39
- public aiInspiration?: PluginPresentationAIInspirationApi
38
+ public abstract aiInspiration: PluginPresentationAIInspirationApi
40
39
 
41
40
  constructor() {}
42
41
  }
@@ -6,12 +6,12 @@ import { PluginApiReturn } from "../../types"
6
6
  *
7
7
  * A **view** is a saved camera/plan: a sheet-ready 2D plan or a saved 3D view.
8
8
  * A plugin can list and read views, capture them to images, activate one (move
9
- * the camera to it), and save the current camera as a new view.
9
+ * the camera to it), save the current camera as a new view, and read/update a
10
+ * view's display settings (background, color mode, axis, edges, labels).
10
11
  *
11
- * `list`/`get`/`getActive`/`capture` are reads; `setActive`/`create` are writes
12
- * (a view is a camera bookmark — not geometry). Members typed optional (`?`) are
13
- * authored ahead of the host: declared for plugins/codegen but not yet on the
14
- * live discovery surface until the host lands them.
12
+ * `list`/`get`/`getActive`/`capture`/`getSettings` are reads;
13
+ * `setActive`/`create`/`updateSettings` are writes (a view is a camera bookmark
14
+ * not geometry).
15
15
  *
16
16
  * Accessed via `snaptrude.presentation.views`.
17
17
  */
@@ -153,6 +153,85 @@ export abstract class PluginPresentationViewsApi {
153
153
  name?: string,
154
154
  options?: { kind?: "view" | "sitePlan" },
155
155
  ): PluginApiReturn<PluginPresentationViewsCreateResult>
156
+
157
+ /**
158
+ * Read a saved view's display settings (background, color mode, axis, edges,
159
+ * labels).
160
+ *
161
+ * @param viewId - The id of the view to read settings for.
162
+ * @returns The view's {@linkcode PluginPresentationViewSettings}, or `null` if
163
+ * no view has that id.
164
+ *
165
+ * @examplePrompt What color mode is the Ground Floor view using?
166
+ * @examplePrompt Get the display settings for this view
167
+ * @examplePrompt Does the site plan view show axes and labels?
168
+ * @examplePrompt Read the background color of the active view
169
+ *
170
+ * # Example
171
+ * ```ts
172
+ * const settings = await snaptrude.presentation.views.getSettings("view_123")
173
+ * if (settings) console.log(settings.colorMode, settings.backgroundColor)
174
+ * ```
175
+ */
176
+ public abstract getSettings(
177
+ viewId: string,
178
+ ): PluginApiReturn<PluginPresentationViewsGetSettingsResult>
179
+
180
+ /**
181
+ * Update a saved view's display settings (partial patch — only the fields you
182
+ * pass change).
183
+ *
184
+ * Persists and broadcasts the change; if the view is currently active, the
185
+ * scene updates live. **Not Ctrl+Z-undoable** — view-metadata edits publish
186
+ * directly and do not land on the local undo stack; this matches how the
187
+ * product's own view-settings UI behaves.
188
+ *
189
+ * Label patch semantics (mirroring the product, which stores no label
190
+ * selection while labels are off):
191
+ *
192
+ * - `{ showLabels: true }` alone turns labels on; if the view has no stored
193
+ * selection, the product defaults (`objectLabels`, `areas`) are applied —
194
+ * labels are never "on" with an empty selection (the product has no such
195
+ * state; labels render only while the selection is non-empty).
196
+ * - `{ labels: [...] }` alone sets the selection **and turns labels on**.
197
+ * - `{ showLabels: false }` turns labels off and **clears the stored
198
+ * selection** — a later read returns `labels: []`.
199
+ * - `{ showLabels: false, labels: [...] }` with a non-empty list is
200
+ * contradictory and **rejected** (nothing is silently discarded).
201
+ * - `{ showLabels: true, labels: [] }` is likewise contradictory and
202
+ * **rejected** — pass a non-empty list, or omit `labels` to get the
203
+ * defaults.
204
+ *
205
+ * `colorMode` accepts the `tag:<categoryId>` scheme strings returned by
206
+ * {@linkcode PluginPresentationViewsApi.getSettings}, so read-then-write
207
+ * round-trips a tag-based color scheme unchanged.
208
+ *
209
+ * @param viewId - The id of the view to update.
210
+ * @param settings - A partial {@linkcode PluginPresentationViewSettings}; any
211
+ * omitted field is left unchanged.
212
+ * @returns The updated view's `id`.
213
+ * @throws If writes are disabled, no view has the given id, or the patch is
214
+ * contradictory (`showLabels: false` with a non-empty `labels`, or
215
+ * `showLabels: true` with an explicitly empty `labels` list).
216
+ *
217
+ * @examplePrompt Switch this view to monochrome color mode
218
+ * @examplePrompt Turn off the axis in the Ground Floor view
219
+ * @examplePrompt Set the background of the active view to white
220
+ * @examplePrompt Show area labels on this view
221
+ * @examplePrompt Enable hidden-line mode for the section view
222
+ *
223
+ * # Example
224
+ * ```ts
225
+ * await snaptrude.presentation.views.updateSettings("view_123", {
226
+ * colorMode: "monochrome",
227
+ * showAxis: false,
228
+ * })
229
+ * ```
230
+ */
231
+ public abstract updateSettings(
232
+ viewId: string,
233
+ settings: Partial<PluginPresentationViewSettings>,
234
+ ): PluginApiReturn<PluginPresentationViewsUpdateSettingsResult>
156
235
  }
157
236
 
158
237
  /**
@@ -301,3 +380,140 @@ export const PluginPresentationViewsCreateResult = PluginPresentationView
301
380
  export type PluginPresentationViewsCreateResult = z.infer<
302
381
  typeof PluginPresentationViewsCreateResult
303
382
  >
383
+
384
+ /**
385
+ * How the scene is colored in a view.
386
+ *
387
+ * | Value | Meaning |
388
+ * |---|---|
389
+ * | `monochrome` | Flat single-tone shading |
390
+ * | `texture` | Material textures/colors |
391
+ * | `department` | Colored by department |
392
+ * | `tag:<categoryId>` | Colored by a project tag category (e.g. `tag:ZONE`) |
393
+ *
394
+ * The `tag:<categoryId>` form carries the product's tag-based color schemes
395
+ * losslessly — reading a view that uses one returns the `tag:` string as-is,
396
+ * and writing it back preserves the scheme (read-then-write is safe).
397
+ */
398
+ export const PluginPresentationViewColorMode = z.union([
399
+ z.enum(["monochrome", "texture", "department"]),
400
+ z.templateLiteral(["tag:", z.string()]),
401
+ ])
402
+ export type PluginPresentationViewColorMode = z.infer<
403
+ typeof PluginPresentationViewColorMode
404
+ >
405
+
406
+ /**
407
+ * A category of on-canvas labels a view can show.
408
+ *
409
+ * | Value | Meaning |
410
+ * |---|---|
411
+ * | `objectLabels` | Per-object name labels |
412
+ * | `areas` | Area/room labels |
413
+ * | `department` | Department labels |
414
+ */
415
+ export const PluginPresentationViewLabel = z.enum([
416
+ "objectLabels",
417
+ "areas",
418
+ "department",
419
+ ])
420
+ export type PluginPresentationViewLabel = z.infer<
421
+ typeof PluginPresentationViewLabel
422
+ >
423
+
424
+ /**
425
+ * A view's display settings.
426
+ *
427
+ * | Property | Type | Description |
428
+ * |---|---|---|
429
+ * | `backgroundColor` | `string` | Canvas background as a hex color (e.g. `#ffffff`) |
430
+ * | `colorMode` | {@linkcode PluginPresentationViewColorMode} | How the scene is colored (including `tag:<categoryId>` schemes) |
431
+ * | `showAxis` | `boolean` | Whether the X/Y/Z axes are shown |
432
+ * | `showEdges` | `boolean` | Whether edges are shown; `false` = hidden-line rendering |
433
+ * | `showLabels` | `boolean` | Master label switch — whether on-canvas labels are shown at all. `true` always pairs with a non-empty `labels` selection (labels render only while the selection is non-empty; there is no labels-on-with-empty-selection state) |
434
+ * | `labels` | {@linkcode PluginPresentationViewLabel}`[]` | Which label categories are selected. When `showLabels` is `false` the view stores no selection and this reads `[]` |
435
+ */
436
+ export const PluginPresentationViewSettings = z.object({
437
+ backgroundColor: z.string(),
438
+ colorMode: PluginPresentationViewColorMode,
439
+ showAxis: z.boolean(),
440
+ showEdges: z.boolean(),
441
+ showLabels: z.boolean(),
442
+ labels: z.array(PluginPresentationViewLabel),
443
+ })
444
+ export type PluginPresentationViewSettings = z.infer<
445
+ typeof PluginPresentationViewSettings
446
+ >
447
+
448
+ /**
449
+ * Arguments for {@linkcode PluginPresentationViewsApi.getSettings}.
450
+ *
451
+ * | Property | Type | Description |
452
+ * |---|---|---|
453
+ * | `id` | `string` | The id of the view to read settings for |
454
+ */
455
+ export const PluginPresentationViewsGetSettingsArgs = z.object({
456
+ id: z.string(),
457
+ })
458
+ export type PluginPresentationViewsGetSettingsArgs = z.infer<
459
+ typeof PluginPresentationViewsGetSettingsArgs
460
+ >
461
+
462
+ /**
463
+ * Result of {@linkcode PluginPresentationViewsApi.getSettings} — the settings,
464
+ * or `null` when no view has that id.
465
+ */
466
+ export const PluginPresentationViewsGetSettingsResult =
467
+ PluginPresentationViewSettings.nullable()
468
+ export type PluginPresentationViewsGetSettingsResult = z.infer<
469
+ typeof PluginPresentationViewsGetSettingsResult
470
+ >
471
+
472
+ /**
473
+ * Arguments for {@linkcode PluginPresentationViewsApi.updateSettings}. The
474
+ * `settings` patch is partial — any omitted field is left unchanged. A patch
475
+ * pairing `showLabels: false` with a non-empty `labels` list, or
476
+ * `showLabels: true` with an explicitly empty `labels` list, is rejected as
477
+ * contradictory (see the method JSDoc for the full label patch semantics).
478
+ *
479
+ * | Property | Type | Description |
480
+ * |---|---|---|
481
+ * | `id` | `string` | The id of the view to update |
482
+ * | `settings` | `Partial<`{@linkcode PluginPresentationViewSettings}`>` | The fields to change |
483
+ */
484
+ export const PluginPresentationViewsUpdateSettingsArgs = z
485
+ .object({
486
+ id: z.string(),
487
+ settings: PluginPresentationViewSettings.partial(),
488
+ })
489
+ .refine(
490
+ (v) =>
491
+ !(v.settings.showLabels === false && (v.settings.labels?.length ?? 0) > 0),
492
+ {
493
+ message:
494
+ "Contradictory patch: labels cannot be set while showLabels is false",
495
+ },
496
+ )
497
+ .refine(
498
+ (v) =>
499
+ !(
500
+ v.settings.showLabels === true &&
501
+ v.settings.labels !== undefined &&
502
+ v.settings.labels.length === 0
503
+ ),
504
+ {
505
+ message:
506
+ "Contradictory patch: showLabels cannot be true with an explicitly empty labels list — pass a non-empty list, or omit labels to apply the defaults",
507
+ },
508
+ )
509
+ export type PluginPresentationViewsUpdateSettingsArgs = z.infer<
510
+ typeof PluginPresentationViewsUpdateSettingsArgs
511
+ >
512
+
513
+ /** Result of {@linkcode PluginPresentationViewsApi.updateSettings} — the updated view's id. */
514
+ export const PluginPresentationViewsUpdateSettingsResult = z.object({
515
+ id: z.string(),
516
+ })
517
+ export type PluginPresentationViewsUpdateSettingsResult = z.infer<
518
+ typeof PluginPresentationViewsUpdateSettingsResult
519
+ >
@@ -1,6 +1,7 @@
1
1
  import * as z from "zod"
2
2
  import { PluginApiReturn } from "../../types"
3
3
  import { PluginAreaUnit } from "./metrics"
4
+ import { PluginAreaClass } from "../entity/space"
4
5
  import { ComponentHandle } from "../../handles"
5
6
 
6
7
  /**
@@ -12,15 +13,25 @@ import { ComponentHandle } from "../../handles"
12
13
  * department-allocation lens (targets vs allocated area per department); this
13
14
  * namespace is the whole-program area/FAR summary and its groupings.
14
15
  *
16
+ * **Net vs gross:** the `carpet` / `builtUp` / `excluded` figures are the three
17
+ * area *classes* — every space's whole footprint lands in exactly one, chosen
18
+ * by its `areaClass` (see {@linkcode PluginProgramAreaMember.areaClass}). In UI
19
+ * terms `carpet` is the **Net Internal Area** (Σ of `NET`-classed spaces), and
20
+ * `builtUp` is the **Gross External Area** (Σ of `GROSS`-classed spaces) — so
21
+ * "net" and "gross" are the plain-English synonyms for `carpet` and `builtUp`.
22
+ * These are not wall-thickness carpet-vs-super-built-up; there is no common-area
23
+ * math. Note the summary also folds in non-mass elements (floors count as NET,
24
+ * slabs as GROSS), so **summing `listMembers` spaces does not reconcile to the
25
+ * summary totals**.
26
+ *
15
27
  * `achievedFar` is **derived and read-only** — computed from built-up area and
16
28
  * site area. `targetFar` is the goal you set (via {@linkcode
17
29
  * PluginProgramAreasApi.update}); the two are the same ratio, one measured and
18
30
  * one intended. The surface speaks **FAR only** — there is no FSI alias.
19
31
  *
20
- * Reads return plain records and never throw. The write member typed as optional
21
- * (`?`) is **authored ahead of the host** declared so plugins and codegen can
22
- * see the shape, but kept out of the discovery manifest until the host lands it
23
- * (at which point it is promoted to a required `abstract` member).
32
+ * Reads return plain records and never throw. The only write
33
+ * {@linkcode PluginProgramAreasApi.update}is a non-undoable settings write
34
+ * for the FAR inputs.
24
35
  *
25
36
  * Accessed via `snaptrude.program.areas`.
26
37
  */
@@ -38,6 +49,8 @@ export abstract class PluginProgramAreasApi {
38
49
  *
39
50
  * @examplePrompt What's my FAR right now?
40
51
  * @examplePrompt Give me the program area summary
52
+ * @examplePrompt What is my net internal area vs gross external area?
53
+ * @examplePrompt How much net and gross area do I have?
41
54
  * @examplePrompt How much built-up area have I used against the site area?
42
55
  * @examplePrompt Am I within my FAR target?
43
56
  *
@@ -62,6 +75,7 @@ export abstract class PluginProgramAreasApi {
62
75
  * (empty when the program has no spaces).
63
76
  *
64
77
  * @examplePrompt Break down the area by storey
78
+ * @examplePrompt Break down net vs gross area by storey
65
79
  * @examplePrompt Show the area rollup per department
66
80
  * @examplePrompt Group the built-up area by building
67
81
  *
@@ -92,6 +106,7 @@ export abstract class PluginProgramAreasApi {
92
106
  * array (empty when the group is missing or empty).
93
107
  *
94
108
  * @examplePrompt List the spaces on this storey with their areas
109
+ * @examplePrompt Which spaces are net and which are gross on this storey?
95
110
  * @examplePrompt What rooms are in the Bedrooms department bucket?
96
111
  * @examplePrompt Break the storey area down into individual spaces
97
112
  *
@@ -142,9 +157,9 @@ export abstract class PluginProgramAreasApi {
142
157
  * |---|---|---|
143
158
  * | `count` | `number` | Number of spaces in the program (a count, not an area) |
144
159
  * | `hiddenCount` | `number` | Number of those spaces that are currently hidden |
145
- * | `carpet` | `number` | Total carpet area in `areaUnit` |
146
- * | `builtUp` | `number` | Total built-up area in `areaUnit` |
147
- * | `excluded` | `number` | Total excluded area in `areaUnit` |
160
+ * | `carpet` | `number` | Total **Net Internal Area** ("net") — Σ `NET`-classed spaces + floors — in `areaUnit` |
161
+ * | `builtUp` | `number` | Total **Gross External Area** ("gross") — Σ `GROSS`-classed spaces + slabs — in `areaUnit` |
162
+ * | `excluded` | `number` | Total **Excluded Area** — Σ `EXCLUDED`-classed spaces — in `areaUnit` |
148
163
  * | `farBuiltUp` | `number` | Built-up area that counts toward FAR, in `areaUnit` |
149
164
  * | `siteArea` | `number` | Site/plot area in `areaUnit` |
150
165
  * | `achievedFar` | `number \| null` | Derived FAR (`farBuiltUp / siteArea`); `null` when site area or target FAR is unset |
@@ -177,8 +192,8 @@ export type PluginProgramAreaSummary = z.infer<typeof PluginProgramAreaSummary>
177
192
  * | `groupId` | `string` | Stable id of the group (e.g. storey id, department id) |
178
193
  * | `name` | `string` | Display name of the group |
179
194
  * | `color` | `string` | CSS hex color string for the group |
180
- * | `carpet` | `number` | Carpet area for this group |
181
- * | `builtUp` | `number` | Built-up area for this group |
195
+ * | `carpet` | `number` | Net Internal Area ("net") for this group |
196
+ * | `builtUp` | `number` | Gross External Area ("gross") for this group |
182
197
  * | `excluded` | `number` | Excluded area for this group |
183
198
  * | `count` | `number` | Number of spaces in this group |
184
199
  * | `targetArea` | `number` | Target area for this group, in `targetUnit` |
@@ -201,18 +216,25 @@ export type PluginProgramAreaGroup = z.infer<typeof PluginProgramAreaGroup>
201
216
  * A single space within an area group. Area figures are in the program's area
202
217
  * unit (see {@linkcode PluginProgramAreaSummary.areaUnit}).
203
218
  *
219
+ * `areaClass` is the space's effective classification — it decides which of the
220
+ * three buckets the space's whole footprint lands in: `NET` → `carpet` ("net"),
221
+ * `GROSS` → `builtUp` ("gross"), `EXCLUDED` → `excluded`. So for any one member
222
+ * exactly one of `carpet` / `builtUp` / `excluded` is non-zero.
223
+ *
204
224
  * | Property | Type | Description |
205
225
  * |---|---|---|
206
226
  * | `id` | `ComponentHandle` | `Component.id` of the space (never a mesh handle) |
207
227
  * | `label` | `string` | Display label of the space |
208
- * | `carpet` | `number` | Carpet area of the space |
209
- * | `builtUp` | `number` | Built-up area of the space |
210
- * | `excluded` | `number` | Excluded area of the space |
228
+ * | `areaClass` | {@linkcode PluginAreaClass} | Effective area class `"NET"` (→ `carpet`), `"GROSS"` (→ `builtUp`), or `"EXCLUDED"` |
229
+ * | `carpet` | `number` | Net area of the space (non-zero when `areaClass` is `"NET"`) |
230
+ * | `builtUp` | `number` | Gross area of the space (non-zero when `areaClass` is `"GROSS"`) |
231
+ * | `excluded` | `number` | Excluded area of the space (non-zero when `areaClass` is `"EXCLUDED"`) |
211
232
  * | `isVisible` | `boolean` | Whether the space is currently visible |
212
233
  */
213
234
  export const PluginProgramAreaMember = z.object({
214
235
  id: ComponentHandle,
215
236
  label: z.string(),
237
+ areaClass: PluginAreaClass,
216
238
  carpet: z.number(),
217
239
  builtUp: z.number(),
218
240
  excluded: z.number(),
@@ -19,7 +19,7 @@ import { PluginProgramAreasApi } from "./areas"
19
19
  *
20
20
  * - {@linkcode PluginProgramApi.departments} — Read & edit program departments (groupings + targets)
21
21
  * - {@linkcode PluginProgramApi.adjacency} — Read & compute the department/space adjacency matrix
22
- * - {@linkcode PluginProgramApi.layout} — Arrange/pack spaces in the envelope (authored ahead)
22
+ * - {@linkcode PluginProgramApi.layout} — Arrange/pack spaces in the envelope
23
23
  * - {@linkcode PluginProgramApi.metrics} — Read the area-program summary
24
24
  * - {@linkcode PluginProgramApi.areas} — FAR / built-up-area rollup and groupings
25
25
  * - {@linkcode PluginProgramApi.spreadsheet} — Render program data to sheets and read it back
@@ -27,11 +27,6 @@ import { PluginProgramAreasApi } from "./areas"
27
27
  * - {@linkcode PluginProgramApi.cores} — Read & trigger vertical-circulation cores
28
28
  * - {@linkcode PluginProgramApi.classification} — Classification catalog + display tags
29
29
  *
30
- * Sub-namespaces typed as optional (`?`) are **authored ahead of the host** —
31
- * declared so plugins and codegen can see the shape, but not required of host
32
- * implementations and kept out of the discovery manifest until the host lands
33
- * them (at which point they are promoted to required `abstract` members).
34
- *
35
30
  * Accessed via `snaptrude.program`.
36
31
  */
37
32
  export abstract class PluginProgramApi {
@@ -39,11 +34,8 @@ export abstract class PluginProgramApi {
39
34
  public abstract departments: PluginProgramDepartmentsApi
40
35
  /** Adjacency matrix — read & compute proximity relationships. See {@linkcode PluginProgramAdjacencyApi}. */
41
36
  public abstract adjacency: PluginProgramAdjacencyApi
42
- /**
43
- * Arrange/pack spaces in the envelope. See {@linkcode PluginProgramLayoutApi}.
44
- * _(authored ahead — optional until the host lands it next increment.)_
45
- */
46
- public layout?: PluginProgramLayoutApi
37
+ /** Arrange/pack spaces in the envelope (async job family). See {@linkcode PluginProgramLayoutApi}. */
38
+ public abstract layout: PluginProgramLayoutApi
47
39
  /** Area-program summary — targets vs allocated area. See {@linkcode PluginProgramMetricsApi}. */
48
40
  public abstract metrics: PluginProgramMetricsApi
49
41
  /** FAR / built-up-area rollup and groupings. See {@linkcode PluginProgramAreasApi}. */