@rslsp1/fa-app-tools 2.0.56 → 2.0.57
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.
|
@@ -116,11 +116,16 @@ async function loadHFState(namespace, token) {
|
|
|
116
116
|
meta: JSON.parse(metaStr)
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
|
-
async function loadPendingEvents(namespace, token, sinceTs) {
|
|
119
|
+
async function loadPendingEvents(namespace, token, sinceTs, knownPaths) {
|
|
120
120
|
const files = await hfListDir(namespace, "events", token);
|
|
121
|
-
const pending = files.filter((f) => f.type === "file" && tsFromEventPath(f.path) > sinceTs).sort((a, b) => a.path.localeCompare(b.path));
|
|
121
|
+
const pending = files.filter((f) => f.type === "file" && tsFromEventPath(f.path) > sinceTs && !knownPaths?.has(f.path)).sort((a, b) => a.path.localeCompare(b.path));
|
|
122
|
+
if (!pending.length) return [];
|
|
122
123
|
const raw = await Promise.all(
|
|
123
|
-
pending.map((f) =>
|
|
124
|
+
pending.map(async (f) => {
|
|
125
|
+
const result = await hfDownloadJsonByPath(f.path, token);
|
|
126
|
+
knownPaths?.add(f.path);
|
|
127
|
+
return result;
|
|
128
|
+
})
|
|
124
129
|
);
|
|
125
130
|
return raw.flatMap((e) => Array.isArray(e) ? e : [e]);
|
|
126
131
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -589,7 +589,7 @@ declare function hfBatchArchive(moves: Array<{
|
|
|
589
589
|
}>, token: string, summary: string): Promise<void>;
|
|
590
590
|
declare function tsFromEventPath(repoPath: string): number;
|
|
591
591
|
declare function loadHFState(namespace: string, token: string): Promise<HFStateSnapshot | null>;
|
|
592
|
-
declare function loadPendingEvents(namespace: string, token: string, sinceTs: number): Promise<HFEvent[]>;
|
|
592
|
+
declare function loadPendingEvents(namespace: string, token: string, sinceTs: number, knownPaths?: Set<string>): Promise<HFEvent[]>;
|
|
593
593
|
declare function getSessionClientId(): string;
|
|
594
594
|
declare function writeHFEvent<P>(namespace: string, token: string, type: string, payload: P, prevTs: number[]): Promise<HFEvent<P>>;
|
|
595
595
|
declare function hfBootstrapFromLegacy(namespace: string, token: string, onProgress?: (msg: string) => void): Promise<void>;
|
|
@@ -641,6 +641,6 @@ declare function findTips(dag: Dag): number[];
|
|
|
641
641
|
declare function findForks(dag: Dag): DagFork[];
|
|
642
642
|
declare function topoSort(events: HFEvent[]): HFEvent[];
|
|
643
643
|
|
|
644
|
-
declare const LIB_VERSION = "2.0.
|
|
644
|
+
declare const LIB_VERSION = "2.0.57";
|
|
645
645
|
|
|
646
646
|
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, ServerTab, 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
|
@@ -589,7 +589,7 @@ declare function hfBatchArchive(moves: Array<{
|
|
|
589
589
|
}>, token: string, summary: string): Promise<void>;
|
|
590
590
|
declare function tsFromEventPath(repoPath: string): number;
|
|
591
591
|
declare function loadHFState(namespace: string, token: string): Promise<HFStateSnapshot | null>;
|
|
592
|
-
declare function loadPendingEvents(namespace: string, token: string, sinceTs: number): Promise<HFEvent[]>;
|
|
592
|
+
declare function loadPendingEvents(namespace: string, token: string, sinceTs: number, knownPaths?: Set<string>): Promise<HFEvent[]>;
|
|
593
593
|
declare function getSessionClientId(): string;
|
|
594
594
|
declare function writeHFEvent<P>(namespace: string, token: string, type: string, payload: P, prevTs: number[]): Promise<HFEvent<P>>;
|
|
595
595
|
declare function hfBootstrapFromLegacy(namespace: string, token: string, onProgress?: (msg: string) => void): Promise<void>;
|
|
@@ -641,6 +641,6 @@ declare function findTips(dag: Dag): number[];
|
|
|
641
641
|
declare function findForks(dag: Dag): DagFork[];
|
|
642
642
|
declare function topoSort(events: HFEvent[]): HFEvent[];
|
|
643
643
|
|
|
644
|
-
declare const LIB_VERSION = "2.0.
|
|
644
|
+
declare const LIB_VERSION = "2.0.57";
|
|
645
645
|
|
|
646
646
|
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, ServerTab, 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.js
CHANGED
|
@@ -404,11 +404,16 @@ async function loadHFState(namespace, token) {
|
|
|
404
404
|
meta: JSON.parse(metaStr)
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
|
-
async function loadPendingEvents(namespace, token, sinceTs) {
|
|
407
|
+
async function loadPendingEvents(namespace, token, sinceTs, knownPaths) {
|
|
408
408
|
const files = await hfListDir(namespace, "events", token);
|
|
409
|
-
const pending = files.filter((f) => f.type === "file" && tsFromEventPath(f.path) > sinceTs).sort((a, b) => a.path.localeCompare(b.path));
|
|
409
|
+
const pending = files.filter((f) => f.type === "file" && tsFromEventPath(f.path) > sinceTs && !knownPaths?.has(f.path)).sort((a, b) => a.path.localeCompare(b.path));
|
|
410
|
+
if (!pending.length) return [];
|
|
410
411
|
const raw = await Promise.all(
|
|
411
|
-
pending.map((f) =>
|
|
412
|
+
pending.map(async (f) => {
|
|
413
|
+
const result = await hfDownloadJsonByPath(f.path, token);
|
|
414
|
+
knownPaths?.add(f.path);
|
|
415
|
+
return result;
|
|
416
|
+
})
|
|
412
417
|
);
|
|
413
418
|
return raw.flatMap((e) => Array.isArray(e) ? e : [e]);
|
|
414
419
|
}
|
|
@@ -2714,6 +2719,7 @@ function useHFState(token, namespace) {
|
|
|
2714
2719
|
const [lastEventTs, setLastEventTs] = (0, import_react16.useState)(0);
|
|
2715
2720
|
const [hasStateZip, setHasStateZip] = (0, import_react16.useState)(false);
|
|
2716
2721
|
const knownEventPaths = (0, import_react16.useRef)(/* @__PURE__ */ new Set());
|
|
2722
|
+
const knownFilePaths = (0, import_react16.useRef)(/* @__PURE__ */ new Set());
|
|
2717
2723
|
const allEventsRef = (0, import_react16.useRef)([]);
|
|
2718
2724
|
const applyNewEvents = (0, import_react16.useCallback)((snapshot, newEvents) => {
|
|
2719
2725
|
if (!newEvents.length && allEventsRef.current.length === 0) {
|
|
@@ -2733,6 +2739,7 @@ function useHFState(token, namespace) {
|
|
|
2733
2739
|
if (!token || !namespace) return;
|
|
2734
2740
|
setIsLoading(true);
|
|
2735
2741
|
setError(null);
|
|
2742
|
+
knownFilePaths.current = /* @__PURE__ */ new Set();
|
|
2736
2743
|
try {
|
|
2737
2744
|
const snapshot = await loadHFState(namespace, token);
|
|
2738
2745
|
setHasStateZip(snapshot !== null);
|
|
@@ -2741,7 +2748,7 @@ function useHFState(token, namespace) {
|
|
|
2741
2748
|
tags: { by_category: {}, all: [] },
|
|
2742
2749
|
meta: { consolidatedAt: 0, version: 1 }
|
|
2743
2750
|
};
|
|
2744
|
-
const hfEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt);
|
|
2751
|
+
const hfEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt, knownFilePaths.current);
|
|
2745
2752
|
const hfEventKeys = new Set(hfEvents.map((e) => `${e.ts}_${e.clientId}`));
|
|
2746
2753
|
const localOnlyEvents = allEventsRef.current.filter(
|
|
2747
2754
|
(e) => !hfEventKeys.has(`${e.ts}_${e.clientId}`)
|
|
@@ -2766,7 +2773,7 @@ function useHFState(token, namespace) {
|
|
|
2766
2773
|
}
|
|
2767
2774
|
writeOfflineBuffer(failed);
|
|
2768
2775
|
setPendingBufferCount(failed.length);
|
|
2769
|
-
const freshEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt);
|
|
2776
|
+
const freshEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt, knownFilePaths.current);
|
|
2770
2777
|
freshEvents.forEach((e) => knownEventPaths.current.add(`${e.ts}_${e.clientId}`));
|
|
2771
2778
|
setState((prev) => prev ? applyNewEvents(base, freshEvents) : prev);
|
|
2772
2779
|
}
|
|
@@ -2779,7 +2786,7 @@ function useHFState(token, namespace) {
|
|
|
2779
2786
|
const pollNew = (0, import_react16.useCallback)(async () => {
|
|
2780
2787
|
if (!token || !namespace || !state) return;
|
|
2781
2788
|
try {
|
|
2782
|
-
const events = await loadPendingEvents(namespace, token, state.meta.consolidatedAt);
|
|
2789
|
+
const events = await loadPendingEvents(namespace, token, state.meta.consolidatedAt, knownFilePaths.current);
|
|
2783
2790
|
const newEvents = events.filter((e) => !knownEventPaths.current.has(`${e.ts}_${e.clientId}`));
|
|
2784
2791
|
if (!newEvents.length) return;
|
|
2785
2792
|
newEvents.forEach((e) => knownEventPaths.current.add(`${e.ts}_${e.clientId}`));
|
|
@@ -6741,7 +6748,7 @@ function FaApp({
|
|
|
6741
6748
|
// src/index.ts
|
|
6742
6749
|
init_hfStateService();
|
|
6743
6750
|
init_hfStateService();
|
|
6744
|
-
var LIB_VERSION = "2.0.
|
|
6751
|
+
var LIB_VERSION = "2.0.57";
|
|
6745
6752
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6746
6753
|
0 && (module.exports = {
|
|
6747
6754
|
AvatarArchitectApp,
|
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
setHFToken,
|
|
22
22
|
tsFromEventPath,
|
|
23
23
|
writeHFEvent
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-VVLKEBHL.mjs";
|
|
25
25
|
|
|
26
26
|
// src/hooks/useOnClickOutside.ts
|
|
27
27
|
import { useEffect } from "react";
|
|
@@ -1666,7 +1666,7 @@ var ProjectSyncTab = ({
|
|
|
1666
1666
|
{
|
|
1667
1667
|
onClick: async () => {
|
|
1668
1668
|
try {
|
|
1669
|
-
const { hfDownloadProject: hfDownloadProject2 } = await import("./hfStateService-
|
|
1669
|
+
const { hfDownloadProject: hfDownloadProject2 } = await import("./hfStateService-PHK6676C.mjs");
|
|
1670
1670
|
const file = await hfDownloadProject2(p.path, hfToken);
|
|
1671
1671
|
onHfLoad(file);
|
|
1672
1672
|
} catch (e) {
|
|
@@ -2030,6 +2030,7 @@ function useHFState(token, namespace) {
|
|
|
2030
2030
|
const [lastEventTs, setLastEventTs] = useState9(0);
|
|
2031
2031
|
const [hasStateZip, setHasStateZip] = useState9(false);
|
|
2032
2032
|
const knownEventPaths = useRef6(/* @__PURE__ */ new Set());
|
|
2033
|
+
const knownFilePaths = useRef6(/* @__PURE__ */ new Set());
|
|
2033
2034
|
const allEventsRef = useRef6([]);
|
|
2034
2035
|
const applyNewEvents = useCallback((snapshot, newEvents) => {
|
|
2035
2036
|
if (!newEvents.length && allEventsRef.current.length === 0) {
|
|
@@ -2049,6 +2050,7 @@ function useHFState(token, namespace) {
|
|
|
2049
2050
|
if (!token || !namespace) return;
|
|
2050
2051
|
setIsLoading(true);
|
|
2051
2052
|
setError(null);
|
|
2053
|
+
knownFilePaths.current = /* @__PURE__ */ new Set();
|
|
2052
2054
|
try {
|
|
2053
2055
|
const snapshot = await loadHFState(namespace, token);
|
|
2054
2056
|
setHasStateZip(snapshot !== null);
|
|
@@ -2057,7 +2059,7 @@ function useHFState(token, namespace) {
|
|
|
2057
2059
|
tags: { by_category: {}, all: [] },
|
|
2058
2060
|
meta: { consolidatedAt: 0, version: 1 }
|
|
2059
2061
|
};
|
|
2060
|
-
const hfEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt);
|
|
2062
|
+
const hfEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt, knownFilePaths.current);
|
|
2061
2063
|
const hfEventKeys = new Set(hfEvents.map((e) => `${e.ts}_${e.clientId}`));
|
|
2062
2064
|
const localOnlyEvents = allEventsRef.current.filter(
|
|
2063
2065
|
(e) => !hfEventKeys.has(`${e.ts}_${e.clientId}`)
|
|
@@ -2082,7 +2084,7 @@ function useHFState(token, namespace) {
|
|
|
2082
2084
|
}
|
|
2083
2085
|
writeOfflineBuffer(failed);
|
|
2084
2086
|
setPendingBufferCount(failed.length);
|
|
2085
|
-
const freshEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt);
|
|
2087
|
+
const freshEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt, knownFilePaths.current);
|
|
2086
2088
|
freshEvents.forEach((e) => knownEventPaths.current.add(`${e.ts}_${e.clientId}`));
|
|
2087
2089
|
setState((prev) => prev ? applyNewEvents(base, freshEvents) : prev);
|
|
2088
2090
|
}
|
|
@@ -2095,7 +2097,7 @@ function useHFState(token, namespace) {
|
|
|
2095
2097
|
const pollNew = useCallback(async () => {
|
|
2096
2098
|
if (!token || !namespace || !state) return;
|
|
2097
2099
|
try {
|
|
2098
|
-
const events = await loadPendingEvents(namespace, token, state.meta.consolidatedAt);
|
|
2100
|
+
const events = await loadPendingEvents(namespace, token, state.meta.consolidatedAt, knownFilePaths.current);
|
|
2099
2101
|
const newEvents = events.filter((e) => !knownEventPaths.current.has(`${e.ts}_${e.clientId}`));
|
|
2100
2102
|
if (!newEvents.length) return;
|
|
2101
2103
|
newEvents.forEach((e) => knownEventPaths.current.add(`${e.ts}_${e.clientId}`));
|
|
@@ -5224,7 +5226,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
5224
5226
|
onClick: async () => {
|
|
5225
5227
|
setIsLoadingFromHF(true);
|
|
5226
5228
|
try {
|
|
5227
|
-
const { hfListProjects: hfListProjects2, hfDownloadProject: hfDownloadProject2 } = await import("./hfStateService-
|
|
5229
|
+
const { hfListProjects: hfListProjects2, hfDownloadProject: hfDownloadProject2 } = await import("./hfStateService-PHK6676C.mjs");
|
|
5228
5230
|
const projects = await hfListProjects2(hfToken);
|
|
5229
5231
|
if (projects.length > 0) {
|
|
5230
5232
|
const file = await hfDownloadProject2(projects[0].path, hfToken);
|
|
@@ -6055,7 +6057,7 @@ function FaApp({
|
|
|
6055
6057
|
}
|
|
6056
6058
|
|
|
6057
6059
|
// src/index.ts
|
|
6058
|
-
var LIB_VERSION = "2.0.
|
|
6060
|
+
var LIB_VERSION = "2.0.57";
|
|
6059
6061
|
export {
|
|
6060
6062
|
AvatarArchitectApp,
|
|
6061
6063
|
CollapsibleCard,
|