@rslsp1/fa-app-tools 2.0.22 → 2.0.23
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/{chunk-I73HODO5.mjs → chunk-UCEQOGPT.mjs} +23 -19
- package/dist/{hfStateService-PDBVLFML.mjs → hfStateService-TC65WQXK.mjs} +1 -1
- package/dist/index.d.mts +17 -3
- package/dist/index.d.ts +17 -3
- package/dist/index.js +784 -517
- package/dist/index.mjs +754 -492
- package/package.json +1 -1
|
@@ -119,10 +119,10 @@ async function loadHFState(namespace, token) {
|
|
|
119
119
|
async function loadPendingEvents(namespace, token, sinceTs) {
|
|
120
120
|
const files = await hfListDir(namespace, "events", token);
|
|
121
121
|
const pending = files.filter((f) => f.type === "file" && tsFromEventPath(f.path) > sinceTs).sort((a, b) => a.path.localeCompare(b.path));
|
|
122
|
-
const
|
|
122
|
+
const raw = await Promise.all(
|
|
123
123
|
pending.map((f) => hfDownloadJsonByPath(f.path, token))
|
|
124
124
|
);
|
|
125
|
-
return
|
|
125
|
+
return raw.flatMap((e) => Array.isArray(e) ? e : [e]);
|
|
126
126
|
}
|
|
127
127
|
var SESSION_CLIENT_ID = `client-${crypto.randomUUID().slice(0, 8)}`;
|
|
128
128
|
function getSessionClientId() {
|
|
@@ -279,23 +279,27 @@ async function hfUploadImage(base64, id, token, mimeType = "image/jpeg") {
|
|
|
279
279
|
commitTitle: `Add image ${id}`
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
|
-
async function hfLoadImageAsBase64(id, token) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
282
|
+
async function hfLoadImageAsBase64(id, token, namespace) {
|
|
283
|
+
const paths = [`images/${id}`];
|
|
284
|
+
if (namespace) paths.push(`${namespace}images/${id}`);
|
|
285
|
+
for (const basePath of paths) {
|
|
286
|
+
for (const ext of ["jpg", "png"]) {
|
|
287
|
+
try {
|
|
288
|
+
const res = await fetch(
|
|
289
|
+
`${HF_BASE}/datasets/${HF_REPO}/resolve/main/${basePath}.${ext}?download=true`,
|
|
290
|
+
{ headers: { Authorization: `Bearer ${token}` } }
|
|
291
|
+
);
|
|
292
|
+
if (!res.ok) continue;
|
|
293
|
+
const blob = await res.blob();
|
|
294
|
+
return new Promise((resolve, reject) => {
|
|
295
|
+
const reader = new FileReader();
|
|
296
|
+
reader.onload = () => resolve(reader.result.split(",")[1]);
|
|
297
|
+
reader.onerror = reject;
|
|
298
|
+
reader.readAsDataURL(blob);
|
|
299
|
+
});
|
|
300
|
+
} catch {
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
299
303
|
}
|
|
300
304
|
}
|
|
301
305
|
return null;
|
package/dist/index.d.mts
CHANGED
|
@@ -438,6 +438,10 @@ declare function TagManagerPanel({ workspaceTags, onTagCreate, onTagUpdate, onTa
|
|
|
438
438
|
interface LabsTabProps {
|
|
439
439
|
services: LabServices;
|
|
440
440
|
onResult?: (item: LabItem) => void;
|
|
441
|
+
/** Optional: pre-filtered video items for the Frames tab */
|
|
442
|
+
videoItems?: LabItem[];
|
|
443
|
+
/** Optional: resolve a mediaId to a playable video URL */
|
|
444
|
+
resolveVideoUrl?: (mediaId: string) => string;
|
|
441
445
|
}
|
|
442
446
|
declare const LabsTab: React.FC<LabsTabProps>;
|
|
443
447
|
|
|
@@ -465,6 +469,16 @@ interface LabLoopProps {
|
|
|
465
469
|
}
|
|
466
470
|
declare const LabLoop: React.FC<LabLoopProps>;
|
|
467
471
|
|
|
472
|
+
interface LabFrameExtractorProps {
|
|
473
|
+
/** Pre-filtered video items from the host app */
|
|
474
|
+
videoItems: LabItem[];
|
|
475
|
+
/** Called when the user selects a frame to use as output */
|
|
476
|
+
onResult?: (item: LabItem) => void;
|
|
477
|
+
/** Host-provided function to resolve a mediaId to a playable video URL */
|
|
478
|
+
resolveVideoUrl: (mediaId: string) => string;
|
|
479
|
+
}
|
|
480
|
+
declare const LabFrameExtractor: React.FC<LabFrameExtractorProps>;
|
|
481
|
+
|
|
468
482
|
interface LabImagePickerProps {
|
|
469
483
|
availableItems: LabItem[];
|
|
470
484
|
recentItems: LabItem[];
|
|
@@ -575,7 +589,7 @@ declare function hfDownloadProject(path: string, token: string): Promise<File>;
|
|
|
575
589
|
declare function hfUploadProjectForm(_zipBase64: string, _name: string, _token: string): Promise<HFProjectMeta>;
|
|
576
590
|
declare function hfDeleteProject(path: string, token: string): Promise<void>;
|
|
577
591
|
declare function hfUploadImage(base64: string, id: string, token: string, mimeType?: string): Promise<void>;
|
|
578
|
-
declare function hfLoadImageAsBase64(id: string, token: string): Promise<string | null>;
|
|
592
|
+
declare function hfLoadImageAsBase64(id: string, token: string, namespace?: string): Promise<string | null>;
|
|
579
593
|
|
|
580
594
|
interface HFStateResult {
|
|
581
595
|
state: HFStateSnapshot | null;
|
|
@@ -614,6 +628,6 @@ declare function findTips(dag: Dag): number[];
|
|
|
614
628
|
declare function findForks(dag: Dag): DagFork[];
|
|
615
629
|
declare function topoSort(events: HFEvent[]): HFEvent[];
|
|
616
630
|
|
|
617
|
-
declare const LIB_VERSION = "2.0.
|
|
631
|
+
declare const LIB_VERSION = "2.0.23";
|
|
618
632
|
|
|
619
|
-
export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type DagFork, type ExtractedCharacter, FaApp, type FaAppProps, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFEvent, type HFEventVersion, type HFFileInfo$1 as HFFileInfo, type HFMetadataEntry, type HFStateMeta, type HFStateResult, type HFStateSnapshot, HistoryPanel, type ImageAddedPayload, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, type MetadataUpdatedPayload, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type TagUpsertedPayload, type WorkspaceTags, applyEvent, applyEvents, autoLabel, buildBlendInstruction, buildCompareInstruction, buildDag, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, findForks, findTips, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, getSessionClientId, groupGenerationsToLabItems, hfBatchArchive, hfBootstrapFromLegacy, hfDeleteProject, hfDownloadProject, hfListDir, hfListProjects, hfLoadImageAsBase64, hfUploadImage, hfUploadProjectForm, hfUploadSmallFile, importProjectFromZip, injectXMPMetadata, interpretSdkError, loadHFState, loadPendingEvents, parsePromptFile, parsePromptResponse, setHFToken, topoSort, tsFromEventPath, useHFState, useKeyboardNavigation, useOnClickOutside, writeHFEvent };
|
|
633
|
+
export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type DagFork, type ExtractedCharacter, FaApp, type FaAppProps, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFEvent, type HFEventVersion, type HFFileInfo$1 as HFFileInfo, type HFMetadataEntry, type HFStateMeta, type HFStateResult, type HFStateSnapshot, HistoryPanel, type ImageAddedPayload, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabFrameExtractor, type LabFrameExtractorProps, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, type MetadataUpdatedPayload, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type TagUpsertedPayload, type WorkspaceTags, applyEvent, applyEvents, autoLabel, buildBlendInstruction, buildCompareInstruction, buildDag, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, findForks, findTips, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, getSessionClientId, groupGenerationsToLabItems, hfBatchArchive, hfBootstrapFromLegacy, hfDeleteProject, hfDownloadProject, hfListDir, hfListProjects, hfLoadImageAsBase64, hfUploadImage, hfUploadProjectForm, hfUploadSmallFile, importProjectFromZip, injectXMPMetadata, interpretSdkError, loadHFState, loadPendingEvents, parsePromptFile, parsePromptResponse, setHFToken, topoSort, tsFromEventPath, useHFState, useKeyboardNavigation, useOnClickOutside, writeHFEvent };
|
package/dist/index.d.ts
CHANGED
|
@@ -438,6 +438,10 @@ declare function TagManagerPanel({ workspaceTags, onTagCreate, onTagUpdate, onTa
|
|
|
438
438
|
interface LabsTabProps {
|
|
439
439
|
services: LabServices;
|
|
440
440
|
onResult?: (item: LabItem) => void;
|
|
441
|
+
/** Optional: pre-filtered video items for the Frames tab */
|
|
442
|
+
videoItems?: LabItem[];
|
|
443
|
+
/** Optional: resolve a mediaId to a playable video URL */
|
|
444
|
+
resolveVideoUrl?: (mediaId: string) => string;
|
|
441
445
|
}
|
|
442
446
|
declare const LabsTab: React.FC<LabsTabProps>;
|
|
443
447
|
|
|
@@ -465,6 +469,16 @@ interface LabLoopProps {
|
|
|
465
469
|
}
|
|
466
470
|
declare const LabLoop: React.FC<LabLoopProps>;
|
|
467
471
|
|
|
472
|
+
interface LabFrameExtractorProps {
|
|
473
|
+
/** Pre-filtered video items from the host app */
|
|
474
|
+
videoItems: LabItem[];
|
|
475
|
+
/** Called when the user selects a frame to use as output */
|
|
476
|
+
onResult?: (item: LabItem) => void;
|
|
477
|
+
/** Host-provided function to resolve a mediaId to a playable video URL */
|
|
478
|
+
resolveVideoUrl: (mediaId: string) => string;
|
|
479
|
+
}
|
|
480
|
+
declare const LabFrameExtractor: React.FC<LabFrameExtractorProps>;
|
|
481
|
+
|
|
468
482
|
interface LabImagePickerProps {
|
|
469
483
|
availableItems: LabItem[];
|
|
470
484
|
recentItems: LabItem[];
|
|
@@ -575,7 +589,7 @@ declare function hfDownloadProject(path: string, token: string): Promise<File>;
|
|
|
575
589
|
declare function hfUploadProjectForm(_zipBase64: string, _name: string, _token: string): Promise<HFProjectMeta>;
|
|
576
590
|
declare function hfDeleteProject(path: string, token: string): Promise<void>;
|
|
577
591
|
declare function hfUploadImage(base64: string, id: string, token: string, mimeType?: string): Promise<void>;
|
|
578
|
-
declare function hfLoadImageAsBase64(id: string, token: string): Promise<string | null>;
|
|
592
|
+
declare function hfLoadImageAsBase64(id: string, token: string, namespace?: string): Promise<string | null>;
|
|
579
593
|
|
|
580
594
|
interface HFStateResult {
|
|
581
595
|
state: HFStateSnapshot | null;
|
|
@@ -614,6 +628,6 @@ declare function findTips(dag: Dag): number[];
|
|
|
614
628
|
declare function findForks(dag: Dag): DagFork[];
|
|
615
629
|
declare function topoSort(events: HFEvent[]): HFEvent[];
|
|
616
630
|
|
|
617
|
-
declare const LIB_VERSION = "2.0.
|
|
631
|
+
declare const LIB_VERSION = "2.0.23";
|
|
618
632
|
|
|
619
|
-
export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type DagFork, type ExtractedCharacter, FaApp, type FaAppProps, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFEvent, type HFEventVersion, type HFFileInfo$1 as HFFileInfo, type HFMetadataEntry, type HFStateMeta, type HFStateResult, type HFStateSnapshot, HistoryPanel, type ImageAddedPayload, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, type MetadataUpdatedPayload, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type TagUpsertedPayload, type WorkspaceTags, applyEvent, applyEvents, autoLabel, buildBlendInstruction, buildCompareInstruction, buildDag, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, findForks, findTips, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, getSessionClientId, groupGenerationsToLabItems, hfBatchArchive, hfBootstrapFromLegacy, hfDeleteProject, hfDownloadProject, hfListDir, hfListProjects, hfLoadImageAsBase64, hfUploadImage, hfUploadProjectForm, hfUploadSmallFile, importProjectFromZip, injectXMPMetadata, interpretSdkError, loadHFState, loadPendingEvents, parsePromptFile, parsePromptResponse, setHFToken, topoSort, tsFromEventPath, useHFState, useKeyboardNavigation, useOnClickOutside, writeHFEvent };
|
|
633
|
+
export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type DagFork, type ExtractedCharacter, FaApp, type FaAppProps, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFEvent, type HFEventVersion, type HFFileInfo$1 as HFFileInfo, type HFMetadataEntry, type HFStateMeta, type HFStateResult, type HFStateSnapshot, HistoryPanel, type ImageAddedPayload, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabFrameExtractor, type LabFrameExtractorProps, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, type MetadataUpdatedPayload, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type TagUpsertedPayload, type WorkspaceTags, applyEvent, applyEvents, autoLabel, buildBlendInstruction, buildCompareInstruction, buildDag, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, findForks, findTips, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, getSessionClientId, groupGenerationsToLabItems, hfBatchArchive, hfBootstrapFromLegacy, hfDeleteProject, hfDownloadProject, hfListDir, hfListProjects, hfLoadImageAsBase64, hfUploadImage, hfUploadProjectForm, hfUploadSmallFile, importProjectFromZip, injectXMPMetadata, interpretSdkError, loadHFState, loadPendingEvents, parsePromptFile, parsePromptResponse, setHFToken, topoSort, tsFromEventPath, useHFState, useKeyboardNavigation, useOnClickOutside, writeHFEvent };
|