@ultrst-armada/kloks 3.0.0 → 3.0.2

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 (33) hide show
  1. package/.krusbl-release-attestation.json +3 -3
  2. package/package.json +1 -1
  3. package/packages/backend/dist/auth/index.js +1 -1
  4. package/packages/backend/dist/{chunk-UI7AYFAU.js → chunk-363J52AF.js} +0 -48
  5. package/packages/backend/dist/{chunk-GCVR257U.js → chunk-3SDRLTD6.js} +1 -1
  6. package/packages/backend/dist/{chunk-2SNWR4FI.js → chunk-6HGO6CUT.js} +3 -1
  7. package/packages/backend/dist/chunk-7HD7OEUY.js +177 -0
  8. package/packages/backend/dist/chunk-B5DCG4UC.js +602 -0
  9. package/packages/backend/dist/{chunk-7XTURV44.js → chunk-F7BO3GLA.js} +2 -2
  10. package/packages/backend/dist/{chunk-RHW75K46.js → chunk-IAW6N73D.js} +49 -1
  11. package/packages/backend/dist/{chunk-IRKJ6HKP.js → chunk-IXEKOWY4.js} +1 -1
  12. package/packages/backend/dist/{chunk-4X4QGVAO.js → chunk-NRW4TECO.js} +1 -1
  13. package/packages/backend/dist/{chunk-3ZL2DX73.js → chunk-PAU25K7F.js} +5 -172
  14. package/packages/backend/dist/{chunk-NUBA6A5T.js → chunk-VN2NR3KT.js} +1 -1
  15. package/packages/backend/dist/{chunk-B6BQPDJE.js → chunk-YFISFDBW.js} +5 -5
  16. package/packages/backend/dist/index.js +7 -7
  17. package/packages/backend/dist/krnl-services.js +6 -5
  18. package/packages/backend/dist/node.js +20 -11
  19. package/packages/backend/dist/provider-services/index.js +7 -7
  20. package/packages/backend/dist/provider-services/node.d.ts +2 -0
  21. package/packages/backend/dist/provider-services/node.js +15 -4
  22. package/packages/backend/dist/provider-services/saved-account-crypto.d.ts +19 -0
  23. package/packages/backend/dist/provider-services/saved-account-probe.d.ts +26 -0
  24. package/packages/backend/dist/provider-services/saved-account-store.d.ts +29 -0
  25. package/packages/backend/dist/provider-services/saved-account-store.test.d.ts +1 -0
  26. package/packages/backend/dist/services/node.js +5 -4
  27. package/packages/backend/dist/srkl/index.js +3 -2
  28. package/packages/backend/dist/workspace/node.js +5 -4
  29. package/packages/backend/dist/{workspaceFileCore-XPT6WTFY.js → workspaceFileCore-2KCVSECY.js} +3 -2
  30. package/packages/state-graph/dist/browser.js +16 -16
  31. package/packages/state-graph/dist/index.js +16 -16
  32. package/packages/backend/dist/chunk-U5VPYALB.js +0 -261
  33. package/packages/state-graph/dist/{chunk-UKTICGGV.js → chunk-YUJC367F.js} +3 -3
@@ -1,3 +1,8 @@
1
+ import {
2
+ getGoogleDriveOAuthConfiguration,
3
+ getOrCreateStorageConnectionEncryptionKey,
4
+ getStorageConnectionEncryptionKey
5
+ } from "./chunk-7HD7OEUY.js";
1
6
  import {
2
7
  queryUnifiedDb
3
8
  } from "./chunk-3RTRATDJ.js";
@@ -9,178 +14,6 @@ import {
9
14
  GoogleDriveWorkspaceService
10
15
  } from "./chunk-EMSSTOOK.js";
11
16
 
