@ultrst-armada/kloks 1.4.3 → 1.4.4
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/package.json +8 -20
- package/packages/audio-midi/dist/index.d.ts +23 -14
- package/packages/audio-midi/dist/index.js +170 -45
- package/packages/audio-midi/kloks.manifest.json +8 -8
- package/packages/audio-midi/package.json +1 -1
- package/packages/backend/dist/{WebSocketTransport-CxUzUfwl.d.ts → WebSocketTransport-CHmkJ0tj.d.ts} +109 -2
- package/packages/backend/dist/auth/index.js +6 -6
- package/packages/backend/dist/chunk-5336MTXD.js +597 -0
- package/packages/backend/dist/{chunk-T3NYNBDC.js → chunk-5E6JRFUH.js} +201 -3
- package/packages/backend/dist/{chunk-XTWHEZWS.js → chunk-7B24ZWB3.js} +16 -1
- package/packages/backend/dist/{chunk-DZ4ZGIZM.js → chunk-JXUSBKJ2.js} +91 -654
- package/packages/backend/dist/{chunk-FO6WYLW4.js → chunk-KI3LHMUN.js} +133 -46
- package/packages/backend/dist/{chunk-4ZFXEFOE.js → chunk-MPYASJ5A.js} +2 -87
- package/packages/backend/dist/{chunk-KX3OTBQ3.js → chunk-OZDYAEH4.js} +0 -114
- package/packages/backend/dist/chunk-TY32TUNI.js +376 -0
- package/packages/backend/dist/chunk-VDROUXFT.js +116 -0
- package/packages/backend/dist/chunk-ZDH4XI7W.js +140 -0
- package/packages/backend/dist/client/index.d.ts +2 -3
- package/packages/backend/dist/connectivity/index.d.ts +18 -6
- package/packages/backend/dist/connectivity/index.js +3 -7
- package/packages/backend/dist/index.d.ts +3 -6
- package/packages/backend/dist/index.js +101 -91
- package/packages/backend/dist/krnl-services.d.ts +84 -7
- package/packages/backend/dist/krnl-services.js +40 -12
- package/packages/backend/dist/services/index.d.ts +4 -6
- package/packages/backend/dist/services/index.js +2 -2
- package/packages/backend/dist/srkl/index.js +6 -4
- package/packages/backend/dist/storage/index.js +7 -7
- package/packages/backend/dist/workspace/index.js +2 -2
- package/packages/backend/kloks.manifest.json +47 -45
- package/packages/backend/package.json +3 -8
- package/packages/client/package.json +1 -1
- package/packages/contracts/dist/index.js +5 -10
- package/packages/contracts/package.json +1 -1
- package/packages/functions/dist/index.d.ts +12 -1
- package/packages/functions/dist/index.js +132 -24
- package/packages/functions/package.json +1 -1
- package/packages/orchestrations/dist/index.d.ts +33 -31
- package/packages/orchestrations/dist/index.js +81 -203
- package/packages/orchestrations/kloks.manifest.json +10 -2
- package/packages/orchestrations/package.json +2 -2
- package/packages/services/dist/index.d.ts +51 -1
- package/packages/services/dist/index.js +234 -36
- package/packages/services/kloks.manifest.json +69 -33
- package/packages/services/package.json +1 -1
- package/packages/state-graph/dist/{BaseGraph-BvkSYOTw.d.ts → BaseGraph-Bd5F1NMP.d.ts} +1 -1
- package/packages/state-graph/dist/{BaseNode-DTcd3K1B.d.ts → BaseNode-DKpGXMy8.d.ts} +6 -0
- package/packages/state-graph/dist/{CompatibilityMatrix-Dj-tCWUA.d.ts → CompatibilityMatrix-TiEJ3j3_.d.ts} +1 -1
- package/packages/state-graph/dist/domain/index.d.ts +3 -3
- package/packages/state-graph/dist/domain/index.js +0 -1
- package/packages/state-graph/dist/index.d.ts +40 -8
- package/packages/state-graph/dist/index.js +214 -65
- package/packages/state-graph/dist/rules/index.d.ts +3 -3
- package/packages/state-graph/dist/rules/index.js +0 -1
- package/packages/state-graph/dist/spatial/index.d.ts +4 -4
- package/packages/state-graph/dist/spatial/index.js +0 -1
- package/packages/state-graph/dist/state/index.js +1 -3
- package/packages/state-graph/dist/store/index.d.ts +4 -4
- package/packages/state-graph/dist/store/index.js +0 -1
- package/packages/state-graph/dist/{types-VDoc4FIc.d.ts → types-D5kQSa65.d.ts} +2 -2
- package/packages/state-graph/kloks.manifest.json +26 -10
- package/packages/state-graph/package.json +2 -8
- package/packages/backend/dist/IdempotencyManager-B5MjK871.d.ts +0 -16
- package/packages/backend/dist/chunk-25Y7AVTP.js +0 -55
- package/packages/backend/dist/chunk-3EPY34R6.js +0 -67
- package/packages/backend/dist/chunk-7KNGX522.js +0 -220
- package/packages/backend/dist/chunk-FZKBTF34.js +0 -15
- package/packages/backend/dist/chunk-QGHDJGYS.js +0 -92
- package/packages/backend/dist/chunk-UPFKBBQI.js +0 -138
- package/packages/backend/dist/chunk-VQEFULWT.js +0 -88
- package/packages/backend/dist/execution/index.d.ts +0 -124
- package/packages/backend/dist/execution/index.js +0 -20
- package/packages/backend/dist/types-BERZJ93O.d.ts +0 -110
- package/packages/state-graph/dist/chunk-3RG5ZIWI.js +0 -10
- package/packages/state-graph/dist/chunk-Q5I42UX7.js +0 -0
- package/packages/state-graph/dist/chunk-ZTHBPV24.js +0 -267
- package/packages/state-graph/dist/execution/index.d.ts +0 -152
- package/packages/state-graph/dist/execution/index.js +0 -16
- /package/packages/state-graph/dist/{chunk-SHIBCPGQ.js → chunk-EW4ACSZB.js} +0 -0
|
@@ -14,13 +14,6 @@
|
|
|
14
14
|
"export": "AuthServiceFacade",
|
|
15
15
|
"facade": "AuthServiceFacade"
|
|
16
16
|
},
|
|
17
|
-
"ui": {
|
|
18
|
-
"package": "@floks/ui",
|
|
19
|
-
"components": [
|
|
20
|
-
"LoginModal",
|
|
21
|
-
"CredentialField"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
17
|
"modes": [
|
|
25
18
|
"backend",
|
|
26
19
|
"fullstack"
|
|
@@ -33,7 +26,12 @@
|
|
|
33
26
|
"App.main-content"
|
|
34
27
|
]
|
|
35
28
|
},
|
|
36
|
-
"dependencies": []
|
|
29
|
+
"dependencies": [],
|
|
30
|
+
"defaultFrontend": {
|
|
31
|
+
"component": "AuthPage",
|
|
32
|
+
"package": "@ultrst-armada/floks/ui",
|
|
33
|
+
"relationship": "recommended"
|
|
34
|
+
}
|
|
37
35
|
},
|
|
38
36
|
{
|
|
39
37
|
"id": "storage",
|
|
@@ -46,12 +44,6 @@
|
|
|
46
44
|
"export": "StorageServiceFacade",
|
|
47
45
|
"facade": "StorageServiceFacade"
|
|
48
46
|
},
|
|
49
|
-
"ui": {
|
|
50
|
-
"package": "@floks/ui",
|
|
51
|
-
"components": [
|
|
52
|
-
"BaseCard"
|
|
53
|
-
]
|
|
54
|
-
},
|
|
55
47
|
"modes": [
|
|
56
48
|
"backend",
|
|
57
49
|
"fullstack"
|
|
@@ -64,7 +56,14 @@
|
|
|
64
56
|
"App.main-content"
|
|
65
57
|
]
|
|
66
58
|
},
|
|
67
|
-
"dependencies": [
|
|
59
|
+
"dependencies": [
|
|
60
|
+
"srkl"
|
|
61
|
+
],
|
|
62
|
+
"defaultFrontend": {
|
|
63
|
+
"component": "WorkspaceTilesMenu",
|
|
64
|
+
"package": "@ultrst-armada/floks/ui",
|
|
65
|
+
"relationship": "recommended"
|
|
66
|
+
}
|
|
68
67
|
},
|
|
69
68
|
{
|
|
70
69
|
"id": "workspace",
|
|
@@ -77,12 +76,6 @@
|
|
|
77
76
|
"export": "WorkspaceServiceFacade",
|
|
78
77
|
"facade": "WorkspaceServiceFacade"
|
|
79
78
|
},
|
|
80
|
-
"ui": {
|
|
81
|
-
"package": "@floks/ui",
|
|
82
|
-
"components": [
|
|
83
|
-
"WorkspaceTilesMenu"
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
79
|
"modes": [
|
|
87
80
|
"backend",
|
|
88
81
|
"fullstack"
|
|
@@ -95,7 +88,16 @@
|
|
|
95
88
|
"App.main-content"
|
|
96
89
|
]
|
|
97
90
|
},
|
|
98
|
-
"dependencies": [
|
|
91
|
+
"dependencies": [
|
|
92
|
+
"auth",
|
|
93
|
+
"storage",
|
|
94
|
+
"srkl"
|
|
95
|
+
],
|
|
96
|
+
"defaultFrontend": {
|
|
97
|
+
"component": "WorkspaceTilesMenu",
|
|
98
|
+
"package": "@ultrst-armada/floks/ui",
|
|
99
|
+
"relationship": "recommended"
|
|
100
|
+
}
|
|
99
101
|
},
|
|
100
102
|
{
|
|
101
103
|
"id": "control-plane",
|
|
@@ -108,12 +110,6 @@
|
|
|
108
110
|
"export": "ControlPlaneServiceFacade",
|
|
109
111
|
"facade": "ControlPlaneServiceFacade"
|
|
110
112
|
},
|
|
111
|
-
"ui": {
|
|
112
|
-
"package": "@floks/ui",
|
|
113
|
-
"components": [
|
|
114
|
-
"StatusIndicator"
|
|
115
|
-
]
|
|
116
|
-
},
|
|
117
113
|
"modes": [
|
|
118
114
|
"backend",
|
|
119
115
|
"fullstack"
|
|
@@ -126,18 +122,23 @@
|
|
|
126
122
|
"App.footer"
|
|
127
123
|
]
|
|
128
124
|
},
|
|
129
|
-
"dependencies": []
|
|
125
|
+
"dependencies": [],
|
|
126
|
+
"defaultFrontend": {
|
|
127
|
+
"component": "StatusIndicator",
|
|
128
|
+
"package": "@ultrst-armada/floks/ui",
|
|
129
|
+
"relationship": "recommended"
|
|
130
|
+
}
|
|
130
131
|
},
|
|
131
132
|
{
|
|
132
|
-
"id": "
|
|
133
|
-
"name": "
|
|
133
|
+
"id": "database",
|
|
134
|
+
"name": "Database Service",
|
|
134
135
|
"version": "1.0.0",
|
|
135
|
-
"description": "
|
|
136
|
+
"description": "SQL and transaction execution driver service.",
|
|
136
137
|
"backend": {
|
|
137
138
|
"package": "@kloks/backend",
|
|
138
139
|
"subpath": "krnl-services",
|
|
139
|
-
"export": "
|
|
140
|
-
"facade": "
|
|
140
|
+
"export": "DatabaseServiceFacade",
|
|
141
|
+
"facade": "DatabaseServiceFacade"
|
|
141
142
|
},
|
|
142
143
|
"modes": [
|
|
143
144
|
"backend"
|
|
@@ -150,15 +151,15 @@
|
|
|
150
151
|
"dependencies": []
|
|
151
152
|
},
|
|
152
153
|
{
|
|
153
|
-
"id": "
|
|
154
|
-
"name": "
|
|
154
|
+
"id": "gemini",
|
|
155
|
+
"name": "Google Gemini AI Service",
|
|
155
156
|
"version": "1.0.0",
|
|
156
|
-
"description": "
|
|
157
|
+
"description": "Gemini text and multimodal generation service.",
|
|
157
158
|
"backend": {
|
|
158
159
|
"package": "@kloks/backend",
|
|
159
160
|
"subpath": "krnl-services",
|
|
160
|
-
"export": "
|
|
161
|
-
"facade": "
|
|
161
|
+
"export": "GeminiServiceFacade",
|
|
162
|
+
"facade": "GeminiServiceFacade"
|
|
162
163
|
},
|
|
163
164
|
"modes": [
|
|
164
165
|
"backend"
|
|
@@ -171,18 +172,19 @@
|
|
|
171
172
|
"dependencies": []
|
|
172
173
|
},
|
|
173
174
|
{
|
|
174
|
-
"id": "
|
|
175
|
-
"name": "
|
|
175
|
+
"id": "srkl",
|
|
176
|
+
"name": "SRKL Credential Federation",
|
|
176
177
|
"version": "1.0.0",
|
|
177
|
-
"description": "
|
|
178
|
+
"description": "Service-account discovery and Backblaze B2 bucket federation for reusable application modules.",
|
|
178
179
|
"backend": {
|
|
179
180
|
"package": "@kloks/backend",
|
|
180
181
|
"subpath": "krnl-services",
|
|
181
|
-
"export": "
|
|
182
|
-
"facade": "
|
|
182
|
+
"export": "SrklServiceFacade",
|
|
183
|
+
"facade": "SrklServiceFacade"
|
|
183
184
|
},
|
|
184
185
|
"modes": [
|
|
185
|
-
"backend"
|
|
186
|
+
"backend",
|
|
187
|
+
"fullstack"
|
|
186
188
|
],
|
|
187
189
|
"targets": {
|
|
188
190
|
"backend": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kloks/backend",
|
|
3
3
|
"version": "1.0.0",
|
|
4
|
-
"description": "Kloks Backend Services
|
|
4
|
+
"description": "Kloks Backend Services \u2014 Auth, Storage, Workspace, Control Plane, API, Connectivity & Execution built on KrnlTS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"publishConfig": {
|
|
@@ -58,11 +58,6 @@
|
|
|
58
58
|
"types": "./dist/srkl/index.d.ts",
|
|
59
59
|
"default": "./dist/srkl/index.js"
|
|
60
60
|
},
|
|
61
|
-
"./execution": {
|
|
62
|
-
"import": "./dist/execution/index.js",
|
|
63
|
-
"types": "./dist/execution/index.d.ts",
|
|
64
|
-
"default": "./dist/execution/index.js"
|
|
65
|
-
},
|
|
66
61
|
"./services": {
|
|
67
62
|
"import": "./dist/services/index.js",
|
|
68
63
|
"types": "./dist/services/index.d.ts",
|
|
@@ -75,7 +70,7 @@
|
|
|
75
70
|
}
|
|
76
71
|
},
|
|
77
72
|
"scripts": {
|
|
78
|
-
"build": "tsup src/index.ts src/krnl-services.ts src/services/index.ts src/auth/index.ts src/storage/index.ts src/workspace/index.ts src/control-plane/index.ts src/api/index.ts src/connectivity/index.ts src/client/index.ts src/srkl/index.ts
|
|
73
|
+
"build": "tsup src/index.ts src/krnl-services.ts src/services/index.ts src/auth/index.ts src/storage/index.ts src/workspace/index.ts src/control-plane/index.ts src/api/index.ts src/connectivity/index.ts src/client/index.ts src/srkl/index.ts --format esm --dts --clean --external @kloks/functions --external react --external @kloks/state-graph --external @neondatabase/serverless --external @supabase/supabase-js --external @aws-sdk/client-s3 --external @aws-sdk/lib-storage --external bcryptjs --external better-sqlite3 --external zod --external ws",
|
|
79
74
|
"typecheck": "tsc --noEmit",
|
|
80
75
|
"clean": "rm -rf dist"
|
|
81
76
|
},
|
|
@@ -120,6 +115,6 @@
|
|
|
120
115
|
}
|
|
121
116
|
},
|
|
122
117
|
"devDependencies": {
|
|
123
|
-
"@ultrst-armada/krnl": "^1.0.
|
|
118
|
+
"@ultrst-armada/krnl": "^1.0.3"
|
|
124
119
|
}
|
|
125
120
|
}
|
|
@@ -224,24 +224,20 @@ var KLOKS_PUBLIC_SURFACE = [
|
|
|
224
224
|
{ name: "MidiManager", subpath: "audio-midi", category: "audio-midi", hasZodSchema: false },
|
|
225
225
|
{ name: "AudioHardwareServiceFacade", subpath: "audio-midi", category: "audio-midi", hasZodSchema: false },
|
|
226
226
|
{ name: "MidiServiceFacade", subpath: "audio-midi", category: "audio-midi", hasZodSchema: false },
|
|
227
|
-
{ name: "
|
|
227
|
+
{ name: "AudioMidiOrchestratorDefinition", subpath: "audio-midi", category: "audio-midi", hasZodSchema: false },
|
|
228
228
|
{ name: "AudioBusConfig", subpath: "audio-midi", category: "audio-midi", hasZodSchema: true },
|
|
229
229
|
{ name: "AudioHardwareState", subpath: "audio-midi", category: "audio-midi", hasZodSchema: true },
|
|
230
230
|
{ name: "MidiCommandType", subpath: "audio-midi", category: "audio-midi", hasZodSchema: true },
|
|
231
231
|
{ name: "MidiEventPayload", subpath: "audio-midi", category: "audio-midi", hasZodSchema: true },
|
|
232
232
|
// ── orchestrations ──
|
|
233
|
-
{ name: "
|
|
234
|
-
{ name: "
|
|
235
|
-
{ name: "
|
|
236
|
-
{ name: "backendFacade", subpath: "orchestrations", category: "orchestrations", hasZodSchema: false },
|
|
237
|
-
{ name: "workerExecutionBoundary", subpath: "orchestrations", category: "orchestrations", hasZodSchema: false },
|
|
233
|
+
{ name: "OrchestratorADefinition", subpath: "orchestrations", category: "orchestrations", hasZodSchema: false },
|
|
234
|
+
{ name: "OrchestratorBDefinition", subpath: "orchestrations", category: "orchestrations", hasZodSchema: false },
|
|
235
|
+
{ name: "AudioMidiOrchestratorDefinition", subpath: "orchestrations", category: "orchestrations", hasZodSchema: false },
|
|
238
236
|
// ── backend ──
|
|
239
237
|
{ name: "AuthServiceFacade", subpath: "backend", category: "backend", hasZodSchema: false },
|
|
240
238
|
{ name: "StorageServiceFacade", subpath: "backend", category: "backend", hasZodSchema: false },
|
|
241
239
|
{ name: "WorkspaceServiceFacade", subpath: "backend", category: "backend", hasZodSchema: false },
|
|
242
240
|
{ 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
241
|
// ── services ──
|
|
246
242
|
{ name: "ServiceAFacade", subpath: "services", category: "services", hasZodSchema: false },
|
|
247
243
|
{ name: "ServiceBFacade", subpath: "services", category: "services", hasZodSchema: false },
|
|
@@ -276,10 +272,9 @@ var QWNSR_REQUIRED_SURFACE = [
|
|
|
276
272
|
"createNodeInstance",
|
|
277
273
|
"StateLifecycleServiceFacade",
|
|
278
274
|
"NodeGraphEngineServiceFacade",
|
|
279
|
-
"WorkspaceBackendFacade",
|
|
280
275
|
"AudioHardwareServiceFacade",
|
|
281
276
|
"MidiServiceFacade",
|
|
282
|
-
"
|
|
277
|
+
"AudioMidiOrchestratorDefinition"
|
|
283
278
|
];
|
|
284
279
|
function validateConsumerSurfaceCompatibility(requiredSymbols = QWNSR_REQUIRED_SURFACE, publicSurface = KLOKS_PUBLIC_SURFACE) {
|
|
285
280
|
const publicNames = new Set(publicSurface.map((s) => s.name));
|
|
@@ -384,5 +384,16 @@ declare const FunctionsServiceFacade: {
|
|
|
384
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
|
+
declare const krnlFunctionsServiceDefinition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
|
|
388
|
+
declare const krnlFunctionsServiceFacade: {
|
|
389
|
+
id: string;
|
|
390
|
+
name: string;
|
|
391
|
+
version: string;
|
|
392
|
+
runtime: "server";
|
|
393
|
+
deployment: "local";
|
|
394
|
+
definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
|
|
395
|
+
createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
|
|
396
|
+
execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
|
|
397
|
+
};
|
|
387
398
|
|
|
388
|
-
export { type Disposable, type EventListener, FileCache, FileLock, FunctionsServiceDefinition, FunctionsServiceFacade, LRUCache, type Logger, type Provider, type RealtimeWorkspaceEvent, type ReleaseFn, type Result, SkipoBase, type SkipoConfig, type SkipoHTTPOptions, type SkipoHTTPResult, type SpawnHandle, TTLCache, appendFile, copyDir, createClient, createTempDir, createTempFile, debounce, deepClone, deepEqual, deepMerge, del, deleteDir, deleteFile, dirExists, ensureDir, execCmd, fileExists, firstExisting, get, getEnv, getFileStat, getPath, getRecentEvents, interpolate, isPlaceholderConnection, listDir, loadEnv, memoize, objectDiff, once, pLimit, platform, post, prefixedId, publishRealtimeEvent, put, readFile, readJSON, request, requestRaw, requireEnv, retry, sanitizeDatabaseUrl, setPath, shortId, sleep, spawnCmd, streamResponse, subscribeRealtimeEvents, swr, throttle, toCamelCase, toKebabCase, toPascalCase, toScreamingSnake, toSlug, toSnakeCase, updateJSON, uuid, validateEnvSchema, walkDir, watchDir, watchFile, which, withTempDir, withTimeout, writeFile, writeFileAtomic, writeJSON };
|
|
399
|
+
export { type Disposable, type EventListener, FileCache, FileLock, FunctionsServiceDefinition, FunctionsServiceFacade, LRUCache, type Logger, type Provider, type RealtimeWorkspaceEvent, type ReleaseFn, type Result, SkipoBase, type SkipoConfig, type SkipoHTTPOptions, type SkipoHTTPResult, type SpawnHandle, TTLCache, appendFile, copyDir, createClient, createTempDir, createTempFile, debounce, deepClone, deepEqual, deepMerge, del, deleteDir, deleteFile, dirExists, ensureDir, execCmd, fileExists, firstExisting, get, getEnv, getFileStat, getPath, getRecentEvents, interpolate, isPlaceholderConnection, krnlFunctionsServiceDefinition, krnlFunctionsServiceFacade, listDir, loadEnv, memoize, objectDiff, once, pLimit, platform, post, prefixedId, publishRealtimeEvent, put, readFile, readJSON, request, requestRaw, requireEnv, retry, sanitizeDatabaseUrl, setPath, shortId, sleep, spawnCmd, streamResponse, subscribeRealtimeEvents, swr, throttle, toCamelCase, toKebabCase, toPascalCase, toScreamingSnake, toSlug, toSnakeCase, updateJSON, uuid, validateEnvSchema, walkDir, watchDir, watchFile, which, withTempDir, withTimeout, writeFile, writeFileAtomic, writeJSON };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.
|
|
1
|
+
// ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.3/node_modules/@ultrst-armada/krnl/packages/core/dist/index.js
|
|
2
2
|
var ServiceStateStore = class {
|
|
3
3
|
state;
|
|
4
4
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -52,17 +52,37 @@ var ServiceEventBus = class {
|
|
|
52
52
|
this.handlers.clear();
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
+
var TRANSITIONS = {
|
|
56
|
+
uninitialized: ["initializing"],
|
|
57
|
+
initializing: ["ready", "uninitialized"],
|
|
58
|
+
ready: ["starting"],
|
|
59
|
+
starting: ["running", "ready"],
|
|
60
|
+
running: ["stopping"],
|
|
61
|
+
stopping: ["stopped", "running"],
|
|
62
|
+
stopped: ["starting"]
|
|
63
|
+
};
|
|
55
64
|
var LifecycleManager = class {
|
|
56
65
|
status = "uninitialized";
|
|
57
66
|
getStatus() {
|
|
58
67
|
return this.status;
|
|
59
68
|
}
|
|
60
|
-
|
|
69
|
+
canTransitionTo(next) {
|
|
70
|
+
return TRANSITIONS[this.status].includes(next);
|
|
71
|
+
}
|
|
72
|
+
transitionTo(next) {
|
|
73
|
+
if (!this.canTransitionTo(next)) {
|
|
74
|
+
throw new Error("[Lifecycle] Invalid transition '" + this.status + "' -> '" + next + "'.");
|
|
75
|
+
}
|
|
61
76
|
this.status = next;
|
|
62
77
|
}
|
|
78
|
+
setStatus(next) {
|
|
79
|
+
this.transitionTo(next);
|
|
80
|
+
}
|
|
63
81
|
assertRunning(serviceName) {
|
|
64
82
|
if (this.status !== "running") {
|
|
65
|
-
throw new Error(
|
|
83
|
+
throw new Error(
|
|
84
|
+
"[Service:" + serviceName + "] Cannot invoke operation while status is '" + this.status + "' (expected 'running')."
|
|
85
|
+
);
|
|
66
86
|
}
|
|
67
87
|
}
|
|
68
88
|
};
|
|
@@ -74,7 +94,7 @@ var ServiceInstance = class {
|
|
|
74
94
|
this.version = definition.version;
|
|
75
95
|
this.lifecycle = new LifecycleManager();
|
|
76
96
|
this.eventBus = new ServiceEventBus();
|
|
77
|
-
if (definition.state
|
|
97
|
+
if (definition.state) {
|
|
78
98
|
this.stateStore = new ServiceStateStore(definition.state.initial);
|
|
79
99
|
}
|
|
80
100
|
}
|
|
@@ -85,46 +105,76 @@ var ServiceInstance = class {
|
|
|
85
105
|
stateStore;
|
|
86
106
|
eventBus;
|
|
87
107
|
lifecycle;
|
|
108
|
+
initialized = false;
|
|
109
|
+
disposed = false;
|
|
88
110
|
getDefinition() {
|
|
89
111
|
return this.definition;
|
|
90
112
|
}
|
|
113
|
+
getStatus() {
|
|
114
|
+
return this.lifecycle.getStatus();
|
|
115
|
+
}
|
|
91
116
|
async start() {
|
|
92
|
-
this.
|
|
93
|
-
|
|
94
|
-
|
|
117
|
+
if (this.disposed) throw new Error("[Service:" + this.name + "] Cannot start a disposed service.");
|
|
118
|
+
const current = this.lifecycle.getStatus();
|
|
119
|
+
if (current === "running") return;
|
|
120
|
+
if (current === "initializing" || current === "starting" || current === "stopping") {
|
|
121
|
+
throw new Error("[Service:" + this.name + "] Cannot start while status is '" + current + "'.");
|
|
95
122
|
}
|
|
96
|
-
if (this.
|
|
97
|
-
|
|
123
|
+
if (!this.initialized) {
|
|
124
|
+
this.lifecycle.transitionTo("initializing");
|
|
125
|
+
try {
|
|
126
|
+
await this.definition.lifecycle?.onInit?.();
|
|
127
|
+
this.initialized = true;
|
|
128
|
+
this.lifecycle.transitionTo("ready");
|
|
129
|
+
} catch (error) {
|
|
130
|
+
this.lifecycle.transitionTo("uninitialized");
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
this.lifecycle.transitionTo("starting");
|
|
135
|
+
try {
|
|
136
|
+
await this.definition.lifecycle?.onStart?.();
|
|
137
|
+
this.lifecycle.transitionTo("running");
|
|
138
|
+
} catch (error) {
|
|
139
|
+
this.lifecycle.transitionTo("ready");
|
|
140
|
+
throw error;
|
|
98
141
|
}
|
|
99
|
-
this.lifecycle.setStatus("running");
|
|
100
142
|
}
|
|
101
143
|
async stop() {
|
|
102
|
-
this.lifecycle.
|
|
103
|
-
if (
|
|
104
|
-
|
|
144
|
+
const current = this.lifecycle.getStatus();
|
|
145
|
+
if (current === "stopped") return;
|
|
146
|
+
if (current !== "running") {
|
|
147
|
+
throw new Error("[Service:" + this.name + "] Cannot stop while status is '" + current + "'.");
|
|
105
148
|
}
|
|
106
|
-
|
|
107
|
-
|
|
149
|
+
this.lifecycle.transitionTo("stopping");
|
|
150
|
+
try {
|
|
151
|
+
await this.definition.lifecycle?.onStop?.();
|
|
152
|
+
this.lifecycle.transitionTo("stopped");
|
|
153
|
+
} catch (error) {
|
|
154
|
+
this.lifecycle.transitionTo("running");
|
|
155
|
+
throw error;
|
|
108
156
|
}
|
|
109
|
-
|
|
157
|
+
}
|
|
158
|
+
async dispose() {
|
|
159
|
+
if (this.disposed) return;
|
|
160
|
+
if (this.lifecycle.getStatus() === "running") await this.stop();
|
|
161
|
+
await this.definition.lifecycle?.onDispose?.();
|
|
162
|
+
this.disposed = true;
|
|
110
163
|
}
|
|
111
164
|
async call(op, input, ctx = {}) {
|
|
112
165
|
this.lifecycle.assertRunning(this.name);
|
|
113
166
|
const operation = this.definition.operations[op];
|
|
114
167
|
if (!operation) {
|
|
115
|
-
throw new Error(
|
|
168
|
+
throw new Error("[Service:" + this.name + "] Operation '" + op + "' not found.");
|
|
116
169
|
}
|
|
117
170
|
return await operation.handler(input, ctx);
|
|
118
171
|
}
|
|
119
172
|
getState() {
|
|
120
|
-
|
|
121
|
-
return Object.freeze({});
|
|
122
|
-
}
|
|
123
|
-
return this.stateStore.getState();
|
|
173
|
+
return this.stateStore?.getState() ?? Object.freeze({});
|
|
124
174
|
}
|
|
125
175
|
setState(mutation) {
|
|
126
176
|
if (!this.stateStore) {
|
|
127
|
-
this.stateStore = new ServiceStateStore(mutation);
|
|
177
|
+
this.stateStore = new ServiceStateStore({ ...mutation });
|
|
128
178
|
return;
|
|
129
179
|
}
|
|
130
180
|
this.stateStore.setState(mutation);
|
|
@@ -136,12 +186,66 @@ var ServiceInstance = class {
|
|
|
136
186
|
this.eventBus.emit(event, payload);
|
|
137
187
|
}
|
|
138
188
|
};
|
|
139
|
-
function
|
|
189
|
+
function assertRecord(value, field) {
|
|
190
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
191
|
+
throw new Error("[KrnlTS] Invalid service definition: '" + field + "' must be an object.");
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function assertNonEmptyString(value, field) {
|
|
195
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
196
|
+
throw new Error("[KrnlTS] Invalid service definition: '" + field + "' must be a non-empty string.");
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function validateServiceDefinition(definition) {
|
|
200
|
+
if (!definition || typeof definition !== "object") {
|
|
201
|
+
throw new Error("[KrnlTS] Invalid service definition: expected an object.");
|
|
202
|
+
}
|
|
203
|
+
assertNonEmptyString(definition.id, "id");
|
|
204
|
+
assertNonEmptyString(definition.name, "name");
|
|
205
|
+
assertNonEmptyString(definition.version, "version");
|
|
206
|
+
if (!definition.operations || typeof definition.operations !== "object") {
|
|
207
|
+
throw new Error("[Service:" + definition.name + "] Invalid operations: expected an object.");
|
|
208
|
+
}
|
|
209
|
+
for (const [key, operation] of Object.entries(definition.operations)) {
|
|
210
|
+
if (!operation || typeof operation !== "object") {
|
|
211
|
+
throw new Error("[Service:" + definition.name + "] Invalid operation '" + key + "'.");
|
|
212
|
+
}
|
|
213
|
+
assertNonEmptyString(operation.id, "operations." + key + ".id");
|
|
214
|
+
assertNonEmptyString(operation.name, "operations." + key + ".name");
|
|
215
|
+
if (operation.inputSchema !== void 0) assertRecord(operation.inputSchema, "operations." + key + ".inputSchema");
|
|
216
|
+
if (operation.outputSchema !== void 0) assertRecord(operation.outputSchema, "operations." + key + ".outputSchema");
|
|
217
|
+
if (typeof operation.handler !== "function") {
|
|
218
|
+
throw new Error("[Service:" + definition.name + "] Operation '" + key + "' must define a handler.");
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
for (const [key, event] of Object.entries(definition.events ?? {})) {
|
|
222
|
+
if (!event || typeof event !== "object") {
|
|
223
|
+
throw new Error("[Service:" + definition.name + "] Invalid event '" + key + "'.");
|
|
224
|
+
}
|
|
225
|
+
assertNonEmptyString(event.name, "events." + key + ".name");
|
|
226
|
+
}
|
|
227
|
+
for (const [key, schema] of Object.entries(definition.inputs ?? {})) assertRecord(schema, "inputs." + key);
|
|
228
|
+
for (const [key, schema] of Object.entries(definition.outputs ?? {})) assertRecord(schema, "outputs." + key);
|
|
229
|
+
if (definition.state?.schema !== void 0) assertRecord(definition.state.schema, "state.schema");
|
|
230
|
+
for (const capability of definition.capabilities ?? []) {
|
|
231
|
+
assertNonEmptyString(capability.id, "capability.id");
|
|
232
|
+
assertNonEmptyString(capability.name, "capability.name");
|
|
233
|
+
if (!Array.isArray(capability.protocols)) {
|
|
234
|
+
throw new Error("[Service:" + definition.name + "] Capability '" + capability.name + "' protocols must be an array.");
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
for (const dependency of definition.dependencies ?? []) {
|
|
238
|
+
assertNonEmptyString(dependency.serviceId, "dependency.serviceId");
|
|
239
|
+
}
|
|
140
240
|
return definition;
|
|
141
241
|
}
|
|
242
|
+
function createServiceDefinition(definition) {
|
|
243
|
+
return validateServiceDefinition(definition);
|
|
244
|
+
}
|
|
142
245
|
function createService(definition) {
|
|
143
|
-
return new ServiceInstance(definition);
|
|
246
|
+
return new ServiceInstance(validateServiceDefinition(definition));
|
|
144
247
|
}
|
|
248
|
+
var asyncHooks = globalThis.process?.getBuiltinModule?.("node:async_hooks");
|
|
145
249
|
|
|
146
250
|
// src/string.ts
|
|
147
251
|
function toCamelCase(str) {
|
|
@@ -1121,6 +1225,8 @@ var FunctionsServiceFacade = {
|
|
|
1121
1225
|
return defaultFunctionsService.call(op, input);
|
|
1122
1226
|
}
|
|
1123
1227
|
};
|
|
1228
|
+
var krnlFunctionsServiceDefinition = FunctionsServiceDefinition;
|
|
1229
|
+
var krnlFunctionsServiceFacade = FunctionsServiceFacade;
|
|
1124
1230
|
export {
|
|
1125
1231
|
FileCache,
|
|
1126
1232
|
FileLock,
|
|
@@ -1153,6 +1259,8 @@ export {
|
|
|
1153
1259
|
getRecentEvents,
|
|
1154
1260
|
interpolate,
|
|
1155
1261
|
isPlaceholderConnection,
|
|
1262
|
+
krnlFunctionsServiceDefinition,
|
|
1263
|
+
krnlFunctionsServiceFacade,
|
|
1156
1264
|
listDir,
|
|
1157
1265
|
loadEnv,
|
|
1158
1266
|
memoize,
|
|
@@ -1,31 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ExecutableBackendFacade, WorkerExecutionBoundary } from '@ultrst-armada/kloks/backend/execution';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @file backendExecutionFacade.ts
|
|
6
|
-
* @description Registers backend services on ExecutableBackendFacade and connects BullMQ workers.
|
|
7
|
-
* Enforces SKIPO::STATE_EXECUTION_ARCHITECTURE (Worker-only access to Backend Facade).
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
declare class WorkspaceBackendFacade extends ExecutableBackendFacade {
|
|
11
|
-
}
|
|
12
|
-
declare const backendFacade: WorkspaceBackendFacade;
|
|
13
|
-
declare const workerExecutionBoundary: WorkerExecutionBoundary;
|
|
1
|
+
import { OrchestrationDefinition } from '@ultrst-armada/krnl';
|
|
14
2
|
|
|
15
3
|
/**
|
|
16
4
|
* @file index.ts
|
|
17
|
-
* @description @ultrst-armada/kloks/orchestrations — Canonical
|
|
18
|
-
*
|
|
19
|
-
*
|
|
5
|
+
* @description @ultrst-armada/kloks/orchestrations — Canonical pure Orchestration Definitions A & B.
|
|
6
|
+
* STRICT INVARIANT: Kloks is a pure distribution catalog and NEVER owns execution,
|
|
7
|
+
* queues, workers, schedulers, or dispatchers. Kloks exports pure serializable definitions
|
|
8
|
+
* conforming to OrchestrationDefinition<TInput, TOutput>.
|
|
20
9
|
*/
|
|
21
10
|
|
|
22
|
-
interface OrchestratorFacade<TInput = unknown, TOutput = unknown> {
|
|
23
|
-
readonly id: string;
|
|
24
|
-
readonly name: string;
|
|
25
|
-
readonly version: string;
|
|
26
|
-
readonly dependencies: string[];
|
|
27
|
-
execute(input: TInput): Promise<TOutput>;
|
|
28
|
-
}
|
|
29
11
|
interface OrchestratorAInput {
|
|
30
12
|
a: number;
|
|
31
13
|
b: number;
|
|
@@ -33,23 +15,43 @@ interface OrchestratorAInput {
|
|
|
33
15
|
}
|
|
34
16
|
interface OrchestratorAOutput {
|
|
35
17
|
computed: number;
|
|
36
|
-
state:
|
|
18
|
+
state: {
|
|
19
|
+
count: number;
|
|
20
|
+
};
|
|
37
21
|
}
|
|
38
22
|
/**
|
|
39
|
-
*
|
|
23
|
+
* Pure serializable definition for Orchestrator A.
|
|
24
|
+
* Sequences Service A (Pure Math) -> Service B (Stateful Counter).
|
|
25
|
+
* Free from execution machinery. To be instantiated and executed by Skipo/runtime.
|
|
40
26
|
*/
|
|
41
|
-
declare const
|
|
27
|
+
declare const OrchestratorADefinition: OrchestrationDefinition<OrchestratorAInput, OrchestratorAOutput>;
|
|
42
28
|
interface OrchestratorBInput {
|
|
43
29
|
delta?: number;
|
|
44
30
|
metricName?: string;
|
|
45
31
|
}
|
|
46
32
|
interface OrchestratorBOutput {
|
|
47
|
-
state:
|
|
48
|
-
|
|
33
|
+
state: {
|
|
34
|
+
count: number;
|
|
35
|
+
};
|
|
36
|
+
emitted: {
|
|
37
|
+
metric: string;
|
|
38
|
+
value: number;
|
|
39
|
+
timestamp: number;
|
|
40
|
+
};
|
|
49
41
|
}
|
|
50
42
|
/**
|
|
51
|
-
*
|
|
43
|
+
* Pure serializable definition for Orchestrator B.
|
|
44
|
+
* Sequences Service B (Stateful Counter) -> Service C (Event-Emitting Telemetry).
|
|
45
|
+
* Free from execution machinery. To be instantiated and executed by Skipo/runtime.
|
|
46
|
+
*/
|
|
47
|
+
declare const OrchestratorBDefinition: OrchestrationDefinition<OrchestratorBInput, OrchestratorBOutput>;
|
|
48
|
+
/**
|
|
49
|
+
* Pure serializable definition for Audio-Midi Orchestrator.
|
|
50
|
+
* Sequences MidiService -> AudioHardwareService.
|
|
52
51
|
*/
|
|
53
|
-
declare const
|
|
52
|
+
declare const AudioMidiOrchestratorDefinition: OrchestrationDefinition;
|
|
53
|
+
declare const krnlOrchestratorADefinition: OrchestrationDefinition<OrchestratorAInput, OrchestratorAOutput>;
|
|
54
|
+
declare const krnlOrchestratorBDefinition: OrchestrationDefinition<OrchestratorBInput, OrchestratorBOutput>;
|
|
55
|
+
declare const krnlAudioMidiOrchestratorDefinition: OrchestrationDefinition<unknown, unknown>;
|
|
54
56
|
|
|
55
|
-
export {
|
|
57
|
+
export { AudioMidiOrchestratorDefinition, OrchestratorADefinition, type OrchestratorAInput, type OrchestratorAOutput, OrchestratorBDefinition, type OrchestratorBInput, type OrchestratorBOutput, krnlAudioMidiOrchestratorDefinition, krnlOrchestratorADefinition, krnlOrchestratorBDefinition };
|