@snaptrude/plugin-core 1.0.1 → 1.1.0-dev.20261025.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.
- package/CHANGELOG.md +0 -6
- package/dist/api/design/networks.d.ts +61 -1
- package/dist/api/design/networks.d.ts.map +1 -1
- package/dist/index.cjs +39 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/design/networks.ts +62 -2
- package/api-manifest.json +0 -9120
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as z from "zod"
|
|
2
2
|
import type { PluginApiReturn } from "../../types"
|
|
3
|
+
import { Vec3Handle } from "../../handles"
|
|
3
4
|
|
|
4
5
|
const id = z.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,79}$/)
|
|
5
6
|
const vector = z.tuple([
|
|
@@ -412,6 +413,47 @@ export const NetworkCreateArgs = NetworkValidateArgs.extend({
|
|
|
412
413
|
requestId: z.string().uuid(),
|
|
413
414
|
})
|
|
414
415
|
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>
|
|
415
457
|
export const NetworkContextArgs = z
|
|
416
458
|
.object({
|
|
417
459
|
offset: z.number().int().nonnegative().default(0),
|
|
@@ -474,10 +516,12 @@ export type NetworkComponentBinding = z.infer<typeof NetworkComponentBinding>
|
|
|
474
516
|
export interface SavedNetworkGraph {
|
|
475
517
|
id: string
|
|
476
518
|
domain: NetworkDomain
|
|
477
|
-
revision:
|
|
519
|
+
revision: number
|
|
478
520
|
requestId: string
|
|
479
521
|
document: NetworkGraphDocument
|
|
480
522
|
components: NetworkComponentBinding[]
|
|
523
|
+
edits?: NetworkEditReceipt[]
|
|
524
|
+
transitions?: NetworkTransitionReceipt[]
|
|
481
525
|
}
|
|
482
526
|
export interface NetworkCreateResult {
|
|
483
527
|
graphId: string
|
|
@@ -602,6 +646,22 @@ export abstract class PluginDomainNetworkApi {
|
|
|
602
646
|
/** Electrical equipment, physical routes and logical circuits, constructed from agent-authored intent. */
|
|
603
647
|
export abstract class PluginElectricalApi extends PluginDomainNetworkApi {}
|
|
604
648
|
/** Plumbing equipment and routed pipe networks, constructed from agent-authored intent. */
|
|
605
|
-
export abstract class PluginPlumbingApi extends PluginDomainNetworkApi {
|
|
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
|
+
}
|
|
606
666
|
/** Family-backed air-side HVAC networks. The agent authors engineering intent; the host constructs it. */
|
|
607
667
|
export abstract class PluginMechanicalApi extends PluginDomainNetworkApi {}
|