12
- // src/core/systemCredentialsCore.ts
13
- function parseCredentials(value) {
14
- if (typeof value === "string") {
15
- try {
16
- const parsed = JSON.parse(value);
17
- return parsed && typeof parsed === "object" ? parsed : {};
18
- } catch {
19
- return {};
20
- }
21
- }
22
- return value && typeof value === "object" ? value : {};
23
- }
24
- async function readSystemCredentialsRecord(queryDb, targetId = "system") {
25
- const result = await queryDb(
26
- 'SELECT id, credentials, created_at, updated_at FROM public."ultrst-credentials" WHERE id = $1 LIMIT 1',
27
- [targetId]
28
- );
29
- const row = result.rows[0];
30
- if (!row) return { id: targetId, credentials: {} };
31
- return {
32
- id: String(row.id || targetId),
33
- credentials: parseCredentials(row.credentials),
34
- ...row.created_at ? { created_at: new Date(row.created_at).toISOString() } : {},
35
- ...row.updated_at ? { updated_at: new Date(row.updated_at).toISOString() } : {}
36
- };
37
- }
38
- async function getSystemCredentialsRecord(queryDb, targetId = "system") {
39
- await queryDb(`
40
- CREATE TABLE IF NOT EXISTS public."ultrst-credentials" (
41
- id TEXT PRIMARY KEY,
42
- credentials JSONB NOT NULL DEFAULT '{}'::jsonb,
43
- created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
44
- updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
45
- )
46
- `);
47
- await queryDb(`
48
- ALTER TABLE public."ultrst-credentials"
49
- ADD COLUMN IF NOT EXISTS credentials JSONB NOT NULL DEFAULT '{}'::jsonb
50
- `);
51
- await queryDb(`
52
- INSERT INTO public."ultrst-credentials" (id, credentials)
53
- VALUES ($1, '{}'::jsonb)
54
- ON CONFLICT (id) DO NOTHING
55
- `, [targetId]);
56
- const result = await queryDb(
57
- 'SELECT id, credentials, created_at, updated_at FROM public."ultrst-credentials" WHERE id = $1 LIMIT 1',
58
- [targetId]
59
- );
60
- const row = result.rows[0];
61
- if (!row) return { id: targetId, credentials: {} };
62
- return {
63
- id: String(row.id || targetId),
64
- credentials: parseCredentials(row.credentials),
65
- ...row.created_at ? { created_at: new Date(row.created_at).toISOString() } : {},
66
- ...row.updated_at ? { updated_at: new Date(row.updated_at).toISOString() } : {}
67
- };
68
- }
69
- async function getGoogleDriveOAuthConfiguration(queryDb) {
70
- const record = await getSystemCredentialsRecord(queryDb, "system");
71
- const root = record.credentials || {};
72
- const oauth = root.googleDriveOAuth || root.googleOAuth || {};
73
- const clientId = typeof oauth.clientId === "string" ? oauth.clientId.trim() : "";
74
- const clientSecret = typeof oauth.clientSecret === "string" ? oauth.clientSecret.trim() : "";
75
- const redirectUri = typeof oauth.redirectUri === "string" ? oauth.redirectUri.trim() : "";
76
- const stateSecret = typeof oauth.stateSecret === "string" ? oauth.stateSecret.trim() : "";
77
- const missing = [];
78
- if (!clientId) missing.push("client ID");
79
- if (!clientSecret) missing.push("client secret");
80
- if (!redirectUri) missing.push("redirect URI");
81
- if (!stateSecret || stateSecret.length < 32) missing.push("OAuth state signing secret (minimum 32 characters)");
82
- if (missing.length) {
83
- throw new Error(
84
- `[STORAGE_PROVIDER_CONFIGURATION_MISSING] Google Drive OAuth system configuration is incomplete: ${missing.join(", ")}. Configure system.ultrst-credentials.googleDriveOAuth.`
85
- );
86
- }
87
- let parsedRedirect;
88
- try {
89
- parsedRedirect = new URL(redirectUri);
90
- } catch {
91
- throw new Error("[STORAGE_PROVIDER_CONFIGURATION_INVALID] Google Drive OAuth redirect URI must be an absolute URL.");
92
- }
93
- if (parsedRedirect.protocol !== "https:" && parsedRedirect.hostname !== "localhost") {
94
- throw new Error("[STORAGE_PROVIDER_CONFIGURATION_INVALID] Google Drive OAuth redirect URI must use HTTPS (localhost is allowed for development).");
95
- }
96
- const allowedReturnOrigins = Array.isArray(oauth.allowedReturnOrigins) ? oauth.allowedReturnOrigins.flatMap((value) => {
97
- if (typeof value !== "string") return [];
98
- try {
99
- const url = new URL(value.trim());
100
- if (url.protocol !== "https:" && url.hostname !== "localhost") return [];
101
- return [url.origin];
102
- } catch {
103
- return [];
104
- }
105
- }) : [];
106
- return { clientId, clientSecret, redirectUri, stateSecret, allowedReturnOrigins };
107
- }
108
- function decodeStorageEncryptionKey(value) {
109
- if (!/^[A-Za-z0-9_-]{43}$/.test(value)) {
110
- throw new Error("[STORAGE_SECRET_CONFIGURATION_INVALID] The canonical storage encryption key is malformed.");
111
- }
112
- const base64 = value.replace(/-/g, "+").replace(/_/g, "/").padEnd(44, "=");
113
- let binary;
114
- try {
115
- binary = atob(base64);
116
- } catch {
117
- throw new Error("[STORAGE_SECRET_CONFIGURATION_INVALID] The canonical storage encryption key is malformed.");
118
- }
119
- const bytes = Uint8Array.from(binary, (character) => character.charCodeAt(0));
120
- if (bytes.length !== 32) {
121
- throw new Error("[STORAGE_SECRET_CONFIGURATION_INVALID] The canonical storage encryption key must decode to exactly 32 bytes.");
122
- }
123
- return bytes;
124
- }
125
- async function getStorageConnectionEncryptionKey(queryDb) {
126
- const record = await readSystemCredentialsRecord(queryDb, "system");
127
- const storage = record.credentials?.storageConnections && typeof record.credentials.storageConnections === "object" ? record.credentials.storageConnections : {};
128
- const current = typeof storage.encryptionKey === "string" ? storage.encryptionKey.trim() : "";
129
- if (!current) {
130
- throw new Error("[STORAGE_SECRET_CONFIGURATION_MISSING] The system-owned storage encryption key is missing; encrypted user connections were not modified.");
131
- }
132
- decodeStorageEncryptionKey(current);
133
- const version = storage.encryptionKeyVersion == null ? 1 : Number(storage.encryptionKeyVersion);
134
- if (version !== 1) {
135
- throw new Error("[STORAGE_SECRET_CONFIGURATION_UNSUPPORTED] The canonical storage encryption key version is not supported.");
136
- }
137
- return current;
138
- }
139
- async function getOrCreateStorageConnectionEncryptionKey(queryDb) {
140
- const record = await getSystemCredentialsRecord(queryDb, "system");
141
- const root = record.credentials || {};
142
- const storage = root.storageConnections && typeof root.storageConnections === "object" ? root.storageConnections : {};
143
- const current = typeof storage.encryptionKey === "string" ? storage.encryptionKey.trim() : "";
144
- if (current) {
145
- decodeStorageEncryptionKey(current);
146
- const version2 = storage.encryptionKeyVersion == null ? 1 : Number(storage.encryptionKeyVersion);
147
- if (version2 !== 1) {
148
- throw new Error("[STORAGE_SECRET_CONFIGURATION_UNSUPPORTED] The canonical storage encryption key version is not supported.");
149
- }
150
- return current;
151
- }
152
- const bytes = crypto.getRandomValues(new Uint8Array(32));
153
- let binary = "";
154
- for (const byte of bytes) binary += String.fromCharCode(byte);
155
- const generated = btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
156
- decodeStorageEncryptionKey(generated);
157
- await queryDb(
158
- `UPDATE public."ultrst-credentials"
159
- SET credentials = jsonb_set(
160
- COALESCE(credentials, '{}'::jsonb),
161
- '{storageConnections}',
162
- COALESCE(credentials->'storageConnections', '{}'::jsonb)
163
- || jsonb_build_object('encryptionKey', $1::text, 'encryptionKeyVersion', 1),
164
- true
165
- ),
166
- updated_at = NOW()
167
- WHERE id = $2
168
- AND NULLIF(credentials #>> '{storageConnections,encryptionKey}', '') IS NULL`,
169
- [generated, "system"]
170
- );
171
- const refreshed = await getSystemCredentialsRecord(queryDb, "system");
172
- const persisted = typeof refreshed.credentials?.storageConnections?.encryptionKey === "string" ? refreshed.credentials.storageConnections.encryptionKey.trim() : "";
173
- if (!persisted) {
174
- throw new Error("[STORAGE_SECRET_CONFIGURATION_UNAVAILABLE] Unable to resolve the canonical storage encryption key.");
175
- }
176
- decodeStorageEncryptionKey(persisted);
177
- const version = refreshed.credentials.storageConnections.encryptionKeyVersion == null ? 1 : Number(refreshed.credentials.storageConnections.encryptionKeyVersion);
178
- if (version !== 1) {
179
- throw new Error("[STORAGE_SECRET_CONFIGURATION_UNSUPPORTED] The canonical storage encryption key version is not supported.");
180
- }
181
- return persisted;
182
- }
183
-
184
17
  // src/core/storageConnectionCore.ts
