@ultrst-armada/kloks 1.2.0 → 1.3.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/package.json +2 -1
- package/packages/audio-midi/dist/chunk-3GRGELA4.js +6 -6
- package/packages/audio-midi/dist/index.d.ts +3 -3
- package/packages/audio-midi/dist/index.js +10 -10
- package/packages/backend/dist/BaseAccountProvider-DduKf5HG.d.ts +1 -1
- package/packages/backend/dist/BaseStorageAdapter-tosOoSUg.d.ts +1 -1
- package/packages/backend/dist/api/index.d.ts +1 -1
- package/packages/backend/dist/auth/index.d.ts +1 -1
- package/packages/backend/dist/chunk-4ZFXEFOE.js +2 -2
- package/packages/backend/dist/chunk-BM4QMVPA.js +338 -0
- package/packages/backend/dist/chunk-J2J24JVC.js +1 -1
- package/packages/backend/dist/chunk-KTLD7Z4L.js +3 -3
- package/packages/backend/dist/{chunk-MN54ZIKZ.js → chunk-KX3OTBQ3.js} +309 -4
- package/packages/backend/dist/chunk-RCCQ7IRM.js +3 -3
- package/packages/backend/dist/chunk-TWCEVES2.js +1 -1
- package/packages/backend/dist/control-plane/index.d.ts +1 -1
- package/packages/backend/dist/index.d.ts +146 -5
- package/packages/backend/dist/index.js +50 -19
- package/packages/backend/dist/krnl-services.js +2 -2
- package/packages/backend/dist/services/index.d.ts +168 -1
- package/packages/backend/dist/services/index.js +15 -3
- package/packages/backend/dist/srkl/index.d.ts +108 -1
- package/packages/backend/dist/srkl/index.js +15 -1
- package/packages/backend/dist/storage/index.d.ts +1 -1
- package/packages/backend/dist/workspace/index.d.ts +1 -1
- package/packages/orchestrations/dist/index.d.ts +3 -3
- package/packages/orchestrations/dist/index.js +3 -3
- package/packages/services/dist/index.d.ts +3 -3
- package/packages/state-graph/dist/index.js +11 -11
- package/packages/backend/dist/chunk-P4HL4C6V.js +0 -149
- package/packages/backend/dist/{chunk-OYQKQAEF.js → chunk-CU7RZBMF.js} +4 -4
|
@@ -166,7 +166,7 @@ async function getPrimarySrklDeploymentUrl(queryDb) {
|
|
|
166
166
|
cachedSrklUrl = { url: fallback, expiresAt: Date.now() + 10 * 60 * 1e3 };
|
|
167
167
|
return fallback;
|
|
168
168
|
}
|
|
169
|
-
async function getSrklAccounts(userId,
|
|
169
|
+
async function getSrklAccounts(userId, service2, queryDb) {
|
|
170
170
|
const srklUrl = await getPrimarySrklDeploymentUrl(queryDb);
|
|
171
171
|
const accounts = [];
|
|
172
172
|
const seenKeys = /* @__PURE__ */ new Set();
|
|
@@ -182,7 +182,7 @@ async function getSrklAccounts(userId, service, queryDb) {
|
|
|
182
182
|
...p.loky?.storage_connections || []
|
|
183
183
|
];
|
|
184
184
|
for (const conn of pool) {
|
|
185
|
-
if (
|
|
185
|
+
if (service2 && !conn.provider?.toLowerCase().includes(service2.toLowerCase())) continue;
|
|
186
186
|
const kId = (conn.b2KeyId || conn.keyId || conn.accessKeyId || "").trim();
|
|
187
187
|
const key = kId ? `key:${kId}` : `id:${conn.id}`;
|
|
188
188
|
if (!seenKeys.has(key)) {
|
|
@@ -216,7 +216,7 @@ async function getSrklAccounts(userId, service, queryDb) {
|
|
|
216
216
|
const list = Array.isArray(data.services) ? data.services : [];
|
|
217
217
|
for (const item of list) {
|
|
218
218
|
const sId = String(item.serviceId || item.id || "").toLowerCase();
|
|
219
|
-
if (
|
|
219
|
+
if (service2 && !sId.includes(service2.toLowerCase())) continue;
|
|
220
220
|
const kId = (item.credentials?.keyId || item.credentials?.b2KeyId || "").trim();
|
|
221
221
|
const key = kId ? `key:${kId}` : `id:${item.id}`;
|
|
222
222
|
if (!seenKeys.has(key)) {
|
|
@@ -325,6 +325,304 @@ function useSrklServices(options) {
|
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
// src/srkl/SrklCryptoClient.ts
|
|
329
|
+
var SALT_LENGTH = 16;
|
|
330
|
+
var IV_LENGTH = 12;
|
|
331
|
+
var TAG_LENGTH = 16;
|
|
332
|
+
var HEADER_LENGTH = SALT_LENGTH + IV_LENGTH + TAG_LENGTH;
|
|
333
|
+
var PBKDF2_ITERATIONS = 1e5;
|
|
334
|
+
function hexToBytes(hex) {
|
|
335
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
336
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
337
|
+
bytes[i] = parseInt(hex.substring(i * 2, i * 2 + 2), 16);
|
|
338
|
+
}
|
|
339
|
+
return bytes;
|
|
340
|
+
}
|
|
341
|
+
async function decryptVaultBufferInBrowser(envelopeBuffer, secretHex) {
|
|
342
|
+
const rawBytes = envelopeBuffer instanceof Uint8Array ? envelopeBuffer : new Uint8Array(envelopeBuffer);
|
|
343
|
+
if (rawBytes.length < HEADER_LENGTH) {
|
|
344
|
+
throw new Error(`Invalid encrypted vault payload: buffer too short (${rawBytes.length} bytes)`);
|
|
345
|
+
}
|
|
346
|
+
const salt = rawBytes.slice(0, SALT_LENGTH);
|
|
347
|
+
const iv = rawBytes.slice(SALT_LENGTH, SALT_LENGTH + IV_LENGTH);
|
|
348
|
+
const authTag = rawBytes.slice(SALT_LENGTH + IV_LENGTH, HEADER_LENGTH);
|
|
349
|
+
const ciphertext = rawBytes.slice(HEADER_LENGTH);
|
|
350
|
+
const ciphertextWithTag = new Uint8Array(ciphertext.length + authTag.length);
|
|
351
|
+
ciphertextWithTag.set(ciphertext, 0);
|
|
352
|
+
ciphertextWithTag.set(authTag, ciphertext.length);
|
|
353
|
+
const cryptoObj = typeof window !== "undefined" ? window.crypto : globalThis.crypto;
|
|
354
|
+
if (!cryptoObj?.subtle) {
|
|
355
|
+
throw new Error("Web Crypto API (crypto.subtle) is not available in this environment.");
|
|
356
|
+
}
|
|
357
|
+
const rawSecretBytes = new TextEncoder().encode(secretHex);
|
|
358
|
+
const baseKey = await cryptoObj.subtle.importKey(
|
|
359
|
+
"raw",
|
|
360
|
+
rawSecretBytes,
|
|
361
|
+
"PBKDF2",
|
|
362
|
+
false,
|
|
363
|
+
["deriveKey"]
|
|
364
|
+
);
|
|
365
|
+
const aesKey = await cryptoObj.subtle.deriveKey(
|
|
366
|
+
{
|
|
367
|
+
name: "PBKDF2",
|
|
368
|
+
salt,
|
|
369
|
+
iterations: PBKDF2_ITERATIONS,
|
|
370
|
+
hash: "SHA-256"
|
|
371
|
+
},
|
|
372
|
+
baseKey,
|
|
373
|
+
{ name: "AES-GCM", length: 256 },
|
|
374
|
+
false,
|
|
375
|
+
["decrypt"]
|
|
376
|
+
);
|
|
377
|
+
const decryptedBuffer = await cryptoObj.subtle.decrypt(
|
|
378
|
+
{
|
|
379
|
+
name: "AES-GCM",
|
|
380
|
+
iv,
|
|
381
|
+
tagLength: 128
|
|
382
|
+
},
|
|
383
|
+
aesKey,
|
|
384
|
+
ciphertextWithTag
|
|
385
|
+
);
|
|
386
|
+
return new Uint8Array(decryptedBuffer);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// src/srkl/SrklCredentialRegistry.ts
|
|
390
|
+
var SrklCredentialRegistry = class {
|
|
391
|
+
registry = /* @__PURE__ */ new Map();
|
|
392
|
+
constructor() {
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Populate the in-memory registry directly from an initialized sql.js Database instance.
|
|
396
|
+
* Performs the set intersection: DB.services ∩ DEPM.supported_services.
|
|
397
|
+
*/
|
|
398
|
+
populateFromSqlite(db, supportedServices) {
|
|
399
|
+
this.registry.clear();
|
|
400
|
+
const normalizedSupported = new Set(supportedServices.map((s) => s.toLowerCase().trim()));
|
|
401
|
+
try {
|
|
402
|
+
const res = db.exec("SELECT * FROM srkl_service_accounts");
|
|
403
|
+
if (!res || !res.length) return;
|
|
404
|
+
const { columns, values } = res[0];
|
|
405
|
+
for (const row of values) {
|
|
406
|
+
const item = {};
|
|
407
|
+
columns.forEach((col, idx) => {
|
|
408
|
+
item[col] = row[idx];
|
|
409
|
+
});
|
|
410
|
+
const serviceId = (item.service_id || "").toLowerCase().trim();
|
|
411
|
+
if (normalizedSupported.size > 0 && !normalizedSupported.has(serviceId)) {
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
let credentials = {};
|
|
415
|
+
let metadata = {};
|
|
416
|
+
try {
|
|
417
|
+
credentials = JSON.parse(item.credentials_json || "{}");
|
|
418
|
+
} catch {
|
|
419
|
+
}
|
|
420
|
+
try {
|
|
421
|
+
metadata = JSON.parse(item.metadata_json || "{}");
|
|
422
|
+
} catch {
|
|
423
|
+
}
|
|
424
|
+
const entry = {
|
|
425
|
+
id: item.id,
|
|
426
|
+
serviceId: item.service_id,
|
|
427
|
+
name: item.name,
|
|
428
|
+
credentials,
|
|
429
|
+
status: item.status,
|
|
430
|
+
lastSync: item.last_sync,
|
|
431
|
+
metadata,
|
|
432
|
+
createdAt: item.created_at,
|
|
433
|
+
updatedAt: item.updated_at
|
|
434
|
+
};
|
|
435
|
+
const existing = this.registry.get(entry.serviceId) || [];
|
|
436
|
+
existing.push(entry);
|
|
437
|
+
this.registry.set(entry.serviceId, existing);
|
|
438
|
+
}
|
|
439
|
+
} catch (err) {
|
|
440
|
+
console.warn("[SrklCredentialRegistry] Failed to query srkl_service_accounts table:", err.message);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Register a service account in volatile memory (for manual entry or synced accounts)
|
|
445
|
+
*/
|
|
446
|
+
registerServiceAccount(account) {
|
|
447
|
+
const serviceId = (account.serviceId || "").toLowerCase().trim();
|
|
448
|
+
if (!serviceId) return;
|
|
449
|
+
if (!this.registry.has(serviceId)) {
|
|
450
|
+
this.registry.set(serviceId, []);
|
|
451
|
+
}
|
|
452
|
+
const existing = this.registry.get(serviceId);
|
|
453
|
+
const idx = existing.findIndex((a) => a.id === account.id);
|
|
454
|
+
if (idx >= 0) {
|
|
455
|
+
existing[idx] = account;
|
|
456
|
+
} else {
|
|
457
|
+
existing.push(account);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
getAccountsForService(serviceId) {
|
|
461
|
+
return this.registry.get(serviceId.toLowerCase().trim()) || [];
|
|
462
|
+
}
|
|
463
|
+
getPrimaryAccount(serviceId) {
|
|
464
|
+
const list = this.getAccountsForService(serviceId);
|
|
465
|
+
return list[0] || null;
|
|
466
|
+
}
|
|
467
|
+
hasCredentials(serviceId) {
|
|
468
|
+
const list = this.getAccountsForService(serviceId);
|
|
469
|
+
return list.length > 0;
|
|
470
|
+
}
|
|
471
|
+
listAvailableServices() {
|
|
472
|
+
return Array.from(this.registry.keys());
|
|
473
|
+
}
|
|
474
|
+
toMap() {
|
|
475
|
+
const obj = {};
|
|
476
|
+
for (const [sId, accounts] of this.registry.entries()) {
|
|
477
|
+
obj[sId] = accounts;
|
|
478
|
+
}
|
|
479
|
+
return obj;
|
|
480
|
+
}
|
|
481
|
+
clear() {
|
|
482
|
+
this.registry.clear();
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
var globalCredentialRegistry = new SrklCredentialRegistry();
|
|
486
|
+
|
|
487
|
+
// src/srkl/SrklVaultAccessClient.ts
|
|
488
|
+
var SrklVaultAccessClient = class {
|
|
489
|
+
constructor(options) {
|
|
490
|
+
this.options = options;
|
|
491
|
+
}
|
|
492
|
+
options;
|
|
493
|
+
registry = new SrklCredentialRegistry();
|
|
494
|
+
activeGrant = null;
|
|
495
|
+
sqlEngine = null;
|
|
496
|
+
/**
|
|
497
|
+
* Initialize sql.js engine (WASM).
|
|
498
|
+
* Consumers can pass pre-loaded initSqlJs or let this load from window or CDN.
|
|
499
|
+
*/
|
|
500
|
+
async initSqlEngine(customInitSqlJs) {
|
|
501
|
+
if (this.sqlEngine) return this.sqlEngine;
|
|
502
|
+
const initFn = customInitSqlJs || typeof window !== "undefined" && window.initSqlJs;
|
|
503
|
+
if (!initFn) {
|
|
504
|
+
throw new Error(
|
|
505
|
+
'sql.js engine not found. Ensure "sql.js" is installed or <script src="sql-wasm.js"> is loaded.'
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
this.sqlEngine = await initFn({
|
|
509
|
+
locateFile: (file) => `/${file}`
|
|
510
|
+
});
|
|
511
|
+
return this.sqlEngine;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Full pipeline: Authorize → Presigned URL → Direct Download → Decrypt → SQLite Query → Registry.
|
|
515
|
+
*/
|
|
516
|
+
async loadCredentials(userSessionToken, workspaceId, customInitSqlJs) {
|
|
517
|
+
await this.initSqlEngine(customInitSqlJs);
|
|
518
|
+
const baseUrl = this.options.srklApiBaseUrl.replace(/\/+$/, "");
|
|
519
|
+
let res;
|
|
520
|
+
try {
|
|
521
|
+
res = await fetch(`${baseUrl}/api/ecosystem/vault-access`, {
|
|
522
|
+
method: "POST",
|
|
523
|
+
headers: {
|
|
524
|
+
"Content-Type": "application/json",
|
|
525
|
+
"Authorization": `Bearer ${userSessionToken}`,
|
|
526
|
+
"x-app-id": this.options.appId,
|
|
527
|
+
...workspaceId ? { "x-workspace-id": workspaceId } : {}
|
|
528
|
+
},
|
|
529
|
+
body: JSON.stringify({
|
|
530
|
+
appId: this.options.appId,
|
|
531
|
+
workspaceId,
|
|
532
|
+
supportedServices: this.options.supportedServices
|
|
533
|
+
})
|
|
534
|
+
});
|
|
535
|
+
} catch (fetchErr) {
|
|
536
|
+
try {
|
|
537
|
+
res = await fetch("/api/ecosystem/vault-access", {
|
|
538
|
+
method: "POST",
|
|
539
|
+
headers: {
|
|
540
|
+
"Content-Type": "application/json",
|
|
541
|
+
"Authorization": `Bearer ${userSessionToken}`,
|
|
542
|
+
"x-app-id": this.options.appId,
|
|
543
|
+
...workspaceId ? { "x-workspace-id": workspaceId } : {}
|
|
544
|
+
},
|
|
545
|
+
body: JSON.stringify({
|
|
546
|
+
appId: this.options.appId,
|
|
547
|
+
workspaceId,
|
|
548
|
+
supportedServices: this.options.supportedServices
|
|
549
|
+
})
|
|
550
|
+
});
|
|
551
|
+
} catch {
|
|
552
|
+
throw new Error(`[SrklVaultAccess] Connection to SRKL Engine (${baseUrl}) failed: ${fetchErr.message}`);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
if (!res.ok) {
|
|
556
|
+
const err = await res.json().catch(() => ({ error: res.statusText }));
|
|
557
|
+
throw new Error(`[SrklVaultAccess] Failed to authorize vault access: ${err.error || res.statusText}`);
|
|
558
|
+
}
|
|
559
|
+
const grant = await res.json();
|
|
560
|
+
this.activeGrant = grant;
|
|
561
|
+
const bucketResponse = await fetch(grant.presignedUrl);
|
|
562
|
+
if (!bucketResponse.ok) {
|
|
563
|
+
throw new Error(
|
|
564
|
+
`[SrklVaultAccess] Direct cloud bucket download failed (${bucketResponse.status}): ${bucketResponse.statusText}`
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
const encryptedArrayBuffer = await bucketResponse.arrayBuffer();
|
|
568
|
+
const decryptedSqliteBytes = await decryptVaultBufferInBrowser(
|
|
569
|
+
encryptedArrayBuffer,
|
|
570
|
+
grant.keyMaterial.secretHex
|
|
571
|
+
);
|
|
572
|
+
const db = new this.sqlEngine.Database(decryptedSqliteBytes);
|
|
573
|
+
try {
|
|
574
|
+
this.registry.populateFromSqlite(db, this.options.supportedServices);
|
|
575
|
+
} finally {
|
|
576
|
+
db.close();
|
|
577
|
+
}
|
|
578
|
+
return this.registry;
|
|
579
|
+
}
|
|
580
|
+
getRegistry() {
|
|
581
|
+
return this.registry;
|
|
582
|
+
}
|
|
583
|
+
getActiveGrant() {
|
|
584
|
+
return this.activeGrant;
|
|
585
|
+
}
|
|
586
|
+
clear() {
|
|
587
|
+
this.registry.clear();
|
|
588
|
+
this.activeGrant = null;
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
// src/srkl/srklSyncBridge.ts
|
|
593
|
+
async function syncSrklAccounts(userId, sessionToken, srklUrl) {
|
|
594
|
+
const resp = await fetch("/api/srkl/sync", {
|
|
595
|
+
method: "POST",
|
|
596
|
+
headers: {
|
|
597
|
+
"Content-Type": "application/json",
|
|
598
|
+
Authorization: `Bearer ${sessionToken}`,
|
|
599
|
+
"x-user-id": userId
|
|
600
|
+
},
|
|
601
|
+
body: JSON.stringify({ srklUrl })
|
|
602
|
+
});
|
|
603
|
+
return await resp.json();
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
// src/srkl/srkl.ts
|
|
607
|
+
var runtime = {
|
|
608
|
+
VaultAccessClient: SrklVaultAccessClient,
|
|
609
|
+
CredentialRegistry: SrklCredentialRegistry,
|
|
610
|
+
decryptVaultBufferInBrowser,
|
|
611
|
+
hexToBytes
|
|
612
|
+
};
|
|
613
|
+
var deployment = {
|
|
614
|
+
target: "universal",
|
|
615
|
+
supportedEngines: ["browser", "worker", "node"],
|
|
616
|
+
version: "1.0.0"
|
|
617
|
+
};
|
|
618
|
+
var service = {
|
|
619
|
+
name: "srkl",
|
|
620
|
+
description: "SRKL Ecosystem Volatile Memory Credential Vault Service",
|
|
621
|
+
runtime,
|
|
622
|
+
deployment
|
|
623
|
+
};
|
|
624
|
+
var srklService = service;
|
|
625
|
+
|
|
328
626
|
export {
|
|
329
627
|
CANONICAL_SRKL_URL,
|
|
330
628
|
SrklClient,
|
|
@@ -332,5 +630,12 @@ export {
|
|
|
332
630
|
getPrimarySrklDeploymentUrl,
|
|
333
631
|
getSrklAccounts,
|
|
334
632
|
srklListBackblazeBuckets,
|
|
335
|
-
useSrklServices
|
|
633
|
+
useSrklServices,
|
|
634
|
+
hexToBytes,
|
|
635
|
+
decryptVaultBufferInBrowser,
|
|
636
|
+
SrklCredentialRegistry,
|
|
637
|
+
globalCredentialRegistry,
|
|
638
|
+
SrklVaultAccessClient,
|
|
639
|
+
syncSrklAccounts,
|
|
640
|
+
srklService
|
|
336
641
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/control-plane/AuditLogger.ts
|
|
2
2
|
import { promises as fs } from "fs";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import { SkipoBase } from "@kloks/functions";
|
|
4
|
+
import { SkipoBase } from "@ultrst-armada/kloks/functions";
|
|
5
5
|
var AuditLogger = class extends SkipoBase {
|
|
6
6
|
logFile;
|
|
7
7
|
constructor(logFile = ".skipo/audit.jsonl") {
|
|
@@ -41,7 +41,7 @@ var AuditLogger = class extends SkipoBase {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
// src/control-plane/DatabaseClusterManager.ts
|
|
44
|
-
import { SkipoBase as SkipoBase2 } from "@kloks/functions";
|
|
44
|
+
import { SkipoBase as SkipoBase2 } from "@ultrst-armada/kloks/functions";
|
|
45
45
|
var DatabaseClusterManager = class _DatabaseClusterManager extends SkipoBase2 {
|
|
46
46
|
config;
|
|
47
47
|
health = /* @__PURE__ */ new Map();
|
|
@@ -116,7 +116,7 @@ function resolveSystemDatabaseClusterNodes(env = process.env) {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
// src/control-plane/ControlPlaneManager.ts
|
|
119
|
-
import { SkipoBase as SkipoBase3 } from "@kloks/functions";
|
|
119
|
+
import { SkipoBase as SkipoBase3 } from "@ultrst-armada/kloks/functions";
|
|
120
120
|
var ControlPlaneManager = class extends SkipoBase3 {
|
|
121
121
|
auth;
|
|
122
122
|
audit;
|
|
@@ -5,16 +5,16 @@ export { B2AuthToken, BackblazeB2Adapter, LocalFSAdapter, S3Adapter, StorageAdap
|
|
|
5
5
|
export { CloneReplicationResult, ConflictPolicy, SyncEngine, SyncState, WorkspaceCloneSyncEngine, WorkspaceConfig, WorkspaceDescriptor, WorkspaceFS, WorkspaceSecondaryClone, WorkspaceSyncSummary, formatCanonicalWorkspaceFolderName, sanitizeWorkspaceName } from './workspace/index.js';
|
|
6
6
|
export { AuditEvent, AuditLogger, ClusterConfig, ControlPlaneManager, DatabaseClusterManager, HealthStatus, detectDatabaseEngine, getSystemDatabaseUrls, resolveSystemDatabaseClusterNodes } from './control-plane/index.js';
|
|
7
7
|
export { ApiError, ApiResponse, BaseApiRoute, Middleware, RouteConfig, createSSEResponse, withAuth, withCors } from './api/index.js';
|
|
8
|
-
import { SkipoBase } from '@kloks/functions';
|
|
8
|
+
import { SkipoBase } from '@ultrst-armada/kloks/functions';
|
|
9
9
|
export { A as AuthContext, B as BackendExecutor, a as BackendInstance, C as CallbackHandle, b as CapabilityContext, D as Delegation, c as DistributedLock, I as IdempotentRequest, J as Job, d as JobPriority, e as JobState, M as Message, f as MessageType, R as ResolutionStrategy, g as ResourceVersion, h as RoutingStrategy } from './types-BERZJ93O.js';
|
|
10
10
|
export { BackendContract, BackendRegistry, CallbackDefinition, ConcurrencyConflictError, ConcurrencyManager, DomainContract, EventDefinition, HealthMonitor, InProcessExecutor, JobDefinition, JobHandler, JobScheduler, LoadBalancer, LockManager, OperationDefinition, RemoteExecutor, RemoteExecutorOptions, createEmptyContract } from './connectivity/index.js';
|
|
11
11
|
export { B as BackendClient, a as BackendClientOptions, b as BackendResolver, c as BackendResolverOptions, C as CallbackFn, d as CallbackRegistry, D as DomainProxy, E as ErrorHandler, e as EventBus, f as EventHandler, F as FrontendSession, g as FrontendSessionOptions, G as GapHandler, H as HTTPTransport, h as HTTPTransportOptions, I as ITransport, M as MessageHandler, S as SequenceCheckResult, i as SequenceTracker, W as WebSocketTransport, j as WebSocketTransportOptions, k as createBackendClient } from './WebSocketTransport-CxUzUfwl.js';
|
|
12
12
|
export { I as IdempotencyManager } from './IdempotencyManager-B5MjK871.js';
|
|
13
13
|
export { BackendClientInstance, BackendProvider, BackendProviderProps, useBackend, useBackendClient } from './client/index.js';
|
|
14
|
-
export { AdaptedStorageConnection, AppAccountManifest, AppServiceDeclaration, CANONICAL_SRKL_URL, EcosystemAccount, EcosystemAccountsRequest, EcosystemAccountsResponse, EcosystemServiceCategory, SrklClient, SrklClientOptions, SrklEcosystemQueryOptions, SrklEcosystemResponse, SrklServiceAccount, UseSrklServicesOptions, UseSrklServicesResult, createSrklClient, getPrimarySrklDeploymentUrl, getSrklAccounts, srklListBackblazeBuckets, useSrklServices } from './srkl/index.js';
|
|
14
|
+
export { AdaptedStorageConnection, AppAccountManifest, AppServiceDeclaration, CANONICAL_SRKL_URL, CredentialRegistryMap, EcosystemAccount, EcosystemAccountsRequest, EcosystemAccountsResponse, EcosystemServiceCategory, KeyMaterial, ServiceAccountEntry, SrklClient, SrklClientOptions, SrklCredentialRegistry, SrklEcosystemQueryOptions, SrklEcosystemResponse, SrklServiceAccount, SrklVaultAccessClient, SrklVaultAccessResponse, UseSrklServicesOptions, UseSrklServicesResult, VaultAccessClientOptions, createSrklClient, decryptVaultBufferInBrowser, getPrimarySrklDeploymentUrl, getSrklAccounts, globalCredentialRegistry, hexToBytes, srklListBackblazeBuckets, srklService, syncSrklAccounts, useSrklServices } from './srkl/index.js';
|
|
15
15
|
export { BackendCommand, DomainService, ExecutableBackendFacade, ExecutionContext, JobDependencyGraph, NormalizedResult, OperationComponent, ResultFlowBridge, ServiceDispatcher, StateUpdateEvent, WorkerExecutionBoundary, createOperationComponent } from './execution/index.js';
|
|
16
|
-
export { CompositeBackend, EndpointGenerator, GeneratedEndpointSummary, LocalService, RemoteServiceProxy, createBackend, createCompositeService, createLocalService, createRemoteService } from './services/index.js';
|
|
17
|
-
import { AssetDataType as AssetDataType$1, AssetChannelType as AssetChannelType$1, GraphFolderInfo as GraphFolderInfo$1, GraphAssetItem as GraphAssetItem$1, SpaceNode, NodeConnection, DawProject } from '@kloks/state-graph';
|
|
16
|
+
export { CompositeBackend, EndpointGenerator, GeneratedEndpointSummary, LOCAL_STORAGE_GRAPHS_PREFIX, LocalService, NodeGraphPersistenceService, NodeGraphValidationResult, RemoteServiceProxy, SaveGraphOptions, UniversalAppEntity, UniversalGraphEdge, UniversalGraphNode, UniversalNodeGraphDocument, UniversalStorageConnection, createBackend, createCompositeService, createLocalService, createRemoteService, exportGraphAsJsonFile, nodeGraphPersistence, parseGraphJsonFile, validateGraphDocument } from './services/index.js';
|
|
17
|
+
import { AssetDataType as AssetDataType$1, AssetChannelType as AssetChannelType$1, GraphFolderInfo as GraphFolderInfo$1, GraphAssetItem as GraphAssetItem$1, SpaceNode, NodeConnection, DawProject } from '@ultrst-armada/kloks/state-graph';
|
|
18
18
|
export { AuthServiceDefinition, AuthServiceFacade, ControlPlaneServiceDefinition, ControlPlaneServiceFacade, DatabaseServiceDefinition, DatabaseServiceFacade, ExecutionServiceDefinition, ExecutionServiceFacade, GeminiServiceDefinition, GeminiServiceFacade, StorageServiceDefinition, StorageServiceFacade, WorkspaceServiceDefinition, WorkspaceServiceFacade } from './krnl-services.js';
|
|
19
19
|
export { EndpointDescriptor, IService, ProtocolAdapter, ServiceDefinition } from '@ultrst-armada/krnl';
|
|
20
20
|
import 'react';
|
|
@@ -1109,7 +1109,44 @@ declare function saveWorkspaceGraph(workspaceIdOrSlug: string, graphIdOrName: st
|
|
|
1109
1109
|
declare function deleteWorkspaceGraph(workspaceIdOrSlug: string, graphIdOrName: string): Promise<boolean>;
|
|
1110
1110
|
|
|
1111
1111
|
type ProviderType = 'VERCEL' | 'CLOUDFLARE' | 'AWS' | 'GCP' | 'FASTLY' | 'BACKBLAZE_B2' | 'CLOUDFLARE_R2' | 'SUPABASE' | 'NEON' | 'POSTGRESQL';
|
|
1112
|
+
type NodeType = 'ECOSYSTEM' | 'ECOSYSTEM_HUB' | 'SYSTEM_DATABASE' | 'SYSTEM_BUCKET' | 'ADMIN_CREDENTIALS' | 'APP_GRAPH_NODE' | 'APP' | 'APP_NODE' | 'APP_COMPONENT' | 'DEPLOYMENT' | 'WEIGHT_USER' | 'WEIGHT_RESOURCE' | 'WEIGHT_ACCOUNT' | 'WEIGHT_MULTIPLY' | 'WEIGHT_MODIFIER' | 'URL_NODE' | 'VARIANTS';
|
|
1112
1113
|
type HealthState = 'HEALTHY' | 'DEGRADED' | 'UNHEALTHY';
|
|
1114
|
+
interface SystemDbConfig {
|
|
1115
|
+
databaseUrl?: string;
|
|
1116
|
+
provider?: string;
|
|
1117
|
+
dbName?: string;
|
|
1118
|
+
host?: string;
|
|
1119
|
+
port?: number;
|
|
1120
|
+
ssl?: boolean;
|
|
1121
|
+
selectedTable?: string;
|
|
1122
|
+
adminTable?: string;
|
|
1123
|
+
adminEmailColumn?: string;
|
|
1124
|
+
adminPasswordColumn?: string;
|
|
1125
|
+
adminUsernameColumn?: string;
|
|
1126
|
+
bucketTable?: string;
|
|
1127
|
+
connectionStatus?: 'CONNECTED' | 'DISCONNECTED' | 'ERROR' | 'CONNECTING';
|
|
1128
|
+
lastTestedAt?: string;
|
|
1129
|
+
latencyMs?: number;
|
|
1130
|
+
serverVersion?: string;
|
|
1131
|
+
discoveredTables?: string[];
|
|
1132
|
+
updatedAt?: string;
|
|
1133
|
+
}
|
|
1134
|
+
interface SystemBucketConfig {
|
|
1135
|
+
bucketName?: string;
|
|
1136
|
+
provider?: string;
|
|
1137
|
+
endpoint?: string;
|
|
1138
|
+
region?: string;
|
|
1139
|
+
publicAccess?: boolean;
|
|
1140
|
+
updatedAt?: string;
|
|
1141
|
+
}
|
|
1142
|
+
interface AdminCredentialsConfig {
|
|
1143
|
+
adminEmail?: string;
|
|
1144
|
+
adminSecretKey?: string;
|
|
1145
|
+
depmJwtSecret?: string;
|
|
1146
|
+
apiKey?: string;
|
|
1147
|
+
lastRotatedAt?: string;
|
|
1148
|
+
rotationHistoryCount?: number;
|
|
1149
|
+
}
|
|
1113
1150
|
type AccountTier = 'hobby' | 'pro' | 'enterprise' | 'free' | 'payg' | 'custom';
|
|
1114
1151
|
|
|
1115
1152
|
interface UnifiedResourceMetricItem<T = number> {
|
|
@@ -1371,6 +1408,77 @@ interface DeploymentEntity {
|
|
|
1371
1408
|
resourceRate: number;
|
|
1372
1409
|
createdAt: string;
|
|
1373
1410
|
}
|
|
1411
|
+
interface AggregatedUrlItem {
|
|
1412
|
+
url: string;
|
|
1413
|
+
sourceNodeId: string;
|
|
1414
|
+
sourceNodeName: string;
|
|
1415
|
+
sourceNodeType: NodeType;
|
|
1416
|
+
isDirect: boolean;
|
|
1417
|
+
distance: number;
|
|
1418
|
+
}
|
|
1419
|
+
interface GraphNode {
|
|
1420
|
+
id: string;
|
|
1421
|
+
type: NodeType;
|
|
1422
|
+
x: number;
|
|
1423
|
+
y: number;
|
|
1424
|
+
appId: string;
|
|
1425
|
+
icon?: string;
|
|
1426
|
+
name?: string;
|
|
1427
|
+
componentName?: string;
|
|
1428
|
+
publicLink?: string;
|
|
1429
|
+
urlValue?: string;
|
|
1430
|
+
urls?: string[];
|
|
1431
|
+
aggregatedUrls?: string[];
|
|
1432
|
+
aggregatedUrlItems?: AggregatedUrlItem[];
|
|
1433
|
+
directUrls?: string[];
|
|
1434
|
+
deploymentId?: string;
|
|
1435
|
+
accountId?: string;
|
|
1436
|
+
bubbleTargetType?: 'DOMAIN' | 'DEPLOYMENT';
|
|
1437
|
+
domainUrl?: string;
|
|
1438
|
+
deploymentUrl?: string;
|
|
1439
|
+
weightModifierType?: 'USAGE' | 'USER_DEFINED' | 'ACCOUNT';
|
|
1440
|
+
weightValue?: number;
|
|
1441
|
+
systemDbData?: SystemDbConfig;
|
|
1442
|
+
systemBucketData?: SystemBucketConfig;
|
|
1443
|
+
adminCredsData?: AdminCredentialsConfig;
|
|
1444
|
+
appData?: AppEntity;
|
|
1445
|
+
evolutionScore?: number;
|
|
1446
|
+
redundancyScore?: number;
|
|
1447
|
+
modularityScore?: number;
|
|
1448
|
+
variantsScore?: number;
|
|
1449
|
+
visibilityScore?: number;
|
|
1450
|
+
evolutionStage?: string;
|
|
1451
|
+
ecosystemData?: {
|
|
1452
|
+
connectedAppsCount?: number;
|
|
1453
|
+
health?: HealthState;
|
|
1454
|
+
status?: string;
|
|
1455
|
+
routingRate?: number;
|
|
1456
|
+
redundancyScore?: number;
|
|
1457
|
+
modularityScore?: number;
|
|
1458
|
+
variantsScore?: number;
|
|
1459
|
+
visibilityScore?: number;
|
|
1460
|
+
evolutionScore?: number;
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1463
|
+
interface GraphEdge {
|
|
1464
|
+
id: string;
|
|
1465
|
+
appId: string;
|
|
1466
|
+
sourceId: string;
|
|
1467
|
+
targetId: string;
|
|
1468
|
+
sourceSocketId?: string;
|
|
1469
|
+
targetSocketId?: string;
|
|
1470
|
+
label?: string;
|
|
1471
|
+
}
|
|
1472
|
+
interface AppEntity {
|
|
1473
|
+
id: string;
|
|
1474
|
+
name: string;
|
|
1475
|
+
icon: string;
|
|
1476
|
+
description?: string;
|
|
1477
|
+
publicLink: string;
|
|
1478
|
+
folderName?: string;
|
|
1479
|
+
createdAt: string;
|
|
1480
|
+
updatedAt: string;
|
|
1481
|
+
}
|
|
1374
1482
|
|
|
1375
1483
|
declare abstract class BaseResourceFetcher {
|
|
1376
1484
|
abstract readonly provider: ProviderType;
|
|
@@ -1480,4 +1588,37 @@ declare class ResourceFetcherRegistry {
|
|
|
1480
1588
|
static calculateDetailedScore(account?: AccountEntity, deployment?: DeploymentEntity): ResourceCalculationResult;
|
|
1481
1589
|
}
|
|
1482
1590
|
|
|
1483
|
-
|
|
1591
|
+
/**
|
|
1592
|
+
* Calculates the score (0.0 - 1.0) for a weight modifier or source node.
|
|
1593
|
+
* WEIGHT_MULTIPLY itself is not a source score — its inputs are collected by traversal.
|
|
1594
|
+
*/
|
|
1595
|
+
declare function getWeightModifierScore(node: GraphNode, account?: AccountEntity, accounts?: AccountEntity[], nodes?: GraphNode[], edges?: GraphEdge[], deployments?: DeploymentEntity[]): number;
|
|
1596
|
+
/**
|
|
1597
|
+
* Traverses graph to find all terminal weight modifier source nodes reachable from
|
|
1598
|
+
* a deployment node, including traversing through WEIGHT_MULTIPLY aggregator nodes.
|
|
1599
|
+
*/
|
|
1600
|
+
declare function getConnectedWeightModifiers(deploymentNodeId: string, nodes: GraphNode[], edges: GraphEdge[]): GraphNode[];
|
|
1601
|
+
/**
|
|
1602
|
+
* Computes the final combined weight for a deployment node by multiplying all connected
|
|
1603
|
+
* weight modifier/source node scores together (traversing through WEIGHT_MULTIPLY nodes).
|
|
1604
|
+
*/
|
|
1605
|
+
declare function computeDeploymentFinalWeight(deploymentNodeId: string, nodes: GraphNode[], edges: GraphEdge[], accounts: AccountEntity[], deployments: DeploymentEntity[]): number;
|
|
1606
|
+
|
|
1607
|
+
/**
|
|
1608
|
+
* Calculates the score (0.0 - 1.0) for a WEIGHT_RESOURCE node based on real-time account usage metrics.
|
|
1609
|
+
* Dynamically resolves provider-specific fetchers (Vercel, Cloudflare, etc.) using OOP inheritance.
|
|
1610
|
+
* - Active CPU receives the most weight (50% / 0.50) across all services.
|
|
1611
|
+
* - Function Invocations: 15% (0.15).
|
|
1612
|
+
* - Compute Memory / Subrequests: 15% (0.15).
|
|
1613
|
+
* - Edge Requests: 10% (0.10).
|
|
1614
|
+
* - Fast Data Transfer / Bandwidth: 5% (0.05).
|
|
1615
|
+
* - Other compute / network metrics: 5% (0.05).
|
|
1616
|
+
* - Storage category parameters (Functions Storage, Deployment Storage, R2) are strictly EXCLUDED (0%).
|
|
1617
|
+
*/
|
|
1618
|
+
declare function computeUsageWeightScore(account?: AccountEntity, deployment?: DeploymentEntity): number;
|
|
1619
|
+
/**
|
|
1620
|
+
* Traverses from a weight modifier node to find its connected deployment node.
|
|
1621
|
+
*/
|
|
1622
|
+
declare function getConnectedDeploymentNode(weightNodeId: string, nodes: GraphNode[], edges: GraphEdge[]): GraphNode | undefined;
|
|
1623
|
+
|
|
1624
|
+
export { type AssetChannelType, type AssetDataType, type AssetFolderInfo, type AssetPoolItem, type AssetPoolScope, type B2AuthData, type BackendFacade, BaseDataProvider, BaseResourceFetcher, type CloudflareObservability, type CloudflareProjectItem, CloudflareResourceFetcher, type CloudflareUsageMetrics, type CredentialEntry, type CredentialManifest, type Deployment, type FunctionSet, FunctionalityTable, GRAPHS_ROOT, type IDataProvider, LEGACY_PROJECTS_ROOT, type OrchestrationFn, PROJECTS_ROOT, type ProjectMetadata, type PublicRouteRecord, type QueryFilter, ResourceFetcherRegistry, type Runtime, SAMPLES_GLOBAL_ROOT, SUPPORTED_AUDIO_EXTS, SUPPORTED_MIDI_EXTS, type ServerAudioSampleItem, type ServiceFacade, type ServiceRegistryRecord, type SortOrder, type SrklB2Account, SrklStorageService, type SyncFileResult, type UnifiedQueryResult, type UnifiedResourceMetricItem, type UnifiedResourceMetrics, VercelResourceFetcher, WORKSPACE_ASSETS_ROOT, WORKSPACE_ROOT, type WorkingWorkspaceConfig, type WorkspaceFolderResolution, type WorkspaceStorageConfig, b2DeleteFileVersion, b2DeleteFolder, buildProjectObservability, buildProjectsList, cleanDbUrl, computeDeploymentFinalWeight, computeUsageWeightScore, configureStarterProjectTemplate, createAssetSubfolder, createCredential, createGraphAssetFolder, createGraphAssetFolder as createGraphAssetSubfolder, createGraphPackage, createWavBuffer, createWorkspace, createWorkspaceGraph, decryptSecretFromBlob, deleteAssetFromGraph, deleteAssetFromPool, deleteCredential, deleteGlobalSample, deleteGraphPackage, deleteProject, deleteProjectSample, deleteRoute, deleteWorkspace, deleteWorkspaceFile, deleteWorkspaceFolder, deleteWorkspaceGraph, encryptSecretToBlob, ensureAssetPoolDirectories, ensureGlobalSamples, ensureGraphAssetDirectories, ensureProjectAssets, ensureProjectsRoot, ensureWorkspaceStructure, exportEncryptedCredentials, fetchCloudflareData, fetchVercelData, findUserWorkspace, findWorkspaceRecord, formatRelativeCreated, getAllRoutes, getAssetPoolLocationPath, getAssetPoolPublicUrl, getB2BucketId, getConnectedDeploymentNode, getConnectedWeightModifiers, getCredential, getDefaultWorkingWorkspaceDir, getExecutions, getGatewayConfig, getGraphPackageById, getPrimarySrklDeploymentUrl as getPrimarySrklCoreDeploymentUrl, getProjectById, getPublicRouteByPath, getPublicRoutes, getSrklAccounts as getSrklCoreAccounts, getSrklStatus, getUnifiedDbUrl, getUsers, getWeightModifierScore, getWorkingWorkspaceConfig, getWorkingWorkspaceDir, getWorkspaceFolderKey, getWorkspaceFolderPrefix, getWorkspaceGraph, getWorkspaceStorageDetails, getWorkspaces, importEncryptedCredentials, importGraphDependency, initGlobalSamplesDirectory, isB2Workspace, listAllGraphPackages, listAllProjects, listBackblazeBuckets, listCredentials, listGlobalSamples, listProjectSamples, listWorkspaceFiles, listWorkspaceGraphs, loadCredentialManifest, loadWorkspaceData, loginUser, matchGatewayIngress, matchGatewayIngressAsync, queryUnifiedDb, readWorkspaceFile, recordExecution, removeGraphDependency, renameAppInWorkspaceData, resolveDynamicRouteFromDb, resolveWorkspaceConnection, resolveWorkspaceDir, saveAssetToGraph, saveAssetToPool, saveCredentialManifest, saveGlobalSample, saveGraphPackage, saveProject, saveProjectSample, saveWorkspaceData, saveWorkspaceGraph, scanAssetPool, scanGraphAssets, seedDefaultAssets, seedStarterGraphAssets, serverPublicRoutes, setServerPublicRoutes, setWorkingWorkspaceConfig, srklListBackblazeBuckets as srklCoreListBackblazeBuckets, syncWorkspace, syncWorkspaceCreateToBucket, syncWorkspaceDataToBucket, syncWorkspaceDeleteToBucket, updateCredential, updateWorkspace, upsertRoute, validateServiceDefinition, writeWorkspaceFile };
|