@ultrst-armada/kloks 1.0.2 → 1.1.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/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +19 -10
- package/packages/backend/dist/index.js +8 -8
- package/packages/contracts/dist/index.d.ts +552 -0
- package/packages/contracts/dist/index.js +422 -0
- package/packages/contracts/kloks.manifest.json +20 -0
- package/packages/contracts/package.json +33 -0
- package/packages/state-graph/dist/{BaseGraph-Bl2f7Pqx.d.ts → BaseGraph-BvkSYOTw.d.ts} +1 -1
- package/packages/state-graph/dist/{BaseNode-1HCEqmap.d.ts → BaseNode-DTcd3K1B.d.ts} +1 -1
- package/packages/state-graph/dist/{CompatibilityMatrix-DX307_vS.d.ts → CompatibilityMatrix-Dj-tCWUA.d.ts} +1 -1
- package/packages/state-graph/dist/chunk-JXDJZSFW.js +459 -0
- package/packages/state-graph/dist/chunk-RHRXPY2U.js +0 -0
- package/packages/state-graph/dist/domain/index.d.ts +3 -3
- package/packages/state-graph/dist/index.d.ts +8 -9
- package/packages/state-graph/dist/index.js +25 -16
- package/packages/state-graph/dist/rules/index.d.ts +3 -3
- package/packages/state-graph/dist/rules/index.js +2 -1
- package/packages/state-graph/dist/spatial/index.d.ts +53 -5
- package/packages/state-graph/dist/spatial/index.js +12 -3
- package/packages/state-graph/dist/store/index.d.ts +159 -6
- package/packages/state-graph/dist/types-VDoc4FIc.d.ts +150 -0
- package/packages/state-graph/dist/TraceEngine-CJVpUb80.d.ts +0 -18
- package/packages/state-graph/dist/chunk-YTWCH6P2.js +0 -109
- package/packages/state-graph/dist/index-CiekWEH3.d.ts +0 -272
- /package/packages/state-graph/dist/{chunk-QN74PLMF.js → chunk-TZOL3RN7.js} +0 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
// src/schemas.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var GraphEntityMetadataSchema = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
type: z.string(),
|
|
7
|
+
archetype: z.string(),
|
|
8
|
+
tags: z.array(z.string()).optional(),
|
|
9
|
+
description: z.string().optional(),
|
|
10
|
+
createdAt: z.number().optional(),
|
|
11
|
+
updatedAt: z.number().optional(),
|
|
12
|
+
customAttributes: z.record(z.unknown()).optional()
|
|
13
|
+
});
|
|
14
|
+
var SocketPosition2DSchema = z.object({
|
|
15
|
+
x: z.number(),
|
|
16
|
+
y: z.number()
|
|
17
|
+
});
|
|
18
|
+
var SocketDirectionSchema = z.enum(["input", "output", "bidirectional"]);
|
|
19
|
+
var SocketGeometryConfigSchema = z.object({
|
|
20
|
+
radius: z.number().default(6),
|
|
21
|
+
hitRadius: z.number().default(12),
|
|
22
|
+
snapDistance: z.number().default(18),
|
|
23
|
+
direction: SocketDirectionSchema.default("input"),
|
|
24
|
+
relativeOffset: SocketPosition2DSchema.default({ x: 0, y: 0 })
|
|
25
|
+
});
|
|
26
|
+
var SocketStyleConfigSchema = z.object({
|
|
27
|
+
color: z.string(),
|
|
28
|
+
hoverColor: z.string().optional(),
|
|
29
|
+
activeColor: z.string().optional(),
|
|
30
|
+
borderColor: z.string().optional(),
|
|
31
|
+
borderWidth: z.number().optional(),
|
|
32
|
+
fillOpacity: z.number().optional()
|
|
33
|
+
});
|
|
34
|
+
var WireEndpoint2DSchema = z.object({
|
|
35
|
+
nodeId: z.string(),
|
|
36
|
+
socketId: z.string(),
|
|
37
|
+
position: SocketPosition2DSchema
|
|
38
|
+
});
|
|
39
|
+
var WireCurveStyleSchema = z.enum(["bezier", "linear", "orthogonal", "stepped"]);
|
|
40
|
+
var WireAnimationConfigSchema = z.object({
|
|
41
|
+
animated: z.boolean().default(false),
|
|
42
|
+
speed: z.number().default(1),
|
|
43
|
+
direction: z.enum(["forward", "reverse"]).default("forward"),
|
|
44
|
+
pulseFrequency: z.number().optional()
|
|
45
|
+
});
|
|
46
|
+
var WireVisualConfigSchema = z.object({
|
|
47
|
+
strokeColor: z.string(),
|
|
48
|
+
strokeWidth: z.number().default(2),
|
|
49
|
+
strokeDashArray: z.string().optional(),
|
|
50
|
+
curveStyle: WireCurveStyleSchema.default("bezier"),
|
|
51
|
+
curvature: z.number().default(0.5),
|
|
52
|
+
opacity: z.number().default(1),
|
|
53
|
+
glow: z.boolean().default(false),
|
|
54
|
+
glowColor: z.string().optional()
|
|
55
|
+
});
|
|
56
|
+
var NodeDimensions2DSchema = z.object({
|
|
57
|
+
width: z.number(),
|
|
58
|
+
height: z.number(),
|
|
59
|
+
minWidth: z.number().optional(),
|
|
60
|
+
minHeight: z.number().optional(),
|
|
61
|
+
maxWidth: z.number().optional(),
|
|
62
|
+
maxHeight: z.number().optional()
|
|
63
|
+
});
|
|
64
|
+
var NodeScreenRect2DSchema = z.object({
|
|
65
|
+
x: z.number(),
|
|
66
|
+
y: z.number(),
|
|
67
|
+
width: z.number(),
|
|
68
|
+
height: z.number()
|
|
69
|
+
});
|
|
70
|
+
var NodeHeaderStyleSchema = z.object({
|
|
71
|
+
backgroundColor: z.string().optional(),
|
|
72
|
+
titleColor: z.string().optional(),
|
|
73
|
+
iconColor: z.string().optional(),
|
|
74
|
+
badgeColor: z.string().optional()
|
|
75
|
+
});
|
|
76
|
+
var AudioBusConfigSchema = z.object({
|
|
77
|
+
channelCount: z.number().default(2),
|
|
78
|
+
sampleRate: z.number().default(44100),
|
|
79
|
+
bufferSize: z.number().default(512),
|
|
80
|
+
latencyHint: z.enum(["interactive", "balanced", "playback"]).default("interactive")
|
|
81
|
+
});
|
|
82
|
+
var AudioHardwareStateSchema = z.object({
|
|
83
|
+
contextState: z.enum(["suspended", "running", "closed", "uninitialized"]),
|
|
84
|
+
sampleRate: z.number(),
|
|
85
|
+
inputChannels: z.number(),
|
|
86
|
+
outputChannels: z.number(),
|
|
87
|
+
activeInputDeviceId: z.string().nullable().optional(),
|
|
88
|
+
activeOutputDeviceId: z.string().nullable().optional()
|
|
89
|
+
});
|
|
90
|
+
var MidiCommandTypeSchema = z.enum([
|
|
91
|
+
"NOTE_ON",
|
|
92
|
+
"NOTE_OFF",
|
|
93
|
+
"CONTROL_CHANGE",
|
|
94
|
+
"PITCH_BEND",
|
|
95
|
+
"PROGRAM_CHANGE",
|
|
96
|
+
"AFTERTOUCH",
|
|
97
|
+
"POLY_PRESSURE",
|
|
98
|
+
"CLOCK",
|
|
99
|
+
"START",
|
|
100
|
+
"CONTINUE",
|
|
101
|
+
"STOP",
|
|
102
|
+
"ACTIVE_SENSING",
|
|
103
|
+
"SYSTEM_RESET"
|
|
104
|
+
]);
|
|
105
|
+
var MidiEventPayloadSchema = z.object({
|
|
106
|
+
command: MidiCommandTypeSchema,
|
|
107
|
+
channel: z.number().min(1).max(16).default(1),
|
|
108
|
+
note: z.number().min(0).max(127).optional(),
|
|
109
|
+
velocity: z.number().min(0).max(127).optional(),
|
|
110
|
+
controller: z.number().min(0).max(127).optional(),
|
|
111
|
+
value: z.number().min(0).max(127).optional(),
|
|
112
|
+
timestamp: z.number().optional()
|
|
113
|
+
});
|
|
114
|
+
var BackendOperationSchema = z.object({
|
|
115
|
+
name: z.string(),
|
|
116
|
+
service: z.string(),
|
|
117
|
+
description: z.string().optional(),
|
|
118
|
+
inputSchemaName: z.string().optional(),
|
|
119
|
+
outputSchemaName: z.string().optional()
|
|
120
|
+
});
|
|
121
|
+
var PublicContractDefinitionSchema = z.object({
|
|
122
|
+
package: z.string(),
|
|
123
|
+
version: z.string(),
|
|
124
|
+
description: z.string(),
|
|
125
|
+
exports: z.record(z.object({
|
|
126
|
+
types: z.string(),
|
|
127
|
+
import: z.string(),
|
|
128
|
+
default: z.string()
|
|
129
|
+
})),
|
|
130
|
+
symbols: z.array(z.object({
|
|
131
|
+
name: z.string(),
|
|
132
|
+
subpath: z.string(),
|
|
133
|
+
kind: z.enum(["class", "type", "interface", "function", "const", "object"]),
|
|
134
|
+
hasZodSchema: z.boolean()
|
|
135
|
+
})),
|
|
136
|
+
facades: z.array(z.object({
|
|
137
|
+
id: z.string(),
|
|
138
|
+
name: z.string(),
|
|
139
|
+
subpath: z.string(),
|
|
140
|
+
runtime: z.enum(["client", "server"]),
|
|
141
|
+
deployment: z.enum(["local", "remote"])
|
|
142
|
+
})),
|
|
143
|
+
invariants: z.array(z.string())
|
|
144
|
+
});
|
|
145
|
+
var ContractSnapshotSchema = z.object({
|
|
146
|
+
package: z.string(),
|
|
147
|
+
version: z.string(),
|
|
148
|
+
timestamp: z.number(),
|
|
149
|
+
checksum: z.string(),
|
|
150
|
+
publicSymbols: z.array(z.string()),
|
|
151
|
+
normalizedSignatures: z.record(z.string()),
|
|
152
|
+
zodFingerprints: z.record(z.string()),
|
|
153
|
+
facades: z.array(z.string()),
|
|
154
|
+
events: z.array(z.string()),
|
|
155
|
+
commands: z.array(z.string()),
|
|
156
|
+
errorCodes: z.array(z.string())
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// src/surface.ts
|
|
160
|
+
var KLOKS_PUBLIC_SURFACE = [
|
|
161
|
+
// ── state-graph ──
|
|
162
|
+
{ name: "GraphEntityParent", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
163
|
+
{ name: "GraphEntityMetadata", subpath: "state-graph", category: "state-graph", hasZodSchema: true },
|
|
164
|
+
{ name: "GraphSocketParent", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
165
|
+
{ name: "SocketDirection", subpath: "state-graph", category: "state-graph", hasZodSchema: true },
|
|
166
|
+
{ name: "SocketPosition2D", subpath: "state-graph", category: "state-graph", hasZodSchema: true },
|
|
167
|
+
{ name: "SocketGeometryConfig", subpath: "state-graph", category: "state-graph", hasZodSchema: true },
|
|
168
|
+
{ name: "SocketStyleConfig", subpath: "state-graph", category: "state-graph", hasZodSchema: true },
|
|
169
|
+
{ name: "AudioStereoSocket", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
170
|
+
{ name: "AudioMonoSocket", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
171
|
+
{ name: "AudioPacketSocket", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
172
|
+
{ name: "TriggerSocket", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
173
|
+
{ name: "MidiStreamSocket", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
174
|
+
{ name: "MidiPacketSocket", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
175
|
+
{ name: "CurveStreamSocket", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
176
|
+
{ name: "CurvePacketSocket", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
177
|
+
{ name: "ComponentSocket", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
178
|
+
{ name: "PrimitiveSocket", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
179
|
+
{ name: "createSocketInstance", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
180
|
+
{ name: "createQwnsrSocketInstance", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
181
|
+
{ name: "GraphWireParent", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
182
|
+
{ name: "WireEndpoint2D", subpath: "state-graph", category: "state-graph", hasZodSchema: true },
|
|
183
|
+
{ name: "WireCurveStyle", subpath: "state-graph", category: "state-graph", hasZodSchema: true },
|
|
184
|
+
{ name: "WireAnimationConfig", subpath: "state-graph", category: "state-graph", hasZodSchema: true },
|
|
185
|
+
{ name: "WireVisualConfig", subpath: "state-graph", category: "state-graph", hasZodSchema: true },
|
|
186
|
+
{ name: "AudioStereoWire", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
187
|
+
{ name: "AudioMonoWire", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
188
|
+
{ name: "AudioPacketWire", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
189
|
+
{ name: "TriggerWire", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
190
|
+
{ name: "MidiStreamWire", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
191
|
+
{ name: "MidiPacketWire", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
192
|
+
{ name: "CurveStreamWire", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
193
|
+
{ name: "CurvePacketWire", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
194
|
+
{ name: "ComponentWire", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
195
|
+
{ name: "PrimitiveWire", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
196
|
+
{ name: "createWireInstance", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
197
|
+
{ name: "createQwnsrWireInstance", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
198
|
+
{ name: "GraphNodeParent", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
199
|
+
{ name: "DataProcessingNodeParent", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
200
|
+
{ name: "SignalGeneratorNodeParent", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
201
|
+
{ name: "RoutingNodeParent", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
202
|
+
{ name: "ControlNodeParent", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
203
|
+
{ name: "NodeDimensions2D", subpath: "state-graph", category: "state-graph", hasZodSchema: true },
|
|
204
|
+
{ name: "NodeScreenRect2D", subpath: "state-graph", category: "state-graph", hasZodSchema: true },
|
|
205
|
+
{ name: "NodeHeaderStyle", subpath: "state-graph", category: "state-graph", hasZodSchema: true },
|
|
206
|
+
{ name: "TriggerNodeModel", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
207
|
+
{ name: "ContainerNodeModel", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
208
|
+
{ name: "ModuleNodeModel", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
209
|
+
{ name: "EffectNodeModel", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
210
|
+
{ name: "CodeNodeModel", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
211
|
+
{ name: "ArrangementNodeModel", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
212
|
+
{ name: "RouterNodeModel", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
213
|
+
{ name: "StripNodeModel", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
214
|
+
{ name: "ControlNodeModel", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
215
|
+
{ name: "PrimitiveNodeModel", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
216
|
+
{ name: "GroupNodeModel", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
217
|
+
{ name: "createNodeInstance", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
218
|
+
{ name: "createQwnsrNodeInstance", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
219
|
+
{ name: "StateLifecycleServiceFacade", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
220
|
+
{ name: "NodeGraphEngineServiceFacade", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
221
|
+
{ name: "PredictiveGraphServiceFacade", subpath: "state-graph", category: "state-graph", hasZodSchema: false },
|
|
222
|
+
// ── audio-midi ──
|
|
223
|
+
{ name: "AudioInputManager", subpath: "audio-midi", category: "audio-midi", hasZodSchema: false },
|
|
224
|
+
{ name: "MidiManager", subpath: "audio-midi", category: "audio-midi", hasZodSchema: false },
|
|
225
|
+
{ name: "AudioHardwareServiceFacade", subpath: "audio-midi", category: "audio-midi", hasZodSchema: false },
|
|
226
|
+
{ name: "MidiServiceFacade", subpath: "audio-midi", category: "audio-midi", hasZodSchema: false },
|
|
227
|
+
{ name: "AudioMidiOrchestratorFacade", subpath: "audio-midi", category: "audio-midi", hasZodSchema: false },
|
|
228
|
+
{ name: "AudioBusConfig", subpath: "audio-midi", category: "audio-midi", hasZodSchema: true },
|
|
229
|
+
{ name: "AudioHardwareState", subpath: "audio-midi", category: "audio-midi", hasZodSchema: true },
|
|
230
|
+
{ name: "MidiCommandType", subpath: "audio-midi", category: "audio-midi", hasZodSchema: true },
|
|
231
|
+
{ name: "MidiEventPayload", subpath: "audio-midi", category: "audio-midi", hasZodSchema: true },
|
|
232
|
+
// ── orchestrations ──
|
|
233
|
+
{ name: "OrchestratorAFacade", subpath: "orchestrations", category: "orchestrations", hasZodSchema: false },
|
|
234
|
+
{ name: "OrchestratorBFacade", subpath: "orchestrations", category: "orchestrations", hasZodSchema: false },
|
|
235
|
+
{ name: "WorkspaceBackendFacade", subpath: "orchestrations", category: "orchestrations", hasZodSchema: false },
|
|
236
|
+
{ name: "backendFacade", subpath: "orchestrations", category: "orchestrations", hasZodSchema: false },
|
|
237
|
+
{ name: "workerExecutionBoundary", subpath: "orchestrations", category: "orchestrations", hasZodSchema: false },
|
|
238
|
+
// ── backend ──
|
|
239
|
+
{ name: "AuthServiceFacade", subpath: "backend", category: "backend", hasZodSchema: false },
|
|
240
|
+
{ name: "StorageServiceFacade", subpath: "backend", category: "backend", hasZodSchema: false },
|
|
241
|
+
{ name: "WorkspaceServiceFacade", subpath: "backend", category: "backend", hasZodSchema: false },
|
|
242
|
+
{ name: "ControlPlaneServiceFacade", subpath: "backend", category: "backend", hasZodSchema: false },
|
|
243
|
+
{ name: "ExecutionServiceFacade", subpath: "backend", category: "backend", hasZodSchema: false },
|
|
244
|
+
{ name: "ExecutableBackendFacade", subpath: "backend", category: "backend", hasZodSchema: false },
|
|
245
|
+
// ── services ──
|
|
246
|
+
{ name: "ServiceAFacade", subpath: "services", category: "services", hasZodSchema: false },
|
|
247
|
+
{ name: "ServiceBFacade", subpath: "services", category: "services", hasZodSchema: false },
|
|
248
|
+
{ name: "ServiceCFacade", subpath: "services", category: "services", hasZodSchema: false },
|
|
249
|
+
{ name: "ServiceDFacade", subpath: "services", category: "services", hasZodSchema: false },
|
|
250
|
+
// ── functions ──
|
|
251
|
+
{ name: "FunctionsServiceFacade", subpath: "functions", category: "functions", hasZodSchema: false },
|
|
252
|
+
{ name: "toKebabCase", subpath: "functions", category: "functions", hasZodSchema: false },
|
|
253
|
+
{ name: "safeJsonParse", subpath: "functions", category: "functions", hasZodSchema: false },
|
|
254
|
+
// ── contracts ──
|
|
255
|
+
{ name: "KLOKS_CANONICAL_CONTRACT", subpath: "contracts", category: "contracts", hasZodSchema: true },
|
|
256
|
+
{ name: "createKloksSnapshot", subpath: "contracts", category: "contracts", hasZodSchema: true },
|
|
257
|
+
{ name: "diffContractSnapshots", subpath: "contracts", category: "contracts", hasZodSchema: true },
|
|
258
|
+
{ name: "validateConsumerSurfaceCompatibility", subpath: "contracts", category: "contracts", hasZodSchema: true }
|
|
259
|
+
];
|
|
260
|
+
var QWNSR_REQUIRED_SURFACE = [
|
|
261
|
+
"GraphEntityMetadata",
|
|
262
|
+
"SocketPosition2D",
|
|
263
|
+
"SocketDirection",
|
|
264
|
+
"SocketGeometryConfig",
|
|
265
|
+
"SocketStyleConfig",
|
|
266
|
+
"AudioStereoSocket",
|
|
267
|
+
"AudioMonoSocket",
|
|
268
|
+
"TriggerSocket",
|
|
269
|
+
"createSocketInstance",
|
|
270
|
+
"GraphWireParent",
|
|
271
|
+
"WireEndpoint2D",
|
|
272
|
+
"WireVisualConfig",
|
|
273
|
+
"createWireInstance",
|
|
274
|
+
"GraphNodeParent",
|
|
275
|
+
"NodeDimensions2D",
|
|
276
|
+
"createNodeInstance",
|
|
277
|
+
"StateLifecycleServiceFacade",
|
|
278
|
+
"NodeGraphEngineServiceFacade",
|
|
279
|
+
"WorkspaceBackendFacade",
|
|
280
|
+
"AudioHardwareServiceFacade",
|
|
281
|
+
"MidiServiceFacade",
|
|
282
|
+
"AudioMidiOrchestratorFacade"
|
|
283
|
+
];
|
|
284
|
+
function validateConsumerSurfaceCompatibility(requiredSymbols = QWNSR_REQUIRED_SURFACE, publicSurface = KLOKS_PUBLIC_SURFACE) {
|
|
285
|
+
const publicNames = new Set(publicSurface.map((s) => s.name));
|
|
286
|
+
const missingSymbols = requiredSymbols.filter((s) => !publicNames.has(s));
|
|
287
|
+
return {
|
|
288
|
+
compatible: missingSymbols.length === 0,
|
|
289
|
+
missingSymbols,
|
|
290
|
+
totalRequired: requiredSymbols.length,
|
|
291
|
+
totalPresent: requiredSymbols.length - missingSymbols.length
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// src/snapshot.ts
|
|
296
|
+
function createKloksSnapshot(version = "1.0.2", surface = KLOKS_PUBLIC_SURFACE) {
|
|
297
|
+
const publicSymbols = surface.map((s) => s.name).sort();
|
|
298
|
+
const normalizedSignatures = {};
|
|
299
|
+
const zodFingerprints = {};
|
|
300
|
+
for (const item of surface) {
|
|
301
|
+
normalizedSignatures[item.name] = `${item.category}:${item.subpath}`;
|
|
302
|
+
zodFingerprints[item.name] = item.hasZodSchema ? "zod-verified" : "typescript-only";
|
|
303
|
+
}
|
|
304
|
+
const facades = surface.filter((s) => s.name.endsWith("Facade") || s.name.endsWith("facade")).map((s) => s.name).sort();
|
|
305
|
+
const events = [
|
|
306
|
+
"AudioServiceEvents.stateChange",
|
|
307
|
+
"MidiServiceEvents.midiEvent",
|
|
308
|
+
"TelemetryEvents.reading"
|
|
309
|
+
];
|
|
310
|
+
const commands = [
|
|
311
|
+
"WorkspaceBackendFacade.project.list",
|
|
312
|
+
"WorkspaceBackendFacade.project.get",
|
|
313
|
+
"WorkspaceBackendFacade.project.save",
|
|
314
|
+
"WorkspaceBackendFacade.project.create",
|
|
315
|
+
"WorkspaceBackendFacade.project.delete",
|
|
316
|
+
"WorkspaceBackendFacade.sample.list",
|
|
317
|
+
"WorkspaceBackendFacade.sample.upload",
|
|
318
|
+
"WorkspaceBackendFacade.sample.delete",
|
|
319
|
+
"WorkspaceBackendFacade.asset.listPool",
|
|
320
|
+
"WorkspaceBackendFacade.asset.createFolder",
|
|
321
|
+
"WorkspaceBackendFacade.asset.upload",
|
|
322
|
+
"WorkspaceBackendFacade.asset.delete"
|
|
323
|
+
];
|
|
324
|
+
const errorCodes = [
|
|
325
|
+
"ERR_CONTRACT_VIOLATION",
|
|
326
|
+
"ERR_INTERNAL_IMPORT_FORBIDDEN",
|
|
327
|
+
"ERR_LOCAL_SHIM_DETECTED",
|
|
328
|
+
"ERR_INCOMPATIBLE_SURFACE"
|
|
329
|
+
];
|
|
330
|
+
const rawJson = JSON.stringify({ publicSymbols, facades, commands, events });
|
|
331
|
+
let hash = 0;
|
|
332
|
+
for (let i = 0; i < rawJson.length; i++) {
|
|
333
|
+
hash = (hash << 5) - hash + rawJson.charCodeAt(i);
|
|
334
|
+
hash |= 0;
|
|
335
|
+
}
|
|
336
|
+
const checksum = `sha256-${Math.abs(hash).toString(16)}`;
|
|
337
|
+
const snapshot = {
|
|
338
|
+
package: "@ultrst-armada/kloks",
|
|
339
|
+
version,
|
|
340
|
+
timestamp: 1760377e6,
|
|
341
|
+
checksum,
|
|
342
|
+
publicSymbols,
|
|
343
|
+
normalizedSignatures,
|
|
344
|
+
zodFingerprints,
|
|
345
|
+
facades,
|
|
346
|
+
events,
|
|
347
|
+
commands,
|
|
348
|
+
errorCodes
|
|
349
|
+
};
|
|
350
|
+
return ContractSnapshotSchema.parse(snapshot);
|
|
351
|
+
}
|
|
352
|
+
function diffContractSnapshots(previous, current) {
|
|
353
|
+
const prevSymbols = new Set(previous.publicSymbols);
|
|
354
|
+
const currSymbols = new Set(current.publicSymbols);
|
|
355
|
+
const removedSymbols = previous.publicSymbols.filter((s) => !currSymbols.has(s));
|
|
356
|
+
const addedSymbols = current.publicSymbols.filter((s) => !prevSymbols.has(s));
|
|
357
|
+
const changedSignatures = [];
|
|
358
|
+
for (const s of current.publicSymbols) {
|
|
359
|
+
if (prevSymbols.has(s)) {
|
|
360
|
+
const prevSig = previous.normalizedSignatures[s];
|
|
361
|
+
const currSig = current.normalizedSignatures[s];
|
|
362
|
+
if (prevSig && currSig && prevSig !== currSig) {
|
|
363
|
+
changedSignatures.push(`${s} (${prevSig} -> ${currSig})`);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
const hasBreakingChanges = removedSymbols.length > 0;
|
|
368
|
+
const hasAdditiveChanges = addedSymbols.length > 0 || changedSignatures.length > 0;
|
|
369
|
+
const isIdentical = !hasBreakingChanges && !hasAdditiveChanges;
|
|
370
|
+
let versionRecommendation = "PATCH";
|
|
371
|
+
if (hasBreakingChanges) {
|
|
372
|
+
versionRecommendation = "MAJOR";
|
|
373
|
+
} else if (hasAdditiveChanges) {
|
|
374
|
+
versionRecommendation = "MINOR";
|
|
375
|
+
}
|
|
376
|
+
const summary = isIdentical ? "Identical public contract surface (PATCH compatible)." : hasBreakingChanges ? `Breaking contract change detected: ${removedSymbols.length} removed symbols (MAJOR bump required).` : `Additive compatible changes: ${addedSymbols.length} added symbols (MINOR bump required).`;
|
|
377
|
+
return {
|
|
378
|
+
versionRecommendation,
|
|
379
|
+
hasBreakingChanges,
|
|
380
|
+
hasAdditiveChanges,
|
|
381
|
+
isIdentical,
|
|
382
|
+
removedSymbols,
|
|
383
|
+
addedSymbols,
|
|
384
|
+
changedSignatures,
|
|
385
|
+
summary
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// src/index.ts
|
|
390
|
+
var KLOKS_CANONICAL_CONTRACT = {
|
|
391
|
+
package: "@ultrst-armada/kloks",
|
|
392
|
+
version: "1.0.2",
|
|
393
|
+
getSnapshot: () => createKloksSnapshot("1.0.2", KLOKS_PUBLIC_SURFACE),
|
|
394
|
+
validateCompatibility: (consumerSymbols) => validateConsumerSurfaceCompatibility(consumerSymbols ?? QWNSR_REQUIRED_SURFACE, KLOKS_PUBLIC_SURFACE)
|
|
395
|
+
};
|
|
396
|
+
export {
|
|
397
|
+
AudioBusConfigSchema,
|
|
398
|
+
AudioHardwareStateSchema,
|
|
399
|
+
BackendOperationSchema,
|
|
400
|
+
ContractSnapshotSchema,
|
|
401
|
+
GraphEntityMetadataSchema,
|
|
402
|
+
KLOKS_CANONICAL_CONTRACT,
|
|
403
|
+
KLOKS_PUBLIC_SURFACE,
|
|
404
|
+
MidiCommandTypeSchema,
|
|
405
|
+
MidiEventPayloadSchema,
|
|
406
|
+
NodeDimensions2DSchema,
|
|
407
|
+
NodeHeaderStyleSchema,
|
|
408
|
+
NodeScreenRect2DSchema,
|
|
409
|
+
PublicContractDefinitionSchema,
|
|
410
|
+
QWNSR_REQUIRED_SURFACE,
|
|
411
|
+
SocketDirectionSchema,
|
|
412
|
+
SocketGeometryConfigSchema,
|
|
413
|
+
SocketPosition2DSchema,
|
|
414
|
+
SocketStyleConfigSchema,
|
|
415
|
+
WireAnimationConfigSchema,
|
|
416
|
+
WireCurveStyleSchema,
|
|
417
|
+
WireEndpoint2DSchema,
|
|
418
|
+
WireVisualConfigSchema,
|
|
419
|
+
createKloksSnapshot,
|
|
420
|
+
diffContractSnapshots,
|
|
421
|
+
validateConsumerSurfaceCompatibility
|
|
422
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://skipo.dev/schemas/kloks-manifest.v1.json",
|
|
3
|
+
"package": "@kloks/contracts",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"services": [
|
|
6
|
+
{
|
|
7
|
+
"id": "canonical-contracts",
|
|
8
|
+
"name": "Canonical Contract & Snapshot Engine",
|
|
9
|
+
"version": "1.0.0",
|
|
10
|
+
"description": "Zod runtime schemas, export manifests, and contract snapshot diff engine.",
|
|
11
|
+
"backend": {
|
|
12
|
+
"package": "@kloks/contracts",
|
|
13
|
+
"export": "KLOKS_CANONICAL_CONTRACT",
|
|
14
|
+
"facade": "KLOKS_CANONICAL_CONTRACT"
|
|
15
|
+
},
|
|
16
|
+
"modes": ["backend"],
|
|
17
|
+
"targets": { "backend": ["BackendFacade.contracts"] }
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kloks/contracts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Kloks Canonical Public Contracts, Zod Runtime Schemas, and Snapshot/Diff Validation Engine",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public",
|
|
9
|
+
"registry": "https://registry.npmjs.org/"
|
|
10
|
+
},
|
|
11
|
+
"skipoManifest": "./kloks.manifest.json",
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"module": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsup src/index.ts --format esm --dts --clean --external zod",
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"clean": "rm -rf dist"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"zod": "^3.24.1"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@ultrst-armada/krnl": "^1.0.0"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NodePosition,
|
|
1
|
+
import { N as NodePosition, a as NodeSize, b as BaseNode } from './BaseNode-DTcd3K1B.js';
|
|
2
2
|
import { B as BaseConnection } from './BaseConnection-CMRrL6Fe.js';
|
|
3
3
|
|
|
4
4
|
type DynamicState = 'INACTIVE' | 'ACTIVE' | 'PINNED_LIVE';
|
|
@@ -120,4 +120,4 @@ declare class CustomNode extends BaseNode {
|
|
|
120
120
|
customDefinition?: NodeDefinition;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
export {
|
|
123
|
+
export { BaseHandle as B, type ConnectionMode as C, DataHandle as D, type HandleCategory as H, type NodePosition as N, ViewHandle as V, type NodeSize as a, BaseNode as b, type HandleDirection as c, type BaseHandleProps as d, type BaseNodeProps as e, CustomNode as f, type HandleDefinition as g, type HandleOffset as h, type HandlePosition as i, type NodeDefinition as j };
|