@snaptrude/plugin-core 0.9.16-networks-20261012.1 → 0.9.17

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 (88) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/api-manifest.json +9711 -0
  3. package/dist/api/analysis/daylight.d.ts +5 -5
  4. package/dist/api/analysis/solar.d.ts +2 -2
  5. package/dist/api/core/camera/index.d.ts +0 -29
  6. package/dist/api/core/camera/index.d.ts.map +1 -1
  7. package/dist/api/core/zoom/index.d.ts +0 -13
  8. package/dist/api/core/zoom/index.d.ts.map +1 -1
  9. package/dist/api/design/create/bulk-items.d.ts +21 -40
  10. package/dist/api/design/create/bulk-items.d.ts.map +1 -1
  11. package/dist/api/design/create/index.d.ts +97 -120
  12. package/dist/api/design/create/index.d.ts.map +1 -1
  13. package/dist/api/design/create/opening-fields.d.ts +12 -13
  14. package/dist/api/design/create/opening-fields.d.ts.map +1 -1
  15. package/dist/api/design/doors/index.d.ts +24 -18
  16. package/dist/api/design/doors/index.d.ts.map +1 -1
  17. package/dist/api/design/family.d.ts +27 -797
  18. package/dist/api/design/family.d.ts.map +1 -1
  19. package/dist/api/design/index.d.ts +0 -16
  20. package/dist/api/design/index.d.ts.map +1 -1
  21. package/dist/api/design/query/index.d.ts +30 -30
  22. package/dist/api/design/selection/index.d.ts +10 -10
  23. package/dist/api/design/types/index.d.ts +24 -40
  24. package/dist/api/design/types/index.d.ts.map +1 -1
  25. package/dist/api/design/update/index.d.ts +3 -40
  26. package/dist/api/design/update/index.d.ts.map +1 -1
  27. package/dist/api/design/windows/index.d.ts +8 -8
  28. package/dist/api/design/windows/index.d.ts.map +1 -1
  29. package/dist/api/presentation/aiInspiration.d.ts +10 -10
  30. package/dist/api/presentation/annotate.d.ts +22 -38
  31. package/dist/api/presentation/annotate.d.ts.map +1 -1
  32. package/dist/api/presentation/export.d.ts +5 -23
  33. package/dist/api/presentation/export.d.ts.map +1 -1
  34. package/dist/api/presentation/index.d.ts +21 -32
  35. package/dist/api/presentation/index.d.ts.map +1 -1
  36. package/dist/api/presentation/placedViews.d.ts +6 -106
  37. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  38. package/dist/api/presentation/sections.d.ts +461 -0
  39. package/dist/api/presentation/sections.d.ts.map +1 -0
  40. package/dist/api/presentation/shapes.d.ts +2 -2
  41. package/dist/api/presentation/sheets.d.ts +19 -175
  42. package/dist/api/presentation/sheets.d.ts.map +1 -1
  43. package/dist/api/presentation/views.d.ts +5 -103
  44. package/dist/api/presentation/views.d.ts.map +1 -1
  45. package/dist/api/presentation/walkthroughs.d.ts +6 -6
  46. package/dist/index.cjs +2434 -3619
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.js +2421 -3501
  49. package/dist/index.js.map +1 -1
  50. package/package.json +1 -1
  51. package/scripts/generate-manifest.mjs +0 -5
  52. package/src/api/core/camera/index.ts +0 -29
  53. package/src/api/core/zoom/index.ts +0 -13
  54. package/src/api/design/create/bulk-items.ts +16 -23
  55. package/src/api/design/create/index.ts +119 -129
  56. package/src/api/design/create/opening-fields.ts +12 -15
  57. package/src/api/design/doors/index.ts +42 -58
  58. package/src/api/design/family.ts +32 -662
  59. package/src/api/design/index.ts +4 -34
  60. package/src/api/design/types/index.ts +24 -31
  61. package/src/api/design/update/index.ts +3 -41
  62. package/src/api/design/windows/index.ts +22 -40
  63. package/src/api/presentation/annotate.ts +58 -90
  64. package/src/api/presentation/export.ts +6 -32
  65. package/src/api/presentation/index.ts +23 -39
  66. package/src/api/presentation/placedViews.ts +28 -119
  67. package/src/api/presentation/sections.ts +420 -0
  68. package/src/api/presentation/sheets.ts +20 -181
  69. package/src/api/presentation/views.ts +6 -46
  70. package/dist/api/design/bim.d.ts +0 -209
  71. package/dist/api/design/bim.d.ts.map +0 -1
  72. package/dist/api/design/catalog.d.ts +0 -320
  73. package/dist/api/design/catalog.d.ts.map +0 -1
  74. package/dist/api/design/networks.d.ts +0 -1703
  75. package/dist/api/design/networks.d.ts.map +0 -1
  76. package/dist/api/presentation/drawingContract.d.ts +0 -32
  77. package/dist/api/presentation/drawingContract.d.ts.map +0 -1
  78. package/dist/api/presentation/drawings.d.ts +0 -3523
  79. package/dist/api/presentation/drawings.d.ts.map +0 -1
  80. package/dist/api/presentation/viewPresets.d.ts +0 -222
  81. package/dist/api/presentation/viewPresets.d.ts.map +0 -1
  82. package/src/api/design/bim.ts +0 -121
  83. package/src/api/design/catalog.ts +0 -203
  84. package/src/api/design/networks.ts +0 -607
  85. package/src/api/presentation/drawingContract.ts +0 -70
  86. package/src/api/presentation/drawings.ts +0 -1179
  87. package/src/api/presentation/viewPresets.ts +0 -241
  88. package/test/drawingContract.test.mjs +0 -288
