@snaptrude/plugin-core 0.0.0-dev-20260708130115

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 (241) hide show
  1. package/AGENTS.md +227 -0
  2. package/CHANGELOG.md +119 -0
  3. package/CLAUDE.md +11 -0
  4. package/api-manifest.json +5004 -0
  5. package/dist/api/core/buildings.d.ts +427 -0
  6. package/dist/api/core/buildings.d.ts.map +1 -0
  7. package/dist/api/core/comment/index.d.ts +230 -0
  8. package/dist/api/core/comment/index.d.ts.map +1 -0
  9. package/dist/api/core/geom/create/index.d.ts +247 -0
  10. package/dist/api/core/geom/create/index.d.ts.map +1 -0
  11. package/dist/api/core/geom/delete/index.d.ts +72 -0
  12. package/dist/api/core/geom/delete/index.d.ts.map +1 -0
  13. package/dist/api/core/geom/index.d.ts +33 -0
  14. package/dist/api/core/geom/index.d.ts.map +1 -0
  15. package/dist/api/core/geom/query/arc.d.ts +169 -0
  16. package/dist/api/core/geom/query/arc.d.ts.map +1 -0
  17. package/dist/api/core/geom/query/brep.d.ts +402 -0
  18. package/dist/api/core/geom/query/brep.d.ts.map +1 -0
  19. package/dist/api/core/geom/query/circle.d.ts +378 -0
  20. package/dist/api/core/geom/query/circle.d.ts.map +1 -0
  21. package/dist/api/core/geom/query/contour.d.ts +450 -0
  22. package/dist/api/core/geom/query/contour.d.ts.map +1 -0
  23. package/dist/api/core/geom/query/curve.d.ts +918 -0
  24. package/dist/api/core/geom/query/curve.d.ts.map +1 -0
  25. package/dist/api/core/geom/query/edge.d.ts +128 -0
  26. package/dist/api/core/geom/query/edge.d.ts.map +1 -0
  27. package/dist/api/core/geom/query/face.d.ts +363 -0
  28. package/dist/api/core/geom/query/face.d.ts.map +1 -0
  29. package/dist/api/core/geom/query/halfedge.d.ts +206 -0
  30. package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
  31. package/dist/api/core/geom/query/index.d.ts +61 -0
  32. package/dist/api/core/geom/query/index.d.ts.map +1 -0
  33. package/dist/api/core/geom/query/profile.d.ts +410 -0
  34. package/dist/api/core/geom/query/profile.d.ts.map +1 -0
  35. package/dist/api/core/geom/query/vertex.d.ts +187 -0
  36. package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
  37. package/dist/api/core/geom/update/contour.d.ts +272 -0
  38. package/dist/api/core/geom/update/contour.d.ts.map +1 -0
  39. package/dist/api/core/geom/update/curve.d.ts +180 -0
  40. package/dist/api/core/geom/update/curve.d.ts.map +1 -0
  41. package/dist/api/core/geom/update/index.d.ts +27 -0
  42. package/dist/api/core/geom/update/index.d.ts.map +1 -0
  43. package/dist/api/core/geom/update/profile.d.ts +329 -0
  44. package/dist/api/core/geom/update/profile.d.ts.map +1 -0
  45. package/dist/api/core/groups.d.ts +485 -0
  46. package/dist/api/core/groups.d.ts.map +1 -0
  47. package/dist/api/core/history/index.d.ts +78 -0
  48. package/dist/api/core/history/index.d.ts.map +1 -0
  49. package/dist/api/core/index.d.ts +63 -0
  50. package/dist/api/core/index.d.ts.map +1 -0
  51. package/dist/api/core/layers.d.ts +402 -0
  52. package/dist/api/core/layers.d.ts.map +1 -0
  53. package/dist/api/core/math/index.d.ts +18 -0
  54. package/dist/api/core/math/index.d.ts.map +1 -0
  55. package/dist/api/core/math/quat.d.ts +170 -0
  56. package/dist/api/core/math/quat.d.ts.map +1 -0
  57. package/dist/api/core/math/vec3.d.ts +174 -0
  58. package/dist/api/core/math/vec3.d.ts.map +1 -0
  59. package/dist/api/core/project/index.d.ts +399 -0
  60. package/dist/api/core/project/index.d.ts.map +1 -0
  61. package/dist/api/core/tags.d.ts +755 -0
  62. package/dist/api/core/tags.d.ts.map +1 -0
  63. package/dist/api/core/units/index.d.ts +175 -0
  64. package/dist/api/core/units/index.d.ts.map +1 -0
  65. package/dist/api/core/zoom/index.d.ts +45 -0
  66. package/dist/api/core/zoom/index.d.ts.map +1 -0
  67. package/dist/api/design/boolean/index.d.ts +168 -0
  68. package/dist/api/design/boolean/index.d.ts.map +1 -0
  69. package/dist/api/design/create/index.d.ts +828 -0
  70. package/dist/api/design/create/index.d.ts.map +1 -0
  71. package/dist/api/design/delete/index.d.ts +63 -0
  72. package/dist/api/design/delete/index.d.ts.map +1 -0
  73. package/dist/api/design/doors/index.d.ts +268 -0
  74. package/dist/api/design/doors/index.d.ts.map +1 -0
  75. package/dist/api/design/edit/index.d.ts +49 -0
  76. package/dist/api/design/edit/index.d.ts.map +1 -0
  77. package/dist/api/design/erase/index.d.ts +160 -0
  78. package/dist/api/design/erase/index.d.ts.map +1 -0
  79. package/dist/api/design/furniture/index.d.ts +123 -0
  80. package/dist/api/design/furniture/index.d.ts.map +1 -0
  81. package/dist/api/design/index.d.ts +153 -0
  82. package/dist/api/design/index.d.ts.map +1 -0
  83. package/dist/api/design/lock.d.ts +41 -0
  84. package/dist/api/design/lock.d.ts.map +1 -0
  85. package/dist/api/design/materials/index.d.ts +297 -0
  86. package/dist/api/design/materials/index.d.ts.map +1 -0
  87. package/dist/api/design/query/geometry/index.d.ts +140 -0
  88. package/dist/api/design/query/geometry/index.d.ts.map +1 -0
  89. package/dist/api/design/query/index.d.ts +1011 -0
  90. package/dist/api/design/query/index.d.ts.map +1 -0
  91. package/dist/api/design/query/spaces.d.ts +221 -0
  92. package/dist/api/design/query/spaces.d.ts.map +1 -0
  93. package/dist/api/design/selection/index.d.ts +138 -0
  94. package/dist/api/design/selection/index.d.ts.map +1 -0
  95. package/dist/api/design/shared.d.ts +38 -0
  96. package/dist/api/design/shared.d.ts.map +1 -0
  97. package/dist/api/design/transform/index.d.ts +87 -0
  98. package/dist/api/design/transform/index.d.ts.map +1 -0
  99. package/dist/api/design/update/index.d.ts +178 -0
  100. package/dist/api/design/update/index.d.ts.map +1 -0
  101. package/dist/api/design/windows/index.d.ts +189 -0
  102. package/dist/api/design/windows/index.d.ts.map +1 -0
  103. package/dist/api/entity/buildableEnvelope.d.ts +261 -0
  104. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
  105. package/dist/api/entity/department.d.ts +1 -0
  106. package/dist/api/entity/department.d.ts.map +1 -0
  107. package/dist/api/entity/index.d.ts +28 -0
  108. package/dist/api/entity/index.d.ts.map +1 -0
  109. package/dist/api/entity/referenceLine.d.ts +202 -0
  110. package/dist/api/entity/referenceLine.d.ts.map +1 -0
  111. package/dist/api/entity/space.d.ts +846 -0
  112. package/dist/api/entity/space.d.ts.map +1 -0
  113. package/dist/api/entity/story.d.ts +249 -0
  114. package/dist/api/entity/story.d.ts.map +1 -0
  115. package/dist/api/index.d.ts +35 -0
  116. package/dist/api/index.d.ts.map +1 -0
  117. package/dist/api/presentation/aiInspiration.d.ts +2400 -0
  118. package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
  119. package/dist/api/presentation/diagrams.d.ts +81 -0
  120. package/dist/api/presentation/diagrams.d.ts.map +1 -0
  121. package/dist/api/presentation/import.d.ts +113 -0
  122. package/dist/api/presentation/import.d.ts.map +1 -0
  123. package/dist/api/presentation/index.d.ts +45 -0
  124. package/dist/api/presentation/index.d.ts.map +1 -0
  125. package/dist/api/presentation/sheets.d.ts +176 -0
  126. package/dist/api/presentation/sheets.d.ts.map +1 -0
  127. package/dist/api/presentation/views.d.ts +296 -0
  128. package/dist/api/presentation/views.d.ts.map +1 -0
  129. package/dist/api/program/adjacency.d.ts +155 -0
  130. package/dist/api/program/adjacency.d.ts.map +1 -0
  131. package/dist/api/program/areas.d.ts +360 -0
  132. package/dist/api/program/areas.d.ts.map +1 -0
  133. package/dist/api/program/classification.d.ts +135 -0
  134. package/dist/api/program/classification.d.ts.map +1 -0
  135. package/dist/api/program/cores.d.ts +174 -0
  136. package/dist/api/program/cores.d.ts.map +1 -0
  137. package/dist/api/program/departments.d.ts +431 -0
  138. package/dist/api/program/departments.d.ts.map +1 -0
  139. package/dist/api/program/index.d.ts +69 -0
  140. package/dist/api/program/index.d.ts.map +1 -0
  141. package/dist/api/program/layout.d.ts +63 -0
  142. package/dist/api/program/layout.d.ts.map +1 -0
  143. package/dist/api/program/metrics.d.ts +108 -0
  144. package/dist/api/program/metrics.d.ts.map +1 -0
  145. package/dist/api/program/site.d.ts +367 -0
  146. package/dist/api/program/site.d.ts.map +1 -0
  147. package/dist/api/program/spreadsheet.d.ts +2041 -0
  148. package/dist/api/program/spreadsheet.d.ts.map +1 -0
  149. package/dist/handles.d.ts +138 -0
  150. package/dist/handles.d.ts.map +1 -0
  151. package/dist/host-utils.d.ts +43 -0
  152. package/dist/host-utils.d.ts.map +1 -0
  153. package/dist/index.cjs +4597 -0
  154. package/dist/index.cjs.map +1 -0
  155. package/dist/index.d.ts +5 -0
  156. package/dist/index.d.ts.map +1 -0
  157. package/dist/index.js +3870 -0
  158. package/dist/index.js.map +1 -0
  159. package/dist/types.d.ts +16 -0
  160. package/dist/types.d.ts.map +1 -0
  161. package/package.json +39 -0
  162. package/scripts/generate-manifest.mjs +193 -0
  163. package/scripts/generate-manifest.test.mjs +193 -0
  164. package/src/api/core/buildings.ts +485 -0
  165. package/src/api/core/comment/index.ts +258 -0
  166. package/src/api/core/geom/create/index.ts +293 -0
  167. package/src/api/core/geom/delete/index.ts +78 -0
  168. package/src/api/core/geom/index.ts +35 -0
  169. package/src/api/core/geom/query/arc.ts +169 -0
  170. package/src/api/core/geom/query/brep.ts +444 -0
  171. package/src/api/core/geom/query/circle.ts +404 -0
  172. package/src/api/core/geom/query/contour.ts +540 -0
  173. package/src/api/core/geom/query/curve.ts +1078 -0
  174. package/src/api/core/geom/query/edge.ts +130 -0
  175. package/src/api/core/geom/query/face.ts +403 -0
  176. package/src/api/core/geom/query/halfedge.ts +210 -0
  177. package/src/api/core/geom/query/index.ts +63 -0
  178. package/src/api/core/geom/query/profile.ts +473 -0
  179. package/src/api/core/geom/query/vertex.ts +205 -0
  180. package/src/api/core/geom/update/contour.ts +315 -0
  181. package/src/api/core/geom/update/curve.ts +209 -0
  182. package/src/api/core/geom/update/index.ts +29 -0
  183. package/src/api/core/geom/update/profile.ts +377 -0
  184. package/src/api/core/groups.ts +521 -0
  185. package/src/api/core/history/index.ts +84 -0
  186. package/src/api/core/index.ts +65 -0
  187. package/src/api/core/layers.ts +333 -0
  188. package/src/api/core/math/index.ts +20 -0
  189. package/src/api/core/math/quat.ts +172 -0
  190. package/src/api/core/math/vec3.ts +179 -0
  191. package/src/api/core/project/index.ts +418 -0
  192. package/src/api/core/tags.ts +808 -0
  193. package/src/api/core/units/index.ts +164 -0
  194. package/src/api/core/zoom/index.ts +47 -0
  195. package/src/api/design/boolean/index.ts +179 -0
  196. package/src/api/design/create/index.ts +886 -0
  197. package/src/api/design/delete/index.ts +67 -0
  198. package/src/api/design/doors/index.ts +285 -0
  199. package/src/api/design/edit/index.ts +54 -0
  200. package/src/api/design/erase/index.ts +151 -0
  201. package/src/api/design/furniture/index.ts +130 -0
  202. package/src/api/design/index.ts +162 -0
  203. package/src/api/design/lock.ts +42 -0
  204. package/src/api/design/materials/index.ts +301 -0
  205. package/src/api/design/query/geometry/index.ts +166 -0
  206. package/src/api/design/query/index.ts +937 -0
  207. package/src/api/design/query/spaces.ts +132 -0
  208. package/src/api/design/selection/index.ts +144 -0
  209. package/src/api/design/shared.ts +40 -0
  210. package/src/api/design/transform/index.ts +93 -0
  211. package/src/api/design/update/index.ts +117 -0
  212. package/src/api/design/windows/index.ts +207 -0
  213. package/src/api/entity/buildableEnvelope.ts +318 -0
  214. package/src/api/entity/department.ts +0 -0
  215. package/src/api/entity/index.ts +30 -0
  216. package/src/api/entity/referenceLine.ts +227 -0
  217. package/src/api/entity/space.ts +612 -0
  218. package/src/api/entity/story.ts +273 -0
  219. package/src/api/index.ts +37 -0
  220. package/src/api/presentation/aiInspiration.ts +1116 -0
  221. package/src/api/presentation/diagrams.ts +84 -0
  222. package/src/api/presentation/import.ts +112 -0
  223. package/src/api/presentation/index.ts +47 -0
  224. package/src/api/presentation/sheets.ts +198 -0
  225. package/src/api/presentation/views.ts +303 -0
  226. package/src/api/program/adjacency.ts +164 -0
  227. package/src/api/program/areas.ts +335 -0
  228. package/src/api/program/classification.ts +138 -0
  229. package/src/api/program/cores.ts +171 -0
  230. package/src/api/program/departments.ts +465 -0
  231. package/src/api/program/index.ts +71 -0
  232. package/src/api/program/layout.ts +68 -0
  233. package/src/api/program/metrics.ts +120 -0
  234. package/src/api/program/site.ts +326 -0
  235. package/src/api/program/spreadsheet.ts +2075 -0
  236. package/src/handles.ts +148 -0
  237. package/src/host-utils.ts +64 -0
  238. package/src/index.ts +4 -0
  239. package/src/types.ts +16 -0
  240. package/tsconfig.json +17 -0
  241. package/tsup.config.ts +12 -0