185
18
  var DEFAULT_QUERY = (sql, params) => queryUnifiedDb(sql, params);
186
19
  var PUBLIC_FIELDS = [
@@ -10,7 +10,7 @@ import {
10
10
  findUserWorkspace,
11
11
  getWorkspaces,
12
12
  updateWorkspace
13
- } from "./chunk-7XTURV44.js";
13
+ } from "./chunk-F7BO3GLA.js";
14
14
  import {
15
15
  queryUnifiedDb
16
16
  } from "./chunk-3RTRATDJ.js";
@@ -8,18 +8,18 @@ import {
8
8
  findUserWorkspace,
9
9
  getWorkspaces,
10
10
  updateWorkspace
11
- } from "./chunk-7XTURV44.js";
11
+ } from "./chunk-F7BO3GLA.js";
12
12
  import {
13
13
  deleteWorkspaceFile,
14
14
  listWorkspaceFiles,
15
15
  readWorkspaceFile,
16
16
  writeWorkspaceFile
17
- } from "./chunk-GCVR257U.js";
17
+ } from "./chunk-3SDRLTD6.js";
18
18
  import {
19
19
  getPrimarySrklDeploymentUrl,
20
20
  getSrklAccounts,
21
21
  srklListBackblazeBuckets
22
- } from "./chunk-IRKJ6HKP.js";
22
+ } from "./chunk-IXEKOWY4.js";
23
23
  import {
24
24
  completeGoogleDriveAuthorization,
25
25
  createBackblazeStorageConnection,
@@ -42,7 +42,7 @@ import {
42
42
  testBackblazeCredentials,
43
43
  testGoogleDriveConnectionForUser,
44
44
  writeGoogleDriveFileForConnection
45
- } from "./chunk-3ZL2DX73.js";
45
+ } from "./chunk-PAU25K7F.js";
46
46
  import {
47
47
  queryUnifiedDb
48
48
  } from "./chunk-3RTRATDJ.js";