@@ -1,607 +0,0 @@
1
- import * as z from "zod"
2
- import type { PluginApiReturn } from "../../types"
3
-
4
- const id = z.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,79}$/)
5
- const vector = z.tuple([
6
- z.number().finite(),
7
- z.number().finite(),
8
- z.number().finite(),
9
- ])
10
- const positive = z.number().finite().positive()
11
- const endpoint = z.object({ node: id, port: id }).strict()
12
- const relationships = z
13
- .array(
14
- z
15
- .object({
16
- node: id,
17
- relation: z.enum(["mountedOn", "within", "serves", "penetrates"]),
18
- target: z
19
- .object({
20
- kind: z.enum(["component", "topology"]),
21
- id: z.string().min(1).max(200),
22
- })
23
- .strict(),
24
- })
25
- .strict(),
26
- )
27
- .max(4000)
28
-
29
- /** Versioned metadata stored in a pinned FamilySpecBundle.network. Expressions use the
30
- * family's parameter scope and SU, just like its geometry. No world-space port overrides.
31
- * Pipe recipes run from local [0,0,0] to [length,0,0] along +X.
32
- */
33
- export const NetworkFamilyContract = z
34
- .object({
35
- schemaVersion: z.literal(1),
36
- role: z.enum([
37
- "pipe",
38
- "duct",
39
- "wire",
40
- "cable",
41
- "conduit",
42
- "cableDuct",
43
- "cableTray",
44
- "connector",
45
- "equipment",
46
- ]),
47
- lengthParameter: z.string().min(1).optional(),
48
- ports: z
49
- .array(
50
- z
51
- .object({
52
- id,
53
- position: z.tuple([z.string(), z.string(), z.string()]),
54
- direction: z.tuple([z.string(), z.string(), z.string()]),
55
- size: z.string(),
56
- height: z.string().optional(),
57
- /** Unit width axis in family coordinates, perpendicular to direction.
58
- * Required with height for mechanical rectangular ports; prevents guessed roll.
59
- */
60
- widthDirection: z
61
- .tuple([z.string(), z.string(), z.string()])
62
- .optional(),
63
- systems: z.array(z.string().min(1)).min(1),
64
- })
65
- .strict(),
66
- )
67
- .min(1)
68
- .max(64),
69
- })
70
- .strict()
71
- export type NetworkFamilyContract = z.infer<typeof NetworkFamilyContract>
72
-
73
- const familyPin = z
74
- .object({
75
- definitionId: z.string().min(1).max(200),
76
- version: z.number().int().positive(),
77
- values: z.record(
78
- z.string(),
79
- z.union([z.number().finite(), z.string(), z.boolean()]),
80
- ),
81
- })
82
- .strict()
83
-
84
- /** Authored topology: vertices are pinned connector/equipment families; each edge is one
85
- * line and one pinned straight-pipe family. Curved runs are not yet supported by this
86
- * contract; bends require explicit connector vertices. World mm, Y up, rotations in degrees.
87
- * Plumbing v2 accepts round ports only. Rectangular ports need a section-roll contract.
88
- * The resolved component graph is retained for existing persistence, replay and queries.
89
- */
90
- export const NetworkTopologyDocument = z
91
- .object({
92
- schemaVersion: z.literal(2),
93
- domain: z.literal("plumbing"),
94
- label: z.string().min(1).max(120),
95
- architectureRevision: z.string().min(1).max(80),
96
- relationships,
97
- vertices: z
98
- .array(
99
- z
100
- .object({
101
- id,
102
- kind: z.enum([
103
- "fixture",
104
- "equipment",
105
- "tank",
106
- "pump",
107
- "valve",
108
- "manifold",
109
- "fitting",
110
- ]),
111
- storey: z.number().int(),
112
- family: familyPin,
113
- positionMm: vector,
114
- rotationDeg: vector,
115
- systems: z.record(z.string(), z.string().min(1)),
116
- })
117
- .strict(),
118
- )
119
- .min(1)
120
- .max(1000),
121
- edges: z
122
- .array(
123
- z
124
- .object({
125
- id,
126
- kind: z.enum(["pipe", "riser"]),
127
- storey: z.number().int(),
128
- family: familyPin,
129
- from: endpoint,
130
- to: endpoint,
131
- system: z.string().min(1),
132
- /** One line between evaluated connector ports, never a corner-bearing polyline. */
133
- curve: z.object({ kind: z.literal("line") }).strict(),
134
- })
135
- .strict(),
136
- )
137
- .max(1000),
138
- })
139
- .strict()
140
- export type NetworkTopologyDocument = z.infer<typeof NetworkTopologyDocument>
141
-
142
- export const MechanicalAirSystem = z.enum([
143
- "supplyAir",
144
- "returnAir",
145
- "exhaustAir",
146
- "outsideAir",
147
- "reliefAir",
148
- ])
149
- const mechanicalVertexKind = z.enum([
150
- "equipment",
151
- "terminal",
152
- "damper",
153
- "fitting",
154
- ])
155
- const mechanicalEdgeKind = z.enum(["duct", "riser"])
156
-
157
- /** Air-side HVAC intent. Reuses the graph transport, not plumbing domain semantics.
158
- * Every vertex and edge pins an existing family. Edges run from upstream to downstream.
159
- * Rectangular duct ports use local +Y as their width axis. The host aligns this axis to
160
- * the upstream connector's widthDirection and rejects incompatible downstream roll.
161
- * Bends, branches and transitions are explicit fitting vertices. No flexible curves,
162
- * hydronic/refrigerant design, airflow sizing or code-compliance inference is provided.
163
- */
164
- export const MechanicalTopologyDocument = NetworkTopologyDocument.extend({
165
- domain: z.literal("mechanical"),
166
- vertices: z
167
- .array(
168
- NetworkTopologyDocument.shape.vertices.element.extend({
169
- kind: mechanicalVertexKind,
170
- systems: z.record(z.string(), MechanicalAirSystem),
171
- }),
172
- )
173
- .min(1)
174
- .max(1000),
175
- edges: z
176
- .array(
177
- NetworkTopologyDocument.shape.edges.element.extend({
178
- kind: mechanicalEdgeKind,
179
- system: MechanicalAirSystem,
180
- }),
181
- )
182
- .max(1000),
183
- })
184
- export type MechanicalTopologyDocument = z.infer<
185
- typeof MechanicalTopologyDocument
186
- >
187
-
188
- const electricalVertexKind = z.enum([
189
- "transformer",
190
- "mainBoard",
191
- "distributionBoard",
192
- "mcbBox",
193
- "junctionBox",
194
- "switch",
195
- "outlet",
196
- "light",
197
- "load",
198
- "equipment",
199
- "fitting",
200
- ])
201
- const electricalEdgeKind = z.enum([
202
- "wire",
203
- "cable",
204
- "conduit",
205
- "cableDuct",
206
- "cableTray",
207
- ])
208
- const electricalCircuits = z
209
- .array(
210
- z
211
- .object({
212
- id,
213
- source: id,
214
- loads: z.array(id).min(1).max(1000),
215
- routes: z.array(id).max(1000),
216
- voltage: positive,
217
- phases: z.number().int().min(1).max(3),
218
- ratedAmps: positive,
219
- })
220
- .strict(),
221
- )
222
- .max(1000)
223
-
224
- /** Physical electrical topology, independent of logical circuit membership.
225
- * Each straight edge pins a family whose role matches its kind. Bends and branches
226
- * require connector vertices. Junction boxes are equipment with explicit named ports.
227
- * Rectangular containment uses the same section frame as mechanical ducts.
228
- * Systems are authored labels which must be supported by the pinned ports.
229
- * Direction is explicit, never inferred from circuits or spatial contact.
230
- */
231
- export const ElectricalTopologyDocument = NetworkTopologyDocument.extend({
232
- domain: z.literal("electrical"),
233
- vertices: z
234
- .array(
235
- NetworkTopologyDocument.shape.vertices.element.extend({
236
- kind: electricalVertexKind,
237
- }),
238
- )
239
- .min(1)
240
- .max(1000),
241
- edges: z
242
- .array(
243
- NetworkTopologyDocument.shape.edges.element.extend({
244
- kind: electricalEdgeKind,
245
- directed: z.boolean(),
246
- }),
247
- )
248
- .max(1000),
249
- circuits: electricalCircuits,
250
- })
251
- export type ElectricalTopologyDocument = z.infer<
252
- typeof ElectricalTopologyDocument
253
- >
254
-
255
- export const AuthoredNetworkTopologyDocument = z.discriminatedUnion("domain", [
256
- NetworkTopologyDocument,
257
- MechanicalTopologyDocument,
258
- ElectricalTopologyDocument,
259
- ])
260
- export type AuthoredNetworkTopologyDocument = z.infer<
261
- typeof AuthoredNetworkTopologyDocument
262
- >
263
-
264
- /** Authored world-space connector. This is not a claim of certified family connector metadata. */
265
- export const NetworkPort = z
266
- .object({
267
- id,
268
- positionMm: vector,
269
- direction: vector,
270
- system: z.string().min(1).max(80),
271
- /** Diameter for round ports; width when heightMm is supplied (rectangular port). */
272
- sizeMm: positive,
273
- heightMm: positive.optional(),
274
- /** World-space unit width axis. Mechanical rectangular ports require this section frame. */
275
- widthDirection: vector.optional(),
276
- })
277
- .strict()
278
-
279
- /** The agent supplies every route and section. The host does not size or route a network. */
280
- export const NetworkGeometry = z.discriminatedUnion("kind", [
281
- z
282
- .object({
283
- kind: z.literal("family"),
284
- definitionId: z.string().min(1).max(200),
285
- version: z.number().int().positive(),
286
- values: z.record(
287
- z.string(),
288
- z.union([z.number().finite(), z.string(), z.boolean()]),
289
- ),
290
- positionMm: vector,
291
- rotationDeg: vector,
292
- ports: z.array(NetworkPort).max(64),
293
- })
294
- .strict(),
295
- z
296
- .object({
297
- kind: z.literal("route"),
298
- pathMm: z.array(vector).min(2).max(256),
299
- system: z.string().min(1).max(80),
300
- section: z.discriminatedUnion("kind", [
301
- z
302
- .object({
303
- kind: z.literal("round"),
304
- diameterMm: positive,
305
- wallMm: z.number().finite().nonnegative(),
306
- })
307
- .strict(),
308
- z
309
- .object({
310
- kind: z.literal("rectangular"),
311
- widthMm: positive,
312
- heightMm: positive,
313
- wallMm: z.number().finite().nonnegative(),
314
- })
315
- .strict(),
316
- ]),
317
- })
318
- .strict(),
319
- ])
320
-
321
- // Storey is scene membership, not a coordinate offset. A route can span multiple elevations.
322
- const node = z
323
- .object({ id, storey: z.number().int(), geometry: NetworkGeometry })
324
- .strict()
325
- const electricalNode = node.extend({
326
- kind: z.enum([
327
- ...electricalVertexKind.options,
328
- ...electricalEdgeKind.options,
329
- ]),
330
- })
331
- const plumbingNode = node.extend({
332
- kind: z.enum([
333
- "fixture",
334
- "equipment",
335
- "tank",
336
- "pump",
337
- "valve",
338
- "manifold",
339
- "fitting",
340
- "pipe",
341
- "riser",
342
- ]),
343
- })
344
- const document = z
345
- .object({
346
- schemaVersion: z.literal(1),
347
- label: z.string().min(1).max(120),
348
- /** Revision from context(); invalidated when the source architectural graph changes. */
349
- architectureRevision: z.string().min(1).max(80),
350
- connections: z
351
- .array(
352
- z
353
- .object({ id, from: endpoint, to: endpoint, directed: z.boolean() })
354
- .strict(),
355
- )
356
- .max(4000),
357
- relationships,
358
- })
359
- .strict()
360
-
361
- /** Electrical connectivity and circuit membership are distinct from physical route occupancy. */
362
- export const ElectricalGraphDocument = document.extend({
363
- domain: z.literal("electrical"),
364
- nodes: z.array(electricalNode).min(1).max(1000),
365
- circuits: electricalCircuits,
366
- /** Required for new authoring. Omitted only on saved legacy snapshots. */
367
- authored: ElectricalTopologyDocument.optional(),
368
- })
369
-
370
- /** Plumbing uses explicit directed port connections; touching geometry never creates a connection. */
371
- export const PlumbingGraphDocument = document.extend({
372
- domain: z.literal("plumbing"),
373
- nodes: z.array(plumbingNode).min(1).max(1000),
374
- /** Original v2 intent. Nodes/connections are the resolved snapshot for replay.
375
- * Kept inside the document so existing save services preserve it without envelope changes.
376
- * Legacy v1 saves omit this field; new plumbing submissions require v2.
377
- */
378
- authored: NetworkTopologyDocument.optional(),
379
- })
380
- /** Resolved HVAC snapshot for queries, commands and load. New submissions require v2 intent. */
381
- export const MechanicalGraphDocument = document.extend({
382
- domain: z.literal("mechanical"),
383
- nodes: z
384
- .array(
385
- node.extend({
386
- kind: z.enum([
387
- ...mechanicalVertexKind.options,
388
- ...mechanicalEdgeKind.options,
389
- ]),
390
- geometry: NetworkGeometry.options[0],
391
- }),
392
- )
393
- .min(1)
394
- .max(1000),
395
- authored: MechanicalTopologyDocument,
396
- })
397
- export const NetworkGraphDocument = z.discriminatedUnion("domain", [
398
- ElectricalGraphDocument,
399
- PlumbingGraphDocument,
400
- MechanicalGraphDocument,
401
- ])
402
- export type NetworkGraphDocument = z.infer<typeof NetworkGraphDocument>
403
- export type NetworkNode = NetworkGraphDocument["nodes"][number]
404
- export type NetworkPort = z.infer<typeof NetworkPort>
405
- export type NetworkDomain = NetworkGraphDocument["domain"]
406
-
407
- /** JSON is an authored document, not a transport for live geometry handles. Maximum 2 MB characters. */
408
- export const NetworkValidateArgs = z
409
- .object({ graphJson: z.string().max(2_000_000) })
410
- .strict()
411
- export const NetworkCreateArgs = NetworkValidateArgs.extend({
412
- requestId: z.string().uuid(),
413
- })
414
- export const NetworkGetArgs = z.object({ graphId: z.string().uuid() }).strict()
415
- export const NetworkContextArgs = z
416
- .object({
417
- offset: z.number().int().nonnegative().default(0),
418
- limit: z.number().int().min(1).max(100).default(30),
419
- /** Omit the legacy PG2 dump when using the routing view, to avoid duplicate geometry tokens. */
420
- includeTopology: z.boolean().default(true),
421
- })
422
- .strict()
423
- export const NetworkQueryArgs = NetworkGetArgs.extend({
424
- revision: z.number().int().positive(),
425
- queryJson: z.string().max(16000),
426
- })
427
- export const NetworkQuery = z
428
- .object({
429
- kind: z.enum([
430
- "nodes",
431
- "connected",
432
- "upstream",
433
- "downstream",
434
- "ports",
435
- "nearestPort",
436
- "circuits",
437
- "relationships",
438
- ]),
439
- node: id.optional(),
440
- pointMm: vector.optional(),
441
- radiusMm: positive.optional(),
442
- /** Filter nodes, ports and traversal links by system. Traversal always includes its start node. */
443
- system: z.string().optional(),
444
- sizeMm: positive.optional(),
445
- heightMm: positive.optional(),
446
- offset: z.number().int().nonnegative().default(0),
447
- limit: z.number().int().min(1).max(100).default(30),
448
- })
449
- .strict()
450
- export type NetworkQuery = z.infer<typeof NetworkQuery>
451
-
452
- export interface NetworkDiagnostic {
453
- path: string
454
- message: string
455
- }
456
- export interface NetworkValidation {
457
- ok: boolean
458
- diagnostics: NetworkDiagnostic[]
459
- nodeCount: number
460
- }
461
- /** Durable node-to-scene mapping. New family-backed nodes retain the original authorized pin;
462
- * parameters and placement belong to the component, not a generated library family.
463
- * Existing wrapper pins and v1 raw-route recipe pins remain readable, not newly authored.
464
- */
465
- export const NetworkComponentBinding = z
466
- .object({
467
- nodeId: id,
468
- componentId: z.string().min(1),
469
- definitionId: z.string().min(1),
470
- definitionVersion: z.number().int().positive(),
471
- })
472
- .strict()
473
- export type NetworkComponentBinding = z.infer<typeof NetworkComponentBinding>
474
- export interface SavedNetworkGraph {
475
- id: string
476
- domain: NetworkDomain
477
- revision: 1
478
- requestId: string
479
- document: NetworkGraphDocument
480
- components: NetworkComponentBinding[]
481
- }
482
- export interface NetworkCreateResult {
483
- graphId: string
484
- revision: number
485
- components: NetworkComponentBinding[]
486
- alreadyCreated: boolean
487
- /** Queue acceptance is not a durable database acknowledgement. */
488
- saveStatus: "queued" | "existing"
489
- }
490
-
491
- /** Exact TopoGraph routing evidence, not a route planner or inferred enclosure.
492
- * World mm, Y-up. A curve's axis is a unit direction, not a length.
493
- * Shared region IDs mean a shared boundary, not permission to penetrate a wall.
494
- * Regions preserve directed outer/hole loops. No vertical connectivity is inferred;
495
- * use their curves and storey elevations to plan risers and explicit penetrations.
496
- */
497
- export interface NetworkRoutingContext {
498
- units: "mm"
499
- edges: {
500
- id: string
501
- curve:
502
- | { type: "line"; start: number[]; end: number[] }
503
- | {
504
- type: "arc"
505
- start: number[]
506
- end: number[]
507
- centre: number[]
508
- axis: number[]
509
- }
510
- wallId: string | null
511
- regionIds: string[]
512
- }[]
513
- regions: {
514
- id: string
515
- /** Stable source component IDs; read label/storey from context.components. */
516
- ownerIds: string[]
517
- boundary: {
518
- outer: { edgeId: string; direction: "forward" | "reverse" }[]
519
- holes: { edgeId: string; direction: "forward" | "reverse" }[][]
520
- }
521
- floorId: string | null
522
- slabId: string | null
523
- }[]
524
- /** Hosting is exact; bounds are only coarse avoidance data, not a penetration clearance check. */
525
- openings: {
526
- id: string
527
- wallId: string
528
- type: string
529
- minMm: number[]
530
- maxMm: number[]
531
- }[]
532
- }
533
- export interface NetworkContextResult {
534
- proposalId: string
535
- buildingId: string | null
536
- revision: string
537
- /** PG2's native serialization uses Snaptrude units (1 SU = 254 mm). */
538
- topologyUnits: "SU"
539
- /** JSON array; empty when includeTopology is false. Prefer routing for network planning. */
540
- topologyJson: string
541
- /** Each collection uses offset/limit independently. Follow nextOffset before resolving references.
542
- * Empty regions mean topology is unavailable, not that bounds can substitute for room boundaries.
543
- */
544
- routing: NetworkRoutingContext
545
- nextOffset: number | null
546
- total: number
547
- storeys: { number: number; elevationMm: number }[]
548
- components: {
549
- id: string
550
- type: string
551
- label: string
552
- storey: number
553
- minMm: number[]
554
- maxMm: number[]
555
- }[]
556
- /** Saved graph inventory, paged with topology/components. Use these IDs after reopening a project. */
557
- networks: {
558
- graphId: string
559
- domain: NetworkDomain
560
- revision: number
561
- label: string
562
- componentCount: number
563
- }[]
564
- }
565
- export interface NetworkQueryResult {
566
- revision: number
567
- resultJson: string
568
- nextOffset: number | null
569
- total: number
570
- }
571
-
572
- /** Shared transport only. Each domain retains a separate schema and semantics. */
573
- export abstract class PluginDomainNetworkApi {
574
- /** Read the active proposal's architectural context before authoring. Keep one revision across pages. */
575
- abstract context(
576
- args?: z.input<typeof NetworkContextArgs>,
577
- ): PluginApiReturn<NetworkContextResult>
578
- /** Validate authored JSON, pinned families and recipe evaluation without placing or saving anything.
579
- * This does not build kernel meshes or certify engineering/code compliance.
580
- */
581
- abstract validate(
582
- args: z.input<typeof NetworkValidateArgs>,
583
- ): PluginApiReturn<NetworkValidation>
584
- /** Construct each node on its authored storey, with one undo command and queued project persistence.
585
- * Networks can span storeys. Reuse requestId on retry; components returns the durable node mapping.
586
- * Coordinates are world millimetres, Y-up; rotations are degrees. No engineering rules are inferred.
587
- * Throws for stale architecture, invalid references/geometry or conflicting retries.
588
- */
589
- abstract create(
590
- args: z.input<typeof NetworkCreateArgs>,
591
- ): PluginApiReturn<NetworkCreateResult>
592
- /** Read one saved graph in the active proposal; null on miss. IDs are durable, not worker handles. */
593
- abstract get(
594
- args: z.input<typeof NetworkGetArgs>,
595
- ): PluginApiReturn<SavedNetworkGraph | null>
596
- /** Read bounded authored topology in graph revision. Crossings do not connect. No clash/compliance claims. */
597
- abstract query(
598
- args: z.input<typeof NetworkQueryArgs>,
599
- ): PluginApiReturn<NetworkQueryResult>
600
- }
601
-
602
- /** Electrical equipment, physical routes and logical circuits, constructed from agent-authored intent. */
603
- export abstract class PluginElectricalApi extends PluginDomainNetworkApi {}
604
- /** Plumbing equipment and routed pipe networks, constructed from agent-authored intent. */
605
- export abstract class PluginPlumbingApi extends PluginDomainNetworkApi {}
606
- /** Family-backed air-side HVAC networks. The agent authors engineering intent; the host constructs it. */
607
- export abstract class PluginMechanicalApi extends PluginDomainNetworkApi {}
@@ -1,70 +0,0 @@
1
- import * as z from "zod"
2
-
3
- /**
4
- * Metric architectural scale denominators (`100` means 1:100), the metric
5
- * values of the placed view's Scale dropdown.
6
- */
7
- export const METRIC_DRAWING_SCALES = [
8
- 10, 20, 50, 100, 150, 200, 250, 500, 1000,
9
- ] as const
10
-
11
- /**
12
- * Imperial detail scale denominators, 1" = 1' (12) to 1/128" = 1' (1536):
13
- * `48` is 1/4" = 1', `96` is 1/8" = 1'.
14
- */
15
- export const IMPERIAL_DETAIL_DRAWING_SCALES = [
16
- 12, 16, 24, 32, 48, 64, 96, 128, 192, 384, 768, 1536,
17
- ] as const
18
-
19
- /** Imperial site (engineering) scale denominators, 1" = 10' (120) to 1" = 400' (4800). */
20
- export const IMPERIAL_SITE_DRAWING_SCALES = [
21
- 120, 240, 360, 480, 600, 1200, 2400, 3600, 4800,
22
- ] as const
23
-
24
- /**
25
- * Imperial architectural scale denominators, ascending: the imperial detail
26
- * and site values of the placed view's Scale dropdown.
27
- */
28
- export const IMPERIAL_DRAWING_SCALES: readonly number[] = [
29
- ...IMPERIAL_DETAIL_DRAWING_SCALES,
30
- ...IMPERIAL_SITE_DRAWING_SCALES,
31
- ].sort((a, b) => a - b)
32
-
33
- /**
34
- * Every standard architectural scale denominator, metric and imperial,
35
- * ascending. Drawing and placed-view scale arguments accept only these; the
36
- * host may further restrict them to the project's unit system.
37
- */
38
- export const STANDARD_DRAWING_SCALES: readonly number[] = [
39
- ...METRIC_DRAWING_SCALES,
40
- ...IMPERIAL_DRAWING_SCALES,
41
- ].sort((a, b) => a - b)
42
-
43
- const standardScaleSet = new Set<number>(STANDARD_DRAWING_SCALES)
44
-
45
- /** A standard architectural scale denominator; anything else is rejected with the allowed list. */
46
- export const PluginStandardDrawingScale = z
47
- .number()
48
- .finite()
49
- .refine((scale) => standardScaleSet.has(scale), {
50
- message: `Scale must be a standard architectural scale denominator in the project's unit system. Metric: ${METRIC_DRAWING_SCALES.join(", ")}; imperial detail: ${IMPERIAL_DETAIL_DRAWING_SCALES.join(", ")}; imperial site: ${IMPERIAL_SITE_DRAWING_SCALES.join(", ")}. Pick the largest standard scale (smallest denominator) at which the view fits its frame or sheet and its room labels stay readable (usually 1:50 to 1:200 for a building plan).`,
51
- })
52
-
53
- const EXTENSION = /\.(pdf|svg|png|jpe?g)$/i
54
- // The host appends ".<ext>", so a trailing dot yields "a.pdf..pdf" and trailing
55
- // whitespace yields "plan .pdf".
56
- const TRAILING_DOT_OR_SPACE = /[.\s]$/
57
-
58
- /**
59
- * An export base file name without an extension, not ending in a dot or
60
- * whitespace; the host adds `.pdf`, `.svg`, `.png` or `.jpg`.
61
- */
62
- export const PluginExportFileName = z
63
- .string()
64
- .refine(
65
- (name) => !EXTENSION.test(name.trim()) && !TRAILING_DOT_OR_SPACE.test(name),
66
- {
67
- message:
68
- "fileName must be a base name without an extension and not ending in a dot or a space (for example \"Ground Floor Plan\", not \"Ground Floor Plan.pdf\" or \"Ground Floor Plan.\"); the export adds the extension for the format.",
69
- },
70
- )