@agent-native/core 0.207.1-nightly-20261012070747 → 0.207.1
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/dist/automation/index.d.ts +1 -1
- package/dist/client/action-query-cache.js +129 -5
- package/dist/client/use-action.d.ts +4 -1
- package/dist/client/use-action.js +19 -9
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/routes.d.ts +1 -1
- package/dist/file-upload/actions/get-file-storage.js +1 -1
- package/dist/file-upload/index.d.ts +1 -0
- package/dist/file-upload/index.js +1 -0
- package/dist/file-upload/storage-readiness.d.ts +8 -0
- package/dist/file-upload/storage-readiness.js +70 -0
- package/dist/file-upload/storage-settings.d.ts +3 -0
- package/dist/file-upload/storage-settings.js +4 -1
- package/dist/org/actions/offboard-member.d.ts +1 -1
- package/dist/org/index.d.ts +26 -64
- package/dist/private-blob/attachment-ref.d.ts +1 -0
- package/dist/private-blob/attachment-ref.js +3 -3
- package/dist/private-blob/index.d.ts +3 -2
- package/dist/private-blob/index.js +2 -2
- package/dist/private-blob/registry.d.ts +5 -0
- package/dist/private-blob/registry.js +17 -8
- package/dist/provider-api/actions/custom-provider-registration.d.ts +13 -13
- package/dist/provider-api/actions/provider-api.d.ts +13 -13
- package/dist/secrets/routes.d.ts +6 -6
- package/dist/server/agent-engine-default-model-route.d.ts +2 -2
- package/dist/server/core-routes-plugin.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/triggers/actions/manage-automation.d.ts +2 -2
- package/package.json +4 -4
|
@@ -139,8 +139,8 @@ export declare function createAutomationCallbackHandler(runtime: AutomationRunti
|
|
|
139
139
|
duplicate?: undefined;
|
|
140
140
|
eventId?: undefined;
|
|
141
141
|
} | {
|
|
142
|
+
error?: undefined;
|
|
142
143
|
accepted: boolean;
|
|
143
144
|
duplicate: boolean;
|
|
144
145
|
eventId: string;
|
|
145
|
-
error?: undefined;
|
|
146
146
|
}>;
|
|
@@ -5,7 +5,7 @@ import { clear as clearStore, createStore, del as deleteEntry, get as getEntry,
|
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
6
|
import { actionErrorStatus } from "./action-failure-circuit.js";
|
|
7
7
|
import { clientBuildId } from "./build-compatibility.js";
|
|
8
|
-
import { isBrowserPersistableActionQuery } from "./use-action.js";
|
|
8
|
+
import { isBrowserPersistableActionQuery, markRestoredBrowserPersistableActionQuery, revokeBrowserPersistableActionQuery, } from "./use-action.js";
|
|
9
9
|
import { useSession } from "./use-session.js";
|
|
10
10
|
// Bump when a cached result's shape or meaning changes. A record stored under
|
|
11
11
|
// another buster is discarded on restore instead of being hydrated.
|
|
@@ -65,6 +65,14 @@ function scopedPersister(scope) {
|
|
|
65
65
|
let latest;
|
|
66
66
|
let timer;
|
|
67
67
|
let restored = new Map();
|
|
68
|
+
let restoredSources = new Map();
|
|
69
|
+
let restoreAccepted = false;
|
|
70
|
+
let restoreRevision = 0;
|
|
71
|
+
const clearRestoredState = () => {
|
|
72
|
+
restoreAccepted = false;
|
|
73
|
+
restored = new Map();
|
|
74
|
+
restoredSources = new Map();
|
|
75
|
+
};
|
|
68
76
|
const flush = () => {
|
|
69
77
|
timer = undefined;
|
|
70
78
|
const next = latest;
|
|
@@ -83,25 +91,49 @@ function scopedPersister(scope) {
|
|
|
83
91
|
timer ??= setTimeout(flush, WRITE_DELAY_MS);
|
|
84
92
|
},
|
|
85
93
|
async restoreClient() {
|
|
94
|
+
clearRestoredState();
|
|
86
95
|
if (!open)
|
|
87
96
|
return undefined;
|
|
97
|
+
const revision = restoreRevision;
|
|
88
98
|
const stored = await storage.get(scope);
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
|
|
99
|
+
// A revoked record can still be in an outstanding storage read. Do not
|
|
100
|
+
// return it to the persister after discard, even if the read was started
|
|
101
|
+
// before the matching access-denied response.
|
|
102
|
+
const record = open && revision === restoreRevision ? withinMaxAge(stored) : undefined;
|
|
92
103
|
restored = new Map(record?.clientState.queries.map((query) => [
|
|
93
104
|
query.queryHash,
|
|
94
105
|
query.state.dataUpdatedAt,
|
|
95
106
|
]));
|
|
107
|
+
restoredSources = new Map(record?.clientState.queries.map((query) => [
|
|
108
|
+
query.queryHash,
|
|
109
|
+
{
|
|
110
|
+
dataUpdatedAt: query.state.dataUpdatedAt,
|
|
111
|
+
data: query.state.data,
|
|
112
|
+
queryKey: query.queryKey,
|
|
113
|
+
status: query.state.status,
|
|
114
|
+
},
|
|
115
|
+
]));
|
|
116
|
+
restoreAccepted =
|
|
117
|
+
open && revision === restoreRevision && record !== undefined;
|
|
96
118
|
return record;
|
|
97
119
|
},
|
|
98
120
|
restoredStates() {
|
|
99
121
|
return restored;
|
|
100
122
|
},
|
|
123
|
+
restoredSources() {
|
|
124
|
+
return restoredSources;
|
|
125
|
+
},
|
|
126
|
+
restoreWasAccepted() {
|
|
127
|
+
return open && restoreAccepted;
|
|
128
|
+
},
|
|
101
129
|
removeClient() {
|
|
130
|
+
restoreRevision += 1;
|
|
131
|
+
clearRestoredState();
|
|
102
132
|
return storage.del(scope);
|
|
103
133
|
},
|
|
104
134
|
discard() {
|
|
135
|
+
restoreRevision += 1;
|
|
136
|
+
clearRestoredState();
|
|
105
137
|
// A debounced write still holds the client as it was before the revoke,
|
|
106
138
|
// and would put the revoked result back after this delete.
|
|
107
139
|
latest = undefined;
|
|
@@ -113,6 +145,8 @@ function scopedPersister(scope) {
|
|
|
113
145
|
},
|
|
114
146
|
close() {
|
|
115
147
|
open = false;
|
|
148
|
+
restoreRevision += 1;
|
|
149
|
+
clearRestoredState();
|
|
116
150
|
latest = undefined;
|
|
117
151
|
clearTimeout(timer);
|
|
118
152
|
timer = undefined;
|
|
@@ -169,11 +203,66 @@ export async function bindActionQueryCache(client, scope) {
|
|
|
169
203
|
if (generation !== bindingGeneration)
|
|
170
204
|
return;
|
|
171
205
|
const persister = scopedPersister(scope);
|
|
206
|
+
let payloadMappingValid = true;
|
|
207
|
+
let deserializeIndex = 0;
|
|
208
|
+
const deserializedByHash = new Map();
|
|
209
|
+
let cachedSourceEntries;
|
|
210
|
+
const sourceEntries = () => {
|
|
211
|
+
cachedSourceEntries ??= [...persister.restoredSources()].filter(([, source]) => source.data !== undefined);
|
|
212
|
+
return cachedSourceEntries;
|
|
213
|
+
};
|
|
214
|
+
const clientHydrateOptions = client.getDefaultOptions().hydrate;
|
|
215
|
+
const clientDeserializeData = clientHydrateOptions?.deserializeData;
|
|
216
|
+
const hydrateOptions = {
|
|
217
|
+
defaultOptions: {
|
|
218
|
+
...clientHydrateOptions,
|
|
219
|
+
deserializeData: (data) => {
|
|
220
|
+
const result = clientDeserializeData
|
|
221
|
+
? clientDeserializeData(data)
|
|
222
|
+
: data;
|
|
223
|
+
const expected = sourceEntries()[deserializeIndex++];
|
|
224
|
+
if (!expected || !Object.is(expected[1].data, data)) {
|
|
225
|
+
payloadMappingValid = false;
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
deserializedByHash.set(expected[0], {
|
|
229
|
+
dataUpdatedAt: expected[1].dataUpdatedAt,
|
|
230
|
+
data: result,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return result;
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
const hydratedQueryHashes = new Set();
|
|
238
|
+
const unsubscribeHydration = client.getQueryCache().subscribe((event) => {
|
|
239
|
+
if (!persister.restoreWasAccepted())
|
|
240
|
+
return;
|
|
241
|
+
const hash = event.query.queryHash;
|
|
242
|
+
const source = persister.restoredSources().get(hash);
|
|
243
|
+
const deserialized = deserializedByHash.get(hash);
|
|
244
|
+
if (!source || !deserialized)
|
|
245
|
+
return;
|
|
246
|
+
// An unrelated local setState can happen while restore is pending. Count
|
|
247
|
+
// it only when its payload is the object produced by SDK deserialization.
|
|
248
|
+
const isHydratedState = (state) => state.status === source.status &&
|
|
249
|
+
state.dataUpdatedAt === source.dataUpdatedAt &&
|
|
250
|
+
Object.is(state.data, deserialized.data);
|
|
251
|
+
if (event.type === "added" && isHydratedState(event.query.state)) {
|
|
252
|
+
hydratedQueryHashes.add(hash);
|
|
253
|
+
}
|
|
254
|
+
else if (event.type === "updated" &&
|
|
255
|
+
event.action.type === "setState" &&
|
|
256
|
+
isHydratedState(event.action.state)) {
|
|
257
|
+
hydratedQueryHashes.add(hash);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
172
260
|
const [unsubscribe, restored] = persistQueryClient({
|
|
173
261
|
queryClient: client,
|
|
174
262
|
persister,
|
|
175
263
|
buster: ACTION_QUERY_CACHE_BUSTER,
|
|
176
264
|
maxAge: ACTION_QUERY_CACHE_MAX_AGE_MS,
|
|
265
|
+
hydrateOptions,
|
|
177
266
|
dehydrateOptions: {
|
|
178
267
|
shouldDehydrateQuery: isBrowserPersistableActionQuery,
|
|
179
268
|
// A mutation replayed from disk would look like a write that succeeded.
|
|
@@ -191,8 +280,10 @@ export async function bindActionQueryCache(client, scope) {
|
|
|
191
280
|
// The record may still hold this result from before the refetch. Only a
|
|
192
281
|
// successful query is dehydrated, so the rewrite after this error leaves
|
|
193
282
|
// it out.
|
|
194
|
-
if (status === 403 || status === 404)
|
|
283
|
+
if (status === 401 || status === 403 || status === 404) {
|
|
284
|
+
revokeBrowserPersistableActionQuery(event.query);
|
|
195
285
|
persister.discard();
|
|
286
|
+
}
|
|
196
287
|
});
|
|
197
288
|
binding = {
|
|
198
289
|
client,
|
|
@@ -200,8 +291,41 @@ export async function bindActionQueryCache(client, scope) {
|
|
|
200
291
|
unsubscribe: () => {
|
|
201
292
|
unsubscribe();
|
|
202
293
|
unsubscribeRevoked();
|
|
294
|
+
unsubscribeHydration();
|
|
203
295
|
},
|
|
204
296
|
};
|
|
297
|
+
const finishAcceptedRestore = () => {
|
|
298
|
+
const expectedDataCount = sourceEntries().length;
|
|
299
|
+
if (deserializeIndex !== expectedDataCount)
|
|
300
|
+
payloadMappingValid = false;
|
|
301
|
+
if (!payloadMappingValid ||
|
|
302
|
+
generation !== bindingGeneration ||
|
|
303
|
+
!persister.restoreWasAccepted()) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const restoredStates = persister.restoredStates();
|
|
307
|
+
const restoredSources = persister.restoredSources();
|
|
308
|
+
for (const query of client.getQueryCache().getAll()) {
|
|
309
|
+
const source = restoredSources.get(query.queryHash);
|
|
310
|
+
const deserialized = deserializedByHash.get(query.queryHash);
|
|
311
|
+
if (hydratedQueryHashes.has(query.queryHash) &&
|
|
312
|
+
source?.queryKey[0] === "action" &&
|
|
313
|
+
source.status === "success" &&
|
|
314
|
+
query.queryKey[0] === "action" &&
|
|
315
|
+
query.state.status === "success" &&
|
|
316
|
+
restoredStates.get(query.queryHash) === query.state.dataUpdatedAt &&
|
|
317
|
+
source.dataUpdatedAt === deserialized?.dataUpdatedAt &&
|
|
318
|
+
Object.is(query.state.data, deserialized?.data)) {
|
|
319
|
+
markRestoredBrowserPersistableActionQuery(query);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
// This runs after SDK hydration settles even if the UI's bounded wait has
|
|
324
|
+
// already released the app; a later scope generation cannot be authorized.
|
|
325
|
+
void restored.then(() => {
|
|
326
|
+
finishAcceptedRestore();
|
|
327
|
+
unsubscribeHydration();
|
|
328
|
+
}, () => unsubscribeHydration());
|
|
205
329
|
await waitForRestore(restored);
|
|
206
330
|
// A scope change during the restore can hydrate the old scope after the new
|
|
207
331
|
// one has started; drop those results before the new scope saves them. A
|
|
@@ -105,8 +105,11 @@ export declare function guardActionQueryRefetchInterval<TData = unknown>(refetch
|
|
|
105
105
|
export declare function resolveActionQueryRetry(retry: unknown, failureCount: number, error: unknown): boolean;
|
|
106
106
|
/** @internal exported for tests */
|
|
107
107
|
export declare function resetActionCircuitTripEventsForTests(): void;
|
|
108
|
-
/** @internal read by the persisted query cache
|
|
108
|
+
/** @internal read by the persisted query cache. */
|
|
109
109
|
export declare function isBrowserPersistableActionQuery(query: Query): boolean;
|
|
110
|
+
/** @internal used only after a persisted action result is accepted and hydrated. */
|
|
111
|
+
export declare function markRestoredBrowserPersistableActionQuery(query: Query): void;
|
|
112
|
+
export declare function revokeBrowserPersistableActionQuery(query: Query): void;
|
|
110
113
|
export declare function useActionQuery<TResult = undefined, TName extends ActionName = ActionName>(actionName: TName, params?: ActionParams<TName>, options?: Omit<UseQueryOptions<TResult extends undefined ? ActionResult<TName> : TResult>, "queryKey" | "queryFn"> & {
|
|
111
114
|
queryKeyScope?: readonly unknown[];
|
|
112
115
|
/**
|
|
@@ -774,13 +774,20 @@ function trackActionCircuitTrip(actionName, error, trip) {
|
|
|
774
774
|
// coercion-ok: telemetry must never change what the circuit does.
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
|
-
//
|
|
778
|
-
const
|
|
779
|
-
/** @internal read by the persisted query cache
|
|
777
|
+
// Identical keys in another client or auth scope must earn their own permission.
|
|
778
|
+
const browserPersistableActionQueries = new WeakSet();
|
|
779
|
+
/** @internal read by the persisted query cache. */
|
|
780
780
|
export function isBrowserPersistableActionQuery(query) {
|
|
781
781
|
return (query.queryKey[0] === "action" &&
|
|
782
782
|
query.state.status === "success" &&
|
|
783
|
-
|
|
783
|
+
browserPersistableActionQueries.has(query));
|
|
784
|
+
}
|
|
785
|
+
/** @internal used only after a persisted action result is accepted and hydrated. */
|
|
786
|
+
export function markRestoredBrowserPersistableActionQuery(query) {
|
|
787
|
+
browserPersistableActionQueries.add(query);
|
|
788
|
+
}
|
|
789
|
+
export function revokeBrowserPersistableActionQuery(query) {
|
|
790
|
+
browserPersistableActionQueries.delete(query);
|
|
784
791
|
}
|
|
785
792
|
export function useActionQuery(actionName, params, options) {
|
|
786
793
|
const apiDisabled = Boolean(agentNativeApiDisabledReason());
|
|
@@ -789,8 +796,9 @@ export function useActionQuery(actionName, params, options) {
|
|
|
789
796
|
const circuitKey = () => hashKey(queryKey);
|
|
790
797
|
return useQuery({
|
|
791
798
|
queryKey,
|
|
792
|
-
queryFn: async ({ signal }) => {
|
|
799
|
+
queryFn: async ({ signal, client }) => {
|
|
793
800
|
const key = circuitKey();
|
|
801
|
+
const query = client.getQueryCache().find({ queryKey, exact: true });
|
|
794
802
|
assertActionCircuitClosed(key);
|
|
795
803
|
let browserPersist = false;
|
|
796
804
|
const result = await actionFetch(actionName, "GET", params, {
|
|
@@ -802,10 +810,12 @@ export function useActionQuery(actionName, params, options) {
|
|
|
802
810
|
},
|
|
803
811
|
});
|
|
804
812
|
resetActionFailureCircuit(key);
|
|
805
|
-
if (
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
813
|
+
if (query && !signal.aborted) {
|
|
814
|
+
if (browserPersist)
|
|
815
|
+
browserPersistableActionQueries.add(query);
|
|
816
|
+
else
|
|
817
|
+
browserPersistableActionQueries.delete(query);
|
|
818
|
+
}
|
|
809
819
|
return result;
|
|
810
820
|
},
|
|
811
821
|
// The failure circuit counts fetch cycles, so a cycle is recorded where
|
|
@@ -38,19 +38,19 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
|
|
|
38
38
|
error: string;
|
|
39
39
|
states?: undefined;
|
|
40
40
|
} | {
|
|
41
|
+
error?: undefined;
|
|
41
42
|
states: {
|
|
42
43
|
clientId: number;
|
|
43
44
|
state: string;
|
|
44
45
|
}[];
|
|
45
|
-
error?: undefined;
|
|
46
46
|
}>>;
|
|
47
47
|
export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
48
48
|
error: string;
|
|
49
49
|
users?: undefined;
|
|
50
50
|
} | {
|
|
51
|
+
error?: undefined;
|
|
51
52
|
users: {
|
|
52
53
|
clientId: number;
|
|
53
54
|
lastSeen: number;
|
|
54
55
|
}[];
|
|
55
|
-
error?: undefined;
|
|
56
56
|
}>>;
|
package/dist/collab/routes.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
|
|
|
13
13
|
};
|
|
14
14
|
}>>;
|
|
15
15
|
export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
16
|
-
error: string;
|
|
17
16
|
ok?: undefined;
|
|
17
|
+
error: string;
|
|
18
18
|
} | {
|
|
19
19
|
error?: undefined;
|
|
20
20
|
ok: boolean;
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { defineAction } from "../../action.js";
|
|
3
3
|
import { getFileStorageStatus } from "../storage-settings.js";
|
|
4
4
|
export default defineAction({
|
|
5
|
-
description: "Read the workspace's S3-compatible file storage settings: whether they are complete, the inferred provider, the saved endpoint, bucket, region, and public URL (owners and admins only), which keys are saved, whether a public URL is required,
|
|
5
|
+
description: "Read the workspace's S3-compatible file storage settings: whether they are complete, the inferred provider, the saved endpoint, bucket, region, and public URL (owners and admins only), which keys are saved, whether a public URL is required, where new uploads go now, and whether private screenshot storage is ready in the selected storage context. Secret values are never returned.",
|
|
6
6
|
schema: z.object({}),
|
|
7
7
|
http: { method: "GET" },
|
|
8
8
|
run: async (_args, ctx) => getFileStorageStatus(ctx),
|
|
@@ -4,3 +4,4 @@ export { builderFileUploadProvider } from "./builder.js";
|
|
|
4
4
|
export { ensureS3FileUploadProvider, s3FileUploadProvider } from "./s3.js";
|
|
5
5
|
export { FILE_STORAGE_SECRET_KEYS, getFileStorageStatus, saveFileStorage, clearFileStorage, type FileStorageField, type FileStorageProviderId, type FileStorageStatus, type SaveFileStorageInput, } from "./storage-settings.js";
|
|
6
6
|
export { preUploadImageAttachments, preUploadAttachments, isFileUploadProviderConfigured, type PreUploadAttachmentsResult, type PreUploadedImageAttachment, type PreUploadedFileAttachment, } from "./pre-upload-attachments.js";
|
|
7
|
+
export { getPrivateStorageReadinessForRequest, getPrivateStorageReadinessForUser, type PrivateStorageReadinessStatus, } from "./storage-readiness.js";
|
|
@@ -3,3 +3,4 @@ export { builderFileUploadProvider } from "./builder.js";
|
|
|
3
3
|
export { ensureS3FileUploadProvider, s3FileUploadProvider } from "./s3.js";
|
|
4
4
|
export { FILE_STORAGE_SECRET_KEYS, getFileStorageStatus, saveFileStorage, clearFileStorage, } from "./storage-settings.js";
|
|
5
5
|
export { preUploadImageAttachments, preUploadAttachments, isFileUploadProviderConfigured, } from "./pre-upload-attachments.js";
|
|
6
|
+
export { getPrivateStorageReadinessForRequest, getPrivateStorageReadinessForUser, } from "./storage-readiness.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface PrivateStorageReadinessStatus {
|
|
2
|
+
selectedOrg: "selected" | "none" | "unavailable";
|
|
3
|
+
provider: "s3" | "builder" | "none" | "other" | "unavailable";
|
|
4
|
+
readiness: "ready" | "unavailable";
|
|
5
|
+
builderAuthorized: "yes" | "no" | "unavailable";
|
|
6
|
+
}
|
|
7
|
+
export declare function getPrivateStorageReadinessForRequest(): Promise<PrivateStorageReadinessStatus>;
|
|
8
|
+
export declare function getPrivateStorageReadinessForUser(userEmail: string | undefined): Promise<PrivateStorageReadinessStatus>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { resolveActiveOrgIdForStorageCredential } from "../org/index.js";
|
|
2
|
+
import { isAttachmentEncryptionKeyAvailable } from "../private-blob/attachment-ref.js";
|
|
3
|
+
import { getPrivateBlobStorageReadinessForRequest } from "../private-blob/registry.js";
|
|
4
|
+
import { canAuthorizeBuilderApiRequest } from "../server/builder-api-auth.js";
|
|
5
|
+
import { BUILDER_ASSETS_WRITE_SCOPE } from "../server/builder-oauth.js";
|
|
6
|
+
import { getRequestBuilderStorageCredentialOrgId, getRequestContext, runWithRequestContext, } from "../server/request-context.js";
|
|
7
|
+
const UNAVAILABLE_STATUS = {
|
|
8
|
+
selectedOrg: "unavailable",
|
|
9
|
+
provider: "unavailable",
|
|
10
|
+
readiness: "unavailable",
|
|
11
|
+
builderAuthorized: "unavailable",
|
|
12
|
+
};
|
|
13
|
+
function toProviderStatus(providerId) {
|
|
14
|
+
if (!providerId)
|
|
15
|
+
return "none";
|
|
16
|
+
if (providerId === "s3" || providerId === "builder")
|
|
17
|
+
return providerId;
|
|
18
|
+
return "other";
|
|
19
|
+
}
|
|
20
|
+
export async function getPrivateStorageReadinessForRequest() {
|
|
21
|
+
const context = getRequestContext();
|
|
22
|
+
const storageOrgId = getRequestBuilderStorageCredentialOrgId();
|
|
23
|
+
if (!context?.userEmail?.trim() ||
|
|
24
|
+
context.orgScope !== "personal" ||
|
|
25
|
+
!Object.prototype.hasOwnProperty.call(context, "orgId") ||
|
|
26
|
+
context.orgId !== undefined ||
|
|
27
|
+
storageOrgId === undefined ||
|
|
28
|
+
(typeof storageOrgId === "string" && !storageOrgId.trim())) {
|
|
29
|
+
return UNAVAILABLE_STATUS;
|
|
30
|
+
}
|
|
31
|
+
const [storageResult, builderResult, encryptionReady] = await Promise.allSettled([
|
|
32
|
+
getPrivateBlobStorageReadinessForRequest(),
|
|
33
|
+
canAuthorizeBuilderApiRequest(BUILDER_ASSETS_WRITE_SCOPE),
|
|
34
|
+
isAttachmentEncryptionKeyAvailable(),
|
|
35
|
+
]);
|
|
36
|
+
return {
|
|
37
|
+
selectedOrg: storageOrgId === null ? "none" : "selected",
|
|
38
|
+
provider: storageResult.status === "fulfilled"
|
|
39
|
+
? toProviderStatus(storageResult.value.providerId)
|
|
40
|
+
: "unavailable",
|
|
41
|
+
readiness: storageResult.status === "fulfilled" &&
|
|
42
|
+
storageResult.value.configured &&
|
|
43
|
+
encryptionReady.status === "fulfilled" &&
|
|
44
|
+
encryptionReady.value
|
|
45
|
+
? "ready"
|
|
46
|
+
: "unavailable",
|
|
47
|
+
builderAuthorized: builderResult.status === "fulfilled"
|
|
48
|
+
? builderResult.value
|
|
49
|
+
? "yes"
|
|
50
|
+
: "no"
|
|
51
|
+
: "unavailable",
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export async function getPrivateStorageReadinessForUser(userEmail) {
|
|
55
|
+
const email = userEmail?.trim();
|
|
56
|
+
if (!email)
|
|
57
|
+
return UNAVAILABLE_STATUS;
|
|
58
|
+
try {
|
|
59
|
+
const storageOrgId = await resolveActiveOrgIdForStorageCredential(email);
|
|
60
|
+
return await runWithRequestContext({
|
|
61
|
+
userEmail: email,
|
|
62
|
+
orgId: undefined,
|
|
63
|
+
orgScope: "personal",
|
|
64
|
+
builderStorageCredentialOrgId: storageOrgId,
|
|
65
|
+
}, getPrivateStorageReadinessForRequest);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return UNAVAILABLE_STATUS;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* keep uploading to the old bucket.
|
|
9
9
|
*/
|
|
10
10
|
import { type ActionRunContext } from "../action.js";
|
|
11
|
+
import { type PrivateStorageReadinessStatus } from "./storage-readiness.js";
|
|
11
12
|
export declare const FILE_STORAGE_SECRET_KEYS: {
|
|
12
13
|
readonly endpoint: "S3_ENDPOINT";
|
|
13
14
|
readonly bucket: "S3_BUCKET";
|
|
@@ -47,6 +48,8 @@ export interface FileStorageStatus {
|
|
|
47
48
|
} | null;
|
|
48
49
|
/** Whether Builder.io storage would take uploads after a clear; null when the check failed. */
|
|
49
50
|
builderUploadConfigured: boolean | null;
|
|
51
|
+
/** Private-blob readiness in the caller's strict selected-storage context. */
|
|
52
|
+
privateStorageReadiness: PrivateStorageReadinessStatus;
|
|
50
53
|
}
|
|
51
54
|
export interface SaveFileStorageInput {
|
|
52
55
|
endpoint?: string;
|
|
@@ -11,6 +11,7 @@ import { fail } from "../action.js";
|
|
|
11
11
|
import { getDbExec } from "../db/client.js";
|
|
12
12
|
import { deleteAppSecret, readAppSecrets, writeAppSecret, } from "../secrets/storage.js";
|
|
13
13
|
import { getActiveFileUploadProviderForRequest, listFileUploadProviders, } from "./registry.js";
|
|
14
|
+
import { getPrivateStorageReadinessForUser, } from "./storage-readiness.js";
|
|
14
15
|
export const FILE_STORAGE_SECRET_KEYS = {
|
|
15
16
|
endpoint: "S3_ENDPOINT",
|
|
16
17
|
bucket: "S3_BUCKET",
|
|
@@ -122,9 +123,10 @@ export async function getFileStorageStatus(ctx) {
|
|
|
122
123
|
const access = await resolveFileStorageAccess(ctx);
|
|
123
124
|
const publicUrlRequired = isFileStoragePublicUrlRequired();
|
|
124
125
|
const values = await readWorkspaceValues(access.scopeId);
|
|
125
|
-
const [active, builderUploadConfigured] = await Promise.all([
|
|
126
|
+
const [active, builderUploadConfigured, privateStorageReadiness] = await Promise.all([
|
|
126
127
|
getActiveFileUploadProviderForRequest(),
|
|
127
128
|
readBuilderUploadConfigured(),
|
|
129
|
+
getPrivateStorageReadinessForUser(ctx?.userEmail),
|
|
128
130
|
]);
|
|
129
131
|
const saved = {};
|
|
130
132
|
for (const field of FIELDS) {
|
|
@@ -145,6 +147,7 @@ export async function getFileStorageStatus(ctx) {
|
|
|
145
147
|
publicUrlRequired,
|
|
146
148
|
activeProvider: active ? { id: active.id, name: active.name } : null,
|
|
147
149
|
builderUploadConfigured,
|
|
150
|
+
privateStorageReadiness,
|
|
148
151
|
};
|
|
149
152
|
}
|
|
150
153
|
const FIELD_LABELS = {
|
package/dist/org/index.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export declare const createSSOProviderHandler: import("h3").EventHandlerWithFetc
|
|
|
61
61
|
redirectURI: string;
|
|
62
62
|
spMetadataUrl: string;
|
|
63
63
|
};
|
|
64
|
-
domainVerificationToken?: string
|
|
64
|
+
domainVerificationToken?: string;
|
|
65
65
|
registeredBy: string;
|
|
66
66
|
}>>;
|
|
67
67
|
export declare const verifySSOProviderHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
@@ -73,7 +73,7 @@ export declare const verifySSOProviderHandler: import("h3").EventHandlerWithFetc
|
|
|
73
73
|
type: "oidc" | "saml";
|
|
74
74
|
redirectURI: string;
|
|
75
75
|
spMetadataUrl: string;
|
|
76
|
-
}
|
|
76
|
+
};
|
|
77
77
|
}>>;
|
|
78
78
|
export declare const deleteSSOProviderHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
79
79
|
ok: boolean;
|
|
@@ -95,30 +95,13 @@ export declare const createSCIMHandler: import("h3").EventHandlerWithFetch<impor
|
|
|
95
95
|
};
|
|
96
96
|
token: string;
|
|
97
97
|
}>>;
|
|
98
|
-
export declare const deleteSCIMHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<
|
|
98
|
+
export declare const deleteSCIMHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<unknown>>;
|
|
99
99
|
export declare const getMyOrgHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
100
100
|
email: string;
|
|
101
|
-
orgId: string
|
|
102
|
-
orgName: string
|
|
103
|
-
role: import("./types.js").OrgRole
|
|
104
|
-
icon:
|
|
105
|
-
version: 1;
|
|
106
|
-
kind: "emoji";
|
|
107
|
-
emoji: string;
|
|
108
|
-
} | {
|
|
109
|
-
version: 1;
|
|
110
|
-
kind: "library";
|
|
111
|
-
library: "tabler";
|
|
112
|
-
name: string;
|
|
113
|
-
variant?: "filled" | "outline" | undefined;
|
|
114
|
-
color?: "blue" | "brown" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "yellow" | undefined;
|
|
115
|
-
} | {
|
|
116
|
-
version: 1;
|
|
117
|
-
kind: "image";
|
|
118
|
-
assetId: string;
|
|
119
|
-
authority: string;
|
|
120
|
-
alt?: string | undefined;
|
|
121
|
-
} | null;
|
|
101
|
+
orgId: string;
|
|
102
|
+
orgName: string;
|
|
103
|
+
role: import("./types.js").OrgRole;
|
|
104
|
+
icon: any;
|
|
122
105
|
iconRevision: number;
|
|
123
106
|
emailConfigured: boolean;
|
|
124
107
|
access: {
|
|
@@ -144,15 +127,15 @@ export declare const getMyOrgHandler: import("h3").EventHandlerWithFetch<import(
|
|
|
144
127
|
kind: "library";
|
|
145
128
|
library: "tabler";
|
|
146
129
|
name: string;
|
|
147
|
-
variant?: "filled" | "outline"
|
|
148
|
-
color?: "blue" | "brown" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "yellow"
|
|
130
|
+
variant?: "filled" | "outline";
|
|
131
|
+
color?: "blue" | "brown" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "yellow";
|
|
149
132
|
} | {
|
|
150
133
|
version: 1;
|
|
151
134
|
kind: "image";
|
|
152
135
|
assetId: string;
|
|
153
136
|
authority: string;
|
|
154
|
-
alt?: string
|
|
155
|
-
}
|
|
137
|
+
alt?: string;
|
|
138
|
+
};
|
|
156
139
|
iconRevision: number;
|
|
157
140
|
}[];
|
|
158
141
|
pendingRemovals: {
|
|
@@ -169,18 +152,18 @@ export declare const getMyOrgHandler: import("h3").EventHandlerWithFetch<import(
|
|
|
169
152
|
orgId: string;
|
|
170
153
|
orgName: string;
|
|
171
154
|
}[];
|
|
172
|
-
allowedDomain: string
|
|
173
|
-
workspaceUrl: string
|
|
155
|
+
allowedDomain: string;
|
|
156
|
+
workspaceUrl: string;
|
|
174
157
|
requiredAuthProvider: import("./types.js").RequiredAuthProvider;
|
|
175
158
|
workspaceAppDefaultVisibility: import("./types.js").WorkspaceAppDefaultVisibility;
|
|
176
|
-
signInMethods: import("./sign-in-methods.js").OrgSignInMethods
|
|
177
|
-
a2aSecretSet: boolean
|
|
178
|
-
soloDeploymentAdmin: boolean
|
|
159
|
+
signInMethods: import("./sign-in-methods.js").OrgSignInMethods;
|
|
160
|
+
a2aSecretSet: boolean;
|
|
161
|
+
soloDeploymentAdmin: boolean;
|
|
179
162
|
}>>;
|
|
180
163
|
export declare const createOrgHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
181
|
-
name?: undefined;
|
|
182
164
|
success: boolean;
|
|
183
165
|
id?: undefined;
|
|
166
|
+
name?: undefined;
|
|
184
167
|
role?: undefined;
|
|
185
168
|
} | {
|
|
186
169
|
success?: undefined;
|
|
@@ -193,10 +176,6 @@ export declare const updateOrgHandler: import("h3").EventHandlerWithFetch<import
|
|
|
193
176
|
name: any;
|
|
194
177
|
}>>;
|
|
195
178
|
export declare const switchOrgHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
196
|
-
orgId: string | null;
|
|
197
|
-
orgName: string | null;
|
|
198
|
-
role: import("./types.js").OrgRole | null;
|
|
199
|
-
} | {
|
|
200
179
|
orgId: any;
|
|
201
180
|
orgName: string;
|
|
202
181
|
role: import("./types.js").OrgRole;
|
|
@@ -206,12 +185,12 @@ export declare const listMembersHandler: import("h3").EventHandlerWithFetch<impo
|
|
|
206
185
|
email: string;
|
|
207
186
|
role: import("./types.js").OrgRole;
|
|
208
187
|
joinedAt: number;
|
|
209
|
-
name?: string
|
|
210
|
-
image: string
|
|
188
|
+
name?: string;
|
|
189
|
+
image: string;
|
|
211
190
|
}[];
|
|
212
191
|
totalCount: number;
|
|
213
192
|
hasMore: boolean;
|
|
214
|
-
nextOffset: number
|
|
193
|
+
nextOffset: number;
|
|
215
194
|
}>>;
|
|
216
195
|
export declare const removeMemberHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
217
196
|
success: boolean;
|
|
@@ -243,7 +222,7 @@ export declare const acceptInvitationHandler: import("h3").EventHandlerWithFetch
|
|
|
243
222
|
}>>;
|
|
244
223
|
export declare const setA2ASecretHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
245
224
|
a2aSecret: any;
|
|
246
|
-
previousSecret: string
|
|
225
|
+
previousSecret: string;
|
|
247
226
|
}>>;
|
|
248
227
|
export declare const syncA2ASecretHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
249
228
|
total: number;
|
|
@@ -272,41 +251,24 @@ export declare const setWorkspaceAppDefaultVisibilityHandler: import("h3").Event
|
|
|
272
251
|
}>>;
|
|
273
252
|
export declare const setOrgVisualIdentityHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
274
253
|
orgId: string;
|
|
275
|
-
icon:
|
|
276
|
-
version: 1;
|
|
277
|
-
kind: "emoji";
|
|
278
|
-
emoji: string;
|
|
279
|
-
} | {
|
|
280
|
-
version: 1;
|
|
281
|
-
kind: "library";
|
|
282
|
-
library: "tabler";
|
|
283
|
-
name: string;
|
|
284
|
-
variant?: "filled" | "outline" | undefined;
|
|
285
|
-
color?: "blue" | "brown" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "yellow" | undefined;
|
|
286
|
-
} | {
|
|
287
|
-
version: 1;
|
|
288
|
-
kind: "image";
|
|
289
|
-
assetId: string;
|
|
290
|
-
authority: string;
|
|
291
|
-
alt?: string | undefined;
|
|
292
|
-
} | null;
|
|
254
|
+
icon: any;
|
|
293
255
|
iconRevision: number;
|
|
294
256
|
syncPending: boolean;
|
|
295
257
|
}>>;
|
|
296
258
|
export declare const listAppRolesHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
297
259
|
appId: string;
|
|
298
260
|
roles: readonly string[];
|
|
299
|
-
defaultRole: string
|
|
261
|
+
defaultRole: string;
|
|
300
262
|
roleLabels: Partial<Record<string, string>>;
|
|
301
263
|
permissions: Partial<Record<string, readonly string[]>>;
|
|
302
264
|
canManage: boolean;
|
|
303
265
|
assignments: {
|
|
304
|
-
email: string;
|
|
305
266
|
roles: string[];
|
|
306
|
-
role: string
|
|
267
|
+
role: string;
|
|
268
|
+
email: string;
|
|
307
269
|
}[];
|
|
308
270
|
myRoles: string[];
|
|
309
|
-
myRole: string
|
|
271
|
+
myRole: string;
|
|
310
272
|
}>>;
|
|
311
273
|
export declare const setAppRoleHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
312
274
|
appId: string;
|
|
@@ -71,6 +71,7 @@ export declare function attachmentOwnerKey(email: string): string;
|
|
|
71
71
|
export declare function isAttachmentRef(value: unknown): value is AttachmentRef;
|
|
72
72
|
/** Retryable means the same ref can succeed later; nothing else qualifies. */
|
|
73
73
|
export declare function isRetryableAttachmentFailure(failure: AttachmentFailure): failure is StorageUnavailable;
|
|
74
|
+
export declare function isAttachmentEncryptionKeyAvailable(): boolean;
|
|
74
75
|
export declare function mintAttachmentRef(input: {
|
|
75
76
|
data: Uint8Array | Buffer;
|
|
76
77
|
filename: string;
|
|
@@ -132,7 +132,7 @@ function unsealDescriptor(sealed) {
|
|
|
132
132
|
]);
|
|
133
133
|
return inflateRawSync(deflated).toString("utf8");
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
export function isAttachmentEncryptionKeyAvailable() {
|
|
136
136
|
try {
|
|
137
137
|
getSecretEncryptionKey();
|
|
138
138
|
return true;
|
|
@@ -145,7 +145,7 @@ function encryptionKeyAvailable() {
|
|
|
145
145
|
}
|
|
146
146
|
export async function mintAttachmentRef(input) {
|
|
147
147
|
const filename = path.basename(input.filename);
|
|
148
|
-
if (!
|
|
148
|
+
if (!isAttachmentEncryptionKeyAvailable()) {
|
|
149
149
|
const failure = storageUnavailable("encryption_key_unavailable", filename);
|
|
150
150
|
logFailure("mint", failure);
|
|
151
151
|
return failure;
|
|
@@ -221,7 +221,7 @@ function openDescriptor(ref, scope) {
|
|
|
221
221
|
const prefix = Object.keys(DESCRIPTOR_KINDS).find((candidate) => ref.startsWith(candidate));
|
|
222
222
|
if (!prefix)
|
|
223
223
|
return { status: "malformed", reason: "unrecognized_scheme" };
|
|
224
|
-
if (!
|
|
224
|
+
if (!isAttachmentEncryptionKeyAvailable()) {
|
|
225
225
|
return storageUnavailable("encryption_key_unavailable");
|
|
226
226
|
}
|
|
227
227
|
let parsed;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export type { PrivateBlobDeleteResult, PrivateBlobHandle, PrivateBlobMetadata, PrivateBlobProvider, PrivateBlobPutInput, PrivateBlobReadResult, } from "./types.js";
|
|
2
2
|
export type { AttachmentFailure, AttachmentFile, AttachmentRef, AttachmentResolution, AttachmentScope, DeleteAttachmentResult, MintAttachmentResult, StorageFixer, StorageUnavailable, StorageUnavailableReason, } from "./attachment-ref.js";
|
|
3
|
-
export { ATTACHMENT_REF_MAX_CHARS, ATTACHMENT_REF_PREFIX, LEGACY_SLIDES_UPLOAD_REF_PREFIX, attachmentOwnerKey, deleteAttachment, isAttachmentRef, isRetryableAttachmentFailure, mintAttachmentRef, resolveAttachment, } from "./attachment-ref.js";
|
|
3
|
+
export { ATTACHMENT_REF_MAX_CHARS, ATTACHMENT_REF_PREFIX, LEGACY_SLIDES_UPLOAD_REF_PREFIX, attachmentOwnerKey, deleteAttachment, isAttachmentRef, isAttachmentEncryptionKeyAvailable, isRetryableAttachmentFailure, mintAttachmentRef, resolveAttachment, } from "./attachment-ref.js";
|
|
4
4
|
export type { AttachmentErrorCode, AttachmentFailureDescription, AttachmentFailureDetails, AttachmentOperation, } from "./attachment-errors.js";
|
|
5
5
|
export { ATTACHMENT_ERROR_CODES, AttachmentStorageUnavailableError, AttachmentUnavailableError, attachmentFailureDetails, attachmentFailureToError, describeAttachmentFailure, isAttachmentError, unwrapAttachment, } from "./attachment-errors.js";
|
|
6
6
|
export type { PrivateBlobFailureKind } from "./errors.js";
|
|
7
7
|
export { PrivateBlobError, isPrivateBlobError } from "./errors.js";
|
|
8
|
-
export { deletePrivateBlob, getActivePrivateBlobProvider, getActivePrivateBlobProviderForRequest, isPrivateBlobConfiguredForRequest, listPrivateBlobProviders, putPrivateBlob, readPrivateBlob, registerPrivateBlobProvider, setPrivateBlobPublicUploadFallbackEnabled, unregisterPrivateBlobProvider, } from "./registry.js";
|
|
8
|
+
export { deletePrivateBlob, getActivePrivateBlobProvider, getActivePrivateBlobProviderForRequest, getPrivateBlobStorageReadinessForRequest, isPrivateBlobConfiguredForRequest, listPrivateBlobProviders, putPrivateBlob, readPrivateBlob, registerPrivateBlobProvider, setPrivateBlobPublicUploadFallbackEnabled, unregisterPrivateBlobProvider, } from "./registry.js";
|
|
9
|
+
export type { PrivateBlobStorageReadiness } from "./registry.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ATTACHMENT_REF_MAX_CHARS, ATTACHMENT_REF_PREFIX, LEGACY_SLIDES_UPLOAD_REF_PREFIX, attachmentOwnerKey, deleteAttachment, isAttachmentRef, isRetryableAttachmentFailure, mintAttachmentRef, resolveAttachment, } from "./attachment-ref.js";
|
|
1
|
+
export { ATTACHMENT_REF_MAX_CHARS, ATTACHMENT_REF_PREFIX, LEGACY_SLIDES_UPLOAD_REF_PREFIX, attachmentOwnerKey, deleteAttachment, isAttachmentRef, isAttachmentEncryptionKeyAvailable, isRetryableAttachmentFailure, mintAttachmentRef, resolveAttachment, } from "./attachment-ref.js";
|
|
2
2
|
export { ATTACHMENT_ERROR_CODES, AttachmentStorageUnavailableError, AttachmentUnavailableError, attachmentFailureDetails, attachmentFailureToError, describeAttachmentFailure, isAttachmentError, unwrapAttachment, } from "./attachment-errors.js";
|
|
3
3
|
export { PrivateBlobError, isPrivateBlobError } from "./errors.js";
|
|
4
|
-
export { deletePrivateBlob, getActivePrivateBlobProvider, getActivePrivateBlobProviderForRequest, isPrivateBlobConfiguredForRequest, listPrivateBlobProviders, putPrivateBlob, readPrivateBlob, registerPrivateBlobProvider, setPrivateBlobPublicUploadFallbackEnabled, unregisterPrivateBlobProvider, } from "./registry.js";
|
|
4
|
+
export { deletePrivateBlob, getActivePrivateBlobProvider, getActivePrivateBlobProviderForRequest, getPrivateBlobStorageReadinessForRequest, isPrivateBlobConfiguredForRequest, listPrivateBlobProviders, putPrivateBlob, readPrivateBlob, registerPrivateBlobProvider, setPrivateBlobPublicUploadFallbackEnabled, unregisterPrivateBlobProvider, } from "./registry.js";
|
|
@@ -5,6 +5,11 @@ export declare function listPrivateBlobProviders(): PrivateBlobProvider[];
|
|
|
5
5
|
export declare function getActivePrivateBlobProvider(): PrivateBlobProvider | null;
|
|
6
6
|
export declare function getActivePrivateBlobProviderForRequest(): Promise<PrivateBlobProvider | null>;
|
|
7
7
|
export declare function isPrivateBlobConfiguredForRequest(): Promise<boolean>;
|
|
8
|
+
export interface PrivateBlobStorageReadiness {
|
|
9
|
+
configured: boolean;
|
|
10
|
+
providerId: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function getPrivateBlobStorageReadinessForRequest(): Promise<PrivateBlobStorageReadiness>;
|
|
8
13
|
export declare function setPrivateBlobPublicUploadFallbackEnabled(enabled: boolean): void;
|
|
9
14
|
export declare function putPrivateBlob(input: PrivateBlobPutInput): Promise<PrivateBlobHandle | null>;
|
|
10
15
|
export declare function readPrivateBlob(handle: PrivateBlobHandle): Promise<PrivateBlobReadResult>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
|
|
2
2
|
import { getAppConfig } from "../app-config/index.js";
|
|
3
|
-
import { deleteUploadedFile, getActiveFileUploadProviderForRequest, uploadFile, } from "../file-upload/
|
|
3
|
+
import { deleteUploadedFile, getActiveFileUploadProviderForRequest, uploadFile, } from "../file-upload/registry.js";
|
|
4
4
|
import { decryptSecretValue, encryptSecretValue, getSecretEncryptionKey, } from "../secrets/crypto.js";
|
|
5
5
|
import { PrivateBlobError } from "./errors.js";
|
|
6
6
|
const PUBLIC_UPLOAD_HANDLE_PREFIX = "public-upload:v1:";
|
|
@@ -240,13 +240,22 @@ export async function getActivePrivateBlobProviderForRequest() {
|
|
|
240
240
|
return null;
|
|
241
241
|
}
|
|
242
242
|
export async function isPrivateBlobConfiguredForRequest() {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
if (
|
|
248
|
-
return
|
|
249
|
-
|
|
243
|
+
return (await getPrivateBlobStorageReadinessForRequest()).configured;
|
|
244
|
+
}
|
|
245
|
+
export async function getPrivateBlobStorageReadinessForRequest() {
|
|
246
|
+
const privateProvider = await getActivePrivateBlobProviderForRequest();
|
|
247
|
+
if (privateProvider) {
|
|
248
|
+
return { configured: true, providerId: privateProvider.id };
|
|
249
|
+
}
|
|
250
|
+
if (!publicUploadFallbackRef.enabled ||
|
|
251
|
+
!getAppConfig().privateBlob.publicUploadFallback) {
|
|
252
|
+
return { configured: false, providerId: null };
|
|
253
|
+
}
|
|
254
|
+
const uploadProvider = await getActiveFileUploadProviderForRequest();
|
|
255
|
+
return {
|
|
256
|
+
configured: Boolean(uploadProvider),
|
|
257
|
+
providerId: uploadProvider?.id ?? null,
|
|
258
|
+
};
|
|
250
259
|
}
|
|
251
260
|
export function setPrivateBlobPublicUploadFallbackEnabled(enabled) {
|
|
252
261
|
publicUploadFallbackRef.enabled = enabled;
|
|
@@ -75,10 +75,8 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
75
75
|
user: "user";
|
|
76
76
|
}>>;
|
|
77
77
|
}, z.core.$strip>>, {
|
|
78
|
-
provider?: undefined;
|
|
79
|
-
id?: undefined;
|
|
80
|
-
deleted?: undefined;
|
|
81
78
|
message?: undefined;
|
|
79
|
+
found?: undefined;
|
|
82
80
|
providers: {
|
|
83
81
|
id: string;
|
|
84
82
|
label: string;
|
|
@@ -89,45 +87,47 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
89
87
|
updatedAt: number;
|
|
90
88
|
}[];
|
|
91
89
|
count: number;
|
|
92
|
-
|
|
90
|
+
provider?: undefined;
|
|
91
|
+
deleted?: undefined;
|
|
93
92
|
registered?: undefined;
|
|
93
|
+
id?: undefined;
|
|
94
94
|
label?: undefined;
|
|
95
95
|
} | {
|
|
96
|
-
id?: undefined;
|
|
97
96
|
count?: undefined;
|
|
98
|
-
deleted?: undefined;
|
|
99
97
|
message?: undefined;
|
|
100
98
|
providers?: undefined;
|
|
101
99
|
found: boolean;
|
|
102
100
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
101
|
+
deleted?: undefined;
|
|
103
102
|
registered?: undefined;
|
|
103
|
+
id?: undefined;
|
|
104
104
|
label?: undefined;
|
|
105
105
|
} | {
|
|
106
|
-
provider?: undefined;
|
|
107
106
|
count?: undefined;
|
|
108
|
-
deleted?: undefined;
|
|
109
107
|
message?: undefined;
|
|
110
108
|
providers?: undefined;
|
|
109
|
+
provider?: undefined;
|
|
111
110
|
found: boolean;
|
|
112
111
|
id: string;
|
|
112
|
+
deleted?: undefined;
|
|
113
113
|
registered?: undefined;
|
|
114
114
|
label?: undefined;
|
|
115
115
|
} | {
|
|
116
|
-
provider?: undefined;
|
|
117
116
|
count?: undefined;
|
|
118
117
|
message?: undefined;
|
|
119
|
-
providers?: undefined;
|
|
120
118
|
found?: undefined;
|
|
119
|
+
providers?: undefined;
|
|
120
|
+
provider?: undefined;
|
|
121
121
|
deleted: boolean;
|
|
122
122
|
id: string;
|
|
123
123
|
registered?: undefined;
|
|
124
124
|
label?: undefined;
|
|
125
125
|
} | {
|
|
126
|
-
provider?: undefined;
|
|
127
126
|
count?: undefined;
|
|
128
|
-
deleted?: undefined;
|
|
129
|
-
providers?: undefined;
|
|
130
127
|
found?: undefined;
|
|
128
|
+
providers?: undefined;
|
|
129
|
+
provider?: undefined;
|
|
130
|
+
deleted?: undefined;
|
|
131
131
|
registered: boolean;
|
|
132
132
|
id: string;
|
|
133
133
|
label: string;
|
|
@@ -311,9 +311,9 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
311
311
|
notes?: string | undefined;
|
|
312
312
|
scope?: "org" | "user" | undefined;
|
|
313
313
|
}, {
|
|
314
|
-
message?: undefined;
|
|
315
314
|
id?: undefined;
|
|
316
|
-
|
|
315
|
+
message?: undefined;
|
|
316
|
+
found?: undefined;
|
|
317
317
|
providers: {
|
|
318
318
|
id: string;
|
|
319
319
|
label: string;
|
|
@@ -325,45 +325,45 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
325
325
|
}[];
|
|
326
326
|
count: number;
|
|
327
327
|
provider?: undefined;
|
|
328
|
-
|
|
328
|
+
deleted?: undefined;
|
|
329
329
|
registered?: undefined;
|
|
330
330
|
label?: undefined;
|
|
331
331
|
} | {
|
|
332
|
-
message?: undefined;
|
|
333
332
|
id?: undefined;
|
|
334
|
-
|
|
335
|
-
count?: undefined;
|
|
333
|
+
message?: undefined;
|
|
336
334
|
providers?: undefined;
|
|
335
|
+
count?: undefined;
|
|
337
336
|
found: boolean;
|
|
338
337
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
338
|
+
deleted?: undefined;
|
|
339
339
|
registered?: undefined;
|
|
340
340
|
label?: undefined;
|
|
341
341
|
} | {
|
|
342
342
|
message?: undefined;
|
|
343
|
-
deleted?: undefined;
|
|
344
|
-
count?: undefined;
|
|
345
343
|
providers?: undefined;
|
|
344
|
+
count?: undefined;
|
|
346
345
|
provider?: undefined;
|
|
347
346
|
found: boolean;
|
|
348
347
|
id: string;
|
|
348
|
+
deleted?: undefined;
|
|
349
349
|
registered?: undefined;
|
|
350
350
|
label?: undefined;
|
|
351
351
|
} | {
|
|
352
352
|
message?: undefined;
|
|
353
|
-
|
|
353
|
+
found?: undefined;
|
|
354
354
|
providers?: undefined;
|
|
355
|
+
count?: undefined;
|
|
355
356
|
provider?: undefined;
|
|
356
|
-
found?: undefined;
|
|
357
357
|
deleted: boolean;
|
|
358
358
|
id: string;
|
|
359
359
|
registered?: undefined;
|
|
360
360
|
label?: undefined;
|
|
361
361
|
} | {
|
|
362
|
-
|
|
363
|
-
count?: undefined;
|
|
362
|
+
found?: undefined;
|
|
364
363
|
providers?: undefined;
|
|
364
|
+
count?: undefined;
|
|
365
365
|
provider?: undefined;
|
|
366
|
-
|
|
366
|
+
deleted?: undefined;
|
|
367
367
|
registered: boolean;
|
|
368
368
|
id: string;
|
|
369
369
|
label: string;
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -73,32 +73,32 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
|
|
|
73
73
|
status?: undefined;
|
|
74
74
|
ok?: undefined;
|
|
75
75
|
} | {
|
|
76
|
+
error?: undefined;
|
|
76
77
|
errorCode?: undefined;
|
|
77
78
|
retryable?: undefined;
|
|
78
79
|
ok: boolean;
|
|
79
80
|
status: string;
|
|
80
|
-
error?: undefined;
|
|
81
81
|
} | {
|
|
82
82
|
error: string;
|
|
83
83
|
removed?: undefined;
|
|
84
84
|
ok?: undefined;
|
|
85
85
|
} | {
|
|
86
|
+
error?: undefined;
|
|
86
87
|
ok: boolean;
|
|
87
88
|
removed: boolean;
|
|
88
|
-
error?: undefined;
|
|
89
89
|
}>>;
|
|
90
90
|
export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
91
91
|
error: string;
|
|
92
92
|
note?: undefined;
|
|
93
93
|
ok?: undefined;
|
|
94
94
|
} | {
|
|
95
|
+
error?: undefined;
|
|
95
96
|
ok: boolean;
|
|
96
97
|
note?: undefined;
|
|
97
|
-
error?: undefined;
|
|
98
98
|
} | {
|
|
99
|
+
error?: undefined;
|
|
99
100
|
ok: boolean;
|
|
100
101
|
note: string;
|
|
101
|
-
error?: undefined;
|
|
102
102
|
} | {
|
|
103
103
|
note?: undefined;
|
|
104
104
|
ok: boolean;
|
|
@@ -126,11 +126,11 @@ export declare function createAdHocSecretHandler(): import("h3").EventHandlerWit
|
|
|
126
126
|
} | {
|
|
127
127
|
error: string;
|
|
128
128
|
} | {
|
|
129
|
+
error?: undefined;
|
|
129
130
|
ok: boolean;
|
|
130
131
|
key: string;
|
|
131
|
-
error?: undefined;
|
|
132
132
|
} | {
|
|
133
|
+
error?: undefined;
|
|
133
134
|
ok: boolean;
|
|
134
135
|
removed: boolean;
|
|
135
|
-
error?: undefined;
|
|
136
136
|
}>>;
|
|
@@ -9,16 +9,16 @@ export declare const AGENT_ENGINE_API_KEY_ACTION_NAME = "agent-engine-api-key";
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function createAgentEngineDisconnectHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
11
11
|
error: string;
|
|
12
|
-
scope?: undefined;
|
|
13
12
|
ok?: undefined;
|
|
13
|
+
scope?: undefined;
|
|
14
14
|
} | {
|
|
15
15
|
ok: boolean;
|
|
16
16
|
error: any;
|
|
17
17
|
scope?: undefined;
|
|
18
18
|
} | {
|
|
19
|
+
error?: undefined;
|
|
19
20
|
ok: boolean;
|
|
20
21
|
scope: "org" | "user";
|
|
21
|
-
error?: undefined;
|
|
22
22
|
}>>;
|
|
23
23
|
export interface DefaultModelSelectionRequest {
|
|
24
24
|
engine: string;
|
|
@@ -584,8 +584,8 @@ export declare function createPublicRemoteAgentsHandler(discover?: PublicAgentDi
|
|
|
584
584
|
error: string;
|
|
585
585
|
agents?: undefined;
|
|
586
586
|
} | {
|
|
587
|
-
agents: Omit<import("./agent-discovery.js").DiscoveredAgent, "auth" | "kind">[];
|
|
588
587
|
error?: undefined;
|
|
588
|
+
agents: Omit<import("./agent-discovery.js").DiscoveredAgent, "auth" | "kind">[];
|
|
589
589
|
}>>;
|
|
590
590
|
export declare function getBuilderConnectErrorDisposition(error: unknown, connectAttemptId: string | null): "correlated" | "legacy" | null;
|
|
591
591
|
export declare function getBuilderConnectErrorKey(ownerEmail: string, connectAttemptId?: string | null): string;
|
|
@@ -29,10 +29,10 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
29
29
|
executionEngine?: undefined;
|
|
30
30
|
executionCwd?: undefined;
|
|
31
31
|
} | {
|
|
32
|
+
scope?: undefined;
|
|
32
33
|
enabled?: undefined;
|
|
33
34
|
nextRun?: undefined;
|
|
34
35
|
created?: undefined;
|
|
35
|
-
scope?: undefined;
|
|
36
36
|
triggerType?: undefined;
|
|
37
37
|
event?: undefined;
|
|
38
38
|
deleted: boolean;
|
|
@@ -45,9 +45,9 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
45
45
|
executionCwd?: undefined;
|
|
46
46
|
webhookPath?: undefined;
|
|
47
47
|
} | {
|
|
48
|
+
scope?: undefined;
|
|
48
49
|
deleted?: undefined;
|
|
49
50
|
created?: undefined;
|
|
50
|
-
scope?: undefined;
|
|
51
51
|
triggerType?: undefined;
|
|
52
52
|
event?: undefined;
|
|
53
53
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.207.1
|
|
3
|
+
"version": "0.207.1",
|
|
4
4
|
"description": "The agentic application framework for building autonomous agents with intuitive UIs",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -694,8 +694,8 @@
|
|
|
694
694
|
"yaml": "^2.9.0",
|
|
695
695
|
"yjs": "^13.6.33",
|
|
696
696
|
"zod": "^4.3.6",
|
|
697
|
-
"@agent-native/agentkit": "^0.207.1
|
|
698
|
-
"@agent-native/recap-cli": "^0.5.
|
|
697
|
+
"@agent-native/agentkit": "^0.207.1",
|
|
698
|
+
"@agent-native/recap-cli": "^0.5.70"
|
|
699
699
|
},
|
|
700
700
|
"devDependencies": {
|
|
701
701
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
@@ -765,7 +765,7 @@
|
|
|
765
765
|
"xlsx": "^0.18.5"
|
|
766
766
|
},
|
|
767
767
|
"peerDependencies": {
|
|
768
|
-
"@agent-native/core-corpus": "0.
|
|
768
|
+
"@agent-native/core-corpus": ">=0.196.0",
|
|
769
769
|
"@ai-sdk/anthropic": ">=3",
|
|
770
770
|
"@ai-sdk/cohere": ">=3",
|
|
771
771
|
"@ai-sdk/google": ">=3",
|