@ultrst-armada/kloks 1.6.0 → 1.7.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.
@@ -19,12 +19,17 @@ import {
19
19
  SrklVaultAccessClient,
20
20
  createSrklClient,
21
21
  decryptVaultBufferInBrowser,
22
+ getPrimarySrklDeploymentUrl as getPrimarySrklDeploymentUrl2,
23
+ getSrklAccounts as getSrklAccounts2,
24
+ getSrklStatus,
22
25
  globalCredentialRegistry,
23
26
  hexToBytes,
27
+ listBackblazeBuckets,
28
+ srklListBackblazeBuckets as srklListBackblazeBuckets2,
24
29
  srklService,
25
30
  syncSrklAccounts,
26
31
  useSrklServices
27
- } from "./chunk-OZDYAEH4.js";
32
+ } from "./chunk-BI5RDDB4.js";
28
33
  import "./chunk-LS3HWJBX.js";
29
34
  import {
30
35
  RemoteWorkspaceService,
@@ -41,7 +46,7 @@ import {
41
46
  setWorkingWorkspaceConfig,
42
47
  syncWorkspace,
43
48
  workingWorkspaceService
44
- } from "./chunk-GPXV4GBD.js";
49
+ } from "./chunk-6QTNNZSE.js";
45
50
  import {
46
51
  AuthServiceDefinition,
47
52
  AuthServiceFacade,
@@ -75,15 +80,15 @@ import {
75
80
  krnlWorkspaceGraphServiceFacade,
76
81
  krnlWorkspaceServiceDefinition,
77
82
  krnlWorkspaceServiceFacade
78
- } from "./chunk-GQUNN7SA.js";
83
+ } from "./chunk-Y3X3H2XX.js";
79
84
  import {
80
85
  workspaceGraphService
81
- } from "./chunk-DBZVGMJ7.js";
86
+ } from "./chunk-KSZ67VZJ.js";
82
87
  import {
83
88
  getPrimarySrklDeploymentUrl,
84
89
  getSrklAccounts,
85
90
  srklListBackblazeBuckets
86
- } from "./chunk-VDROUXFT.js";
91
+ } from "./chunk-N4Z57FVR.js";
87
92
  import {
88
93
  BackblazeB2Adapter,
89
94
  BaseStorageAdapter,
@@ -111,24 +116,17 @@ import {
111
116
  sanitizeWorkspaceName
112
117
  } from "./chunk-FZKBTF34.js";
113
118
  import {
114
- b2DeleteFileVersion,
115
- b2DeleteFolder,
116
- b2ListBuckets as b2ListBuckets2,
117
- cleanDbUrl,
118
119
  createWorkspace,
119
120
  deleteWorkspace,
120
121
  deleteWorkspaceFile,
121
122
  deleteWorkspaceFolder,
122
123
  findUserWorkspace,
123
- getB2BucketId,
124
- getUnifiedDbUrl,
125
124
  getWorkspaceFolderPrefix,
126
125
  getWorkspaceStorageDetails,
127
126
  getWorkspaces,
128
127
  isB2Workspace,
129
128
  listWorkspaceFiles,
130
129
  loadWorkspaceData,
131
- queryUnifiedDb,
132
130
  readWorkspaceFile,
133
131
  renameAppInWorkspaceData,
134
132
  resolveWorkspaceConnection,
@@ -138,13 +136,26 @@ import {
138
136
  syncWorkspaceDeleteToBucket,
139
137
  updateWorkspace,
140
138
  writeWorkspaceFile
141
- } from "./chunk-E72GXBXF.js";
139
+ } from "./chunk-6K75XXFD.js";
140
+ import {
141
+ b2DeleteFileVersion,
142
+ b2DeleteFolder,
143
+ cleanDbUrl,
144
+ getB2BucketId,
145
+ getUnifiedDbUrl,
146
+ queryUnifiedDb
147
+ } from "./chunk-VAFCR2MS.js";
142
148
  import {
143
149
  BaseApiRoute,
144
150
  createSSEResponse,
145
151
  withAuth,
146
152
  withCors
147
153
  } from "./chunk-TWCEVES2.js";
154
+ import {
155
+ BackendProvider,
156
+ useBackend,
157
+ useBackendClient
158
+ } from "./chunk-G3ZOSXUR.js";
148
159
  import {
149
160
  AdminGuard,
150
161
  BaseAccountProvider,
@@ -157,11 +168,6 @@ import {
157
168
  loginSystemUser,
158
169
  resolveUserFromToken
159
170
  } from "./chunk-ZDH4XI7W.js";
160
- import {
161
- BackendProvider,
162
- useBackend,
163
- useBackendClient
164
- } from "./chunk-G3ZOSXUR.js";
165
171
  import {
166
172
  BackendRegistry,
167
173
  ConcurrencyConflictError,
@@ -195,6 +201,9 @@ import {
195
201
  resolveSystemDatabaseClusterNodes
196
202
  } from "./chunk-RCCQ7IRM.js";
197
203
  import {
204
+ AgentHarnessRuntime,
205
+ AgentHarnessServiceDefinition,
206
+ AgentHarnessServiceFacade,
198
207
  CodeDiagnosticsService,
199
208
  CodeValidationRuntime,
200
209
  CodeValidationServiceDefinition,
@@ -214,7 +223,7 @@ import {
214
223
  WebContainerServiceFacade,
215
224
  codeDiagnosticsService,
216
225
  resolveDevelopmentCommand
217
- } from "./chunk-3HZYAZF4.js";
226
+ } from "./chunk-SQGBAWZN.js";
218
227
  import "./chunk-TY32TUNI.js";
219
228
 
220
229
  // src/data/BaseDataProvider.ts
@@ -564,200 +573,6 @@ var SrklStorageService = class {
564
573
  }
565
574
  };
566
575
 
567
- // src/core/srklCore.ts
568
- var cachedSrklUrl = null;
569
- async function getPrimarySrklDeploymentUrl2(env) {
570
- if (cachedSrklUrl && Date.now() < cachedSrklUrl.expiresAt) return cachedSrklUrl.url;
571
- try {
572
- const res = await queryUnifiedDb(
573
- `SELECT url FROM "ultrst-srkl-deployments" WHERE is_active = true ORDER BY is_primary DESC, priority DESC, created_at ASC LIMIT 1`,
574
- [],
575
- env
576
- );
577
- if (res.rows.length > 0 && res.rows[0].url) {
578
- const url = res.rows[0].url.trim().replace(/\/+$/, "");
579
- cachedSrklUrl = { url, expiresAt: Date.now() + 10 * 60 * 1e3 };
580
- return url;
581
- }
582
- } catch (err) {
583
- console.warn("[SrklCore] Deployment DB lookup fallback:", err.message);
584
- }
585
- const fallback = "https://srkl-engine.vercel.app";
586
- cachedSrklUrl = { url: fallback, expiresAt: Date.now() + 10 * 60 * 1e3 };
587
- return fallback;
588
- }
589
- function deduplicateAccounts(items) {
590
- const seen = /* @__PURE__ */ new Set();
591
- const out = [];
592
- for (const a of items) {
593
- if (!a) continue;
594
- const creds = a.credentials || a.metadata?.credentials || a;
595
- const keyId = (creds.keyId || creds.b2KeyId || creds.accessKeyId || "").trim();
596
- const token = (creds.token || creds.apiToken || creds.applicationKey || creds.b2ApplicationKey || "").trim();
597
- const sId = (a.serviceId || a.provider || "").toLowerCase().trim();
598
- const sig = keyId ? `key:${keyId}` : token ? `tok:${sId}:${token.slice(-12)}` : a.id ? `id:${a.id}` : `nam:${sId}:${a.name || a.label}`;
599
- if (!seen.has(sig)) {
600
- seen.add(sig);
601
- if (a.id) seen.add(`id:${a.id}`);
602
- out.push(a);
603
- }
604
- }
605
- return out;
606
- }
607
- async function getSrklAccounts2(userId, service, env) {
608
- const rawAccounts = [];
609
- const srklUrl = await getPrimarySrklDeploymentUrl2(env);
610
- if (userId) {
611
- try {
612
- const uRes = await queryUnifiedDb(
613
- `SELECT app_profiles FROM "ultrst-users" WHERE id = $1 OR email = $1 LIMIT 1`,
614
- [userId],
615
- env
616
- );
617
- if (uRes.rows.length > 0) {
618
- const p = typeof uRes.rows[0].app_profiles === "string" ? JSON.parse(uRes.rows[0].app_profiles) : uRes.rows[0].app_profiles || {};
619
- const conns = [
620
- ...p.srkl?.storage_connections || [],
621
- ...p.depm?.storage_connections || [],
622
- ...p.qwnsr?.storage_connections || [],
623
- ...p.loky?.storage_connections || []
624
- ];
625
- for (const c of conns) {
626
- if (!service || (c.provider || "").toLowerCase().includes(service.toLowerCase())) {
627
- rawAccounts.push({
628
- id: c.id,
629
- name: c.label || c.name || "Backblaze B2 Account",
630
- provider: c.provider === "backblaze_b2" ? "backblaze" : c.provider,
631
- serviceId: "backblaze",
632
- category: "storage",
633
- groupIds: c.groupIds || (c.groupId ? [c.groupId] : []),
634
- credentials: {
635
- keyId: c.b2KeyId || c.keyId || c.accessKeyId || "",
636
- applicationKey: c.b2ApplicationKey || c.applicationKey || c.secretAccessKey || "",
637
- bucketName: c.b2BucketName || c.bucketName || "",
638
- bucketId: c.b2BucketId || c.bucketId || "",
639
- endpoint: c.b2Endpoint || c.endpoint || "s3.eu-central-003.backblazeb2.com",
640
- region: c.b2Region || c.region || "eu-central-003"
641
- }
642
- });
643
- }
644
- }
645
- }
646
- } catch (err) {
647
- console.warn("[SrklCore] Storage connection DB lookup fallback:", err.message);
648
- }
649
- }
650
- try {
651
- const fs9 = await import("fs/promises");
652
- const path9 = await import("path");
653
- const accPath = path9.resolve(".skipo/accounts.json");
654
- const raw = await fs9.readFile(accPath, "utf-8");
655
- const localUsers = JSON.parse(raw);
656
- for (const u of Object.values(localUsers)) {
657
- const conns = Array.isArray(u.storage_connections) ? u.storage_connections : [];
658
- for (const c of conns) {
659
- if (!service || (c.provider || "").toLowerCase().includes(service.toLowerCase())) {
660
- rawAccounts.push({
661
- id: c.id,
662
- name: c.label || c.name || "Local B2 Account",
663
- provider: "backblaze",
664
- serviceId: "backblaze",
665
- credentials: {
666
- keyId: c.b2KeyId || c.keyId || "",
667
- applicationKey: c.b2ApplicationKey || c.applicationKey || "",
668
- bucketName: c.b2BucketName || c.bucketName || "",
669
- bucketId: c.b2BucketId || "",
670
- endpoint: c.b2Endpoint || "s3.eu-central-003.backblazeb2.com",
671
- region: c.b2Region || "eu-central-003"
672
- }
673
- });
674
- }
675
- }
676
- }
677
- } catch {
678
- }
679
- let fetchError;
680
- try {
681
- const srklRes = await fetch(`${srklUrl}/api/srkl/accounts?service=${service || "backblaze"}`, {
682
- signal: AbortSignal.timeout(5e3)
683
- });
684
- if (srklRes.ok) {
685
- const sData = await srklRes.json();
686
- if (Array.isArray(sData.accounts)) {
687
- for (const sa of sData.accounts) {
688
- rawAccounts.push(sa);
689
- }
690
- }
691
- }
692
- } catch (err) {
693
- fetchError = err.message;
694
- }
695
- const accounts = deduplicateAccounts(rawAccounts);
696
- return {
697
- success: true,
698
- deploymentUrl: srklUrl,
699
- userId,
700
- count: accounts.length,
701
- accounts,
702
- error: accounts.length > 0 ? void 0 : fetchError
703
- };
704
- }
705
- async function listBackblazeBuckets(payload, rawUserId, env) {
706
- try {
707
- const userId = rawUserId || payload?.userId || payload?.credentials?.userId || "";
708
- const creds = payload?.credentials || {};
709
- let keyId = (payload?.keyId || payload?.b2KeyId || payload?.accessKeyId || creds.keyId || creds.b2KeyId || creds.accessKeyId || "").trim();
710
- let appKey = (payload?.applicationKey || payload?.b2ApplicationKey || payload?.appKey || payload?.secretAccessKey || creds.applicationKey || creds.b2ApplicationKey || creds.appKey || creds.secretAccessKey || "").trim();
711
- const bucketId = (payload?.bucketId || creds.bucketId || "").trim();
712
- const bucketName = (payload?.bucketName || payload?.b2BucketName || creds.bucketName || creds.b2BucketName || "").trim();
713
- if ((!keyId || !appKey) && (payload?.accountId || payload?.id)) {
714
- const srkl = await getSrklAccounts2(userId, "backblaze", env);
715
- const matched = srkl.accounts?.find((a) => a.id === (payload.accountId || payload.id));
716
- if (matched?.credentials) {
717
- keyId = (matched.credentials.keyId || matched.credentials.b2KeyId || matched.credentials.accessKeyId || keyId).trim();
718
- appKey = (matched.credentials.applicationKey || matched.credentials.b2ApplicationKey || matched.credentials.appKey || matched.credentials.secretAccessKey || appKey).trim();
719
- }
720
- }
721
- if (!keyId || !appKey) return { success: false, error: "Backblaze credentials (Key ID and Application Key) required." };
722
- try {
723
- const buckets = await b2ListBuckets2(keyId, appKey, bucketId || void 0, bucketName || void 0);
724
- if (Array.isArray(buckets) && buckets.length > 0) return { success: true, buckets };
725
- } catch (err) {
726
- console.warn("[SrklCore] Direct B2 bucket query failed, trying SRKL fallback:", err.message);
727
- }
728
- const srklUrl = await getPrimarySrklDeploymentUrl2(env);
729
- const srklRes = await fetch(`${srklUrl}/api/backblaze/buckets`, {
730
- method: "POST",
731
- headers: { "Content-Type": "application/json", "x-user-id": userId || "" },
732
- body: JSON.stringify({ keyId, applicationKey: appKey, bucketId: bucketId || void 0 }),
733
- signal: AbortSignal.timeout(6e3)
734
- });
735
- if (srklRes.ok) {
736
- const data = await srklRes.json();
737
- if (data.success && Array.isArray(data.buckets)) return { success: true, buckets: data.buckets };
738
- }
739
- return { success: true, buckets: [] };
740
- } catch (err) {
741
- return { success: false, error: err.message || "Failed to list Backblaze buckets" };
742
- }
743
- }
744
- var srklListBackblazeBuckets2 = (keyId, applicationKey, bucketId, bucketName, userId) => listBackblazeBuckets({ keyId, applicationKey, bucketId, bucketName }, userId);
745
- async function getSrklStatus(env) {
746
- const srklUrl = await getPrimarySrklDeploymentUrl2(env);
747
- const start = Date.now();
748
- try {
749
- const resp = await fetch(`${srklUrl}/api/ecosystem/health`, { signal: AbortSignal.timeout(5e3) });
750
- const latencyMs = Date.now() - start;
751
- if (resp.ok) {
752
- const data = await resp.json().catch(() => ({}));
753
- return { success: true, deploymentUrl: srklUrl, online: true, latencyMs, details: data };
754
- }
755
- return { success: false, deploymentUrl: srklUrl, online: false, status: resp.status, latencyMs };
756
- } catch (err) {
757
- return { success: false, deploymentUrl: srklUrl, online: false, error: err.message, latencyMs: Date.now() - start };
758
- }
759
- }
760
-
761
576
  // src/core/credentialVaultCore.ts
762
577
  var MANIFEST_PATH = "credentials/manifest.json";
763
578
  var SECRET_PREFIX = "credentials/secrets";
@@ -4372,6 +4187,9 @@ function tryResolveSystemDatabaseUrl(env = typeof process !== "undefined" ? proc
4372
4187
  }
4373
4188
  export {
4374
4189
  AdminGuard,
4190
+ AgentHarnessRuntime,
4191
+ AgentHarnessServiceDefinition,
4192
+ AgentHarnessServiceFacade,
4375
4193
  AuditLogger,
4376
4194
  AuthServiceDefinition,
4377
4195
  AuthServiceFacade,
@@ -31,13 +31,14 @@ import {
31
31
  krnlWorkspaceGraphServiceFacade,
32
32
  krnlWorkspaceServiceDefinition,
33
33
  krnlWorkspaceServiceFacade
34
- } from "./chunk-GQUNN7SA.js";
35
- import "./chunk-DBZVGMJ7.js";
36
- import "./chunk-VDROUXFT.js";
34
+ } from "./chunk-Y3X3H2XX.js";
35
+ import "./chunk-KSZ67VZJ.js";
36
+ import "./chunk-N4Z57FVR.js";
37
37
  import "./chunk-J2J24JVC.js";
38
38
  import "./chunk-4QEMALXF.js";
39
39
  import "./chunk-FZKBTF34.js";
40
- import "./chunk-E72GXBXF.js";
40
+ import "./chunk-6K75XXFD.js";
41
+ import "./chunk-VAFCR2MS.js";
41
42
  import "./chunk-ZDH4XI7W.js";
42
43
  import "./chunk-TY32TUNI.js";
43
44
  export {
@@ -14,9 +14,10 @@ import {
14
14
  } from "../chunk-RBF2OGMC.js";
15
15
  import {
16
16
  workspaceGraphService
17
- } from "../chunk-DBZVGMJ7.js";
17
+ } from "../chunk-KSZ67VZJ.js";
18
18
  import "../chunk-J2J24JVC.js";
19
- import "../chunk-E72GXBXF.js";
19
+ import "../chunk-6K75XXFD.js";
20
+ import "../chunk-VAFCR2MS.js";
20
21
  import "../chunk-TY32TUNI.js";
21
22
  export {
22
23
  CompositeBackend,
@@ -187,7 +187,7 @@ declare function getSrklAccounts(userId: string, service?: string, queryDb?: (sq
187
187
  }>;
188
188
  declare function srklListBackblazeBuckets(keyId?: string, applicationKey?: string, _bucketId?: string, _bucketName?: string, userId?: string, queryDb?: (sql: string, params?: unknown[]) => Promise<{
189
189
  rows: any[];
190
- }>): Promise<{
190
+ }>, accountId?: string): Promise<{
191
191
  success: boolean;
192
192
  buckets: any[];
193
193
  error?: string;
@@ -293,6 +293,53 @@ declare const srklService: {
293
293
  supportedEngines: string[];
294
294
  version: string;
295
295
  };
296
+ getSrklAccounts: (userId?: string, serviceName?: string, env?: any) => Promise<{
297
+ success: boolean;
298
+ deploymentUrl: string;
299
+ userId?: string;
300
+ count: number;
301
+ accounts: any[];
302
+ error?: string;
303
+ }>;
304
+ getAccounts: (userId?: string, serviceName?: string, env?: any) => Promise<{
305
+ success: boolean;
306
+ deploymentUrl: string;
307
+ userId?: string;
308
+ count: number;
309
+ accounts: any[];
310
+ error?: string;
311
+ }>;
312
+ listBackblazeBuckets: (payload: any, userId?: string, env?: any) => Promise<{
313
+ success: boolean;
314
+ buckets?: any[];
315
+ error?: string;
316
+ }>;
317
+ getSrklStatus: (env?: any) => Promise<{
318
+ success: boolean;
319
+ deploymentUrl: string;
320
+ online: boolean;
321
+ latencyMs: number;
322
+ details: any;
323
+ status?: undefined;
324
+ error?: undefined;
325
+ } | {
326
+ success: boolean;
327
+ deploymentUrl: string;
328
+ online: boolean;
329
+ status: number;
330
+ latencyMs: number;
331
+ details?: undefined;
332
+ error?: undefined;
333
+ } | {
334
+ success: boolean;
335
+ deploymentUrl: string;
336
+ online: boolean;
337
+ error: any;
338
+ latencyMs: number;
339
+ details?: undefined;
340
+ status?: undefined;
341
+ }>;
342
+ getDeploymentUrl: (env?: any) => Promise<string>;
296
343
  };
297
344
 
298
345
  export { type AdaptedStorageConnection, type AppAccountManifest, type AppServiceDeclaration, CANONICAL_SRKL_URL, type CredentialRegistryMap, type EcosystemAccount, type EcosystemAccountsRequest, type EcosystemAccountsResponse, type EcosystemServiceCategory, type KeyMaterial, type ServiceAccountEntry, SrklClient, type SrklClientOptions, SrklCredentialRegistry, type SrklEcosystemQueryOptions, type SrklEcosystemResponse, type SrklServiceAccount, SrklVaultAccessClient, type SrklVaultAccessResponse, type UseSrklServicesOptions, type UseSrklServicesResult, type VaultAccessClientOptions, createSrklClient, decryptVaultBufferInBrowser, getPrimarySrklDeploymentUrl, getSrklAccounts, globalCredentialRegistry, hexToBytes, srklListBackblazeBuckets, srklService, syncSrklAccounts, useSrklServices };
@@ -10,13 +10,14 @@ import {
10
10
  srklService,
11
11
  syncSrklAccounts,
12
12
  useSrklServices
13
- } from "../chunk-OZDYAEH4.js";
13
+ } from "../chunk-BI5RDDB4.js";
14
14
  import {
15
15
  getPrimarySrklDeploymentUrl,
16
16
  getSrklAccounts,
17
17
  srklListBackblazeBuckets
18
- } from "../chunk-VDROUXFT.js";
18
+ } from "../chunk-N4Z57FVR.js";
19
19
  import "../chunk-4QEMALXF.js";
20
+ import "../chunk-VAFCR2MS.js";
20
21
  export {
21
22
  CANONICAL_SRKL_URL,
22
23
  SrklClient,
@@ -6,12 +6,13 @@ import {
6
6
  WorkspaceFS,
7
7
  remoteWorkspaceService,
8
8
  workingWorkspaceService
9
- } from "../chunk-GPXV4GBD.js";
9
+ } from "../chunk-6QTNNZSE.js";
10
10
  import {
11
11
  formatCanonicalWorkspaceFolderName,
12
12
  sanitizeWorkspaceName
13
13
  } from "../chunk-FZKBTF34.js";
14
- import "../chunk-E72GXBXF.js";
14
+ import "../chunk-6K75XXFD.js";
15
+ import "../chunk-VAFCR2MS.js";
15
16
  export {
16
17
  RemoteWorkspaceService,
17
18
  SyncEngine,
@@ -339,6 +339,31 @@
339
339
  "dependencies": [
340
340
  "web-container"
341
341
  ]
342
+ },
343
+ {
344
+ "id": "agent-harness",
345
+ "name": "Agent Harness",
346
+ "version": "1.0.0",
347
+ "description": "Provider-neutral agent harness service with DeepSeek Harness execution and pluggable OpenAI Agents SDK and Google ADK providers.",
348
+ "backend": {
349
+ "package": "@ultrst-armada/kloks",
350
+ "subpath": "development",
351
+ "export": "AgentHarnessServiceFacade",
352
+ "facade": "AgentHarnessServiceFacade"
353
+ },
354
+ "modes": [
355
+ "backend",
356
+ "fullstack"
357
+ ],
358
+ "targets": {
359
+ "backend": [
360
+ "BackendFacade.services"
361
+ ],
362
+ "frontend": [
363
+ "App.main-content"
364
+ ]
365
+ },
366
+ "dependencies": []
342
367
  }
343
368
  ]
344
369
  }