@snaptrude/plugin-core 1.1.0-dev.20261025.1 → 1.1.0-pbr-20261026.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.
@@ -1,6 +1,5 @@
1
1
  import * as z from "zod"
2
2
  import type { PluginApiReturn } from "../../types"
3
- import { Vec3Handle } from "../../handles"
4
3
 
5
4
  const id = z.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,79}$/)
6
5
  const vector = z.tuple([
@@ -413,47 +412,6 @@ export const NetworkCreateArgs = NetworkValidateArgs.extend({
413
412
  requestId: z.string().uuid(),
414
413
  })
415
414
  export const NetworkGetArgs = z.object({ graphId: z.string().uuid() }).strict()
416
- /** Displacement components are world millimetres, Y up, not Snaptrude units. */
417
- export const NetworkMoveEdgeArgs = NetworkGetArgs.extend({
418
- expectedRevision: z.number().int().positive(),
419
- edgeId: id,
420
- displacement: Vec3Handle,
421
- requestId: z.string().uuid(),
422
- }).strict()
423
- export type NetworkMoveEdgeArgs = z.input<typeof NetworkMoveEdgeArgs>
424
-
425
- export const NetworkMoveEdgeResult = z.object({
426
- graphId: z.string().uuid(),
427
- revision: z.number().int().positive(),
428
- affectedComponentIds: z.array(z.string().min(1)),
429
- alreadyApplied: z.boolean(),
430
- /** Queue acceptance does not acknowledge durable storage. */
431
- saveStatus: z.enum(["queued", "existing"]),
432
- }).strict()
433
- export type NetworkMoveEdgeResult = z.infer<typeof NetworkMoveEdgeResult>
434
-
435
- /** Immutable receipts survive undo. Retrying a move never executes it again. */
436
- export const NetworkEditReceipt = z.object({
437
- requestId: z.string().uuid(),
438
- fingerprint: z.string().max(1000),
439
- revision: z.number().int().positive(),
440
- affectedComponentIds: z.array(z.string().min(1)).max(1000),
441
- }).strict()
442
- export type NetworkEditReceipt = z.infer<typeof NetworkEditReceipt>
443
-
444
- /** Each intentional apply/undo/redo has its own identity. Retries reuse it. */
445
- export const NetworkTransition = z.object({
446
- id: z.string().uuid(),
447
- expectedRevision: z.number().int().positive(),
448
- forward: z.boolean(),
449
- }).strict()
450
- export type NetworkTransition = z.infer<typeof NetworkTransition>
451
-
452
- export const NetworkTransitionReceipt = NetworkTransition.extend({
453
- requestId: z.string().uuid(),
454
- revision: z.number().int().positive(),
455
- }).strict()
456
- export type NetworkTransitionReceipt = z.infer<typeof NetworkTransitionReceipt>
457
415
  export const NetworkContextArgs = z
458
416
  .object({
459
417
  offset: z.number().int().nonnegative().default(0),
@@ -516,12 +474,10 @@ export type NetworkComponentBinding = z.infer<typeof NetworkComponentBinding>
516
474
  export interface SavedNetworkGraph {
517
475
  id: string
518
476
  domain: NetworkDomain
519
- revision: number
477
+ revision: 1
520
478
  requestId: string
521
479
  document: NetworkGraphDocument
522
480
  components: NetworkComponentBinding[]
523
- edits?: NetworkEditReceipt[]
524
- transitions?: NetworkTransitionReceipt[]
525
481
  }
526
482
  export interface NetworkCreateResult {
527
483
  graphId: string
@@ -646,22 +602,6 @@ export abstract class PluginDomainNetworkApi {
646
602
  /** Electrical equipment, physical routes and logical circuits, constructed from agent-authored intent. */
647
603
  export abstract class PluginElectricalApi extends PluginDomainNetworkApi {}
648
604
  /** Plumbing equipment and routed pipe networks, constructed from agent-authored intent. */
649
- export abstract class PluginPlumbingApi extends PluginDomainNetworkApi {
650
- /** Offset one straight pipe perpendicular to its axis between two rigid 90-degree elbows.
651
- * Resize adjacent pipes through instance length parameters. Out-of-plane offsets add
652
- * one pinned elbow and straight pipe per affected end, preserving fixed outer ports
653
- * and existing component identities. Rigid fittings only rotate and translate.
654
- * Reject axial sliding, moving tees, constrained fittings,
655
- * scene drift, stale revisions, and infeasible family geometry before mutation.
656
- * @param args Graph/edge identity, current revision, displacement handle in world mm,
657
- * and a unique retry identity. Identical retries return the original receipt after undo too.
658
- * @returns Affected component IDs and revision in one undoable, queued transaction.
659
- * @example
660
- * const displacement = await snaptrude.core.math.vec3.new(0, 300, 0)
661
- * await snaptrude.design.plumbing.moveEdge({ graphId, edgeId, expectedRevision,
662
- * displacement, requestId: crypto.randomUUID() })
663
- */
664
- abstract moveEdge(args: NetworkMoveEdgeArgs): PluginApiReturn<NetworkMoveEdgeResult>
665
- }
605
+ export abstract class PluginPlumbingApi extends PluginDomainNetworkApi {}
666
606
  /** Family-backed air-side HVAC networks. The agent authors engineering intent; the host constructs it. */
667
607
  export abstract class PluginMechanicalApi extends PluginDomainNetworkApi {}
@@ -1,8 +1,9 @@
1
1
  import * as z from "zod"
2
2
  import { PluginApiReturn } from "../../../types"
3
- import { ComponentHandle } from "../../../handles"
3
+ import { ComponentHandle, MaterialHandle } from "../../../handles"
4
4
  import { PluginDesignChangeResult } from "../lock"
5
5
  import { PluginObjectCatalogGroup, PluginObjectCatalogItem } from "../doors"
6
+ import { PluginMaterialSpec } from "../materials"
6
7
 
7
8
  /**
8
9
  * `snaptrude.design.windows` — window-specific reads. Creation lives at
@@ -22,6 +23,33 @@ import { PluginObjectCatalogGroup, PluginObjectCatalogItem } from "../doors"
22
23
  export abstract class PluginDesignWindowsApi {
23
24
  constructor() {}
24
25
 
26
+ /**
27
+ * Paint only the window's authored glazing, preserving its frame. Families change
28
+ * with linked copies; legacy catalogue types change every instance of that type.
29
+ * Undoable; refuses locked linked/type members or out-of-proposal targets.
30
+ * @param window Window whose glazing to paint
31
+ * @param material Handle or spec; preserve the exact listPresets name for PBR glass
32
+ * @returns Components affected, including linked/type instances
33
+ * @examplePrompt Use clear glass for this window without changing its frame
34
+ */
35
+ public abstract setGlazing(
36
+ window: ComponentHandle,
37
+ material: MaterialHandle | PluginMaterialSpec,
38
+ ): PluginApiReturn<PluginDesignChangeResult>
39
+
40
+ /**
41
+ * Paint only non-glazing slots (frames, sashes, hardware), never the clear panes.
42
+ * Scope, locking and undo match setGlazing and design.materials.applyToSlot.
43
+ * @param window Window whose frame to paint
44
+ * @param material Handle or spec, e.g. `{ name: preset.name }` from listPresets
45
+ * @returns Components affected, including linked/type instances
46
+ * @examplePrompt Use brushed metal for this window's frame without changing the glass
47
+ */
48
+ public abstract setFrame(
49
+ window: ComponentHandle,
50
+ material: MaterialHandle | PluginMaterialSpec,
51
+ ): PluginApiReturn<PluginDesignChangeResult>
52
+
25
53
  /**
26
54
  * Get the type name of a window — the label that identifies which kind of
27
55
  * window the instance is, as shown in its properties.
@@ -310,6 +338,15 @@ export type PluginDesignWindowSetHeightArgs = z.infer<
310
338
  typeof PluginDesignWindowSetHeightArgs
311
339
  >
312
340
 
341
+ /** Arguments for setGlazing / setFrame; both preserve the other authored slot kind. */
342
+ export const PluginDesignWindowSetSlotArgs = z.object({
343
+ window: ComponentHandle,
344
+ material: z.union([MaterialHandle, PluginMaterialSpec]),
345
+ })
346
+ export type PluginDesignWindowSetSlotArgs = z.infer<
347
+ typeof PluginDesignWindowSetSlotArgs
348
+ >
349
+
313
350
  // ---------------------------------------------------------------------------
314
351
  // catalog (shared DTOs defined in ../doors, re-exported here for symmetry)
315
352
  // ---------------------------------------------------------------------------