@fias/arche-sdk 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli/create-plugin.js +0 -0
- package/dist/generated/permissions.d.ts +15 -0
- package/dist/generated/permissions.d.ts.map +1 -0
- package/dist/generated/permissions.js +32 -0
- package/dist/generated/permissions.js.map +1 -0
- package/dist/generated/surfaces.d.ts +267 -0
- package/dist/generated/surfaces.d.ts.map +1 -0
- package/dist/generated/surfaces.js +87 -0
- package/dist/generated/surfaces.js.map +1 -0
- package/dist/hooks.d.ts +81 -18
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +184 -50
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.test.js +232 -0
- package/dist/hooks.test.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +187 -31
- package/dist/types.d.ts +212 -54
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -1
- package/package.json +16 -16
- package/templates/default/AGENTS.md +59 -3
- package/templates/default/CLAUDE.md +59 -3
package/dist/index.mjs
CHANGED
|
@@ -497,6 +497,60 @@ function useImageGeneration() {
|
|
|
497
497
|
);
|
|
498
498
|
return { generate, isLoading, result, error };
|
|
499
499
|
}
|
|
500
|
+
function useAudioGeneration() {
|
|
501
|
+
const bridge = useBridge();
|
|
502
|
+
const [isLoading, setIsLoading] = useState2(false);
|
|
503
|
+
const [result, setResult] = useState2(null);
|
|
504
|
+
const [error, setError] = useState2(null);
|
|
505
|
+
const generate = useCallback(
|
|
506
|
+
async (params) => {
|
|
507
|
+
setIsLoading(true);
|
|
508
|
+
setError(null);
|
|
509
|
+
try {
|
|
510
|
+
const res = await bridge.request("audio_generate", params, 18e4);
|
|
511
|
+
setResult(res);
|
|
512
|
+
return res;
|
|
513
|
+
} catch (err) {
|
|
514
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
515
|
+
setError(e);
|
|
516
|
+
throw e;
|
|
517
|
+
} finally {
|
|
518
|
+
setIsLoading(false);
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
[bridge]
|
|
522
|
+
);
|
|
523
|
+
return { generate, isLoading, result, error };
|
|
524
|
+
}
|
|
525
|
+
function useSurface(surfaceKey, timeoutMs = 18e4) {
|
|
526
|
+
const bridge = useBridge();
|
|
527
|
+
const [isLoading, setIsLoading] = useState2(false);
|
|
528
|
+
const [result, setResult] = useState2(null);
|
|
529
|
+
const [error, setError] = useState2(null);
|
|
530
|
+
const invoke = useCallback(
|
|
531
|
+
async (params) => {
|
|
532
|
+
setIsLoading(true);
|
|
533
|
+
setError(null);
|
|
534
|
+
try {
|
|
535
|
+
const res = await bridge.request(
|
|
536
|
+
"surface_invoke",
|
|
537
|
+
{ surfaceKey, params },
|
|
538
|
+
timeoutMs
|
|
539
|
+
);
|
|
540
|
+
setResult(res);
|
|
541
|
+
return res;
|
|
542
|
+
} catch (err) {
|
|
543
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
544
|
+
setError(e);
|
|
545
|
+
throw e;
|
|
546
|
+
} finally {
|
|
547
|
+
setIsLoading(false);
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
[bridge, surfaceKey, timeoutMs]
|
|
551
|
+
);
|
|
552
|
+
return { invoke, isLoading, result, error };
|
|
553
|
+
}
|
|
500
554
|
function useFiasNavigation() {
|
|
501
555
|
const bridge = useBridge();
|
|
502
556
|
const [currentPath, setCurrentPath] = useState2(bridge.getCurrentPath());
|
|
@@ -760,32 +814,44 @@ function useFiasStore() {
|
|
|
760
814
|
]
|
|
761
815
|
);
|
|
762
816
|
}
|
|
763
|
-
var
|
|
817
|
+
var DOWNLOAD_URL_REFRESH_BUFFER_MS = 6e4;
|
|
764
818
|
var downloadUrlCache = /* @__PURE__ */ new Map();
|
|
765
819
|
var downloadUrlInflight = /* @__PURE__ */ new Map();
|
|
766
|
-
async function
|
|
820
|
+
async function fetchVaultDocumentDownloadUrl(documentId) {
|
|
767
821
|
const now = Date.now();
|
|
768
|
-
const cached = downloadUrlCache.get(
|
|
769
|
-
if (cached && now < cached.expiresAt -
|
|
770
|
-
return { url: cached.url, expiresAt: cached.expiresAt };
|
|
822
|
+
const cached = downloadUrlCache.get(documentId);
|
|
823
|
+
if (cached && now < cached.expiresAt - DOWNLOAD_URL_REFRESH_BUFFER_MS) {
|
|
824
|
+
return { url: cached.url, expiresAt: cached.expiresAt, contentType: cached.contentType };
|
|
771
825
|
}
|
|
772
|
-
const inflight = downloadUrlInflight.get(
|
|
826
|
+
const inflight = downloadUrlInflight.get(documentId);
|
|
773
827
|
if (inflight) return inflight;
|
|
774
828
|
const bridge = getBridge();
|
|
775
|
-
const promise = bridge.request(
|
|
776
|
-
|
|
777
|
-
|
|
829
|
+
const promise = bridge.request(
|
|
830
|
+
"vault_documents_download_url",
|
|
831
|
+
{ documentId }
|
|
832
|
+
).then((result) => {
|
|
833
|
+
const normalized = {
|
|
834
|
+
url: result.url,
|
|
835
|
+
expiresAt: new Date(result.expiresAt).getTime(),
|
|
836
|
+
contentType: result.contentType
|
|
837
|
+
};
|
|
838
|
+
downloadUrlCache.set(documentId, {
|
|
839
|
+
url: normalized.url,
|
|
840
|
+
expiresAt: normalized.expiresAt,
|
|
841
|
+
contentType: normalized.contentType
|
|
842
|
+
});
|
|
843
|
+
return normalized;
|
|
778
844
|
}).finally(() => {
|
|
779
|
-
downloadUrlInflight.delete(
|
|
845
|
+
downloadUrlInflight.delete(documentId);
|
|
780
846
|
});
|
|
781
|
-
downloadUrlInflight.set(
|
|
847
|
+
downloadUrlInflight.set(documentId, promise);
|
|
782
848
|
return promise;
|
|
783
849
|
}
|
|
784
|
-
function
|
|
850
|
+
function useVaultDocuments() {
|
|
785
851
|
const bridge = useBridge();
|
|
786
852
|
const list = useCallback(
|
|
787
853
|
async (options) => {
|
|
788
|
-
return bridge.request("
|
|
854
|
+
return bridge.request("vault_documents_list", {
|
|
789
855
|
search: options?.search,
|
|
790
856
|
limit: options?.limit,
|
|
791
857
|
cursor: options?.cursor
|
|
@@ -794,13 +860,15 @@ function useFiasFiles() {
|
|
|
794
860
|
[bridge]
|
|
795
861
|
);
|
|
796
862
|
const read = useCallback(
|
|
797
|
-
async (
|
|
798
|
-
return bridge.request("
|
|
863
|
+
async (documentId) => {
|
|
864
|
+
return bridge.request("vault_documents_read", {
|
|
865
|
+
documentId
|
|
866
|
+
});
|
|
799
867
|
},
|
|
800
868
|
[bridge]
|
|
801
869
|
);
|
|
802
870
|
const getDownloadUrl = useCallback(
|
|
803
|
-
(
|
|
871
|
+
(documentId) => fetchVaultDocumentDownloadUrl(documentId),
|
|
804
872
|
// The hook closes over the React context's bridge, but the resolver
|
|
805
873
|
// uses the singleton — they are the same instance in practice. Keeping
|
|
806
874
|
// `bridge` in the deps for symmetry with other hooks that do go through
|
|
@@ -809,7 +877,7 @@ function useFiasFiles() {
|
|
|
809
877
|
);
|
|
810
878
|
const write = useCallback(
|
|
811
879
|
async (params) => {
|
|
812
|
-
return bridge.request("
|
|
880
|
+
return bridge.request("vault_documents_write", {
|
|
813
881
|
name: params.name,
|
|
814
882
|
content: params.content,
|
|
815
883
|
contentType: params.contentType,
|
|
@@ -819,21 +887,21 @@ function useFiasFiles() {
|
|
|
819
887
|
[bridge]
|
|
820
888
|
);
|
|
821
889
|
const update = useCallback(
|
|
822
|
-
async (
|
|
823
|
-
await bridge.request("
|
|
824
|
-
|
|
890
|
+
async (documentId, params) => {
|
|
891
|
+
await bridge.request("vault_documents_update", {
|
|
892
|
+
documentId,
|
|
825
893
|
name: params.name,
|
|
826
894
|
tags: params.tags
|
|
827
895
|
});
|
|
828
|
-
downloadUrlCache.delete(
|
|
896
|
+
downloadUrlCache.delete(documentId);
|
|
829
897
|
},
|
|
830
898
|
[bridge]
|
|
831
899
|
);
|
|
832
|
-
const
|
|
833
|
-
async (
|
|
834
|
-
await bridge.request("
|
|
835
|
-
downloadUrlCache.delete(
|
|
836
|
-
downloadUrlInflight.delete(
|
|
900
|
+
const deleteDocument = useCallback(
|
|
901
|
+
async (documentId) => {
|
|
902
|
+
await bridge.request("vault_documents_delete", { documentId });
|
|
903
|
+
downloadUrlCache.delete(documentId);
|
|
904
|
+
downloadUrlInflight.delete(documentId);
|
|
837
905
|
},
|
|
838
906
|
[bridge]
|
|
839
907
|
);
|
|
@@ -844,11 +912,76 @@ function useFiasFiles() {
|
|
|
844
912
|
getDownloadUrl,
|
|
845
913
|
write,
|
|
846
914
|
update,
|
|
847
|
-
delete:
|
|
915
|
+
delete: deleteDocument
|
|
848
916
|
}),
|
|
849
|
-
[list, read, getDownloadUrl, write, update,
|
|
917
|
+
[list, read, getDownloadUrl, write, update, deleteDocument]
|
|
850
918
|
);
|
|
851
919
|
}
|
|
920
|
+
function useArcheAssets() {
|
|
921
|
+
const bridge = useBridge();
|
|
922
|
+
const list = useCallback(
|
|
923
|
+
async (options) => {
|
|
924
|
+
return bridge.request("arche_assets_list", {
|
|
925
|
+
cursor: options?.cursor,
|
|
926
|
+
limit: options?.limit
|
|
927
|
+
});
|
|
928
|
+
},
|
|
929
|
+
[bridge]
|
|
930
|
+
);
|
|
931
|
+
const getUrl = useCallback(
|
|
932
|
+
async (assetId) => {
|
|
933
|
+
return bridge.request("arche_assets_get_url", { assetId });
|
|
934
|
+
},
|
|
935
|
+
[bridge]
|
|
936
|
+
);
|
|
937
|
+
return useMemo2(() => ({ list, getUrl }), [list, getUrl]);
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// src/generated/surfaces.ts
|
|
941
|
+
var AUDIO_AUDIO_ISOLATION_SURFACE_KEY = "audio.audio-isolation";
|
|
942
|
+
var useElevenLabsAudioIsolation = () => useSurface(
|
|
943
|
+
AUDIO_AUDIO_ISOLATION_SURFACE_KEY
|
|
944
|
+
);
|
|
945
|
+
var AUDIO_FORCED_ALIGNMENT_SURFACE_KEY = "audio.forced-alignment";
|
|
946
|
+
var useElevenLabsForcedAlignment = () => useSurface(
|
|
947
|
+
AUDIO_FORCED_ALIGNMENT_SURFACE_KEY
|
|
948
|
+
);
|
|
949
|
+
var AUDIO_LYRIA_MUSIC_SURFACE_KEY = "audio.lyria-music";
|
|
950
|
+
var useLyriaMusic = () => useSurface(AUDIO_LYRIA_MUSIC_SURFACE_KEY);
|
|
951
|
+
var AUDIO_MUSIC_SURFACE_KEY = "audio.music";
|
|
952
|
+
var useElevenLabsMusic = () => useSurface(AUDIO_MUSIC_SURFACE_KEY);
|
|
953
|
+
var AUDIO_SOUND_EFFECTS_SURFACE_KEY = "audio.sound-effects";
|
|
954
|
+
var useElevenLabsSfx = () => useSurface(AUDIO_SOUND_EFFECTS_SURFACE_KEY);
|
|
955
|
+
var AUDIO_SPEECH_TO_TEXT_SURFACE_KEY = "audio.speech-to-text";
|
|
956
|
+
var useElevenLabsStt = () => useSurface(AUDIO_SPEECH_TO_TEXT_SURFACE_KEY);
|
|
957
|
+
var AUDIO_TTS_SURFACE_KEY = "audio.tts";
|
|
958
|
+
var useElevenLabsTts = () => useSurface(AUDIO_TTS_SURFACE_KEY);
|
|
959
|
+
var AUDIO_VOICE_CHANGER_SURFACE_KEY = "audio.voice-changer";
|
|
960
|
+
var useElevenLabsVoiceChanger = () => useSurface(
|
|
961
|
+
AUDIO_VOICE_CHANGER_SURFACE_KEY
|
|
962
|
+
);
|
|
963
|
+
var AUDIO_VOICE_DESIGN_SURFACE_KEY = "audio.voice-design";
|
|
964
|
+
var useElevenLabsVoiceDesign = () => useSurface(
|
|
965
|
+
AUDIO_VOICE_DESIGN_SURFACE_KEY
|
|
966
|
+
);
|
|
967
|
+
|
|
968
|
+
// src/generated/permissions.ts
|
|
969
|
+
var VALID_PLUGIN_PERMISSIONS = [
|
|
970
|
+
"assets:read",
|
|
971
|
+
"data:store",
|
|
972
|
+
"entities:audio_generate",
|
|
973
|
+
"entities:image_generate",
|
|
974
|
+
"entities:invoke",
|
|
975
|
+
"storage:sandbox",
|
|
976
|
+
"store:purchase",
|
|
977
|
+
"theme:read",
|
|
978
|
+
"user:profile:read",
|
|
979
|
+
"vault:documents:read",
|
|
980
|
+
"vault:documents:write"
|
|
981
|
+
];
|
|
982
|
+
function isValidPluginPermission(perm) {
|
|
983
|
+
return VALID_PLUGIN_PERMISSIONS.includes(perm);
|
|
984
|
+
}
|
|
852
985
|
|
|
853
986
|
// src/fias.ts
|
|
854
987
|
var fias = {
|
|
@@ -2703,28 +2836,51 @@ function getFontPairingById(id) {
|
|
|
2703
2836
|
return FONT_PAIRINGS.find((f) => f.id === id) ?? FONT_PAIRINGS[0];
|
|
2704
2837
|
}
|
|
2705
2838
|
export {
|
|
2839
|
+
AUDIO_AUDIO_ISOLATION_SURFACE_KEY,
|
|
2840
|
+
AUDIO_FORCED_ALIGNMENT_SURFACE_KEY,
|
|
2841
|
+
AUDIO_LYRIA_MUSIC_SURFACE_KEY,
|
|
2842
|
+
AUDIO_MUSIC_SURFACE_KEY,
|
|
2843
|
+
AUDIO_SOUND_EFFECTS_SURFACE_KEY,
|
|
2844
|
+
AUDIO_SPEECH_TO_TEXT_SURFACE_KEY,
|
|
2845
|
+
AUDIO_TTS_SURFACE_KEY,
|
|
2846
|
+
AUDIO_VOICE_CHANGER_SURFACE_KEY,
|
|
2847
|
+
AUDIO_VOICE_DESIGN_SURFACE_KEY,
|
|
2706
2848
|
DARK_THEME,
|
|
2707
2849
|
FONT_PAIRINGS,
|
|
2708
2850
|
FiasBridge,
|
|
2709
2851
|
FiasProvider,
|
|
2710
2852
|
LIGHT_THEME,
|
|
2711
2853
|
THEME_CATALOG,
|
|
2712
|
-
|
|
2854
|
+
VALID_PLUGIN_PERMISSIONS,
|
|
2855
|
+
fetchVaultDocumentDownloadUrl,
|
|
2713
2856
|
fias,
|
|
2714
2857
|
getBridge,
|
|
2715
2858
|
getDefaultTheme,
|
|
2716
2859
|
getFontPairingById,
|
|
2717
2860
|
getThemeById,
|
|
2861
|
+
isValidPluginPermission,
|
|
2718
2862
|
resetBridge,
|
|
2863
|
+
useArcheAssets,
|
|
2864
|
+
useAudioGeneration,
|
|
2865
|
+
useElevenLabsAudioIsolation,
|
|
2866
|
+
useElevenLabsForcedAlignment,
|
|
2867
|
+
useElevenLabsMusic,
|
|
2868
|
+
useElevenLabsSfx,
|
|
2869
|
+
useElevenLabsStt,
|
|
2870
|
+
useElevenLabsTts,
|
|
2871
|
+
useElevenLabsVoiceChanger,
|
|
2872
|
+
useElevenLabsVoiceDesign,
|
|
2719
2873
|
useEntityInvocation,
|
|
2720
2874
|
useFiasDataStore,
|
|
2721
|
-
useFiasFiles,
|
|
2722
2875
|
useFiasNavigation,
|
|
2723
2876
|
useFiasStorage,
|
|
2724
2877
|
useFiasStore,
|
|
2725
2878
|
useFiasTheme,
|
|
2726
2879
|
useFiasUser,
|
|
2727
2880
|
useImageGeneration,
|
|
2881
|
+
useLyriaMusic,
|
|
2728
2882
|
usePersistentState,
|
|
2729
|
-
useStepNavigation
|
|
2883
|
+
useStepNavigation,
|
|
2884
|
+
useSurface,
|
|
2885
|
+
useVaultDocuments
|
|
2730
2886
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Permission scopes that plugins can request in their manifest.
|
|
3
|
+
*
|
|
4
|
+
* Re-exported from `./generated/permissions`, which is produced by
|
|
5
|
+
* `pnpm generate:sdk-types` from `@fias/db-types`'s canonical list. The
|
|
6
|
+
* `sdk-permissions-match-db-types.test.ts` architecture trip-wire ensures
|
|
7
|
+
* the generated file stays in lockstep.
|
|
3
8
|
*/
|
|
4
|
-
|
|
9
|
+
import type { PluginPermission } from './generated/permissions';
|
|
10
|
+
export type { PluginPermission };
|
|
11
|
+
export { VALID_PLUGIN_PERMISSIONS, isValidPluginPermission } from './generated/permissions';
|
|
5
12
|
/**
|
|
6
13
|
* User profile data available via useFiasUser() hook.
|
|
7
14
|
*/
|
|
@@ -99,18 +106,49 @@ export interface EntityInvocationParams {
|
|
|
99
106
|
* Image generation parameters for useImageGeneration() hook.
|
|
100
107
|
*/
|
|
101
108
|
export interface ImageGenerationParams {
|
|
102
|
-
/** Entity ID of an image model (e.g.,
|
|
109
|
+
/** Entity ID of an image model (e.g., ent_modeldef_gpt_image_1_5) */
|
|
103
110
|
entityId: string;
|
|
104
111
|
/** Text prompt describing the image to generate */
|
|
105
112
|
prompt: string;
|
|
106
113
|
/** Image size/aspect ratio (model-specific, e.g., '1024x1024', '16:9') */
|
|
107
114
|
size?: string;
|
|
108
|
-
/** Quality level (model-specific, e.g., '
|
|
115
|
+
/** Quality level (model-specific, e.g., 'low', 'medium', 'high') */
|
|
109
116
|
quality?: string;
|
|
110
|
-
/** Artistic style (model-specific, e.g., '
|
|
117
|
+
/** Artistic style (model-specific, e.g., 'realistic_image', 'digital_illustration') */
|
|
111
118
|
style?: string;
|
|
112
119
|
/** Additional provider-specific parameters */
|
|
113
120
|
providerParams?: Record<string, unknown>;
|
|
121
|
+
/**
|
|
122
|
+
* Optional reference image for image-to-image generation. Provide ONE of:
|
|
123
|
+
*
|
|
124
|
+
* - `{ archeAssetId }` — a published asset from this arche's library
|
|
125
|
+
* (uses the `assets:read` permission scope to read bytes server-side).
|
|
126
|
+
* - `{ fileId }` — a Vault Document this arche owns (uses
|
|
127
|
+
* `vault:documents:read` to read bytes server-side). For images
|
|
128
|
+
* previously generated via `useImageGeneration`, pass `result.fileId`.
|
|
129
|
+
* - `{ dataUrl }` — a `data:` URL with base64-encoded PNG/JPEG/WEBP
|
|
130
|
+
* bytes. Use only when the source isn't already in the asset library
|
|
131
|
+
* or vault; subject to a payload-size cap (~8 MB).
|
|
132
|
+
*
|
|
133
|
+
* The selected image model must support reference images (e.g. the
|
|
134
|
+
* Stability AI entities `ent_modeldef_stable_img_core`,
|
|
135
|
+
* `ent_modeldef_stable_img_ultra`, `ent_modeldef_sd3_large`). Models
|
|
136
|
+
* that don't support it return INVALID_PARAMS rather than silently
|
|
137
|
+
* ignoring the reference.
|
|
138
|
+
*/
|
|
139
|
+
referenceImage?: {
|
|
140
|
+
archeAssetId: string;
|
|
141
|
+
} | {
|
|
142
|
+
fileId: string;
|
|
143
|
+
} | {
|
|
144
|
+
dataUrl: string;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* How closely the output should follow the reference image. 0 = ignore
|
|
148
|
+
* the reference, 1 = copy it almost exactly. Default 0.5 when a
|
|
149
|
+
* `referenceImage` is provided.
|
|
150
|
+
*/
|
|
151
|
+
referenceStrength?: number;
|
|
114
152
|
}
|
|
115
153
|
/**
|
|
116
154
|
* Image generation result.
|
|
@@ -138,6 +176,73 @@ export interface ImageGenerationApi {
|
|
|
138
176
|
result: ImageGenerationResult | null;
|
|
139
177
|
error: Error | null;
|
|
140
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Audio sub-type discriminator. v1 ships music only; future entries
|
|
181
|
+
* (`'speech'`, `'sfx'`, ...) extend the unions on `AudioGenerationParams`,
|
|
182
|
+
* `AudioGenerationResult`, and the bridge dispatch in lockstep.
|
|
183
|
+
*/
|
|
184
|
+
export type AudioType = 'music';
|
|
185
|
+
/**
|
|
186
|
+
* Audio generation parameters for useAudioGeneration() hook.
|
|
187
|
+
*
|
|
188
|
+
* Discriminated union by `audioType` so future sub-types can carry their
|
|
189
|
+
* own parameter shape (e.g., speech adds voice/style, SFX adds duration
|
|
190
|
+
* range) without breaking music callers.
|
|
191
|
+
*/
|
|
192
|
+
export type AudioGenerationParams = MusicAudioGenerationParams;
|
|
193
|
+
/** Parameters for music audio generation (Lyria today). */
|
|
194
|
+
export interface MusicAudioGenerationParams {
|
|
195
|
+
audioType: 'music';
|
|
196
|
+
/** Entity ID of a music model (e.g., ent_modeldef_lyria2) OR a PluginAudioConfig configId. */
|
|
197
|
+
entityId: string;
|
|
198
|
+
/** Text prompt describing the music to generate. */
|
|
199
|
+
prompt: string;
|
|
200
|
+
/** Optional negative prompt — sounds or styles to avoid. */
|
|
201
|
+
negativePrompt?: string;
|
|
202
|
+
/** Optional seed for deterministic regeneration. */
|
|
203
|
+
seed?: number;
|
|
204
|
+
/** Number of clips to generate (1–4 for Lyria 2). */
|
|
205
|
+
sampleCount?: number;
|
|
206
|
+
/** Requested duration in seconds (Lyria 2 emits a fixed 30 s clip). */
|
|
207
|
+
durationSeconds?: number;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Audio generation result. Always returns an array of clips so multi-clip
|
|
211
|
+
* generations (sampleCount > 1) and single-clip generations share one shape.
|
|
212
|
+
*/
|
|
213
|
+
export interface AudioGenerationResult {
|
|
214
|
+
/** Audio sub-type discriminator matching the request. */
|
|
215
|
+
audioType: AudioType;
|
|
216
|
+
/** Generated audio clips. */
|
|
217
|
+
clips: Array<{
|
|
218
|
+
/** Same-origin signed proxy URL for `<audio src>`. Expires after ~1 hour. */
|
|
219
|
+
audioUrl: string;
|
|
220
|
+
/** S3 reference for the clip (use for persistent storage / re-signing). */
|
|
221
|
+
audioRef: string;
|
|
222
|
+
/** User-file record id (best-effort; undefined if the write failed). */
|
|
223
|
+
fileId?: string;
|
|
224
|
+
/** MIME type — `audio/wav` today. */
|
|
225
|
+
mimeType: string;
|
|
226
|
+
sampleRate: number;
|
|
227
|
+
durationSeconds: number;
|
|
228
|
+
sizeBytes: number;
|
|
229
|
+
}>;
|
|
230
|
+
/** Sum of `clips[].durationSeconds`. */
|
|
231
|
+
totalDurationSeconds: number;
|
|
232
|
+
/** Provider that generated the audio. */
|
|
233
|
+
provider: string;
|
|
234
|
+
/** Provider-side model name. */
|
|
235
|
+
model: string;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Audio generation API available via useAudioGeneration() hook.
|
|
239
|
+
*/
|
|
240
|
+
export interface AudioGenerationApi {
|
|
241
|
+
generate: (params: AudioGenerationParams) => Promise<AudioGenerationResult>;
|
|
242
|
+
isLoading: boolean;
|
|
243
|
+
result: AudioGenerationResult | null;
|
|
244
|
+
error: Error | null;
|
|
245
|
+
}
|
|
141
246
|
/**
|
|
142
247
|
* Navigation API available via useFiasNavigation() hook.
|
|
143
248
|
*/
|
|
@@ -146,16 +251,17 @@ export interface FiasNavigationApi {
|
|
|
146
251
|
currentPath: string;
|
|
147
252
|
}
|
|
148
253
|
/**
|
|
149
|
-
* A
|
|
254
|
+
* A document owned by the calling arche in the user's Vault.
|
|
150
255
|
*
|
|
151
|
-
*
|
|
152
|
-
* are scoped by `source_arche_id`. Listing only
|
|
153
|
-
* arche created —
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
256
|
+
* Documents written via useVaultDocuments() (or generated via
|
|
257
|
+
* useImageGeneration()) are scoped by `source_arche_id`. Listing only
|
|
258
|
+
* returns documents the calling arche created — documents from other
|
|
259
|
+
* arches are never visible.
|
|
260
|
+
*/
|
|
261
|
+
export interface VaultDocumentSummary {
|
|
262
|
+
documentId: string;
|
|
263
|
+
name: string;
|
|
264
|
+
mimeType: string;
|
|
159
265
|
sizeBytes: number;
|
|
160
266
|
/** ISO 8601 timestamp. */
|
|
161
267
|
createdAt: string;
|
|
@@ -164,31 +270,34 @@ export interface FiasFile {
|
|
|
164
270
|
/** Free-form tags, set by the arche on write/update. */
|
|
165
271
|
tags: string[];
|
|
166
272
|
/**
|
|
167
|
-
* Folder
|
|
168
|
-
*
|
|
169
|
-
* the
|
|
170
|
-
* source_arche_id
|
|
273
|
+
* Folder the document lives in. The platform places arche-owned
|
|
274
|
+
* writes into `/My-Fias/Arches/<archeId>/` by default; users can move
|
|
275
|
+
* them via the My Data UI without breaking arche access (listing is
|
|
276
|
+
* scoped by `source_arche_id`, not folder).
|
|
171
277
|
*/
|
|
172
|
-
|
|
278
|
+
folderId: string | null;
|
|
173
279
|
}
|
|
174
|
-
export interface
|
|
280
|
+
export interface VaultDocumentsListOptions {
|
|
175
281
|
search?: string;
|
|
176
282
|
limit?: number;
|
|
177
283
|
cursor?: string;
|
|
178
284
|
}
|
|
179
|
-
export interface
|
|
180
|
-
|
|
285
|
+
export interface VaultDocumentsListResult {
|
|
286
|
+
documents: VaultDocumentSummary[];
|
|
181
287
|
nextCursor: string | null;
|
|
182
288
|
}
|
|
183
|
-
export interface
|
|
289
|
+
export interface VaultDocumentDownloadUrl {
|
|
184
290
|
url: string;
|
|
185
291
|
/** Epoch milliseconds when the presigned URL expires. */
|
|
186
292
|
expiresAt: number;
|
|
293
|
+
/** MIME type of the document, or null when unset on the row. */
|
|
294
|
+
contentType: string | null;
|
|
187
295
|
}
|
|
188
|
-
export interface
|
|
296
|
+
export interface VaultDocumentWriteParams {
|
|
189
297
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
298
|
+
* Document name (no leading slash). Must be unique per arche per
|
|
299
|
+
* user; same-name writes create a new row with the same name (no
|
|
300
|
+
* implicit overwrite — call `delete` first if that's what you want).
|
|
192
301
|
*/
|
|
193
302
|
name: string;
|
|
194
303
|
/** UTF-8 string content. Use for JSON, text, or base64-encoded binaries. */
|
|
@@ -198,54 +307,103 @@ export interface FiasFilesWriteParams {
|
|
|
198
307
|
/** Free-form tags. */
|
|
199
308
|
tags?: string[];
|
|
200
309
|
}
|
|
201
|
-
export interface
|
|
202
|
-
/** New
|
|
310
|
+
export interface VaultDocumentUpdateParams {
|
|
311
|
+
/** New document name. */
|
|
203
312
|
name?: string;
|
|
204
313
|
/** Replaces the tag list. */
|
|
205
314
|
tags?: string[];
|
|
206
315
|
}
|
|
207
316
|
/**
|
|
208
|
-
*
|
|
317
|
+
* Vault Documents API available via useVaultDocuments() hook.
|
|
209
318
|
*
|
|
210
|
-
* Provides access to the user's
|
|
211
|
-
* owns (via `source_arche_id`).
|
|
212
|
-
* `/My-Fias/
|
|
213
|
-
*
|
|
319
|
+
* Provides access to the user's Vault Documents, scoped to documents
|
|
320
|
+
* this arche owns (via `source_arche_id`). Documents are visible to
|
|
321
|
+
* the user in My Data under `/My-Fias/Arches/<archeId>/`, but the SDK
|
|
322
|
+
* lists by ownership — moving a document in My Data does not hide it
|
|
323
|
+
* from the arche.
|
|
214
324
|
*
|
|
215
325
|
* Permissions:
|
|
216
|
-
* - `
|
|
217
|
-
* - `
|
|
326
|
+
* - `vault:documents:read` — list, read, getDownloadUrl
|
|
327
|
+
* - `vault:documents:write` — write, update, delete
|
|
218
328
|
*
|
|
219
|
-
* Note: images returned from useImageGeneration() are auto-saved into
|
|
220
|
-
* arche's folder and the result includes a `
|
|
221
|
-
* to refresh the presigned URL after the original ~1h
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
329
|
+
* Note: images returned from useImageGeneration() are auto-saved into
|
|
330
|
+
* the arche's folder and the result includes a `documentId`. Pass that
|
|
331
|
+
* documentId here to refresh the presigned URL after the original ~1h
|
|
332
|
+
* TTL expires.
|
|
333
|
+
*/
|
|
334
|
+
export interface VaultDocumentsApi {
|
|
335
|
+
/** List documents owned by this arche. Paginated. */
|
|
336
|
+
list: (options?: VaultDocumentsListOptions) => Promise<VaultDocumentsListResult>;
|
|
337
|
+
/** Read the UTF-8 content of a document. */
|
|
338
|
+
read: (documentId: string) => Promise<{
|
|
228
339
|
content: string;
|
|
229
340
|
contentType: string;
|
|
230
341
|
}>;
|
|
231
342
|
/**
|
|
232
|
-
* Get a fresh presigned download URL for a
|
|
233
|
-
* client-side and refreshed automatically before expiry.
|
|
343
|
+
* Get a fresh presigned download URL for a documentId. The result is
|
|
344
|
+
* cached client-side and refreshed automatically before expiry.
|
|
234
345
|
*/
|
|
235
|
-
getDownloadUrl: (
|
|
236
|
-
/** Create
|
|
237
|
-
write: (params:
|
|
238
|
-
|
|
346
|
+
getDownloadUrl: (documentId: string) => Promise<VaultDocumentDownloadUrl>;
|
|
347
|
+
/** Create a document. Returns the documentId. */
|
|
348
|
+
write: (params: VaultDocumentWriteParams) => Promise<{
|
|
349
|
+
documentId: string;
|
|
239
350
|
}>;
|
|
240
|
-
/** Rename or retag a
|
|
241
|
-
update: (
|
|
242
|
-
/** Soft-delete a
|
|
243
|
-
delete: (
|
|
351
|
+
/** Rename or retag a document. */
|
|
352
|
+
update: (documentId: string, params: VaultDocumentUpdateParams) => Promise<void>;
|
|
353
|
+
/** Soft-delete a document (recoverable from Trash in My Data). */
|
|
354
|
+
delete: (documentId: string) => Promise<void>;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* One entry from the arche's published asset manifest. Surfaced to
|
|
358
|
+
* plugins via `useArcheAssets().list()`.
|
|
359
|
+
*
|
|
360
|
+
* `signedUrl` is a short-lived (~5 min default) URL that loads through
|
|
361
|
+
* api.fias.ai's signed proxy. Plugins should use `getUrl(assetId)` to
|
|
362
|
+
* refresh after expiry rather than caching URLs across sessions.
|
|
363
|
+
*/
|
|
364
|
+
export interface ArcheAsset {
|
|
365
|
+
assetId: string;
|
|
366
|
+
signedUrl: string;
|
|
367
|
+
/** Unix-seconds expiry of `signedUrl`. */
|
|
368
|
+
expiresAt: number;
|
|
369
|
+
contentType: 'image/png' | 'image/jpeg' | 'image/webp';
|
|
370
|
+
width: number;
|
|
371
|
+
height: number;
|
|
372
|
+
sizeBytes: number;
|
|
373
|
+
/** Display name set by the contributor. May be null if not provided. */
|
|
374
|
+
name: string | null;
|
|
375
|
+
/** Alt text — recommended for accessibility-aware rendering. */
|
|
376
|
+
altText: string | null;
|
|
377
|
+
/** Tags set by the contributor for filtering. Empty array if none. */
|
|
378
|
+
tags: string[];
|
|
379
|
+
}
|
|
380
|
+
export interface ArcheAssetsListOptions {
|
|
381
|
+
cursor?: string;
|
|
382
|
+
/** 1..100. Default 50. */
|
|
383
|
+
limit?: number;
|
|
384
|
+
}
|
|
385
|
+
export interface ArcheAssetsListResult {
|
|
386
|
+
entries: ArcheAsset[];
|
|
387
|
+
nextCursor: string | null;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Asset library API. Permission: `assets:read`.
|
|
391
|
+
*
|
|
392
|
+
* The library is a contributor-curated set of images pinned to this
|
|
393
|
+
* arche's published version — once the contributor publishes, the set
|
|
394
|
+
* is immutable for that version's runtime. New uploads on the
|
|
395
|
+
* contributor's side affect future published versions only.
|
|
396
|
+
*/
|
|
397
|
+
export interface ArcheAssetsApi {
|
|
398
|
+
/** Page through the published asset manifest. */
|
|
399
|
+
list: (options?: ArcheAssetsListOptions) => Promise<ArcheAssetsListResult>;
|
|
400
|
+
/** Refresh the signed URL for a single asset. */
|
|
401
|
+
getUrl: (assetId: string) => Promise<ArcheAsset>;
|
|
244
402
|
}
|
|
245
403
|
/**
|
|
246
404
|
* Message types sent from the plugin iframe to the parent frame.
|
|
247
405
|
*/
|
|
248
|
-
export type PluginToHostMessageType = 'ready' | 'resize' | 'toast' | 'get_user' | 'get_theme' | 'storage_read' | 'storage_write' | 'storage_list' | 'storage_delete' | 'entity_invoke' | 'image_generate' | 'navigate' | 'data_create_collection' | 'data_list_collections' | 'data_delete_collection' | 'data_put' | 'data_get' | 'data_query' | 'data_delete' | 'store_get_products' | 'store_purchase' | 'store_get_entitlements' | 'store_get_purchase_history' | 'store_restore' | 'store_cancel_subscription' | '
|
|
406
|
+
export type PluginToHostMessageType = 'ready' | 'resize' | 'toast' | 'get_user' | 'get_theme' | 'storage_read' | 'storage_write' | 'storage_list' | 'storage_delete' | 'entity_invoke' | 'image_generate' | 'audio_generate' | 'surface_invoke' | 'navigate' | 'data_create_collection' | 'data_list_collections' | 'data_delete_collection' | 'data_put' | 'data_get' | 'data_query' | 'data_delete' | 'store_get_products' | 'store_purchase' | 'store_get_entitlements' | 'store_get_purchase_history' | 'store_restore' | 'store_cancel_subscription' | 'vault_documents_list' | 'vault_documents_read' | 'vault_documents_download_url' | 'vault_documents_write' | 'vault_documents_update' | 'vault_documents_delete' | 'arche_assets_list' | 'arche_assets_get_url';
|
|
249
407
|
/**
|
|
250
408
|
* Step navigation API available via useStepNavigation() hook.
|
|
251
409
|
*/
|