@@ -392,7 +392,7 @@ async function listUserWorkspaceStorageFiles(input) {
392
392
  }
393
393
  async function deleteUserWorkspaceStorageFolder(input) {
394
394
  const context = await resolveWorkspaceContext(input, makeQuery(input.env));
395
- const { deleteWorkspaceFolder } = await import("./workspaceFileCore-XPT6WTFY.js");
395
+ const { deleteWorkspaceFolder } = await import("./workspaceFileCore-2KCVSECY.js");
396
396
  await deleteWorkspaceFolder(context.workspace, context.connection, input.env);
397
397
  }
398
398
 
@@ -6,18 +6,14 @@ import {
6
6
  calculateProviderCapacity,
7
7
  createFlyMachine,
8
8
  getFlyMachine,
9
- getRailwayAccount,
10
9
  invokeFlyMachineHttp,
11
- listFlyApps,
12
10
  listFlyMachines,
13
- listGoogleCloudRunServices,
14
- listRenderServices,
15
11
  mutateFlyMachine,
16
12
  rankComputeRoutes,
17
13
  resolveComputeSpec,
18
14
  selectComputeRoute,
19
15
  validateComputeSpec
20
- } from "./chunk-UI7AYFAU.js";
16
+ } from "./chunk-363J52AF.js";
21
17
  import "./chunk-DAG2L4RN.js";
22
18
  import {
23
19
  isSecretMasked,
@@ -32,8 +28,12 @@ import {
32
28
  } from "./chunk-CDRHYO44.js";
33
29
  import {
34
30
  fetchCloudflareCapacity,
35
- fetchVercelCapacity
36
- } from "./chunk-RHW75K46.js";
31
+ fetchVercelCapacity,
32
+ getRailwayAccount,
33
+ listFlyApps,
34
+ listGoogleCloudRunServices,
35
+ listRenderServices
36
+ } from "./chunk-IAW6N73D.js";
37
37
  import {
38
38
  getGeminiQuotaStatus,
39
39
  listGeminiModels
@@ -27,12 +27,13 @@ import {
27
27
  krnlStorageServiceFacade,
28
28
  krnlWorkspaceServiceDefinition,
29
29
  krnlWorkspaceServiceFacade
30
- } from "./chunk-B6BQPDJE.js";
30
+ } from "./chunk-YFISFDBW.js";
31
31
  import "./chunk-FZKBTF34.js";
