@ultrst-armada/kloks 1.26.1 → 1.26.3

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.
Files changed (36) hide show
  1. package/package.json +12 -3
  2. package/packages/backend/dist/chunk-3S2NSIFA.js +80 -0
  3. package/packages/backend/dist/{chunk-JRNH5KPV.js → chunk-EDKCP5CQ.js} +2 -2
  4. package/packages/backend/dist/{chunk-3W4TN6XB.js → chunk-FU6TYLI2.js} +5 -5
  5. package/packages/backend/dist/chunk-KPZQUA7R.js +406 -0
  6. package/packages/backend/dist/{chunk-IB5SLBHT.js → chunk-U4UI6KK4.js} +1 -1
  7. package/packages/backend/dist/{chunk-QXIMZLGS.js → chunk-WAQDOIGQ.js} +1 -1
  8. package/packages/backend/dist/development/index.js +5 -5
  9. package/packages/backend/dist/index.js +19 -17
  10. package/packages/backend/dist/krnl-ai-services.js +2 -2
  11. package/packages/backend/dist/krnl-services.js +4 -4
  12. package/packages/backend/dist/services/index.js +3 -3
  13. package/packages/backend/dist/storage/GoogleDriveAdapter.d.ts +23 -1
  14. package/packages/backend/dist/storage/GoogleDriveOAuth.d.ts +20 -2
  15. package/packages/backend/dist/storage/GoogleDriveStorageService.d.ts +7 -1
  16. package/packages/backend/dist/storage/GoogleDriveWorkspaceService.d.ts +69 -0
  17. package/packages/backend/dist/storage/GoogleDriveWorkspaceService.test.d.ts +1 -0
  18. package/packages/backend/dist/storage/StorageAdapterFactory.d.ts +6 -1
  19. package/packages/backend/dist/storage/googleDriveSdk.d.ts +7 -0
  20. package/packages/backend/dist/storage/index.js +5 -3
  21. package/packages/backend/dist/storage/types.d.ts +13 -0
  22. package/packages/backend/dist/storage-workspace.d.ts +2 -0
  23. package/packages/backend/dist/storage-workspace.js +339 -0
  24. package/packages/backend/dist/workspace/index.js +2 -2
  25. package/packages/backend/package.json +6 -1
  26. package/packages/state-graph/dist/browser.d.ts +28 -0
  27. package/packages/state-graph/dist/browser.js +302 -0
  28. package/packages/state-graph/dist/chunk-2CQQGFMF.js +7339 -0
  29. package/packages/state-graph/dist/index.js +283 -7260
  30. package/packages/state-graph/dist/runtime-entrypoint.test.d.ts +1 -0
  31. package/packages/state-graph/dist/store/CommandApi.d.ts +4 -4
  32. package/packages/state-graph/package.json +2 -1
  33. package/packages/backend/dist/chunk-52M4L74T.js +0 -247
  34. package/packages/backend/dist/chunk-GZD5A54P.js +0 -67
  35. package/packages/backend/dist/{chunk-M45KQRPR.js → chunk-GWCLYVJT.js} +3 -3
  36. /package/packages/state-graph/dist/{dist-es-OECEAUXH.js → dist-es-QZ6GKMM7.js} +0 -0
@@ -32,10 +32,11 @@ import {
32
32
  } from "./chunk-HF5SGQ5V.js";
33
33
  import {
34
34
  GOOGLE_DRIVE_FILE_SCOPE,
35
+ GOOGLE_DRIVE_STORAGE_SCOPE,
35
36
  createGoogleDriveAuthorizationUrl,
36
37
  exchangeGoogleDriveCode,
37
38
  refreshGoogleDriveAccessToken
38
- } from "./chunk-GZD5A54P.js";
39
+ } from "./chunk-3S2NSIFA.js";
39
40
  import {
40
41
  RemoteWorkspaceService,
41
42
  SyncEngine,
@@ -51,7 +52,8 @@ import {
51
52
  setWorkingWorkspaceConfig,
52
53
  syncWorkspace,
53
54
  workingWorkspaceService
54
- } from "./chunk-IB5SLBHT.js";
55
+ } from "./chunk-U4UI6KK4.js";
56
+ import "./chunk-WVDSMTW3.js";
55
57
  import {
56
58
  validateToolInput
57
59
  } from "./chunk-6GQNYRD6.js";
