@ultrst-armada/kloks 1.0.1 → 1.1.0
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 +1 -0
- package/index.js +1 -0
- package/package.json +6 -1
- package/packages/audio-midi/dist/index.d.ts +7 -6
- package/packages/audio-midi/dist/index.js +9 -1
- package/packages/backend/dist/{chunk-53WQNION.js → chunk-CU7RZBMF.js} +4 -4
- package/packages/backend/dist/{chunk-KPUGS64G.js → chunk-IPP4VURQ.js} +1 -1
- package/packages/backend/dist/{chunk-5MUQSPG4.js → chunk-P4HL4C6V.js} +1 -1
- package/packages/backend/dist/index.d.ts +1 -1
- package/packages/backend/dist/index.js +20 -20
- package/packages/backend/dist/krnl-services.d.ts +9 -9
- package/packages/backend/dist/krnl-services.js +3 -3
- package/packages/backend/dist/services/index.d.ts +2 -2
- package/packages/backend/dist/services/index.js +2 -2
- 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/functions/dist/index.d.ts +3 -3
- package/packages/functions/dist/index.js +1 -1
- package/packages/orchestrations/dist/index.d.ts +5 -3
- package/packages/orchestrations/dist/index.js +4 -1
- package/packages/services/dist/index.d.ts +6 -6
- package/packages/services/dist/index.js +1 -1
- package/packages/state-graph/dist/index.d.ts +175 -19
- package/packages/state-graph/dist/index.js +245 -5
|
@@ -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,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { ServiceDefinition } from '@
|
|
1
|
+
import * as _ultrst_armada_krnl from '@ultrst-armada/krnl';
|
|
2
|
+
import { ServiceDefinition } from '@ultrst-armada/krnl';
|
|
3
3
|
import { ZodTypeAny } from 'zod';
|
|
4
4
|
import { ExecOptions, SpawnOptions } from 'child_process';
|
|
5
5
|
import fs from 'fs';
|
|
@@ -381,7 +381,7 @@ declare const FunctionsServiceFacade: {
|
|
|
381
381
|
runtime: "server";
|
|
382
382
|
deployment: "local";
|
|
383
383
|
definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
|
|
384
|
-
createInstance: () =>
|
|
384
|
+
createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
|
|
385
385
|
execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
|
|
386
386
|
};
|
|
387
387
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../../node_modules/.pnpm/@
|
|
1
|
+
// ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.0/node_modules/@ultrst-armada/krnl/packages/core/dist/index.js
|
|
2
2
|
import { WebSocketServer, WebSocket } from "ws";
|
|
3
3
|
var ServiceStateStore = class {
|
|
4
4
|
state;
|
|
@@ -7,12 +7,14 @@ import { ExecutableBackendFacade, WorkerExecutionBoundary } from '@ultrst-armada
|
|
|
7
7
|
* Enforces SKIPO::STATE_EXECUTION_ARCHITECTURE (Worker-only access to Backend Facade).
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
declare
|
|
10
|
+
declare class WorkspaceBackendFacade extends ExecutableBackendFacade {
|
|
11
|
+
}
|
|
12
|
+
declare const backendFacade: WorkspaceBackendFacade;
|
|
11
13
|
declare const workerExecutionBoundary: WorkerExecutionBoundary;
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* @file index.ts
|
|
15
|
-
* @description kloks/orchestrations — Canonical Orchestrators A & B built on KrnlTS & kloks/services.
|
|
17
|
+
* @description @ultrst-armada/kloks/orchestrations — Canonical Orchestrators A & B built on KrnlTS & @ultrst-armada/kloks/services.
|
|
16
18
|
* Orchestrator A: Service A (Pure) -> Service B (Stateful)
|
|
17
19
|
* Orchestrator B: Service B (Stateful) -> Service C (Event-Emitting)
|
|
18
20
|
*/
|
|
@@ -50,4 +52,4 @@ interface OrchestratorBOutput {
|
|
|
50
52
|
*/
|
|
51
53
|
declare const OrchestratorBFacade: OrchestratorFacade<OrchestratorBInput, OrchestratorBOutput>;
|
|
52
54
|
|
|
53
|
-
export { OrchestratorAFacade, type OrchestratorAInput, type OrchestratorAOutput, OrchestratorBFacade, type OrchestratorBInput, type OrchestratorBOutput, type OrchestratorFacade, backendFacade, workerExecutionBoundary };
|
|
55
|
+
export { OrchestratorAFacade, type OrchestratorAInput, type OrchestratorAOutput, OrchestratorBFacade, type OrchestratorBInput, type OrchestratorBOutput, type OrchestratorFacade, WorkspaceBackendFacade, backendFacade, workerExecutionBoundary };
|
|
@@ -13,7 +13,9 @@ import {
|
|
|
13
13
|
createOperationComponent
|
|
14
14
|
} from "@ultrst-armada/kloks/backend/execution";
|
|
15
15
|
import { SKIPO_EXECUTION } from "@ultrst-armada/kloks/state-graph";
|
|
16
|
-
var
|
|
16
|
+
var WorkspaceBackendFacade = class extends ExecutableBackendFacade {
|
|
17
|
+
};
|
|
18
|
+
var backendFacade = new WorkspaceBackendFacade("WorkspaceBackendFacade");
|
|
17
19
|
var projectService = new ServiceDispatcher("project");
|
|
18
20
|
projectService.registerOperation(
|
|
19
21
|
"list",
|
|
@@ -206,6 +208,7 @@ var OrchestratorBFacade = {
|
|
|
206
208
|
export {
|
|
207
209
|
OrchestratorAFacade,
|
|
208
210
|
OrchestratorBFacade,
|
|
211
|
+
WorkspaceBackendFacade,
|
|
209
212
|
backendFacade,
|
|
210
213
|
workerExecutionBoundary
|
|
211
214
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { ServiceDefinition, IService, EndpointDescriptor, ProtocolAdapter } from '@
|
|
1
|
+
import * as _ultrst_armada_krnl from '@ultrst-armada/krnl';
|
|
2
|
+
import { ServiceDefinition, IService, EndpointDescriptor, ProtocolAdapter } from '@ultrst-armada/krnl';
|
|
3
3
|
import { AdminDatabaseClusterConfig, DatabaseConnectionEntry, UserStorageConnection, AuthState, UserAccount, UserRole, UserWorkspaceRecord } from '@ultrst-armada/kloks/state-graph';
|
|
4
4
|
export { AuthState, UserAccount, UserRole, UserSession, UserStorageConnection, UserWorkspaceRecord } from '@ultrst-armada/kloks/state-graph';
|
|
5
5
|
|
|
@@ -252,7 +252,7 @@ declare const AuthClientServiceFacade: {
|
|
|
252
252
|
deployment: "local";
|
|
253
253
|
definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
|
|
254
254
|
service: AuthService;
|
|
255
|
-
createInstance: () =>
|
|
255
|
+
createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
|
|
256
256
|
execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
|
|
257
257
|
};
|
|
258
258
|
declare const StorageClientServiceDefinition: ServiceDefinition;
|
|
@@ -264,7 +264,7 @@ declare const StorageClientServiceFacade: {
|
|
|
264
264
|
deployment: "local";
|
|
265
265
|
definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
|
|
266
266
|
service: StorageService;
|
|
267
|
-
createInstance: () =>
|
|
267
|
+
createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
|
|
268
268
|
execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
|
|
269
269
|
};
|
|
270
270
|
declare const SystemDbClientServiceDefinition: ServiceDefinition;
|
|
@@ -276,13 +276,13 @@ declare const SystemDbClientServiceFacade: {
|
|
|
276
276
|
deployment: "local";
|
|
277
277
|
definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
|
|
278
278
|
service: SystemDbService;
|
|
279
|
-
createInstance: () =>
|
|
279
|
+
createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
|
|
280
280
|
execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
|
|
281
281
|
};
|
|
282
282
|
|
|
283
283
|
/**
|
|
284
284
|
* @file index.ts
|
|
285
|
-
* @description kloks/services — Canonical KrnlTS Services A, B, C, D.
|
|
285
|
+
* @description @ultrst-armada/kloks/services — Canonical KrnlTS Services A, B, C, D.
|
|
286
286
|
* Exports ServiceFacade, ServiceDefinition, and related types for each service.
|
|
287
287
|
* Built strictly on KrnlTS with zero dependency on Skipo or Floks.
|
|
288
288
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../../node_modules/.pnpm/@
|
|
1
|
+
// ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.0/node_modules/@ultrst-armada/krnl/packages/core/dist/index.js
|
|
2
2
|
import http from "http";
|
|
3
3
|
import { WebSocketServer, WebSocket } from "ws";
|
|
4
4
|
var ServiceStateStore = class {
|