@ultrst-armada/kloks 1.2.1 → 1.4.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 +44 -1
- package/packages/backend/dist/chunk-BM4QMVPA.js +338 -0
- package/packages/backend/dist/chunk-DZ4ZGIZM.js +1323 -0
- package/packages/backend/dist/{chunk-MN54ZIKZ.js → chunk-KX3OTBQ3.js} +309 -4
- package/packages/backend/dist/index.d.ts +145 -4
- package/packages/backend/dist/index.js +447 -1398
- 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/workspace/index.d.ts +119 -1
- package/packages/backend/dist/workspace/index.js +11 -3
- package/packages/client/dist/index.d.ts +154 -0
- package/packages/client/dist/index.js +62 -0
- package/packages/client/package.json +41 -0
- package/packages/state-graph/dist/index.js +14 -14
- package/packages/backend/dist/chunk-KTLD7Z4L.js +0 -124
- package/packages/backend/dist/chunk-P4HL4C6V.js +0 -149
- package/packages/backend/dist/{chunk-OYQKQAEF.js → chunk-CU7RZBMF.js} +4 -4
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
StorageServiceFacade,
|
|
14
14
|
WorkspaceServiceDefinition,
|
|
15
15
|
WorkspaceServiceFacade
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-CU7RZBMF.js";
|
|
17
|
+
import "./chunk-IPP4VURQ.js";
|
|
17
18
|
import "./chunk-J2J24JVC.js";
|
|
18
19
|
import "./chunk-FZKBTF34.js";
|
|
19
20
|
import "./chunk-25Y7AVTP.js";
|
|
20
21
|
import "./chunk-QGHDJGYS.js";
|
|
21
22
|
import "./chunk-3EPY34R6.js";
|
|
22
|
-
import "./chunk-IPP4VURQ.js";
|
|
23
23
|
export {
|
|
24
24
|
AuthServiceDefinition,
|
|
25
25
|
AuthServiceFacade,
|
|
@@ -63,4 +63,171 @@ declare class EndpointGenerator {
|
|
|
63
63
|
declare function createBackend(name: string): CompositeBackend;
|
|
64
64
|
declare function createCompositeService(name: string): CompositeBackend;
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* @file types.ts
|
|
68
|
+
* @description Universal types for node graph document persistence, serialization, and storage sync.
|
|
69
|
+
*/
|
|
70
|
+
interface UniversalGraphNode {
|
|
71
|
+
id: string;
|
|
72
|
+
type?: string;
|
|
73
|
+
label?: string;
|
|
74
|
+
name?: string;
|
|
75
|
+
appId?: string;
|
|
76
|
+
deploymentId?: string;
|
|
77
|
+
position?: {
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
};
|
|
81
|
+
data?: Record<string, any>;
|
|
82
|
+
[key: string]: any;
|
|
83
|
+
}
|
|
84
|
+
interface UniversalGraphEdge {
|
|
85
|
+
id: string;
|
|
86
|
+
source: string;
|
|
87
|
+
target: string;
|
|
88
|
+
sourceSocket?: string;
|
|
89
|
+
targetSocket?: string;
|
|
90
|
+
appId?: string;
|
|
91
|
+
data?: Record<string, any>;
|
|
92
|
+
[key: string]: any;
|
|
93
|
+
}
|
|
94
|
+
interface UniversalAppEntity {
|
|
95
|
+
id: string;
|
|
96
|
+
name: string;
|
|
97
|
+
icon?: string;
|
|
98
|
+
description?: string;
|
|
99
|
+
publicLink?: string;
|
|
100
|
+
createdAt?: string;
|
|
101
|
+
updatedAt?: string;
|
|
102
|
+
[key: string]: any;
|
|
103
|
+
}
|
|
104
|
+
interface UniversalStorageConnection {
|
|
105
|
+
id: string;
|
|
106
|
+
provider: 'local_fs' | 'backblaze_b2' | 'cloudflare_r2' | 'aws_s3' | 'supabase' | string;
|
|
107
|
+
localFolderName?: string;
|
|
108
|
+
b2BucketName?: string;
|
|
109
|
+
s3BucketName?: string;
|
|
110
|
+
r2BucketName?: string;
|
|
111
|
+
supabaseBucketName?: string;
|
|
112
|
+
[key: string]: any;
|
|
113
|
+
}
|
|
114
|
+
interface UniversalNodeGraphDocument {
|
|
115
|
+
$schema?: string;
|
|
116
|
+
version: string;
|
|
117
|
+
appId: string;
|
|
118
|
+
appName: string;
|
|
119
|
+
appIcon?: string;
|
|
120
|
+
description?: string;
|
|
121
|
+
publicLink?: string;
|
|
122
|
+
createdAt: string;
|
|
123
|
+
updatedAt: string;
|
|
124
|
+
exportedAt: string;
|
|
125
|
+
author?: {
|
|
126
|
+
userId?: string;
|
|
127
|
+
username?: string;
|
|
128
|
+
email?: string;
|
|
129
|
+
name?: string;
|
|
130
|
+
role?: string;
|
|
131
|
+
};
|
|
132
|
+
viewport?: {
|
|
133
|
+
zoom: number;
|
|
134
|
+
pan: {
|
|
135
|
+
x: number;
|
|
136
|
+
y: number;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
graph: {
|
|
140
|
+
nodes: UniversalGraphNode[];
|
|
141
|
+
edges: UniversalGraphEdge[];
|
|
142
|
+
};
|
|
143
|
+
deployments?: any[];
|
|
144
|
+
storageMetadata?: {
|
|
145
|
+
provider: string;
|
|
146
|
+
targetName: string;
|
|
147
|
+
targetPath: string;
|
|
148
|
+
storageConnectionId?: string;
|
|
149
|
+
checksum?: string;
|
|
150
|
+
syncedAt?: string;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
interface NodeGraphValidationResult {
|
|
154
|
+
valid: boolean;
|
|
155
|
+
errors: string[];
|
|
156
|
+
document?: UniversalNodeGraphDocument;
|
|
157
|
+
}
|
|
158
|
+
interface SaveGraphOptions {
|
|
159
|
+
app: UniversalAppEntity;
|
|
160
|
+
nodes: UniversalGraphNode[];
|
|
161
|
+
edges: UniversalGraphEdge[];
|
|
162
|
+
deployments?: any[];
|
|
163
|
+
viewport?: {
|
|
164
|
+
zoom: number;
|
|
165
|
+
pan: {
|
|
166
|
+
x: number;
|
|
167
|
+
y: number;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
storageConnection?: UniversalStorageConnection;
|
|
171
|
+
}
|
|
172
|
+
declare const LOCAL_STORAGE_GRAPHS_PREFIX = "depm_graph_doc_";
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @file helpers.ts
|
|
176
|
+
* @description Helper functions for validating, exporting, and parsing universal node graph documents.
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Validates a parsed JSON object to verify it matches the UniversalNodeGraphDocument schema.
|
|
181
|
+
*/
|
|
182
|
+
declare function validateGraphDocument(data: any): NodeGraphValidationResult;
|
|
183
|
+
/**
|
|
184
|
+
* Triggers a browser download of the node graph as a portable JSON file.
|
|
185
|
+
*/
|
|
186
|
+
declare function exportGraphAsJsonFile(graphDoc: UniversalNodeGraphDocument): void;
|
|
187
|
+
/**
|
|
188
|
+
* Reads and parses a graph JSON file from an input file element.
|
|
189
|
+
*/
|
|
190
|
+
declare function parseGraphJsonFile(file: File): Promise<NodeGraphValidationResult>;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @file nodeGraphPersistence.ts
|
|
194
|
+
* @description Universal Node Graph Persistence Service.
|
|
195
|
+
* Manages serialization, schema validation, browser localStorage caching,
|
|
196
|
+
* and direct persistence to file system or cloud storage adapters.
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
declare class NodeGraphPersistenceService {
|
|
200
|
+
/**
|
|
201
|
+
* Generates a fully compliant v1.0.0 JSON document representing the app's complete node graph.
|
|
202
|
+
*/
|
|
203
|
+
createGraphDocument(options: SaveGraphOptions): UniversalNodeGraphDocument;
|
|
204
|
+
/**
|
|
205
|
+
* Validates a parsed JSON object to verify it matches the NodeGraphDocument schema.
|
|
206
|
+
*/
|
|
207
|
+
validateGraphDocument(data: any): NodeGraphValidationResult;
|
|
208
|
+
/**
|
|
209
|
+
* Saves the node graph to the selected user storage option (Local Folder or Cloud Bucket)
|
|
210
|
+
* and caches it in LocalStorage.
|
|
211
|
+
*/
|
|
212
|
+
saveGraphToStorage(options: SaveGraphOptions, customDirectoryHandle?: any): Promise<{
|
|
213
|
+
success: boolean;
|
|
214
|
+
document: UniversalNodeGraphDocument;
|
|
215
|
+
message: string;
|
|
216
|
+
targetPath: string;
|
|
217
|
+
}>;
|
|
218
|
+
/**
|
|
219
|
+
* Loads a cached or previously saved node graph document for an app.
|
|
220
|
+
*/
|
|
221
|
+
loadSavedGraph(appId: string): UniversalNodeGraphDocument | null;
|
|
222
|
+
/**
|
|
223
|
+
* Triggers a browser download of the node graph as a portable JSON file.
|
|
224
|
+
*/
|
|
225
|
+
exportGraphAsJsonFile(graphDoc: UniversalNodeGraphDocument): void;
|
|
226
|
+
/**
|
|
227
|
+
* Reads and parses a graph JSON file from an input file element.
|
|
228
|
+
*/
|
|
229
|
+
parseGraphJsonFile(file: File): Promise<NodeGraphValidationResult>;
|
|
230
|
+
}
|
|
231
|
+
declare const nodeGraphPersistence: NodeGraphPersistenceService;
|
|
232
|
+
|
|
233
|
+
export { CompositeBackend, EndpointGenerator, type GeneratedEndpointSummary, LOCAL_STORAGE_GRAPHS_PREFIX, type LocalService, NodeGraphPersistenceService, type NodeGraphValidationResult, type RemoteServiceProxy, type SaveGraphOptions, type UniversalAppEntity, type UniversalGraphEdge, type UniversalGraphNode, type UniversalNodeGraphDocument, type UniversalStorageConnection, createBackend, createCompositeService, createLocalService, createRemoteService, exportGraphAsJsonFile, nodeGraphPersistence, parseGraphJsonFile, validateGraphDocument };
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CompositeBackend,
|
|
3
3
|
EndpointGenerator,
|
|
4
|
+
LOCAL_STORAGE_GRAPHS_PREFIX,
|
|
5
|
+
NodeGraphPersistenceService,
|
|
4
6
|
createBackend,
|
|
5
7
|
createCompositeService,
|
|
6
8
|
createLocalService,
|
|
7
|
-
createRemoteService
|
|
8
|
-
|
|
9
|
+
createRemoteService,
|
|
10
|
+
exportGraphAsJsonFile,
|
|
11
|
+
nodeGraphPersistence,
|
|
12
|
+
parseGraphJsonFile,
|
|
13
|
+
validateGraphDocument
|
|
14
|
+
} from "../chunk-BM4QMVPA.js";
|
|
9
15
|
import "../chunk-IPP4VURQ.js";
|
|
10
16
|
export {
|
|
11
17
|
CompositeBackend,
|
|
12
18
|
EndpointGenerator,
|
|
19
|
+
LOCAL_STORAGE_GRAPHS_PREFIX,
|
|
20
|
+
NodeGraphPersistenceService,
|
|
13
21
|
createBackend,
|
|
14
22
|
createCompositeService,
|
|
15
23
|
createLocalService,
|
|
16
|
-
createRemoteService
|
|
24
|
+
createRemoteService,
|
|
25
|
+
exportGraphAsJsonFile,
|
|
26
|
+
nodeGraphPersistence,
|
|
27
|
+
parseGraphJsonFile,
|
|
28
|
+
validateGraphDocument
|
|
17
29
|
};
|
|
@@ -96,6 +96,38 @@ interface AdaptedStorageConnection {
|
|
|
96
96
|
s3Region?: string;
|
|
97
97
|
s3Endpoint?: string;
|
|
98
98
|
}
|
|
99
|
+
interface KeyMaterial {
|
|
100
|
+
secretHex: string;
|
|
101
|
+
cipher: 'aes-256-gcm';
|
|
102
|
+
envelope: 'salt_iv_tag_ciphertext';
|
|
103
|
+
}
|
|
104
|
+
interface SrklVaultAccessResponse {
|
|
105
|
+
success: boolean;
|
|
106
|
+
appId: string;
|
|
107
|
+
workspaceId: string;
|
|
108
|
+
workspaceName: string;
|
|
109
|
+
folderPrefix: string;
|
|
110
|
+
storageProvider: 'backblaze_b2' | 'cloudflare_r2' | 'aws_s3' | string;
|
|
111
|
+
presignedUrl: string;
|
|
112
|
+
keyMaterial: KeyMaterial;
|
|
113
|
+
supportedServices: string[];
|
|
114
|
+
expiresAt: string;
|
|
115
|
+
ttlSeconds: number;
|
|
116
|
+
}
|
|
117
|
+
interface ServiceAccountEntry {
|
|
118
|
+
id: string;
|
|
119
|
+
serviceId: string;
|
|
120
|
+
name: string;
|
|
121
|
+
credentials: Record<string, any>;
|
|
122
|
+
status?: string;
|
|
123
|
+
lastSync?: string;
|
|
124
|
+
metadata?: Record<string, any>;
|
|
125
|
+
createdAt?: string;
|
|
126
|
+
updatedAt?: string;
|
|
127
|
+
}
|
|
128
|
+
interface CredentialRegistryMap {
|
|
129
|
+
[serviceId: string]: ServiceAccountEntry[];
|
|
130
|
+
}
|
|
99
131
|
|
|
100
132
|
/**
|
|
101
133
|
* @file SrklClient.ts
|
|
@@ -188,4 +220,79 @@ interface UseSrklServicesResult {
|
|
|
188
220
|
}
|
|
189
221
|
declare function useSrklServices(options: UseSrklServicesOptions): UseSrklServicesResult;
|
|
190
222
|
|
|
191
|
-
|
|
223
|
+
declare function hexToBytes(hex: string): Uint8Array;
|
|
224
|
+
/**
|
|
225
|
+
* Decrypt an AES-256-GCM vault envelope in browser memory using Web Crypto API.
|
|
226
|
+
*/
|
|
227
|
+
declare function decryptVaultBufferInBrowser(envelopeBuffer: ArrayBuffer | Uint8Array, secretHex: string): Promise<Uint8Array>;
|
|
228
|
+
|
|
229
|
+
declare class SrklCredentialRegistry {
|
|
230
|
+
private registry;
|
|
231
|
+
constructor();
|
|
232
|
+
/**
|
|
233
|
+
* Populate the in-memory registry directly from an initialized sql.js Database instance.
|
|
234
|
+
* Performs the set intersection: DB.services ∩ DEPM.supported_services.
|
|
235
|
+
*/
|
|
236
|
+
populateFromSqlite(db: any, supportedServices: string[]): void;
|
|
237
|
+
/**
|
|
238
|
+
* Register a service account in volatile memory (for manual entry or synced accounts)
|
|
239
|
+
*/
|
|
240
|
+
registerServiceAccount(account: ServiceAccountEntry): void;
|
|
241
|
+
getAccountsForService(serviceId: string): ServiceAccountEntry[];
|
|
242
|
+
getPrimaryAccount(serviceId: string): ServiceAccountEntry | null;
|
|
243
|
+
hasCredentials(serviceId: string): boolean;
|
|
244
|
+
listAvailableServices(): string[];
|
|
245
|
+
toMap(): CredentialRegistryMap;
|
|
246
|
+
clear(): void;
|
|
247
|
+
}
|
|
248
|
+
declare const globalCredentialRegistry: SrklCredentialRegistry;
|
|
249
|
+
|
|
250
|
+
interface VaultAccessClientOptions {
|
|
251
|
+
srklApiBaseUrl: string;
|
|
252
|
+
appId: string;
|
|
253
|
+
supportedServices: string[];
|
|
254
|
+
}
|
|
255
|
+
declare class SrklVaultAccessClient {
|
|
256
|
+
private readonly options;
|
|
257
|
+
private registry;
|
|
258
|
+
private activeGrant;
|
|
259
|
+
private sqlEngine;
|
|
260
|
+
constructor(options: VaultAccessClientOptions);
|
|
261
|
+
/**
|
|
262
|
+
* Initialize sql.js engine (WASM).
|
|
263
|
+
* Consumers can pass pre-loaded initSqlJs or let this load from window or CDN.
|
|
264
|
+
*/
|
|
265
|
+
initSqlEngine(customInitSqlJs?: any): Promise<any>;
|
|
266
|
+
/**
|
|
267
|
+
* Full pipeline: Authorize → Presigned URL → Direct Download → Decrypt → SQLite Query → Registry.
|
|
268
|
+
*/
|
|
269
|
+
loadCredentials(userSessionToken: string, workspaceId?: string, customInitSqlJs?: any): Promise<SrklCredentialRegistry>;
|
|
270
|
+
getRegistry(): SrklCredentialRegistry;
|
|
271
|
+
getActiveGrant(): SrklVaultAccessResponse | null;
|
|
272
|
+
clear(): void;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
declare function syncSrklAccounts(userId: string, sessionToken: string, srklUrl?: string): Promise<{
|
|
276
|
+
success: boolean;
|
|
277
|
+
accounts?: any[];
|
|
278
|
+
error?: string;
|
|
279
|
+
sourceUrl?: string;
|
|
280
|
+
}>;
|
|
281
|
+
|
|
282
|
+
declare const srklService: {
|
|
283
|
+
name: string;
|
|
284
|
+
description: string;
|
|
285
|
+
runtime: {
|
|
286
|
+
VaultAccessClient: typeof SrklVaultAccessClient;
|
|
287
|
+
CredentialRegistry: typeof SrklCredentialRegistry;
|
|
288
|
+
decryptVaultBufferInBrowser: typeof decryptVaultBufferInBrowser;
|
|
289
|
+
hexToBytes: typeof hexToBytes;
|
|
290
|
+
};
|
|
291
|
+
deployment: {
|
|
292
|
+
target: string;
|
|
293
|
+
supportedEngines: string[];
|
|
294
|
+
version: string;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
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 };
|
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CANONICAL_SRKL_URL,
|
|
3
3
|
SrklClient,
|
|
4
|
+
SrklCredentialRegistry,
|
|
5
|
+
SrklVaultAccessClient,
|
|
4
6
|
createSrklClient,
|
|
7
|
+
decryptVaultBufferInBrowser,
|
|
5
8
|
getPrimarySrklDeploymentUrl,
|
|
6
9
|
getSrklAccounts,
|
|
10
|
+
globalCredentialRegistry,
|
|
11
|
+
hexToBytes,
|
|
7
12
|
srklListBackblazeBuckets,
|
|
13
|
+
srklService,
|
|
14
|
+
syncSrklAccounts,
|
|
8
15
|
useSrklServices
|
|
9
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-KX3OTBQ3.js";
|
|
10
17
|
import "../chunk-4QEMALXF.js";
|
|
11
18
|
export {
|
|
12
19
|
CANONICAL_SRKL_URL,
|
|
13
20
|
SrklClient,
|
|
21
|
+
SrklCredentialRegistry,
|
|
22
|
+
SrklVaultAccessClient,
|
|
14
23
|
createSrklClient,
|
|
24
|
+
decryptVaultBufferInBrowser,
|
|
15
25
|
getPrimarySrklDeploymentUrl,
|
|
16
26
|
getSrklAccounts,
|
|
27
|
+
globalCredentialRegistry,
|
|
28
|
+
hexToBytes,
|
|
17
29
|
srklListBackblazeBuckets,
|
|
30
|
+
srklService,
|
|
31
|
+
syncSrklAccounts,
|
|
18
32
|
useSrklServices
|
|
19
33
|
};
|
|
@@ -108,4 +108,122 @@ declare class WorkspaceCloneSyncEngine extends SkipoBase {
|
|
|
108
108
|
}>;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
/**
|
|
112
|
+
* @file WorkspaceService.ts
|
|
113
|
+
* @description Canonical WorkspaceService interface contract for Kloks backend.
|
|
114
|
+
* Governs remote-first (DEPM) and local working-workspace (QWNSR) architectures.
|
|
115
|
+
* Conforms to Skipo Governance (< 200 lines).
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
interface WorkspaceFileEntry {
|
|
119
|
+
path: string;
|
|
120
|
+
name: string;
|
|
121
|
+
sizeBytes?: number;
|
|
122
|
+
updatedAt?: string | number;
|
|
123
|
+
isFolder?: boolean;
|
|
124
|
+
}
|
|
125
|
+
interface WorkspaceLookupResult {
|
|
126
|
+
user?: any;
|
|
127
|
+
workspace: any;
|
|
128
|
+
connection?: any;
|
|
129
|
+
}
|
|
130
|
+
interface WorkspaceListResult {
|
|
131
|
+
success: boolean;
|
|
132
|
+
workspaces: any[];
|
|
133
|
+
activeWorkspaceId?: string | null;
|
|
134
|
+
storage_connections?: any[];
|
|
135
|
+
}
|
|
136
|
+
interface WorkspaceMutationResult {
|
|
137
|
+
success: boolean;
|
|
138
|
+
workspace?: any;
|
|
139
|
+
workspaces?: any[];
|
|
140
|
+
}
|
|
141
|
+
interface WorkspaceService {
|
|
142
|
+
readonly type: 'remote' | 'working';
|
|
143
|
+
findWorkspace(workspaceId: string, env?: Record<string, unknown>): Promise<WorkspaceLookupResult>;
|
|
144
|
+
listWorkspaces(userId?: string, env?: Record<string, unknown>): Promise<WorkspaceListResult>;
|
|
145
|
+
createWorkspace(userId: string, data: any, env?: Record<string, unknown>): Promise<WorkspaceMutationResult>;
|
|
146
|
+
updateWorkspace(userId: string, params: any, env?: Record<string, unknown>): Promise<WorkspaceMutationResult>;
|
|
147
|
+
deleteWorkspace(userId: string, workspaceId: string, env?: Record<string, unknown>): Promise<{
|
|
148
|
+
success: boolean;
|
|
149
|
+
workspaces?: any[];
|
|
150
|
+
}>;
|
|
151
|
+
readFile(workspaceId: string, filePath: string, env?: Record<string, unknown>): Promise<Uint8Array | string>;
|
|
152
|
+
writeFile(workspaceId: string, filePath: string, content: Uint8Array | string, env?: Record<string, unknown>): Promise<{
|
|
153
|
+
success: boolean;
|
|
154
|
+
path: string;
|
|
155
|
+
sizeBytes?: number;
|
|
156
|
+
}>;
|
|
157
|
+
deleteFile(workspaceId: string, filePath: string, env?: Record<string, unknown>): Promise<{
|
|
158
|
+
success: boolean;
|
|
159
|
+
}>;
|
|
160
|
+
listFiles(workspaceId: string, subfolder?: string, env?: Record<string, unknown>): Promise<WorkspaceFileEntry[]>;
|
|
161
|
+
sync?(workspaceId: string, options?: any, env?: Record<string, unknown>): Promise<WorkspaceSyncSummary>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @file RemoteWorkspaceService.ts
|
|
166
|
+
* @description Remote-first WorkspaceService implementation for Kloks.
|
|
167
|
+
* Directly mediates with authoritative remote storage (Backblaze B2/S3/DB) without requiring local working files.
|
|
168
|
+
* Canonical choice for DEPM. Conforms to Skipo Governance (< 200 lines).
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
declare class RemoteWorkspaceService implements WorkspaceService {
|
|
172
|
+
readonly type: "remote";
|
|
173
|
+
findWorkspace(workspaceId: string, env?: Record<string, unknown>): Promise<WorkspaceLookupResult>;
|
|
174
|
+
listWorkspaces(userId?: string, env?: Record<string, unknown>): Promise<WorkspaceListResult>;
|
|
175
|
+
createWorkspace(userId: string, data: any, env?: Record<string, unknown>): Promise<WorkspaceMutationResult>;
|
|
176
|
+
updateWorkspace(userId: string, params: any, env?: Record<string, unknown>): Promise<WorkspaceMutationResult>;
|
|
177
|
+
deleteWorkspace(userId: string, workspaceId: string, env?: Record<string, unknown>): Promise<{
|
|
178
|
+
success: boolean;
|
|
179
|
+
workspaces?: any[];
|
|
180
|
+
}>;
|
|
181
|
+
readFile(workspaceId: string, filePath: string, env?: Record<string, unknown>): Promise<Uint8Array | string>;
|
|
182
|
+
writeFile(workspaceId: string, filePath: string, content: Uint8Array | string, env?: Record<string, unknown>): Promise<{
|
|
183
|
+
success: boolean;
|
|
184
|
+
path: string;
|
|
185
|
+
sizeBytes?: number;
|
|
186
|
+
}>;
|
|
187
|
+
deleteFile(workspaceId: string, filePath: string, env?: Record<string, unknown>): Promise<{
|
|
188
|
+
success: boolean;
|
|
189
|
+
}>;
|
|
190
|
+
listFiles(workspaceId: string, subfolder?: string, env?: Record<string, unknown>): Promise<WorkspaceFileEntry[]>;
|
|
191
|
+
}
|
|
192
|
+
declare const remoteWorkspaceService: RemoteWorkspaceService;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @file WorkingWorkspaceService.ts
|
|
196
|
+
* @description Local Working-Workspace implementation for Kloks.
|
|
197
|
+
* Operates on a local working directory for fast low-latency I/O and explicitly
|
|
198
|
+
* synchronizes with authoritative remote storage (Backblaze B2/S3/DB).
|
|
199
|
+
* Canonical choice for QWNSR. Conforms to Skipo Governance (< 200 lines).
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
declare class WorkingWorkspaceService implements WorkspaceService {
|
|
203
|
+
private workingDirResolver?;
|
|
204
|
+
readonly type: "working";
|
|
205
|
+
constructor(workingDirResolver?: () => string);
|
|
206
|
+
getWorkingDir(): string;
|
|
207
|
+
findWorkspace(workspaceId: string, env?: Record<string, unknown>): Promise<WorkspaceLookupResult>;
|
|
208
|
+
listWorkspaces(userId?: string, env?: Record<string, unknown>): Promise<WorkspaceListResult>;
|
|
209
|
+
createWorkspace(userId: string, data: any, env?: Record<string, unknown>): Promise<WorkspaceMutationResult>;
|
|
210
|
+
updateWorkspace(userId: string, params: any, env?: Record<string, unknown>): Promise<WorkspaceMutationResult>;
|
|
211
|
+
deleteWorkspace(userId: string, workspaceId: string, env?: Record<string, unknown>): Promise<{
|
|
212
|
+
success: boolean;
|
|
213
|
+
workspaces?: any[];
|
|
214
|
+
}>;
|
|
215
|
+
readFile(_workspaceId: string, filePath: string): Promise<Uint8Array | string>;
|
|
216
|
+
writeFile(_workspaceId: string, filePath: string, content: Uint8Array | string): Promise<{
|
|
217
|
+
success: boolean;
|
|
218
|
+
path: string;
|
|
219
|
+
sizeBytes?: number;
|
|
220
|
+
}>;
|
|
221
|
+
deleteFile(_workspaceId: string, filePath: string): Promise<{
|
|
222
|
+
success: boolean;
|
|
223
|
+
}>;
|
|
224
|
+
listFiles(_workspaceId: string, subfolder?: string): Promise<WorkspaceFileEntry[]>;
|
|
225
|
+
sync(workspaceId: string, _options?: any, _env?: Record<string, unknown>): Promise<WorkspaceSyncSummary>;
|
|
226
|
+
}
|
|
227
|
+
declare const workingWorkspaceService: WorkingWorkspaceService;
|
|
228
|
+
|
|
229
|
+
export { type CloneReplicationResult, type ConflictPolicy, RemoteWorkspaceService, SyncEngine, type SyncState, WorkingWorkspaceService, WorkspaceCloneSyncEngine, type WorkspaceConfig, type WorkspaceDescriptor, WorkspaceFS, type WorkspaceFileEntry, type WorkspaceListResult, type WorkspaceLookupResult, type WorkspaceMutationResult, type WorkspaceSecondaryClone, type WorkspaceService, type WorkspaceSyncSummary, formatCanonicalWorkspaceFolderName, remoteWorkspaceService, sanitizeWorkspaceName, workingWorkspaceService };
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
+
RemoteWorkspaceService,
|
|
2
3
|
SyncEngine,
|
|
4
|
+
WorkingWorkspaceService,
|
|
3
5
|
WorkspaceCloneSyncEngine,
|
|
4
|
-
WorkspaceFS
|
|
5
|
-
|
|
6
|
+
WorkspaceFS,
|
|
7
|
+
remoteWorkspaceService,
|
|
8
|
+
workingWorkspaceService
|
|
9
|
+
} from "../chunk-DZ4ZGIZM.js";
|
|
6
10
|
import {
|
|
7
11
|
formatCanonicalWorkspaceFolderName,
|
|
8
12
|
sanitizeWorkspaceName
|
|
9
13
|
} from "../chunk-FZKBTF34.js";
|
|
10
14
|
export {
|
|
15
|
+
RemoteWorkspaceService,
|
|
11
16
|
SyncEngine,
|
|
17
|
+
WorkingWorkspaceService,
|
|
12
18
|
WorkspaceCloneSyncEngine,
|
|
13
19
|
WorkspaceFS,
|
|
14
20
|
formatCanonicalWorkspaceFolderName,
|
|
15
|
-
|
|
21
|
+
remoteWorkspaceService,
|
|
22
|
+
sanitizeWorkspaceName,
|
|
23
|
+
workingWorkspaceService
|
|
16
24
|
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file queueContracts.ts
|
|
3
|
+
* @description Pure browser-safe command, job, queue, and execution contracts.
|
|
4
|
+
* ZERO Node/server/BullMQ dependency closure.
|
|
5
|
+
* Conforms to Skipo Governance (< 200 lines).
|
|
6
|
+
*/
|
|
7
|
+
interface CorrelationMetadata {
|
|
8
|
+
correlationId: string;
|
|
9
|
+
idempotencyKey?: string;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
source?: string;
|
|
12
|
+
traceId?: string;
|
|
13
|
+
}
|
|
14
|
+
interface BackendCommand<TPayload = unknown> {
|
|
15
|
+
id: string;
|
|
16
|
+
type: string;
|
|
17
|
+
payload: TPayload;
|
|
18
|
+
metadata?: Record<string, unknown>;
|
|
19
|
+
correlationId: string;
|
|
20
|
+
idempotencyKey?: string;
|
|
21
|
+
createdAt: number;
|
|
22
|
+
}
|
|
23
|
+
type JobStatus = 'QUEUED' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'RETRYING';
|
|
24
|
+
type JobPriority = 'LOW' | 'NORMAL' | 'HIGH' | 'CRITICAL';
|
|
25
|
+
interface RetryPolicy {
|
|
26
|
+
maxAttempts: number;
|
|
27
|
+
backoffMs: number;
|
|
28
|
+
}
|
|
29
|
+
interface ExecutionJob<TPayload = unknown> {
|
|
30
|
+
id: string;
|
|
31
|
+
correlationId: string;
|
|
32
|
+
command: BackendCommand<TPayload>;
|
|
33
|
+
status: JobStatus;
|
|
34
|
+
priority: JobPriority;
|
|
35
|
+
retryPolicy?: RetryPolicy;
|
|
36
|
+
attemptsMade: number;
|
|
37
|
+
createdAt: number;
|
|
38
|
+
completedAt?: number;
|
|
39
|
+
}
|
|
40
|
+
interface NormalizedResult<TData = unknown> {
|
|
41
|
+
correlationId: string;
|
|
42
|
+
status: 'COMPLETED' | 'FAILED';
|
|
43
|
+
data?: TData;
|
|
44
|
+
error?: string;
|
|
45
|
+
executionTimestamp: number;
|
|
46
|
+
}
|
|
47
|
+
interface QueueTransportOptions {
|
|
48
|
+
gatewayUrl?: string;
|
|
49
|
+
headers?: Record<string, string>;
|
|
50
|
+
timeoutMs?: number;
|
|
51
|
+
}
|
|
52
|
+
interface QueueGatewayContract {
|
|
53
|
+
enqueue<T = unknown>(command: BackendCommand<T>): Promise<{
|
|
54
|
+
jobId: string;
|
|
55
|
+
correlationId: string;
|
|
56
|
+
}>;
|
|
57
|
+
checkStatus(jobId: string): Promise<NormalizedResult>;
|
|
58
|
+
}
|
|
59
|
+
interface WorkspaceDescriptor {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
ownerId: string;
|
|
63
|
+
createdAt: number;
|
|
64
|
+
updatedAt: number;
|
|
65
|
+
}
|
|
66
|
+
interface WorkspaceSyncSummary {
|
|
67
|
+
success: boolean;
|
|
68
|
+
workspaceId: string;
|
|
69
|
+
folderKey: string;
|
|
70
|
+
workingDir?: string;
|
|
71
|
+
persistenceType: string;
|
|
72
|
+
targetLocation: string;
|
|
73
|
+
syncedFiles: Array<{
|
|
74
|
+
fileName: string;
|
|
75
|
+
action: string;
|
|
76
|
+
sizeBytes?: number;
|
|
77
|
+
}>;
|
|
78
|
+
uploadedCount: number;
|
|
79
|
+
downloadedCount: number;
|
|
80
|
+
syncedAt: string;
|
|
81
|
+
error?: string;
|
|
82
|
+
}
|
|
83
|
+
interface WorkspaceLookupResult {
|
|
84
|
+
user?: any;
|
|
85
|
+
workspace: any;
|
|
86
|
+
connection?: any;
|
|
87
|
+
}
|
|
88
|
+
interface WorkspaceListResult {
|
|
89
|
+
success: boolean;
|
|
90
|
+
workspaces: any[];
|
|
91
|
+
activeWorkspaceId?: string | null;
|
|
92
|
+
storage_connections?: any[];
|
|
93
|
+
}
|
|
94
|
+
interface WorkspaceMutationResult {
|
|
95
|
+
success: boolean;
|
|
96
|
+
workspace?: any;
|
|
97
|
+
workspaces?: any[];
|
|
98
|
+
}
|
|
99
|
+
interface WorkspaceFileEntry {
|
|
100
|
+
path: string;
|
|
101
|
+
name: string;
|
|
102
|
+
sizeBytes?: number;
|
|
103
|
+
updatedAt?: string | number;
|
|
104
|
+
isFolder?: boolean;
|
|
105
|
+
}
|
|
106
|
+
interface WorkspaceServiceContract {
|
|
107
|
+
readonly type: 'remote' | 'working';
|
|
108
|
+
findWorkspace(workspaceId: string): Promise<WorkspaceLookupResult>;
|
|
109
|
+
listWorkspaces(userId?: string): Promise<WorkspaceListResult>;
|
|
110
|
+
createWorkspace(userId: string, data: any): Promise<WorkspaceMutationResult>;
|
|
111
|
+
updateWorkspace(userId: string, params: any): Promise<WorkspaceMutationResult>;
|
|
112
|
+
deleteWorkspace(userId: string, workspaceId: string): Promise<{
|
|
113
|
+
success: boolean;
|
|
114
|
+
workspaces?: any[];
|
|
115
|
+
}>;
|
|
116
|
+
readFile(workspaceId: string, filePath: string): Promise<Uint8Array | string>;
|
|
117
|
+
writeFile(workspaceId: string, filePath: string, content: Uint8Array | string): Promise<{
|
|
118
|
+
success: boolean;
|
|
119
|
+
path: string;
|
|
120
|
+
sizeBytes?: number;
|
|
121
|
+
}>;
|
|
122
|
+
deleteFile(workspaceId: string, filePath: string): Promise<{
|
|
123
|
+
success: boolean;
|
|
124
|
+
}>;
|
|
125
|
+
listFiles(workspaceId: string, subfolder?: string): Promise<WorkspaceFileEntry[]>;
|
|
126
|
+
sync?(workspaceId: string, options?: any): Promise<WorkspaceSyncSummary>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @file browserExecutionClient.ts
|
|
131
|
+
* @description Browser-safe execution client for SKIPO applications.
|
|
132
|
+
* Dispatches commands across the queue transport boundary to the backend queue gateway.
|
|
133
|
+
* Conforms to Skipo Governance (< 200 lines).
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
declare class BrowserExecutionClient implements QueueGatewayContract {
|
|
137
|
+
private gatewayUrl;
|
|
138
|
+
private headers;
|
|
139
|
+
private timeoutMs;
|
|
140
|
+
constructor(options?: QueueTransportOptions);
|
|
141
|
+
createCommand<T = unknown>(type: string, payload: T, options?: {
|
|
142
|
+
correlationId?: string;
|
|
143
|
+
idempotencyKey?: string;
|
|
144
|
+
metadata?: Record<string, unknown>;
|
|
145
|
+
}): BackendCommand<T>;
|
|
146
|
+
enqueue<T = unknown>(command: BackendCommand<T>): Promise<{
|
|
147
|
+
jobId: string;
|
|
148
|
+
correlationId: string;
|
|
149
|
+
}>;
|
|
150
|
+
checkStatus(jobId: string): Promise<NormalizedResult>;
|
|
151
|
+
}
|
|
152
|
+
declare function createBrowserExecutionClient(options?: QueueTransportOptions): BrowserExecutionClient;
|
|
153
|
+
|
|
154
|
+
export { type BackendCommand, BrowserExecutionClient, type CorrelationMetadata, type ExecutionJob, type JobPriority, type JobStatus, type NormalizedResult, type QueueGatewayContract, type QueueTransportOptions, type RetryPolicy, type WorkspaceDescriptor, type WorkspaceFileEntry, type WorkspaceListResult, type WorkspaceLookupResult, type WorkspaceMutationResult, type WorkspaceServiceContract, type WorkspaceSyncSummary, createBrowserExecutionClient };
|