32
- import "./chunk-7XTURV44.js";
33
- import "./chunk-GCVR257U.js";
34
- import "./chunk-IRKJ6HKP.js";
35
- import "./chunk-3ZL2DX73.js";
32
+ import "./chunk-F7BO3GLA.js";
33
+ import "./chunk-3SDRLTD6.js";
34
+ import "./chunk-IXEKOWY4.js";
35
+ import "./chunk-PAU25K7F.js";
36
+ import "./chunk-7HD7OEUY.js";
36
37
  import "./chunk-3RTRATDJ.js";
37
38
  import "./chunk-I6T64MLT.js";
38
39
  import "./chunk-IP6XWQU2.js";
@@ -12,7 +12,7 @@ import {
12
12
  setWorkingWorkspaceConfig,
13
13
  syncWorkspace,
14
14
  workingWorkspaceService
15
- } from "./chunk-NUBA6A5T.js";
15
+ } from "./chunk-VN2NR3KT.js";
16
16
  import {
17
17
  CompositeBackend,
18
18
  EndpointGenerator,
@@ -27,7 +27,7 @@ import {
27
27
  parseGraphJsonFile,
28
28
  validateGraphDocument,
29
29
  workspaceGraphService
30
- } from "./chunk-4X4QGVAO.js";
30
+ } from "./chunk-NRW4TECO.js";
31
31
  import {
32
32
  CANONICAL_SRKL_URL,
33
33
  SrklClient,
@@ -80,8 +80,12 @@ import {
80
80
  GitLabProviderService,
81
81
  GoogleAccountProviderService,
82
82
  GoogleDriveProviderService,
83
- VercelProviderService
84
- } from "./chunk-U5VPYALB.js";
83
+ VercelProviderService,
84
+ listSavedProviderAccounts,
85
+ readSavedProviderAccount,
86
+ revokeSavedProviderAccount,
87
+ saveVerifiedProviderAccount
88
+ } from "./chunk-B5DCG4UC.js";
85
89
  import {
86
90
  CanonicalStorageProviderService
87
91
  } from "./chunk-GZTZ376X.js";