@@ -120,7 +122,15 @@ import {
120
122
  AIRoutingServiceFacade,
121
123
  AIToolServiceDefinition,
122
124
  AIToolServiceFacade
123
- } from "./chunk-M45KQRPR.js";
125
+ } from "./chunk-GWCLYVJT.js";
126
+ import {
127
+ FailoverExecutionEngine,
128
+ HealthCheckService,
129
+ MetricsLogger,
130
+ failoverExecutionEngine,
131
+ healthCheckService,
132
+ metricsLogger
133
+ } from "./chunk-PT6J6UEU.js";
124
134
  import {
125
135
  MCPEngine,
126
136
  ToolManagerService,
@@ -160,10 +170,10 @@ import {
160
170
  krnlWorkspaceGraphServiceFacade,
161
171
  krnlWorkspaceServiceDefinition,
162
172
  krnlWorkspaceServiceFacade
163
- } from "./chunk-JRNH5KPV.js";
173
+ } from "./chunk-EDKCP5CQ.js";
164
174
  import {
165
175
  workspaceGraphService
166
- } from "./chunk-QXIMZLGS.js";
176
+ } from "./chunk-WAQDOIGQ.js";
167
177
  import {
168
178
  getPrimarySrklDeploymentUrl,
169
179
  getSrklAccounts,
@@ -184,7 +194,7 @@ import {
184
194
  permanentDeleteS3Object,
185
195
  renameS3Folder,
186
196
  resolveBackblazeEndpoint
187
- } from "./chunk-3W4TN6XB.js";
197
+ } from "./chunk-FU6TYLI2.js";
188
198
  import {
189
199
  authorizeB2,
190
200
  b2DownloadFile,
@@ -229,7 +239,7 @@ import {
229
239
  import {
230
240
  BaseStorageAdapter,
231
241
  GoogleDriveAdapter
232
- } from "./chunk-52M4L74T.js";
242
+ } from "./chunk-KPZQUA7R.js";
233
243
  import {
234
244
  loginSystemUser,
235
245
  resolveUserFromToken
@@ -251,16 +261,6 @@ import {
251
261
  } from "./chunk-GCTQY24J.js";
252
262
  import "./chunk-IN3WRHXE.js";
253
263
  import "./chunk-UU6M3L3O.js";
254
- import "./chunk-LV55WKZR.js";
255
- import "./chunk-WVDSMTW3.js";
256
- import {
257
- FailoverExecutionEngine,
258
- HealthCheckService,
259
- MetricsLogger,
260
- failoverExecutionEngine,
261
- healthCheckService,
262
- metricsLogger
263
- } from "./chunk-PT6J6UEU.js";
264
264
  import {
265
265
  EndpointRefresher,
266
266
  ModelCatalogService,
@@ -277,6 +277,7 @@ import {
277
277
  keysStorage,
278
278
  validateApiKey
279
279
  } from "./chunk-P7H6TIEA.js";
280
+ import "./chunk-LV55WKZR.js";
280
281
  import {
281
282
  AIProviderService,
282
283
  aiProviderService
@@ -4460,6 +4461,7 @@ export {
4460
4461
  FrontendSession,
4461
4462
  FunctionalityTable,
4462
4463
  GOOGLE_DRIVE_FILE_SCOPE,
4464
+ GOOGLE_DRIVE_STORAGE_SCOPE,
4463
4465
  GRAPHS_ROOT,
4464
4466
  GeminiServiceDefinition,
4465
4467
  GeminiServiceFacade,
@@ -11,11 +11,11 @@ import {
11
11
  AIRoutingServiceFacade,
12
12
  AIToolServiceDefinition,
13
13
  AIToolServiceFacade
14
- } from "./chunk-M45KQRPR.js";
14
+ } from "./chunk-GWCLYVJT.js";
15
+ import "./chunk-PT6J6UEU.js";
15
16
  import "./chunk-U4HUGPRH.js";
16
17
  import "./chunk-SXDYW3QA.js";
17
18
  import "./chunk-GCTQY24J.js";
18
- import "./chunk-PT6J6UEU.js";
19
19
  import "./chunk-LMWXONZG.js";
20
20
  import "./chunk-P7H6TIEA.js";
21
21
  import "./chunk-SLR6SIEU.js";
@@ -31,15 +31,15 @@ import {
31
31
  krnlWorkspaceGraphServiceFacade,
32
32
  krnlWorkspaceServiceDefinition,
33
33
  krnlWorkspaceServiceFacade
34
- } from "./chunk-JRNH5KPV.js";
35
- import "./chunk-QXIMZLGS.js";
34
+ } from "./chunk-EDKCP5CQ.js";
35
+ import "./chunk-WAQDOIGQ.js";
36
36
  import "./chunk-RIOYKF3X.js";
37
- import "./chunk-3W4TN6XB.js";
37
+ import "./chunk-FU6TYLI2.js";
38
38
  import "./chunk-4QEMALXF.js";
39
39
  import "./chunk-FZKBTF34.js";
40
40
  import "./chunk-JGUWYVOL.js";
41
41
  import "./chunk-JCMB7BIM.js";
42
- import "./chunk-52M4L74T.js";
42
+ import "./chunk-KPZQUA7R.js";
43
43
  import "./chunk-2COYZMUJ.js";
44
44
  import "./chunk-SXDYW3QA.js";
45
45
  export {
@@ -14,11 +14,11 @@ import {
14
14
  } from "../chunk-JOTDEFRG.js";
15
15
  import {
16
16
  workspaceGraphService
17
- } from "../chunk-QXIMZLGS.js";
18
- import "../chunk-3W4TN6XB.js";
17
+ } from "../chunk-WAQDOIGQ.js";
18
+ import "../chunk-FU6TYLI2.js";
19
19
  import "../chunk-JGUWYVOL.js";
20
20
  import "../chunk-JCMB7BIM.js";
21
- import "../chunk-52M4L74T.js";
21
+ import "../chunk-KPZQUA7R.js";
22
22
  import "../chunk-SXDYW3QA.js";
23
23
  export {
24
24
  CompositeBackend,
@@ -1,13 +1,30 @@
1
1
  import { BaseStorageAdapter } from './BaseStorageAdapter.js';
2
- import { FileInfo, ConnectionTestResult } from './types.js';
2
+ import type { GoogleDriveFolder, FileInfo, StorageConfig, ConnectionTestResult } from './types.js';
3
+ import type { GoogleDriveRuntimeAuthOptions } from './GoogleDriveOAuth.js';
3
4
  export declare class GoogleDriveAdapter extends BaseStorageAdapter {
4
5
  private client?;
5
6
  private auth?;
7
+ private authPromise?;
8
+ private pendingCredentialPersistence?;
9
+ private credentialPersistenceError?;
10
+ private readonly runtimeAuth;
11
+ constructor(config: StorageConfig, runtimeAuth?: GoogleDriveRuntimeAuthOptions);
6
12
  private getAuth;
7
13
  private getClient;
8
14
  private findChild;
9
15
  private resolveParent;
10
16
  private split;
17
+ /**
18
+ * Return only non-secret connection metadata for persistence alongside the
19
+ * authenticated application user's storage connection record.
20
+ */
21
+ getConnectionMetadata(): Pick<StorageConfig, 'provider' | 'googleClientId' | 'googleRedirectUri' | 'googleAccountId' | 'googleRootFolderId'>;
22
+ /** Browse only folders directly below the supplied parent (or selected storage root). */
23
+ listFolders(parentFolderId?: string): Promise<GoogleDriveFolder[]>;
24
+ /** Resolve and validate a provider-native folder ID before it is saved as a root. */
25
+ resolveFolder(folderId: string): Promise<GoogleDriveFolder>;
26
+ /** Select a validated folder as this connection's storage/workspace root. */
27
+ selectRootFolder(folderId: string): Promise<GoogleDriveFolder>;
11
28
  read(pathStr: string): Promise<Uint8Array>;
12
29
  write(pathStr: string, data: Uint8Array | string, contentType?: string): Promise<void>;
13
30
  delete(pathStr: string): Promise<void>;
@@ -15,5 +32,10 @@ export declare class GoogleDriveAdapter extends BaseStorageAdapter {
15
32
  list(pathStr?: string): Promise<FileInfo[]>;
16
33
  stat(pathStr: string): Promise<FileInfo>;
17
34
  mkdir(pathStr: string): Promise<void>;
35
+ /** Resolve the stable Google account identity for association with the app user's server-side connection record. */
36
+ getAccountIdentity(): Promise<{
37
+ accountId: string;
38
+ email?: string;
39
+ }>;
18
40
  testConnection(): Promise<ConnectionTestResult>;
19
41
  }
@@ -10,7 +10,25 @@ export interface GoogleDriveTokenSet {
10
10
  expiresAt?: number;
11
11
  tokenType?: string;
12
12
  }
13
+ /**
14
+ * Server-only runtime dependencies. Keep this object out of persisted
15
+ * provider connection records and never pass it to browser code.
16
+ */
17
+ export interface GoogleDriveRuntimeAuthOptions {
18
+ clientSecret?: string;
19
+ getCredentials?: () => Promise<GoogleDriveTokenSet>;
20
+ persistCredentials?: (tokens: GoogleDriveTokenSet) => Promise<void> | void;
21
+ }
22
+ /**
23
+ * A storage root must be able to enumerate, read, create, update and delete
24
+ * files below a user-selected existing folder. drive.file is deliberately
25
+ * insufficient for this contract: it only covers files explicitly opened
26
+ * or created by the application. The full Drive scope is therefore the
27
+ * narrowest single scope that supports the complete storage abstraction.
28
+ */
29
+ export declare const GOOGLE_DRIVE_STORAGE_SCOPE = "https://www.googleapis.com/auth/drive";
30
+ /** @deprecated Use GOOGLE_DRIVE_STORAGE_SCOPE for complete storage roots. */
13
31
  export declare const GOOGLE_DRIVE_FILE_SCOPE = "https://www.googleapis.com/auth/drive.file";
14
32
  export declare function createGoogleDriveAuthorizationUrl(config: GoogleDriveOAuthConfig, state: string, codeChallenge?: string): string;
15
- export declare function exchangeGoogleDriveCode(config: GoogleDriveOAuthConfig, code: string, codeVerifier?: string): Promise<GoogleDriveTokenSet>;
16
- export declare function refreshGoogleDriveAccessToken(clientId: string, refreshToken: string, clientSecret?: string, _redirectUri?: string): Promise<GoogleDriveTokenSet>;
33
+ export declare function exchangeGoogleDriveCode(config: GoogleDriveOAuthConfig, code: string, codeVerifier?: string, existingRefreshToken?: string): Promise<GoogleDriveTokenSet>;
34
+ export declare function refreshGoogleDriveAccessToken(clientId: string, refreshToken: string, clientSecret?: string, redirectUri?: string): Promise<GoogleDriveTokenSet>;
@@ -1,5 +1,11 @@
1
1
  import { GoogleDriveAdapter } from './GoogleDriveAdapter.js';
2
+ import type { GoogleDriveRuntimeAuthOptions } from './GoogleDriveOAuth.js';
2
3
  import type { StorageConfig } from './types.js';
4
+ /**
5
+ * Canonical Google Drive implementation of the KLOKS storage abstraction.
6
+ * Runtime auth callbacks/secrets are server-only and must not be serialized
7
+ * into consumer-visible storage connection records.
8
+ */
3
9
  export declare class GoogleDriveStorageService extends GoogleDriveAdapter {
4
- constructor(config: StorageConfig);
10
+ constructor(config: StorageConfig, runtimeAuth?: GoogleDriveRuntimeAuthOptions);
5
11
  }
@@ -0,0 +1,69 @@
1
+ import type { FileInfo } from './types.js';
2
+ export declare const GOOGLE_DRIVE_WORKSPACE_SCOPE = "https://www.googleapis.com/auth/drive";
3
+ export interface GoogleDriveWorkspaceTokens {
4
+ accessToken: string;
5
+ refreshToken?: string;
6
+ expiresAt?: number;
7
+ tokenType?: string;
8
+ }
9
+ export interface GoogleDriveWorkspaceOptions {
10
+ clientId: string;
11
+ clientSecret?: string;
12
+ redirectUri: string;
13
+ tokens?: GoogleDriveWorkspaceTokens;
14
+ rootFolderId?: string;
15
+ fetcher?: typeof fetch;
16
+ persistTokens?: (tokens: GoogleDriveWorkspaceTokens) => Promise<void> | void;
17
+ }
18
+ export interface GoogleDriveWorkspaceFolder {
19
+ id: string;
20
+ name: string;
21
+ mimeType: string;
22
+ parentIds: string[];
23
+ modifiedAt: number;
24
+ }
25
+ /**
26
+ * Fetch-native Google Drive implementation for Worker/edge runtimes.
27
+ *
28
+ * This class deliberately uses only the Web Fetch, URL, TextEncoder and
29
+ * Uint8Array APIs. It does not import googleapis, Node streams or filesystem
30
+ * modules, so it can be bundled into Cloudflare Workers and serverless APIs.
31
+ * OAuth credentials are supplied and persisted only by server-side callers.
32
+ */
33
+ export declare class GoogleDriveWorkspaceService {
34
+ private readonly options;
35
+ private readonly fetcher;
36
+ private tokens;
37
+ private refreshPromise?;
38
+ constructor(options: GoogleDriveWorkspaceOptions);
39
+ static createAuthorizationUrl(options: Pick<GoogleDriveWorkspaceOptions, 'clientId' | 'redirectUri'>, state: string, scopes?: string[]): string;
40
+ static exchangeAuthorizationCode(options: Pick<GoogleDriveWorkspaceOptions, 'clientId' | 'clientSecret' | 'redirectUri' | 'fetcher'>, code: string, existingRefreshToken?: string, codeVerifier?: string): Promise<GoogleDriveWorkspaceTokens>;
41
+ private static requestTokens;
42
+ private getAccessToken;
43
+ private api;
44
+ private listFiles;
45
+ private findChild;
46
+ private resolveParent;
47
+ private splitPath;
48
+ getAccountIdentity(): Promise<{
49
+ accountId: string;
50
+ email?: string;
51
+ }>;
52
+ listFolders(parentFolderId?: string): Promise<GoogleDriveWorkspaceFolder[]>;
53
+ resolveFolder(folderId: string): Promise<GoogleDriveWorkspaceFolder>;
54
+ selectRootFolder(folderId: string): Promise<GoogleDriveWorkspaceFolder>;
55
+ read(path: string): Promise<Uint8Array>;
56
+ write(path: string, bytes: Uint8Array | string, contentType?: string): Promise<void>;
57
+ delete(path: string): Promise<void>;
58
+ exists(path: string): Promise<boolean>;
59
+ list(path?: string): Promise<FileInfo[]>;
60
+ stat(path: string): Promise<FileInfo>;
61
+ mkdir(path: string): Promise<void>;
62
+ testConnection(): Promise<{
63
+ ok: boolean;
64
+ latencyMs: number;
65
+ error?: string;
66
+ details?: Record<string, unknown>;
67
+ }>;
68
+ getConnectionMetadata(): Record<string, string>;
69
+ }
@@ -1,5 +1,10 @@
1
1
  import { BaseStorageAdapter } from './BaseStorageAdapter.js';
2
2
  import { StorageConfig } from './types.js';
3
+ import type { GoogleDriveRuntimeAuthOptions } from './GoogleDriveOAuth.js';
4
+ export interface StorageAdapterRuntimeOptions {
5
+ /** Server-only OAuth dependencies; never include these in persisted connection JSON. */
6
+ googleDrive?: GoogleDriveRuntimeAuthOptions;
7
+ }
3
8
  export declare class StorageAdapterFactory {
4
- static create(config: StorageConfig): BaseStorageAdapter;
9
+ static create(config: StorageConfig, runtimeOptions?: StorageAdapterRuntimeOptions): BaseStorageAdapter;
5
10
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Canonical Google SDK boundary for storage integrations.
3
+ *
4
+ * This stable local module lets unit tests replace Google OAuth and Drive
5
+ * calls without requiring network credentials or reaching Google's API.
6
+ */
7
+ export { google } from '@dinilmusick/gutts/storage';
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  GOOGLE_DRIVE_FILE_SCOPE,
3
+ GOOGLE_DRIVE_STORAGE_SCOPE,
3
4
  createGoogleDriveAuthorizationUrl,
4
5
  exchangeGoogleDriveCode,
5
6
  refreshGoogleDriveAccessToken
6
- } from "../chunk-GZD5A54P.js";
7
+ } from "../chunk-3S2NSIFA.js";
7
8
  import {
8
9
  BackblazeB2Adapter,
9
10
  BucketStorageService,
@@ -19,7 +20,7 @@ import {
19
20
  permanentDeleteS3Object,
20
21
  renameS3Folder,
21
22
  resolveBackblazeEndpoint
22
- } from "../chunk-3W4TN6XB.js";
23
+ } from "../chunk-FU6TYLI2.js";
23
24
  import {
24
25
  authorizeB2,
25
26
  b2DownloadFile,
@@ -30,12 +31,13 @@ import {
30
31
  import {
31
32
  BaseStorageAdapter,
32
33
  GoogleDriveAdapter
33
- } from "../chunk-52M4L74T.js";
34
+ } from "../chunk-KPZQUA7R.js";
34
35
  export {
35
36
  BackblazeB2Adapter,
36
37
  BaseStorageAdapter,
37
38
  BucketStorageService,
38
39
  GOOGLE_DRIVE_FILE_SCOPE,
40
+ GOOGLE_DRIVE_STORAGE_SCOPE,
39
41
  GoogleDriveAdapter,
40
42
  GoogleDriveStorageService,
41
43
  LocalFSAdapter,
@@ -19,6 +19,8 @@ export interface StorageConfig {
19
19
  accountId?: string;
20
20
  googleClientId?: string;
21
21
  googleRedirectUri?: string;
22
+ /** Stable Google account subject/email identifier for server-side ownership association. */
23
+ googleAccountId?: string;
22
24
  googleAccessToken?: string;
23
25
  googleAccessTokenExpiresAt?: number;
24
26
  googleRefreshToken?: string;
@@ -29,6 +31,17 @@ export interface FileInfo {
29
31
  size: number;
30
32
  modifiedAt: number;
31
33
  contentHash?: string;
34
+ /** Provider-native identifier; populated by providers that expose stable IDs. */
35
+ id?: string;
36
+ mimeType?: string;
37
+ isFolder?: boolean;
38
+ }
39
+ export interface GoogleDriveFolder {
40
+ id: string;
41
+ name: string;
42
+ mimeType: 'application/vnd.google-apps.folder';
43
+ parentIds: string[];
44
+ modifiedAt: number;
32
45
  }
33
46
  export interface UploadResult {
34
47
  path: string;
@@ -0,0 +1,2 @@
1
+ export { GOOGLE_DRIVE_WORKSPACE_SCOPE, GoogleDriveWorkspaceService, } from './storage/GoogleDriveWorkspaceService.js';
2
+ export type { GoogleDriveWorkspaceFolder, GoogleDriveWorkspaceOptions, GoogleDriveWorkspaceTokens, } from './storage/GoogleDriveWorkspaceService.js';