@@ -0,0 +1,335 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../types"
3
+ import { PluginAreaUnit } from "./metrics"
4
+ import { ComponentHandle } from "../../handles"
5
+
6
+ /**
7
+ * Program areas — the FAR / built-up-area rollup for the active program.
8
+ *
9
+ * This is the zoning-compliance lens on the model: carpet / built-up / excluded
10
+ * area totals, the site area, and the achieved-vs-target **FAR** (Floor Area
11
+ * Ratio). It complements {@linkcode PluginProgramMetricsApi}, which is the
12
+ * department-allocation lens (targets vs allocated area per department); this
13
+ * namespace is the whole-program area/FAR summary and its groupings.
14
+ *
15
+ * `achievedFar` is **derived and read-only** — computed from built-up area and
16
+ * site area. `targetFar` is the goal you set (via {@linkcode
17
+ * PluginProgramAreasApi.update}); the two are the same ratio, one measured and
18
+ * one intended. The surface speaks **FAR only** — there is no FSI alias.
19
+ *
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).
24
+ *
25
+ * Accessed via `snaptrude.program.areas`.
26
+ */
27
+ export abstract class PluginProgramAreasApi {
28
+ constructor() {}
29
+
30
+ /**
31
+ * Get the program area summary.
32
+ *
33
+ * Returns the whole-program totals — carpet / built-up / excluded area, site
34
+ * area, and achieved vs target FAR — with the area unit they are reported in.
35
+ *
36
+ * @returns A {@linkcode PluginProgramAreaSummary}. `achievedFar` is `null` when
37
+ * the site area or target FAR is not set.
38
+ *
39
+ * @examplePrompt What's my FAR right now?
40
+ * @examplePrompt Give me the program area summary
41
+ * @examplePrompt How much built-up area have I used against the site area?
42
+ * @examplePrompt Am I within my FAR target?
43
+ *
44
+ * # Example
45
+ * ```ts
46
+ * const s = await snaptrude.program.areas.get()
47
+ * console.log(s.builtUp, s.siteArea, s.achievedFar, s.targetFar, s.areaUnit)
48
+ * ```
49
+ */
50
+ public abstract get(): PluginApiReturn<PluginProgramAreasGetResult>
51
+
52
+ /**
53
+ * List the program area rollup grouped by a facet.
54
+ *
55
+ * Breaks the program's area totals into buckets — by label, storey, building,
56
+ * department, or tag category.
57
+ *
58
+ * @param groupBy - The facet to group by (a {@linkcode PluginProgramAreaGroupBy}).
59
+ * @param categoryId - The tag category to group by (required when `groupBy` is
60
+ * `"tagCategories"`).
61
+ * @returns A {@linkcode PluginProgramAreasListResult} with a `groups` array
62
+ * (empty when the program has no spaces).
63
+ *
64
+ * @examplePrompt Break down the area by storey
65
+ * @examplePrompt Show the area rollup per department
66
+ * @examplePrompt Group the built-up area by building
67
+ *
68
+ * # Example
69
+ * ```ts
70
+ * const { groups } = await snaptrude.program.areas.list("storeys")
71
+ * for (const g of groups) console.log(g.name, g.builtUp, g.count)
72
+ * ```
73
+ */
74
+ public abstract list(
75
+ groupBy: PluginProgramAreaGroupBy,
76
+ categoryId?: string,
77
+ ): PluginApiReturn<PluginProgramAreasListResult>
78
+
79
+ /**
80
+ * List the spaces that make up one area group.
81
+ *
82
+ * Drills into a single bucket returned by {@linkcode
83
+ * PluginProgramAreasApi.list} and returns its member spaces with their per-space
84
+ * area figures.
85
+ *
86
+ * @param groupBy - The same facet used to produce the group (a {@linkcode
87
+ * PluginProgramAreaGroupBy}).
88
+ * @param groupId - The id of the group to expand.
89
+ * @param categoryId - The tag category context (required when `groupBy` is
90
+ * `"tagCategories"`).
91
+ * @returns A {@linkcode PluginProgramAreasListMembersResult} with a `members`
92
+ * array (empty when the group is missing or empty).
93
+ *
94
+ * @examplePrompt List the spaces on this storey with their areas
95
+ * @examplePrompt What rooms are in the Bedrooms department bucket?
96
+ * @examplePrompt Break the storey area down into individual spaces
97
+ *
98
+ * # Example
99
+ * ```ts
100
+ * const { members } = await snaptrude.program.areas.listMembers("storeys", "st_2")
101
+ * for (const m of members) console.log(m.label, m.carpet)
102
+ * ```
103
+ */
104
+ public abstract listMembers(
105
+ groupBy: PluginProgramAreaGroupBy,
106
+ groupId: string,
107
+ categoryId?: string,
108
+ ): PluginApiReturn<PluginProgramAreasListMembersResult>
109
+
110
+ /**
111
+ * Update the program's FAR settings.
112
+ *
113
+ * A **sparse** update of the program-level FAR inputs — target FAR, the site
114
+ * area, and the allowed deviation. This is a **non-undoable settings write**
115
+ * (persisted with the project). `achievedFar` recomputes from these.
116
+ *
117
+ * @param options - Any of `targetFar`, `siteArea`, `deviation`; omitted fields
118
+ * are left unchanged.
119
+ * @returns The recomputed {@linkcode PluginProgramAreaSummary}.
120
+ * @throws If a value is out of range.
121
+ *
122
+ * @examplePrompt Set the target FAR to 2.5
123
+ * @examplePrompt Override the site area to 5000
124
+ * @examplePrompt Allow a 10 percent FAR deviation
125
+ *
126
+ * # Example
127
+ * ```ts
128
+ * const s = await snaptrude.program.areas.update({ targetFar: 2.5 })
129
+ * console.log(s.achievedFar, s.targetFar)
130
+ * ```
131
+ */
132
+ public abstract update(
133
+ options?: { targetFar?: number; siteArea?: number; deviation?: number },
134
+ ): PluginApiReturn<PluginProgramAreasUpdateResult>
135
+ }
136
+
137
+ /**
138
+ * The whole-program area / FAR summary. All area figures are in `areaUnit`;
139
+ * ratios (`achievedFar`, `targetFar`, `deviation`) are unitless.
140
+ *
141
+ * | Property | Type | Description |
142
+ * |---|---|---|
143
+ * | `count` | `number` | Number of spaces in the program (a count, not an area) |
144
+ * | `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` |
148
+ * | `farBuiltUp` | `number` | Built-up area that counts toward FAR, in `areaUnit` |
149
+ * | `siteArea` | `number` | Site/plot area in `areaUnit` |
150
+ * | `achievedFar` | `number \| null` | Derived FAR (`farBuiltUp / siteArea`); `null` when site area or target FAR is unset |
151
+ * | `targetFar` | `number` | The target FAR goal (set via `update`) |
152
+ * | `deviation` | `number` | Allowed FAR deviation, as a percentage |
153
+ * | `areaUnit` | `"ft2" \| "m2"` | The unit every area figure above is reported in |
154
+ */
155
+ export const PluginProgramAreaSummary = z.object({
156
+ count: z.number().int(),
157
+ hiddenCount: z.number().int(),
158
+ carpet: z.number(),
159
+ builtUp: z.number(),
160
+ excluded: z.number(),
161
+ farBuiltUp: z.number(),
162
+ siteArea: z.number(),
163
+ achievedFar: z.number().nullable(),
164
+ targetFar: z.number(),
165
+ deviation: z.number(),
166
+ areaUnit: PluginAreaUnit,
167
+ })
168
+ export type PluginProgramAreaSummary = z.infer<typeof PluginProgramAreaSummary>
169
+
170
+ /**
171
+ * One bucket of the area rollup. Carpet / built-up / excluded figures are in the
172
+ * program's area unit (see {@linkcode PluginProgramAreaSummary.areaUnit});
173
+ * `targetArea` is in `targetUnit`.
174
+ *
175
+ * | Property | Type | Description |
176
+ * |---|---|---|
177
+ * | `groupId` | `string` | Stable id of the group (e.g. storey id, department id) |
178
+ * | `name` | `string` | Display name of the group |
179
+ * | `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 |
182
+ * | `excluded` | `number` | Excluded area for this group |
183
+ * | `count` | `number` | Number of spaces in this group |
184
+ * | `targetArea` | `number` | Target area for this group, in `targetUnit` |
185
+ * | `targetUnit` | `"ft2" \| "m2"` | The unit `targetArea` is reported in |
186
+ */
187
+ export const PluginProgramAreaGroup = z.object({
188
+ groupId: z.string(),
189
+ name: z.string(),
190
+ color: z.string(),
191
+ carpet: z.number(),
192
+ builtUp: z.number(),
193
+ excluded: z.number(),
194
+ count: z.number().int(),
195
+ targetArea: z.number(),
196
+ targetUnit: PluginAreaUnit,
197
+ })
198
+ export type PluginProgramAreaGroup = z.infer<typeof PluginProgramAreaGroup>
199
+
200
+ /**
201
+ * A single space within an area group. Area figures are in the program's area
202
+ * unit (see {@linkcode PluginProgramAreaSummary.areaUnit}).
203
+ *
204
+ * | Property | Type | Description |
205
+ * |---|---|---|
206
+ * | `id` | `ComponentHandle` | `Component.id` of the space (never a mesh handle) |
207
+ * | `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 |
211
+ * | `isVisible` | `boolean` | Whether the space is currently visible |
212
+ */
213
+ export const PluginProgramAreaMember = z.object({
214
+ id: ComponentHandle,
215
+ label: z.string(),
216
+ carpet: z.number(),
217
+ builtUp: z.number(),
218
+ excluded: z.number(),
219
+ isVisible: z.boolean(),
220
+ })
221
+ export type PluginProgramAreaMember = z.infer<typeof PluginProgramAreaMember>
222
+
223
+ /** The facet to group the area rollup by. */
224
+ export const PluginProgramAreaGroupBy = z.enum([
225
+ "labels",
226
+ "storeys",
227
+ "buildings",
228
+ "departments",
229
+ "tagCategories",
230
+ ])
231
+ export type PluginProgramAreaGroupBy = z.infer<typeof PluginProgramAreaGroupBy>
232
+
233
+ /** Result of {@linkcode PluginProgramAreasApi.get} — the program area summary. */
234
+ export const PluginProgramAreasGetResult = PluginProgramAreaSummary
235
+ export type PluginProgramAreasGetResult = z.infer<
236
+ typeof PluginProgramAreasGetResult
237
+ >
238
+
239
+ /**
240
+ * Arguments for {@linkcode PluginProgramAreasApi.list}.
241
+ *
242
+ * | Property | Type | Description |
243
+ * |---|---|---|
244
+ * | `groupBy` | {@linkcode PluginProgramAreaGroupBy} | The facet to group by |
245
+ * | `categoryId` | `string \| undefined` | Tag category to group by; required when `groupBy` is `"tagCategories"` |
246
+ */
247
+ export const PluginProgramAreasListArgs = z
248
+ .object({
249
+ groupBy: PluginProgramAreaGroupBy,
250
+ categoryId: z.string().optional(),
251
+ })
252
+ .refine((v) => v.groupBy !== "tagCategories" || v.categoryId != null, {
253
+ message: 'categoryId is required when groupBy is "tagCategories"',
254
+ })
255
+ export type PluginProgramAreasListArgs = z.infer<
256
+ typeof PluginProgramAreasListArgs
257
+ >
258
+
259
+ /**
260
+ * Result of {@linkcode PluginProgramAreasApi.list}.
261
+ *
262
+ * | Property | Type | Description |
263
+ * |---|---|---|
264
+ * | `groups` | {@linkcode PluginProgramAreaGroup}`[]` | The area buckets (empty when the program has no spaces) |
265
+ */
266
+ export const PluginProgramAreasListResult = z.object({
267
+ groups: z.array(PluginProgramAreaGroup),
268
+ })
269
+ export type PluginProgramAreasListResult = z.infer<
270
+ typeof PluginProgramAreasListResult
271
+ >
272
+
273
+ /**
274
+ * Arguments for {@linkcode PluginProgramAreasApi.listMembers}.
275
+ *
276
+ * | Property | Type | Description |
277
+ * |---|---|---|
278
+ * | `groupBy` | {@linkcode PluginProgramAreaGroupBy} | The facet the group came from |
279
+ * | `groupId` | `string` | The id of the group to expand |
280
+ * | `categoryId` | `string \| undefined` | Tag category context; required when `groupBy` is `"tagCategories"` |
281
+ */
282
+ export const PluginProgramAreasListMembersArgs = z
283
+ .object({
284
+ groupBy: PluginProgramAreaGroupBy,
285
+ groupId: z.string(),
286
+ categoryId: z.string().optional(),
287
+ })
288
+ .refine((v) => v.groupBy !== "tagCategories" || v.categoryId != null, {
289
+ message: 'categoryId is required when groupBy is "tagCategories"',
290
+ })
291
+ export type PluginProgramAreasListMembersArgs = z.infer<
292
+ typeof PluginProgramAreasListMembersArgs
293
+ >
294
+
295
+ /**
296
+ * Result of {@linkcode PluginProgramAreasApi.listMembers}.
297
+ *
298
+ * | Property | Type | Description |
299
+ * |---|---|---|
300
+ * | `members` | {@linkcode PluginProgramAreaMember}`[]` | The group's member spaces (empty when missing or empty) |
301
+ */
302
+ export const PluginProgramAreasListMembersResult = z.object({
303
+ members: z.array(PluginProgramAreaMember),
304
+ })
305
+ export type PluginProgramAreasListMembersResult = z.infer<
306
+ typeof PluginProgramAreasListMembersResult
307
+ >
308
+
309
+ /**
310
+ * Arguments for {@linkcode PluginProgramAreasApi.update}. Sparse — only the
311
+ * provided fields are changed.
312
+ *
313
+ * | Property | Type | Description |
314
+ * |---|---|---|
315
+ * | `targetFar` | `number \| undefined` | New target FAR (≥ 0) |
316
+ * | `siteArea` | `number \| undefined` | Site-area override (> 0), in the program's area unit |
317
+ * | `deviation` | `number \| undefined` | Allowed FAR deviation percentage (0–100) |
318
+ */
319
+ export const PluginProgramAreasUpdateArgs = z.object({
320
+ targetFar: z.number().min(0).optional(),
321
+ siteArea: z.number().positive().optional(),
322
+ deviation: z.number().min(0).max(100).optional(),
323
+ })
324
+ export type PluginProgramAreasUpdateArgs = z.infer<
325
+ typeof PluginProgramAreasUpdateArgs
326
+ >
327
+
328
+ /**
329
+ * Result of {@linkcode PluginProgramAreasApi.update} — the recomputed program
330
+ * area summary.
331
+ */
332
+ export const PluginProgramAreasUpdateResult = PluginProgramAreaSummary
333
+ export type PluginProgramAreasUpdateResult = z.infer<
334
+ typeof PluginProgramAreasUpdateResult
335
+ >
@@ -0,0 +1,138 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../types"
3
+
4
+ /**
5
+ * Program classification — the catalog of space-classification options, and a
6
+ * space's display tags.
7
+ *
8
+ * Only the genuinely program-specific reads live here: the selectable
9
+ * space-type / area-class / mass-type options, and a space's tags for display.
10
+ * Reading or changing a *single space's* classification (its type, label, area
11
+ * class, or department) is done through the space reads/writes, not duplicated
12
+ * here. Tag definitions are managed elsewhere — these methods are display-only.
13
+ *
14
+ * Both methods are reads.
15
+ *
16
+ * Accessed via `snaptrude.program.classification`.
17
+ */
18
+ export abstract class PluginProgramClassificationApi {
19
+ constructor() {}
20
+
21
+ /**
22
+ * List the selectable classification options for spaces.
23
+ *
24
+ * The static catalog (project-independent) of space types, area classes, and
25
+ * mass types a space can be classified as.
26
+ *
27
+ * @returns A {@linkcode PluginProgramClassificationTypesResult} with the
28
+ * `spaceTypes`, `areaClasses`, and `massTypes` option lists.
29
+ *
30
+ * @examplePrompt What space types can I assign?
31
+ * @examplePrompt List the available area classifications
32
+ * @examplePrompt What classification options exist?
33
+ * @examplePrompt Show me the valid space-type values
34
+ *
35
+ * # Example
36
+ * ```ts
37
+ * const { spaceTypes, areaClasses } = await snaptrude.program.classification.listTypes()
38
+ * ```
39
+ */
40
+ public abstract listTypes(): PluginApiReturn<PluginProgramClassificationTypesResult>
41
+
42
+ /**
43
+ * List a space's tags for display, grouped by category.
44
+ *
45
+ * @param id - The id of the space whose tags to read.
46
+ * @returns A {@linkcode PluginProgramClassificationTagsResult} with the space's
47
+ * `tagIds` and `tagsByCategory`.
48
+ *
49
+ * @examplePrompt What tags are on this space?
50
+ * @examplePrompt Show the tags grouped by category for sp_4
51
+ * @examplePrompt List this room's display tags
52
+ * @examplePrompt Which tags does this space have?
53
+ *
54
+ * # Example
55
+ * ```ts
56
+ * const { tagsByCategory } = await snaptrude.program.classification.listTags("sp_4")
57
+ * ```
58
+ */
59
+ public abstract listTags(
60
+ id: string,
61
+ ): PluginApiReturn<PluginProgramClassificationTagsResult>
62
+ }
63
+
64
+ /**
65
+ * A selectable classification option.
66
+ *
67
+ * | Property | Type | Description |
68
+ * |---|---|---|
69
+ * | `value` | `string` | Stored value |
70
+ * | `label` | `string` | Display label |
71
+ */
72
+ export const PluginClassificationOption = z.object({
73
+ value: z.string(),
74
+ label: z.string(),
75
+ })
76
+ export type PluginClassificationOption = z.infer<
77
+ typeof PluginClassificationOption
78
+ >
79
+
80
+ /**
81
+ * Result of {@linkcode PluginProgramClassificationApi.listTypes}.
82
+ *
83
+ * | Property | Type | Description |
84
+ * |---|---|---|
85
+ * | `spaceTypes` | {@linkcode PluginClassificationOption}`[]` | Selectable space types |
86
+ * | `areaClasses` | {@linkcode PluginClassificationOption}`[]` | Selectable area classes (NET/GROSS/EXCLUDED) |
87
+ * | `massTypes` | {@linkcode PluginClassificationOption}`[]` | Selectable mass/object types |
88
+ */
89
+ export const PluginProgramClassificationTypesResult = z.object({
90
+ spaceTypes: z.array(PluginClassificationOption),
91
+ areaClasses: z.array(PluginClassificationOption),
92
+ massTypes: z.array(PluginClassificationOption),
93
+ })
94
+ export type PluginProgramClassificationTypesResult = z.infer<
95
+ typeof PluginProgramClassificationTypesResult
96
+ >
97
+
98
+ /** Arguments for {@linkcode PluginProgramClassificationApi.listTags}. */
99
+ export const PluginProgramClassificationListTagsArgs = z.object({
100
+ id: z.string(),
101
+ })
102
+ export type PluginProgramClassificationListTagsArgs = z.infer<
103
+ typeof PluginProgramClassificationListTagsArgs
104
+ >
105
+
106
+ /**
107
+ * A display tag on a space.
108
+ *
109
+ * | Property | Type | Description |
110
+ * |---|---|---|
111
+ * | `tagId` | `string` | Tag id |
112
+ * | `tagName` | `string` | Tag display name |
113
+ * | `color` | `string` | CSS hex color string |
114
+ * | `categoryId` | `string` | Id of the tag's category |
115
+ */
116
+ export const PluginSpaceTag = z.object({
117
+ tagId: z.string(),
118
+ tagName: z.string(),
119
+ color: z.string(),
120
+ categoryId: z.string(),
121
+ })
122
+ export type PluginSpaceTag = z.infer<typeof PluginSpaceTag>
123
+
124
+ /**
125
+ * Result of {@linkcode PluginProgramClassificationApi.listTags}.
126
+ *
127
+ * | Property | Type | Description |
128
+ * |---|---|---|
129
+ * | `tagIds` | `string[]` | All tag ids on the space |
130
+ * | `tagsByCategory` | `Record<string, `{@linkcode PluginSpaceTag}`>` | Tags keyed by category name |
131
+ */
132
+ export const PluginProgramClassificationTagsResult = z.object({
133
+ tagIds: z.array(z.string()),
134
+ tagsByCategory: z.record(z.string(), PluginSpaceTag),
135
+ })
136
+ export type PluginProgramClassificationTagsResult = z.infer<
137
+ typeof PluginProgramClassificationTagsResult
138
+ >
@@ -0,0 +1,171 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../types"
3
+
4
+ /**
5
+ * Program cores — the building's vertical-circulation cores (lift / stair / shaft
6
+ * shells).
7
+ *
8
+ * Read the cores in the scene, test whether a space is a core, and trigger core
9
+ * generation from a layout. `create` is a **thin trigger**: the program hands a
10
+ * core layout to the core-generation engine, which authors the geometry — the
11
+ * core geometry itself is owned by the geometry layer, not here (the exact
12
+ * layout ↔ engine payload is coordinated with the geometry owner).
13
+ *
14
+ * `list`/`isCore` are reads; `create` triggers generation.
15
+ *
16
+ * Accessed via `snaptrude.program.cores`.
17
+ */
18
+ export abstract class PluginProgramCoresApi {
19
+ constructor() {}
20
+
21
+ /**
22
+ * List the cores currently in the building.
23
+ *
24
+ * @returns A {@linkcode PluginProgramCoresListResult} with each core's id,
25
+ * core group, and storey (empty when there are none).
26
+ *
27
+ * @examplePrompt List the cores in the building
28
+ * @examplePrompt How many cores are placed?
29
+ * @examplePrompt Show me the lift and stair cores
30
+ * @examplePrompt Which storeys have cores?
31
+ *
32
+ * # Example
33
+ * ```ts
34
+ * const { cores } = await snaptrude.program.cores.list()
35
+ * ```
36
+ */
37
+ public abstract list(): PluginApiReturn<PluginProgramCoresListResult>
38
+
39
+ /**
40
+ * Test whether a space is a circulation core element.
41
+ *
42
+ * @param id - The id of the space to test.
43
+ * @returns `true` if the space is a core element.
44
+ *
45
+ * @examplePrompt Is this space a core?
46
+ * @examplePrompt Does this mass belong to the core?
47
+ * @examplePrompt Check if space sp_1 is a circulation core
48
+ *
49
+ * # Example
50
+ * ```ts
51
+ * const isCore = await snaptrude.program.cores.isCore("sp_1")
52
+ * ```
53
+ */
54
+ public abstract isCore(id: string): PluginApiReturn<boolean>
55
+
56
+ /**
57
+ * Generate core geometry from a layout (thin trigger).
58
+ *
59
+ * Hands the core layout to the core-generation engine and returns how many core
60
+ * elements were created. The geometry is authored by the engine, not here.
61
+ * _(Authored ahead — optional until the host's geometry adapter lands; the
62
+ * reads {@linkcode PluginProgramCoresApi.list}/{@linkcode PluginProgramCoresApi.isCore}
63
+ * are live.)_
64
+ *
65
+ * @param cores - The {@linkcode PluginProgramCoreSpec} layout of cores to
66
+ * generate.
67
+ * @param lengthUnit - Unit of the spec dimensions (default project unit).
68
+ * @returns A {@linkcode PluginProgramCoresCreateResult} with the created count.
69
+ * @throws If the layout could not be realized.
70
+ *
71
+ * @examplePrompt Generate the building cores from this layout
72
+ * @examplePrompt Place the elevator and stair cores
73
+ * @examplePrompt Create the service core shells
74
+ *
75
+ * # Example
76
+ * ```ts
77
+ * await snaptrude.program.cores.create([
78
+ * { type: "lift", position: { x: 0, y: 0, z: 0 }, width: 3, depth: 4 },
79
+ * ])
80
+ * ```
81
+ */
82
+ public create?: (
83
+ cores: PluginProgramCoreSpec[],
84
+ lengthUnit?: "mm" | "m" | "ft",
85
+ ) => PluginApiReturn<PluginProgramCoresCreateResult>
86
+ }
87
+
88
+ /**
89
+ * A circulation core element in the building.
90
+ *
91
+ * | Property | Type | Description |
92
+ * |---|---|---|
93
+ * | `id` | `string` | Component id of the core element |
94
+ * | `groupId` | `string` | Id of the core group this element belongs to |
95
+ * | `storey` | `number` | Storey (floor number) the element sits on |
96
+ */
97
+ export const PluginProgramCore = z.object({
98
+ id: z.string(),
99
+ groupId: z.string(),
100
+ storey: z.number(),
101
+ })
102
+ export type PluginProgramCore = z.infer<typeof PluginProgramCore>
103
+
104
+ /** Result of {@linkcode PluginProgramCoresApi.list}. */
105
+ export const PluginProgramCoresListResult = z.object({
106
+ cores: z.array(PluginProgramCore),
107
+ })
108
+ export type PluginProgramCoresListResult = z.infer<
109
+ typeof PluginProgramCoresListResult
110
+ >
111
+
112
+ /** Arguments for {@linkcode PluginProgramCoresApi.isCore}. */
113
+ export const PluginProgramCoresIsCoreArgs = z.object({
114
+ id: z.string(),
115
+ })
116
+ export type PluginProgramCoresIsCoreArgs = z.infer<
117
+ typeof PluginProgramCoresIsCoreArgs
118
+ >
119
+
120
+ /**
121
+ * One core to generate. The geometry layer interprets this layout (the exact
122
+ * fields are coordinated with the geometry owner).
123
+ *
124
+ * | Property | Type | Description |
125
+ * |---|---|---|
126
+ * | `type` | `string \| undefined` | Core kind (e.g. `"lift"`, `"stair"`, `"shaft"`) |
127
+ * | `position` | `{ x; y; z }` | Base position of the core |
128
+ * | `width` | `number` | Core width, in `lengthUnit` |
129
+ * | `depth` | `number` | Core depth, in `lengthUnit` |
130
+ * | `fromStorey` | `number \| undefined` | First storey the core spans |
131
+ * | `toStorey` | `number \| undefined` | Last storey the core spans |
132
+ */
133
+ export const PluginProgramCoreSpec = z.object({
134
+ type: z.string().optional(),
135
+ position: z.object({ x: z.number(), y: z.number(), z: z.number() }),
136
+ width: z.number(),
137
+ depth: z.number(),
138
+ fromStorey: z.number().optional(),
139
+ toStorey: z.number().optional(),
140
+ })
141
+ export type PluginProgramCoreSpec = z.infer<typeof PluginProgramCoreSpec>
142
+
143
+ /**
144
+ * Arguments for {@linkcode PluginProgramCoresApi.create}.
145
+ *
146
+ * | Property | Type | Description |
147
+ * |---|---|---|
148
+ * | `cores` | {@linkcode PluginProgramCoreSpec}`[]` | The cores to generate |
149
+ * | `lengthUnit` | `"mm" \| "m" \| "ft" \| undefined` | Unit of the spec dimensions (default project unit) |
150
+ */
151
+ export const PluginProgramCoresCreateArgs = z.object({
152
+ cores: z.array(PluginProgramCoreSpec),
153
+ lengthUnit: z.enum(["mm", "m", "ft"]).optional(),
154
+ })
155
+ export type PluginProgramCoresCreateArgs = z.infer<
156
+ typeof PluginProgramCoresCreateArgs
157
+ >
158
+
159
+ /**
160
+ * Result of {@linkcode PluginProgramCoresApi.create}.
161
+ *
162
+ * | Property | Type | Description |
163
+ * |---|---|---|
164
+ * | `createdCount` | `number` | Number of core elements created |
165
+ */
166
+ export const PluginProgramCoresCreateResult = z.object({
167
+ createdCount: z.number(),
168
+ })
169
+ export type PluginProgramCoresCreateResult = z.infer<
170
+ typeof PluginProgramCoresCreateResult
171
+ >