@@ -93,7 +97,7 @@ import {
93
97
  import {
94
98
  createCanonicalApplicationOAuthBff,
95
99
  createOAuthBff
96
- } from "./chunk-2SNWR4FI.js";
100
+ } from "./chunk-6HGO6CUT.js";
97
101
  import {
98
102
  BackendProvider,
99
103
  useBackend,
@@ -111,7 +115,7 @@ import {
111
115
  import {
112
116
  WorkspaceCloneSyncEngine
113
117
  } from "./chunk-CDRHYO44.js";
114
- import "./chunk-RHW75K46.js";
118
+ import "./chunk-IAW6N73D.js";
115
119
  import "./chunk-GIUAFRAA.js";
116
120
  import "./chunk-LAKCKX3I.js";
117
121
  import "./chunk-LPM5E2A2.js";
@@ -227,7 +231,7 @@ import {
227
231
  readUserWorkspaceStorageFile,
228
232
  verifyGoogleDriveAuthorizationState,
229
233
  writeUserWorkspaceStorageFile
230
- } from "./chunk-B6BQPDJE.js";
234
+ } from "./chunk-YFISFDBW.js";
231
235
  import {
232
236
  formatCanonicalWorkspaceFolderName,
233
237
  sanitizeWorkspaceName
@@ -246,7 +250,7 @@ import {
246
250
  syncWorkspaceDataToBucket,
247
251
  syncWorkspaceDeleteToBucket,
248
252
  updateWorkspace
249
- } from "./chunk-7XTURV44.js";
253
+ } from "./chunk-F7BO3GLA.js";
250
254
  import {
251
255
  configureLocalWorkspaceFileAdapter,
252
256
  deleteWorkspaceFile,
@@ -258,12 +262,12 @@ import {
258
262
  normalizeWorkspaceStoragePath,
259
263
  readWorkspaceFile,
260
264
  writeWorkspaceFile
261
- } from "./chunk-GCVR257U.js";
265
+ } from "./chunk-3SDRLTD6.js";
262
266
  import {
263
267
  getPrimarySrklDeploymentUrl,
264
268
  getSrklAccounts,
265
269
  srklListBackblazeBuckets
266
- } from "./chunk-IRKJ6HKP.js";
270
+ } from "./chunk-IXEKOWY4.js";
267
271
  import {
268
272
  completeGoogleDriveAuthorization,
269
273
  createBackblazeStorageConnection,
@@ -288,7 +292,8 @@ import {
288
292
  testGoogleDriveConnectionForUser,
289
293
  toPublicStorageConnection,
290
294
  writeGoogleDriveFileForConnection
291
- } from "./chunk-3ZL2DX73.js";
295
+ } from "./chunk-PAU25K7F.js";
296
+ import "./chunk-7HD7OEUY.js";
292
297
  import {
293
298
  cleanDbUrl,
294
299
  configureUnifiedDatabaseEnvironmentResolver,
@@ -4787,6 +4792,7 @@ export {
4787
4792
  listGoogleDriveFoldersForConnection,
4788
4793
  listProjectSamples,
4789
4794
  listProviders,
4795
+ listSavedProviderAccounts,
4790
4796
  listUserStorageConnections,
4791
4797
  listUserStorageConnectionsWithSecrets,
4792
4798
  listUserWorkspaceStorageFiles,
@@ -4814,6 +4820,7 @@ export {
4814
4820
  persistGoogleDriveTokens,
4815
4821
  queryUnifiedDb,
4816
4822
  readGoogleDriveFileForConnection,
4823
+ readSavedProviderAccount,
4817
4824
  readUserWorkspaceStorageFile,
4818
4825
  readWorkspaceFile,
4819
4826
  recordExecution,
@@ -4832,6 +4839,7 @@ export {
4832
4839
  resolveWorkspaceDir,
4833
4840
  resumeCloudflarePagesProject,
4834
4841
  resumeVercelProject,
4842
+ revokeSavedProviderAccount,
4835
4843
  sanitizeWorkspaceName,
4836
4844
  saveAssetToGraph,
4837
4845
  saveAssetToPool,
@@ -4840,6 +4848,7 @@ export {
4840
4848
  saveGraphPackage,
4841
4849
  saveProject,
4842
4850
  saveProjectSample,
4851
+ saveVerifiedProviderAccount,
4843
4852
  saveWorkspaceData,
4844
4853
  saveWorkspaceGraph,
4845
4854
  scanAssetPool,
@@ -3,22 +3,22 @@ import {
3
3
  calculateProviderCapacity,
4
4
  createFlyMachine,
5
5
  getFlyMachine,
6
- getRailwayAccount,
7
6
  invokeFlyMachineHttp,
8
- listFlyApps,
9
7
  listFlyMachines,
10
- listGoogleCloudRunServices,
11
- listRenderServices,
12
8
  mutateFlyMachine,
13
9
  rankComputeRoutes,
14
10
  resolveComputeSpec,
15
11
  selectComputeRoute,
16
12
  validateComputeSpec
17
- } from "../chunk-UI7AYFAU.js";
13
+ } from "../chunk-363J52AF.js";
18
14
  import {
19
15
  fetchCloudflareCapacity,
20
- fetchVercelCapacity
21
- } from "../chunk-RHW75K46.js";
16
+ fetchVercelCapacity,
17
+ getRailwayAccount,
18
+ listFlyApps,
19
+ listGoogleCloudRunServices,
20
+ listRenderServices
21
+ } from "../chunk-IAW6N73D.js";
22
22
  import {
23
23
  getGeminiQuotaStatus,
24
24
  listGeminiModels
@@ -2,3 +2,5 @@
2
2
  export * from './facades.js';
3
3
  export * from './storage-facades.js';
4
4
  export * from './storage-node.js';
5
+ export { saveVerifiedProviderAccount, listSavedProviderAccounts, readSavedProviderAccount, revokeSavedProviderAccount, } from './saved-account-store.js';
6
+ export type { PublicSavedProviderAccount, ProviderAccountQuery, } from './saved-account-store.js';
@@ -7,12 +7,16 @@ import {
7
7
  GitLabProviderService,
8
8
  GoogleAccountProviderService,
9
9
  GoogleDriveProviderService,
10
- VercelProviderService
11
- } from "../chunk-U5VPYALB.js";
10
+ VercelProviderService,
11
+ listSavedProviderAccounts,
12
+ readSavedProviderAccount,
13
+ revokeSavedProviderAccount,
14
+ saveVerifiedProviderAccount
15
+ } from "../chunk-B5DCG4UC.js";
12
16
  import {
13
17
  CanonicalStorageProviderService
14
18
  } from "../chunk-GZTZ376X.js";
15
- import "../chunk-RHW75K46.js";
19
+ import "../chunk-IAW6N73D.js";
16
20
  import "../chunk-GIUAFRAA.js";
17
21
  import "../chunk-LAKCKX3I.js";
18
22
  import "../chunk-LPM5E2A2.js";
@@ -24,7 +28,10 @@ import "../chunk-CTBVXX5C.js";
24
28
  import "../chunk-HJE4CVKY.js";
25
29
  import "../chunk-MQ6AHJ6X.js";
26
30
  import "../chunk-G6FLQJS6.js";
31
+ import "../chunk-7HD7OEUY.js";
32
+ import "../chunk-3RTRATDJ.js";
27
33
  import "../chunk-I6T64MLT.js";
34
+ import "../chunk-IP6XWQU2.js";
28
35
  import "../chunk-EMSSTOOK.js";
29
36
  export {
30
37
  BackblazeB2ProviderService,
@@ -36,5 +43,9 @@ export {
36
43
  GitLabProviderService,
37
44
  GoogleAccountProviderService,
38
45
  GoogleDriveProviderService,
39
- VercelProviderService
46
+ VercelProviderService,
47
+ listSavedProviderAccounts,
48
+ readSavedProviderAccount,
49
+ revokeSavedProviderAccount,
50
+ saveVerifiedProviderAccount
40
51
  };
@@ -0,0 +1,19 @@
1
+ /** Server-only AEAD. The canonical system-owned wrapping key remains in Kloks. */
2
+ export interface ProviderSecretEnvelope {
3
+ version: 1;
4
+ algorithm: 'AES-GCM-256';
5
+ iv: string;
6
+ ciphertext: string;
7
+ }
8
+ export interface BoundSecret {
9
+ ownerUserId: string;
10
+ workspaceId: string;
11
+ id: string;
12
+ providerId: string;
13
+ resourceKind: string;
14
+ accountScope: string;
15
+ projectId: string;
16
+ region: string;
17
+ }
18
+ export declare function encryptSavedCredential(secret: string, key: string, bound: BoundSecret): Promise<ProviderSecretEnvelope>;
19
+ export declare function decryptSavedCredential(envelope: ProviderSecretEnvelope, key: string, bound: BoundSecret): Promise<string>;
@@ -0,0 +1,26 @@
1
+ /** Do not add undocumented providers: this is the live API allowlist. */
2
+ export type SavedProviderId = 'cloudflare' | 'vercel' | 'fly' | 'railway' | 'render' | 'google-cloud-run';
3
+ export type SavedResourceKind = 'workers' | 'pages' | 'projects' | 'deployments' | 'apps' | 'services' | 'identity';
4
+ export interface SavedProviderInput {
5
+ providerId: SavedProviderId;
6
+ resourceKind: SavedResourceKind;
7
+ credential: string;
8
+ label?: string;
9
+ accountScope?: string;
10
+ projectId?: string;
11
+ region?: string;
12
+ }
13
+ export type ValidatedProviderInput = Required<SavedProviderInput>;
14
+ export interface ProviderInventory {
15
+ providerId: SavedProviderId;
16
+ resourceKind: SavedResourceKind;
17
+ resources: Array<{
18
+ id: string;
19
+ name: string;
20
+ }>;
21
+ complete: false;
22
+ checkedAt: string;
23
+ }
24
+ export declare function validateSavedProviderInput(value: unknown): ValidatedProviderInput;
25
+ /** A read proves only current access to this exact API page, not free quota. */
26
+ export declare function readProviderInventory(input: ValidatedProviderInput, transport?: typeof fetch): Promise<ProviderInventory>;
@@ -0,0 +1,29 @@
1
+ import type { SavedProviderInput, ProviderInventory } from './saved-account-probe.js';
2
+ type Result = {
3
+ rows: Array<Record<string, any>>;
4
+ };
5
+ export type ProviderAccountQuery = (sql: string, params?: unknown[]) => Promise<Result>;
6
+ export interface PublicSavedProviderAccount {
7
+ id: string;
8
+ workspaceId: string;
9
+ providerId: string;
10
+ resourceKind: string;
11
+ accountScope: string;
12
+ projectId: string;
13
+ region: string;
14
+ label: string;
15
+ enabled: boolean;
16
+ checkedAt: string;
17
+ createdAt: string;
18
+ }
19
+ export declare function saveVerifiedProviderAccount(ownerUserId: string, workspaceId: string, input: SavedProviderInput, options?: {
20
+ query?: ProviderAccountQuery;
21
+ transport?: typeof fetch;
22
+ }): Promise<PublicSavedProviderAccount>;
23
+ export declare function listSavedProviderAccounts(ownerUserId: string, workspaceId: string, query?: ProviderAccountQuery): Promise<PublicSavedProviderAccount[]>;
24
+ export declare function readSavedProviderAccount(ownerUserId: string, workspaceId: string, id: string, options?: {
25
+ query?: ProviderAccountQuery;
26
+ transport?: typeof fetch;
27
+ }): Promise<ProviderInventory>;
28
+ export declare function revokeSavedProviderAccount(ownerUserId: string, workspaceId: string, id: string, query?: ProviderAccountQuery): Promise<boolean>;
29
+ export {};
@@ -12,15 +12,16 @@ import {
12
12
  parseGraphJsonFile,
13
13
  validateGraphDocument,
14
14
  workspaceGraphService
15
- } from "../chunk-4X4QGVAO.js";
15
+ } from "../chunk-NRW4TECO.js";
16
16
  import "../chunk-AUNIGE6Q.js";
17
17
  import "../chunk-TRJVVNO7.js";
18
18
  import "../chunk-HUY4272L.js";
19
19
  import "../chunk-5Y7K7HAT.js";
20
20
  import "../chunk-LMY6MGFD.js";
21
- import "../chunk-7XTURV44.js";
22
- import "../chunk-GCVR257U.js";
23
- import "../chunk-3ZL2DX73.js";
21
+ import "../chunk-F7BO3GLA.js";
22
+ import "../chunk-3SDRLTD6.js";
23
+ import "../chunk-PAU25K7F.js";
24
+ import "../chunk-7HD7OEUY.js";
24
25
  import "../chunk-3RTRATDJ.js";
25
26
  import "../chunk-I6T64MLT.js";
26
27
  import "../chunk-IP6XWQU2.js";
@@ -15,8 +15,9 @@ import {
15
15
  getPrimarySrklDeploymentUrl,
16
16
  getSrklAccounts,
17
17
  srklListBackblazeBuckets
18
- } from "../chunk-IRKJ6HKP.js";
19
- import "../chunk-3ZL2DX73.js";
18
+ } from "../chunk-IXEKOWY4.js";
19
+ import "../chunk-PAU25K7F.js";
20
+ import "../chunk-7HD7OEUY.js";
20
21
  import "../chunk-3RTRATDJ.js";
21
22
  import "../chunk-I6T64MLT.js";
22
23
  import "../chunk-IP6XWQU2.js";
@@ -5,7 +5,7 @@ import {
5
5
  WorkspaceFS,
6
6
  remoteWorkspaceService,
7
7
  workingWorkspaceService
8
- } from "../chunk-NUBA6A5T.js";
8
+ } from "../chunk-VN2NR3KT.js";
9
9
  import "../chunk-TRJVVNO7.js";
10
10
  import "../chunk-LC6ULEM2.js";
11
11
  import "../chunk-5Y7K7HAT.js";
@@ -17,9 +17,10 @@ import {
17
17
  formatCanonicalWorkspaceFolderName,
18
18
  sanitizeWorkspaceName
19
19
  } from "../chunk-FZKBTF34.js";
20
- import "../chunk-7XTURV44.js";
21
- import "../chunk-GCVR257U.js";
22
- import "../chunk-3ZL2DX73.js";
20
+ import "../chunk-F7BO3GLA.js";
21
+ import "../chunk-3SDRLTD6.js";
22
+ import "../chunk-PAU25K7F.js";
23
+ import "../chunk-7HD7OEUY.js";
23
24
  import "../chunk-3RTRATDJ.js";
24
25
  import "../chunk-I6T64MLT.js";
25
26
  import "../chunk-IP6XWQU2.js";
@@ -9,8 +9,9 @@ import {
9
9
  normalizeWorkspaceStoragePath,
10
10
  readWorkspaceFile,
11
11
  writeWorkspaceFile
12
- } from "./chunk-GCVR257U.js";
13
- import "./chunk-3ZL2DX73.js";
12
+ } from "./chunk-3SDRLTD6.js";
13
+ import "./chunk-PAU25K7F.js";
14
+ import "./chunk-7HD7OEUY.js";
14
15
  import "./chunk-3RTRATDJ.js";
15
16
  import "./chunk-I6T64MLT.js";
16
17
  import "./chunk-IP6XWQU2.js";