@rslsp1/fa-app-tools 6.1.0 → 7.0.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/{chunk-GHKN2VX3.mjs → chunk-B2YV4TNI.mjs} +319 -13
- package/dist/{hfEventTypes-Dkfrcd_t.d.mts → hfEventTypes-BUztJySs.d.mts} +1 -11
- package/dist/{hfEventTypes-C_PX6RFR.d.ts → hfEventTypes-fAdA-0A9.d.ts} +1 -11
- package/dist/index.d.mts +18 -49
- package/dist/index.d.ts +18 -49
- package/dist/index.js +635 -1481
- package/dist/index.mjs +207 -670
- package/dist/szenen.d.mts +2 -2
- package/dist/szenen.d.ts +2 -2
- package/dist/szenen.mjs +1 -2
- package/package.json +1 -1
- package/dist/chunk-NBUS7AWR.mjs +0 -418
- package/dist/chunk-UFXDXENC.mjs +0 -218
- package/dist/hfStateService-W7KO2FOH.mjs +0 -56
- package/dist/project-O4ORKXY5.mjs +0 -8
|
@@ -4,15 +4,307 @@ import {
|
|
|
4
4
|
preferredVersionId,
|
|
5
5
|
resolvePreferredHead
|
|
6
6
|
} from "./chunk-FUY2OCVC.mjs";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
|
|
8
|
+
// src/lib/hfEventTypes.ts
|
|
9
|
+
var HF_BASE = "https://huggingface.co";
|
|
10
|
+
var HF_REPO = "RolandSch/fa-app-state";
|
|
11
|
+
var CURRENT_EVENT_VERSION = { major: 1, minor: 0 };
|
|
12
|
+
var SPEICHERBARE_BILDTYPEN = ["image/png", "image/jpeg", "image/webp"];
|
|
13
|
+
function bildEndungFuer(mimeType) {
|
|
14
|
+
if (mimeType === "image/png") return "png";
|
|
15
|
+
if (mimeType === "image/webp") return "webp";
|
|
16
|
+
return "jpg";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// src/lib/hfEventLog.ts
|
|
20
|
+
function treeUrl(namespace, subdir = "") {
|
|
21
|
+
const parts = [namespace.replace(/\/$/, ""), subdir].filter(Boolean).join("/");
|
|
22
|
+
return `${HF_BASE}/api/datasets/${HF_REPO}/tree/main${parts ? "/" + parts : ""}`;
|
|
23
|
+
}
|
|
24
|
+
var DROSSEL_VERSUCHE = 4;
|
|
25
|
+
var DROSSEL_BASIS_MS = 400;
|
|
26
|
+
var schlafen = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
27
|
+
var HF_LESE_ZEITLIMIT_MS = 2e4;
|
|
28
|
+
async function holeMitZeitlimit(url, init) {
|
|
29
|
+
const abbruch = new AbortController();
|
|
30
|
+
const timer = setTimeout(() => abbruch.abort(), HF_LESE_ZEITLIMIT_MS);
|
|
31
|
+
try {
|
|
32
|
+
return await fetch(url, { ...init, signal: abbruch.signal });
|
|
33
|
+
} catch (error) {
|
|
34
|
+
if (abbruch.signal.aborted) {
|
|
35
|
+
throw new Error(`HF-Anfrage ohne Antwort nach ${HF_LESE_ZEITLIMIT_MS}ms abgebrochen: ${url}`);
|
|
36
|
+
}
|
|
37
|
+
throw error;
|
|
38
|
+
} finally {
|
|
39
|
+
clearTimeout(timer);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function mitGeduld(anfrage) {
|
|
43
|
+
let letzte = null;
|
|
44
|
+
for (let versuch = 0; versuch < DROSSEL_VERSUCHE; versuch += 1) {
|
|
45
|
+
const res = await anfrage();
|
|
46
|
+
if (res.status !== 429 && res.status < 500) return res;
|
|
47
|
+
letzte = res;
|
|
48
|
+
if (versuch === DROSSEL_VERSUCHE - 1) break;
|
|
49
|
+
const angesagt = Number(res.headers.get("retry-after"));
|
|
50
|
+
const warten2 = Number.isFinite(angesagt) && angesagt > 0 ? angesagt * 1e3 : DROSSEL_BASIS_MS * 2 ** versuch;
|
|
51
|
+
await schlafen(warten2);
|
|
52
|
+
}
|
|
53
|
+
return letzte;
|
|
54
|
+
}
|
|
55
|
+
async function hfListDir(namespace, subdir, token) {
|
|
56
|
+
const res = await mitGeduld(() => holeMitZeitlimit(treeUrl(namespace, subdir), {
|
|
57
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
58
|
+
}));
|
|
59
|
+
if (res.status === 404) return [];
|
|
60
|
+
if (!res.ok) throw new Error(`HF list failed: ${res.status} ${res.statusText}`);
|
|
61
|
+
return res.json();
|
|
62
|
+
}
|
|
63
|
+
async function hfDownloadJsonByPath(repoPath, token) {
|
|
64
|
+
const res = await mitGeduld(() => holeMitZeitlimit(
|
|
65
|
+
`${HF_BASE}/datasets/${HF_REPO}/resolve/main/${repoPath}?download=true`,
|
|
66
|
+
{ headers: { Authorization: `Bearer ${token}` } }
|
|
67
|
+
));
|
|
68
|
+
if (!res.ok) throw new Error(`HF download failed: ${res.status}`);
|
|
69
|
+
return res.json();
|
|
70
|
+
}
|
|
71
|
+
async function hfDownloadBinaryByPath(repoPath, token) {
|
|
72
|
+
const res = await mitGeduld(() => holeMitZeitlimit(
|
|
73
|
+
`${HF_BASE}/datasets/${HF_REPO}/resolve/main/${repoPath}?download=true`,
|
|
74
|
+
{ headers: { Authorization: `Bearer ${token}` } }
|
|
75
|
+
));
|
|
76
|
+
if (!res.ok) throw new Error(`HF download binary failed: ${res.status}`);
|
|
77
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
78
|
+
}
|
|
79
|
+
function toBase64(text) {
|
|
80
|
+
const bytes = new TextEncoder().encode(text);
|
|
81
|
+
let binary = "";
|
|
82
|
+
bytes.forEach((b) => binary += String.fromCharCode(b));
|
|
83
|
+
return btoa(binary);
|
|
84
|
+
}
|
|
85
|
+
async function hfUploadSmallFile(repoPath, content, token, summary = `Update ${repoPath}`) {
|
|
86
|
+
const res = await fetch(`${HF_BASE}/api/datasets/${HF_REPO}/commit/main`, {
|
|
87
|
+
method: "POST",
|
|
88
|
+
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/x-ndjson" },
|
|
89
|
+
body: [
|
|
90
|
+
JSON.stringify({ key: "header", value: { summary, description: "" } }),
|
|
91
|
+
JSON.stringify({ key: "file", value: { path: repoPath, encoding: "base64", content: toBase64(content) } })
|
|
92
|
+
].join("\n")
|
|
93
|
+
});
|
|
94
|
+
if (!res.ok) {
|
|
95
|
+
const err = await res.text().catch(() => "");
|
|
96
|
+
throw new Error(`HF upload failed: ${res.status} \u2014 ${err.slice(0, 200)}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async function hfBatchArchive(moves, token, summary) {
|
|
100
|
+
const lines = [
|
|
101
|
+
JSON.stringify({ key: "header", value: { summary, description: "" } }),
|
|
102
|
+
...moves.flatMap(({ from, to, content }) => [
|
|
103
|
+
JSON.stringify({ key: "file", value: { path: to, encoding: "base64", content: toBase64(content) } }),
|
|
104
|
+
JSON.stringify({ key: "deletedFile", value: { path: from } })
|
|
105
|
+
])
|
|
106
|
+
];
|
|
107
|
+
const res = await fetch(`${HF_BASE}/api/datasets/${HF_REPO}/commit/main`, {
|
|
108
|
+
method: "POST",
|
|
109
|
+
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/x-ndjson" },
|
|
110
|
+
body: lines.join("\n")
|
|
111
|
+
});
|
|
112
|
+
if (!res.ok) {
|
|
113
|
+
const err = await res.text().catch(() => "");
|
|
114
|
+
throw new Error(`HF batch archive failed: ${res.status} \u2014 ${err.slice(0, 200)}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function tsFromEventPath(repoPath) {
|
|
118
|
+
const filename = repoPath.split("/").pop() || "";
|
|
119
|
+
const base = filename.replace(/_[^_]+\.json$/, "");
|
|
120
|
+
const iso = base.replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z$/, "T$1:$2:$3.$4Z");
|
|
121
|
+
const ts = Date.parse(iso);
|
|
122
|
+
return isNaN(ts) ? 0 : ts;
|
|
123
|
+
}
|
|
124
|
+
var EVENTDOWNLOAD_PARALLELITAET = 3;
|
|
125
|
+
async function mitBegrenzterParallelitaet(count, limit, task) {
|
|
126
|
+
let cursor = 0;
|
|
127
|
+
let ersterFehler;
|
|
128
|
+
let fehlerAufgetreten = false;
|
|
129
|
+
const worker = async () => {
|
|
130
|
+
while (cursor < count) {
|
|
131
|
+
const index = cursor++;
|
|
132
|
+
try {
|
|
133
|
+
await task(index);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
if (!fehlerAufgetreten) {
|
|
136
|
+
fehlerAufgetreten = true;
|
|
137
|
+
ersterFehler = error;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
await Promise.all(Array.from({ length: Math.min(limit, count) }, worker));
|
|
143
|
+
if (fehlerAufgetreten) throw ersterFehler;
|
|
144
|
+
}
|
|
145
|
+
async function loadPendingEvents(namespace, token, sinceTs, knownPaths) {
|
|
146
|
+
const files = await hfListDir(namespace, "events", token);
|
|
147
|
+
const pending = files.filter((f) => f.type === "file" && tsFromEventPath(f.path) > sinceTs && !knownPaths?.has(f.path)).sort((a, b) => a.path.localeCompare(b.path));
|
|
148
|
+
if (!pending.length) return [];
|
|
149
|
+
const raw = new Array(pending.length);
|
|
150
|
+
await mitBegrenzterParallelitaet(pending.length, EVENTDOWNLOAD_PARALLELITAET, async (index) => {
|
|
151
|
+
raw[index] = await hfDownloadJsonByPath(pending[index].path, token);
|
|
152
|
+
});
|
|
153
|
+
for (const f of pending) knownPaths?.add(f.path);
|
|
154
|
+
return raw.flatMap((e) => Array.isArray(e) ? e : [e]);
|
|
155
|
+
}
|
|
156
|
+
var SESSION_CLIENT_ID = `client-${crypto.randomUUID().slice(0, 8)}`;
|
|
157
|
+
function getSessionClientId() {
|
|
158
|
+
return SESSION_CLIENT_ID;
|
|
159
|
+
}
|
|
160
|
+
function tsToFilename(ts) {
|
|
161
|
+
return new Date(ts).toISOString().replace(/:/g, "-").replace(".", "-");
|
|
162
|
+
}
|
|
163
|
+
var writeSeq = 0;
|
|
164
|
+
var lastOrderedTs = 0;
|
|
165
|
+
async function writeHFEvent(namespace, token, type, payload, prevTs, options) {
|
|
166
|
+
const wallTs = Date.now();
|
|
167
|
+
const ts = options?.ordered ? Math.max(wallTs, lastOrderedTs) : wallTs;
|
|
168
|
+
if (options?.ordered) lastOrderedTs = ts;
|
|
169
|
+
const uuid = crypto.randomUUID().slice(0, 8);
|
|
170
|
+
const event = {
|
|
171
|
+
v: CURRENT_EVENT_VERSION,
|
|
172
|
+
type,
|
|
173
|
+
ts,
|
|
174
|
+
prevTs,
|
|
175
|
+
clientId: SESSION_CLIENT_ID,
|
|
176
|
+
payload
|
|
177
|
+
};
|
|
178
|
+
const suffix = options?.ordered ? `${String(++writeSeq % 1e6).padStart(6, "0")}${uuid}` : uuid;
|
|
179
|
+
const filename = `${tsToFilename(ts)}_${suffix}.json`;
|
|
180
|
+
const repoPath = `${namespace}events/${filename}`;
|
|
181
|
+
await hfUploadSmallFile(repoPath, JSON.stringify(event, null, 2), token, `Event: ${type}`);
|
|
182
|
+
return event;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// src/lib/hfStateService.ts
|
|
186
|
+
import JSZip from "jszip";
|
|
187
|
+
import { uploadFile } from "@huggingface/hub";
|
|
188
|
+
var HF_TOKEN_KEY = "hf-token";
|
|
189
|
+
function getHFToken() {
|
|
190
|
+
try {
|
|
191
|
+
return localStorage.getItem(HF_TOKEN_KEY);
|
|
192
|
+
} catch {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function setHFToken(token) {
|
|
197
|
+
try {
|
|
198
|
+
localStorage.setItem(HF_TOKEN_KEY, token);
|
|
199
|
+
} catch {
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
async function loadHFState(namespace, token) {
|
|
203
|
+
const files = await hfListDir(namespace, "", token);
|
|
204
|
+
const stateFiles = files.filter((f) => f.type === "file" && /^state-[\dT\-]+Z\.zip$/.test(f.path.split("/").pop() || "")).sort((a, b) => b.path.localeCompare(a.path));
|
|
205
|
+
if (!stateFiles.length) return null;
|
|
206
|
+
const zipBytes = await hfDownloadBinaryByPath(stateFiles[0].path, token);
|
|
207
|
+
const zip = await JSZip.loadAsync(zipBytes);
|
|
208
|
+
const [metadataStr, tagsStr, metaStr, openTasksStr] = await Promise.all([
|
|
209
|
+
zip.file("metadata.json")?.async("string"),
|
|
210
|
+
zip.file("tags.json")?.async("string"),
|
|
211
|
+
zip.file("state_meta.json")?.async("string"),
|
|
212
|
+
zip.file("open_tasks.json")?.async("string")
|
|
213
|
+
// optional — ältere Snapshots haben es nicht
|
|
214
|
+
]);
|
|
215
|
+
if (!metadataStr || !tagsStr || !metaStr) throw new Error("state.zip: fehlende Pflicht-Dateien");
|
|
216
|
+
return {
|
|
217
|
+
metadata: JSON.parse(metadataStr),
|
|
218
|
+
tags: JSON.parse(tagsStr),
|
|
219
|
+
meta: JSON.parse(metaStr),
|
|
220
|
+
openTasks: openTasksStr ? JSON.parse(openTasksStr) : {}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
async function hfBootstrapFromLegacy(namespace, token, onProgress) {
|
|
224
|
+
const log = (msg) => {
|
|
225
|
+
if (onProgress) onProgress(msg);
|
|
226
|
+
};
|
|
227
|
+
log("Lese tags.json \u2026");
|
|
228
|
+
const tags = await fetch(
|
|
229
|
+
`${HF_BASE}/datasets/${HF_REPO}/resolve/main/tags.json?download=true`,
|
|
230
|
+
{ headers: { Authorization: `Bearer ${token}` } }
|
|
231
|
+
).then((r) => r.ok ? r.json() : null).catch(() => null);
|
|
232
|
+
log("Lese metadata.json \u2026");
|
|
233
|
+
const metadata = await fetch(
|
|
234
|
+
`${HF_BASE}/datasets/${HF_REPO}/resolve/main/metadata.json?download=true`,
|
|
235
|
+
{ headers: { Authorization: `Bearer ${token}` } }
|
|
236
|
+
).then((r) => r.ok ? r.json() : []).catch(() => []);
|
|
237
|
+
const snapshot = {
|
|
238
|
+
metadata: Array.isArray(metadata) ? metadata : [],
|
|
239
|
+
tags: tags?.by_category ? tags : { by_category: {}, all: [] },
|
|
240
|
+
meta: { consolidatedAt: Date.now(), version: 1 }
|
|
241
|
+
};
|
|
242
|
+
log(`Erstelle state.zip (${snapshot.metadata.length} Bilder, ${snapshot.tags.all?.length ?? 0} Tags) \u2026`);
|
|
243
|
+
const zip = new JSZip();
|
|
244
|
+
zip.file("metadata.json", JSON.stringify(snapshot.metadata, null, 2));
|
|
245
|
+
zip.file("tags.json", JSON.stringify(snapshot.tags, null, 2));
|
|
246
|
+
zip.file("state_meta.json", JSON.stringify(snapshot.meta, null, 2));
|
|
247
|
+
const zipBytes = await zip.generateAsync({ type: "uint8array", compression: "DEFLATE" });
|
|
248
|
+
const ts = snapshot.meta.consolidatedAt;
|
|
249
|
+
const stateFilename = `state-${new Date(ts).toISOString().replace(/:/g, "-").replace(".", "-")}.zip`;
|
|
250
|
+
const repoPath = `${namespace}${stateFilename}`;
|
|
251
|
+
log("Lade state.zip hoch \u2026");
|
|
252
|
+
await uploadFile({
|
|
253
|
+
repo: { type: "dataset", name: HF_REPO },
|
|
254
|
+
credentials: { accessToken: token },
|
|
255
|
+
file: { path: repoPath, content: new Blob([zipBytes.buffer], { type: "application/zip" }) },
|
|
256
|
+
branch: "main",
|
|
257
|
+
commitTitle: `Bootstrap: initialer State aus Legacy-Daten`
|
|
258
|
+
});
|
|
259
|
+
log(`Fertig \u2014 ${stateFilename}`);
|
|
260
|
+
}
|
|
261
|
+
async function hfUploadImage(base64, id, token, mimeType = "image/jpeg") {
|
|
262
|
+
const ext = bildEndungFuer(mimeType);
|
|
263
|
+
const binary = atob(base64);
|
|
264
|
+
const bytes = new Uint8Array(binary.length);
|
|
265
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
266
|
+
await uploadFile({
|
|
267
|
+
repo: { type: "dataset", name: HF_REPO },
|
|
268
|
+
credentials: { accessToken: token },
|
|
269
|
+
file: { path: `images/${id}.${ext}`, content: new Blob([bytes], { type: mimeType }) },
|
|
270
|
+
branch: "main",
|
|
271
|
+
commitTitle: `Add image ${id}`
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
async function hfLoadImageAsBase64(id, token, namespace, filename, on404, mimeType, hasThumb) {
|
|
275
|
+
const fetchBase64 = async (repoPath) => {
|
|
276
|
+
try {
|
|
277
|
+
const res = await fetch(
|
|
278
|
+
`${HF_BASE}/datasets/${HF_REPO}/resolve/main/${repoPath}?download=true`,
|
|
279
|
+
{ headers: { Authorization: `Bearer ${token}` } }
|
|
280
|
+
);
|
|
281
|
+
if (!res.ok) {
|
|
282
|
+
if (on404 && on404()) return "ABORT";
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
const blob = await res.blob();
|
|
286
|
+
return new Promise((resolve, reject) => {
|
|
287
|
+
const reader = new FileReader();
|
|
288
|
+
reader.onload = () => resolve(reader.result.split(",")[1]);
|
|
289
|
+
reader.onerror = reject;
|
|
290
|
+
reader.readAsDataURL(blob);
|
|
291
|
+
});
|
|
292
|
+
} catch {
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
if (filename) {
|
|
297
|
+
if (hasThumb) {
|
|
298
|
+
const thumb = await fetchBase64(`thumbs/${filename}`);
|
|
299
|
+
if (thumb && thumb !== "ABORT") return thumb;
|
|
300
|
+
}
|
|
301
|
+
const result2 = await fetchBase64(`images/${filename}`);
|
|
302
|
+
return result2 === "ABORT" ? null : result2;
|
|
303
|
+
}
|
|
304
|
+
const ext = bildEndungFuer(mimeType);
|
|
305
|
+
const result = await fetchBase64(`images/${id}.${ext}`);
|
|
306
|
+
return result === "ABORT" ? null : result;
|
|
307
|
+
}
|
|
16
308
|
|
|
17
309
|
// src/lib/szenen/viewPort.ts
|
|
18
310
|
function capabilitiesOf(port) {
|
|
@@ -5318,8 +5610,8 @@ async function leseBilderAusZip(datei) {
|
|
|
5318
5610
|
`${name} ist ${mb(datei.size)} MB gro\xDF \u2014 die Grenze liegt bei ${UPLOAD_MAX_BYTES / 1024 / 1024} MB.`
|
|
5319
5611
|
);
|
|
5320
5612
|
}
|
|
5321
|
-
const { default:
|
|
5322
|
-
const archiv = await
|
|
5613
|
+
const { default: JSZip2 } = await import("jszip");
|
|
5614
|
+
const archiv = await JSZip2.loadAsync(datei).catch((fehler4) => {
|
|
5323
5615
|
throw new Error(
|
|
5324
5616
|
`${name} konnte nicht als ZIP gelesen werden: ${fehler4 instanceof Error ? fehler4.message : String(fehler4)}`
|
|
5325
5617
|
);
|
|
@@ -15099,7 +15391,7 @@ function createHfImageStore(options) {
|
|
|
15099
15391
|
const now = options.now ?? (() => Date.now());
|
|
15100
15392
|
const versuche = options.leseVersuche ?? 4;
|
|
15101
15393
|
const basisMs = options.leseBasisMs ?? 400;
|
|
15102
|
-
const
|
|
15394
|
+
const schlafen2 = options.schlafen ?? warten;
|
|
15103
15395
|
const abgelegt = /* @__PURE__ */ new Map();
|
|
15104
15396
|
const vorschauen = /* @__PURE__ */ new Map();
|
|
15105
15397
|
const bekanntePfade = /* @__PURE__ */ new Set();
|
|
@@ -15196,7 +15488,7 @@ function createHfImageStore(options) {
|
|
|
15196
15488
|
}
|
|
15197
15489
|
const pfadTyp = typ ?? "image/png";
|
|
15198
15490
|
for (let versuch = 0; versuch < versuche; versuch += 1) {
|
|
15199
|
-
if (versuch > 0) await
|
|
15491
|
+
if (versuch > 0) await schlafen2(basisMs * 2 ** (versuch - 1));
|
|
15200
15492
|
const base64 = await hfLoadImageAsBase64(
|
|
15201
15493
|
id,
|
|
15202
15494
|
token,
|
|
@@ -16021,6 +16313,20 @@ function createFlowSzenenViewPort(options) {
|
|
|
16021
16313
|
}
|
|
16022
16314
|
|
|
16023
16315
|
export {
|
|
16316
|
+
hfListDir,
|
|
16317
|
+
hfDownloadBinaryByPath,
|
|
16318
|
+
hfUploadSmallFile,
|
|
16319
|
+
hfBatchArchive,
|
|
16320
|
+
tsFromEventPath,
|
|
16321
|
+
loadPendingEvents,
|
|
16322
|
+
getSessionClientId,
|
|
16323
|
+
writeHFEvent,
|
|
16324
|
+
getHFToken,
|
|
16325
|
+
setHFToken,
|
|
16326
|
+
loadHFState,
|
|
16327
|
+
hfBootstrapFromLegacy,
|
|
16328
|
+
hfUploadImage,
|
|
16329
|
+
hfLoadImageAsBase64,
|
|
16024
16330
|
applyEvents,
|
|
16025
16331
|
capabilitiesOf,
|
|
16026
16332
|
unsupportedReason,
|
|
@@ -43,16 +43,6 @@ interface ProjectSettings {
|
|
|
43
43
|
seed: number;
|
|
44
44
|
seedMode: 'random' | 'fixed';
|
|
45
45
|
}
|
|
46
|
-
interface ProjectMeta {
|
|
47
|
-
id: string;
|
|
48
|
-
name: string;
|
|
49
|
-
saved_at: string;
|
|
50
|
-
size: number;
|
|
51
|
-
}
|
|
52
|
-
interface SyncDiff {
|
|
53
|
-
localOnly: Generation[];
|
|
54
|
-
serverOnly: Generation[];
|
|
55
|
-
}
|
|
56
46
|
interface LabFrame {
|
|
57
47
|
id: string;
|
|
58
48
|
base64: string;
|
|
@@ -238,4 +228,4 @@ interface TaskRequestedPayload {
|
|
|
238
228
|
expiresAt?: number;
|
|
239
229
|
}
|
|
240
230
|
|
|
241
|
-
export { type CreateFlowTextGenerationPortOptions as C, type FlowGenerateText as F, type Generation as G, type HFEvent as H, type ImageAddedPayload as I, type LabFrame as L, type MetadataUpdatedPayload as M, type
|
|
231
|
+
export { type CreateFlowTextGenerationPortOptions as C, type FlowGenerateText as F, type Generation as G, type HFEvent as H, type ImageAddedPayload as I, type LabFrame as L, type MetadataUpdatedPayload as M, type ProjectSettings as P, type SelectedLabImage as S, type TagOption as T, type WorkspaceTags as W, type FlowSdk as a, type FlowTextGenerationOptions as b, type HFEventVersion as c, type HFFileInfo as d, type HFMetadataEntry as e, type HFStateMeta as f, type HFStateSnapshot as g, type LabItem as h, type LabServices as i, type SelectedTag as j, type TagUpsertedPayload as k, buildFallbackPrompt as l, buildGenerationPrompt as m, buildImageGenerationOptions as n, buildPromptTabPayload as o, cleanAiResponse as p, createFlowServices as q, createFlowTextGenerationPort as r, interpretSdkError as s, parsePromptResponse as t };
|
|
@@ -43,16 +43,6 @@ interface ProjectSettings {
|
|
|
43
43
|
seed: number;
|
|
44
44
|
seedMode: 'random' | 'fixed';
|
|
45
45
|
}
|
|
46
|
-
interface ProjectMeta {
|
|
47
|
-
id: string;
|
|
48
|
-
name: string;
|
|
49
|
-
saved_at: string;
|
|
50
|
-
size: number;
|
|
51
|
-
}
|
|
52
|
-
interface SyncDiff {
|
|
53
|
-
localOnly: Generation[];
|
|
54
|
-
serverOnly: Generation[];
|
|
55
|
-
}
|
|
56
46
|
interface LabFrame {
|
|
57
47
|
id: string;
|
|
58
48
|
base64: string;
|
|
@@ -238,4 +228,4 @@ interface TaskRequestedPayload {
|
|
|
238
228
|
expiresAt?: number;
|
|
239
229
|
}
|
|
240
230
|
|
|
241
|
-
export { type CreateFlowTextGenerationPortOptions as C, type FlowGenerateText as F, type Generation as G, type HFEvent as H, type ImageAddedPayload as I, type LabFrame as L, type MetadataUpdatedPayload as M, type
|
|
231
|
+
export { type CreateFlowTextGenerationPortOptions as C, type FlowGenerateText as F, type Generation as G, type HFEvent as H, type ImageAddedPayload as I, type LabFrame as L, type MetadataUpdatedPayload as M, type ProjectSettings as P, type SelectedLabImage as S, type TagOption as T, type WorkspaceTags as W, type FlowSdk as a, type FlowTextGenerationOptions as b, type HFEventVersion as c, type HFFileInfo as d, type HFMetadataEntry as e, type HFStateMeta as f, type HFStateSnapshot as g, type LabItem as h, type LabServices as i, type SelectedTag as j, type TagUpsertedPayload as k, buildFallbackPrompt as l, buildGenerationPrompt as m, buildImageGenerationOptions as n, buildPromptTabPayload as o, cleanAiResponse as p, createFlowServices as q, createFlowTextGenerationPort as r, interpretSdkError as s, parsePromptResponse as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { RefObject, ReactNode } from 'react';
|
|
3
|
-
import { G as Generation, W as WorkspaceTags, F as FlowGenerateText,
|
|
4
|
-
export { a as FlowSdk, c as HFEventVersion, d as HFFileInfo, e as HFMetadataEntry, f as HFStateMeta, I as ImageAddedPayload, M as MetadataUpdatedPayload,
|
|
3
|
+
import { G as Generation, W as WorkspaceTags, F as FlowGenerateText, b as FlowTextGenerationOptions, j as SelectedTag, T as TagOption, i as LabServices, h as LabItem, L as LabFrame, S as SelectedLabImage, H as HFEvent, g as HFStateSnapshot } from './hfEventTypes-BUztJySs.mjs';
|
|
4
|
+
export { a as FlowSdk, c as HFEventVersion, d as HFFileInfo, e as HFMetadataEntry, f as HFStateMeta, I as ImageAddedPayload, M as MetadataUpdatedPayload, P as ProjectSettings, k as TagUpsertedPayload, l as buildFallbackPrompt, m as buildGenerationPrompt, n as buildImageGenerationOptions, o as buildPromptTabPayload, p as cleanAiResponse, q as createFlowServices, s as interpretSdkError, t as parsePromptResponse } from './hfEventTypes-BUztJySs.mjs';
|
|
5
5
|
import { Node, Edge } from '@xyflow/react';
|
|
6
6
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
7
7
|
import { F as FeatureSliceId, b as SliceContract, a as PersistenceDescriptor, W as WorkspacePersistence, P as PersistedSlice, L as LoadResult, f as WriteResult, e as WorkspaceTabId, C as CommandResult, R as RequestContext, Q as QueryResult } from './contracts-DdYOMBl9.mjs';
|
|
8
8
|
|
|
9
|
-
var version = "
|
|
9
|
+
var version = "7.0.1";
|
|
10
10
|
|
|
11
11
|
declare function useOnClickOutside(ref: RefObject<HTMLElement | null>, handler: (e: MouseEvent | TouchEvent) => void): void;
|
|
12
12
|
|
|
@@ -28,14 +28,6 @@ declare const GLOBAL_STYLES: string;
|
|
|
28
28
|
|
|
29
29
|
declare function injectXMPMetadata(base64: string, prompt: string, seed?: number, model?: string, id?: string, tags?: string[], hierarchy?: string): string;
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* Vollständiger Export: JSON + MD + Bilder (mit XMP Meta)
|
|
33
|
-
*/
|
|
34
|
-
declare function exportProjectToZip(nodes: any[], edges: any[], history: any[], galleryItems: any[], settings: any, workspaceTags?: any, recentLabItemIds?: string[]): Promise<{
|
|
35
|
-
base64: string;
|
|
36
|
-
}>;
|
|
37
|
-
declare function importProjectFromZip(file: File): Promise<any>;
|
|
38
|
-
|
|
39
31
|
interface ExtractedCharacter {
|
|
40
32
|
name: string;
|
|
41
33
|
prompts: {
|
|
@@ -277,12 +269,8 @@ interface AvatarArchitectAppProps {
|
|
|
277
269
|
/** Flow-Host verlangt vor der App dieselbe User-/Context-Auswahl wie React. */
|
|
278
270
|
requireWorkspaceSelection?: boolean;
|
|
279
271
|
serverBaseUrl?: string;
|
|
280
|
-
onFetchServerProjects?: () => Promise<ProjectMeta[]>;
|
|
281
|
-
onServerSave?: (zipBase64: string, name: string) => Promise<ProjectMeta>;
|
|
282
|
-
onServerLoad?: (id: string) => Promise<File>;
|
|
283
|
-
onServerDelete?: (id: string) => Promise<void>;
|
|
284
272
|
}
|
|
285
|
-
declare function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onSelectMedia, buildInfo, initialHfToken, hfNamespace, allowDevNamespace, requireWorkspaceSelection, serverBaseUrl
|
|
273
|
+
declare function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onSelectMedia, buildInfo, initialHfToken, hfNamespace, allowDevNamespace, requireWorkspaceSelection, serverBaseUrl }: AvatarArchitectAppProps): React__default.JSX.Element;
|
|
286
274
|
|
|
287
275
|
interface FaAppProps {
|
|
288
276
|
onGenerateImage: (params: Record<string, any>) => Promise<{
|
|
@@ -310,13 +298,9 @@ interface FaAppProps {
|
|
|
310
298
|
libToken?: string;
|
|
311
299
|
allowDevNamespace?: boolean;
|
|
312
300
|
serverBaseUrl?: string;
|
|
313
|
-
onFetchServerProjects?: () => Promise<ProjectMeta[]>;
|
|
314
|
-
onServerSave?: (zipBase64: string, name: string) => Promise<ProjectMeta>;
|
|
315
|
-
onServerLoad?: (id: string) => Promise<File>;
|
|
316
|
-
onServerDelete?: (id: string) => Promise<void>;
|
|
317
301
|
buildInfo?: string;
|
|
318
302
|
}
|
|
319
|
-
declare function FaApp({ onGenerateImage, onGeneratePrompt, onGenerateVideo: _onGenerateVideo, onDownload, onSelectMedia, onFlowSave: _onFlowSave, onFlowUpload: _onFlowUpload, onFlowMediaUpload: _onFlowMediaUpload, libToken, allowDevNamespace, serverBaseUrl,
|
|
303
|
+
declare function FaApp({ onGenerateImage, onGeneratePrompt, onGenerateVideo: _onGenerateVideo, onDownload, onSelectMedia, onFlowSave: _onFlowSave, onFlowUpload: _onFlowUpload, onFlowMediaUpload: _onFlowMediaUpload, libToken, allowDevNamespace, serverBaseUrl, buildInfo, }: FaAppProps): React.JSX.Element;
|
|
320
304
|
|
|
321
305
|
interface FlowWorkspacePickerProps {
|
|
322
306
|
tagBase: TagBase;
|
|
@@ -370,25 +354,21 @@ interface PromptTabProps {
|
|
|
370
354
|
}
|
|
371
355
|
declare const PromptTab: React__default.FC<PromptTabProps>;
|
|
372
356
|
|
|
373
|
-
interface
|
|
357
|
+
interface HfMediaSyncTabProps {
|
|
374
358
|
topSlot?: React__default.ReactNode;
|
|
375
|
-
|
|
376
|
-
onProjectImport?: (file: File) => Promise<void>;
|
|
377
|
-
onWorkspaceImport?: (file: File) => void;
|
|
378
|
-
projectActionState?: 'idle' | 'working' | 'working-full' | 'done' | 'error';
|
|
379
|
-
serverProjects?: ProjectMeta[];
|
|
380
|
-
onServerSave?: (name?: string) => Promise<void>;
|
|
381
|
-
onServerLoad?: (id: string) => void;
|
|
382
|
-
onServerDelete?: (id: string) => void;
|
|
383
|
-
onRefreshServerProjects?: () => Promise<void>;
|
|
384
|
-
onComputeSyncDiff?: () => Promise<SyncDiff>;
|
|
385
|
-
onExecuteSync?: (selectedLocalIds: string[]) => Promise<void>;
|
|
386
|
-
hfToken?: string;
|
|
387
|
-
onHfLoad?: (file: File) => void;
|
|
388
|
-
onProjectExportBase64?: () => Promise<string>;
|
|
359
|
+
/** Lädt lokal erzeugte Gallery-Bilder nach, die noch kein HF-Event haben. */
|
|
389
360
|
onHfInitialSync?: (onProgress: (done: number, total: number) => void) => Promise<void>;
|
|
390
361
|
}
|
|
391
|
-
|
|
362
|
+
/**
|
|
363
|
+
* Sync-Tab der Flow-Runtime. Zeigt den HF-State-Status (`topSlot`) und den
|
|
364
|
+
* einmaligen Nachlade-Sync lokal erzeugter Bilder nach Hugging Face.
|
|
365
|
+
*
|
|
366
|
+
* Flow hat keinen eigenen Projekt-State-Lifecycle mehr: Projekt-ZIP-Export,
|
|
367
|
+
* -Import, Server-Projektspeicher und ZIP-Diff sind mit dem globalen Event
|
|
368
|
+
* `2026-08-24-flow-legacy-project-state-removal` entfallen. Persistenz läuft
|
|
369
|
+
* ausschließlich über den HF-Snapshot- und Event-State.
|
|
370
|
+
*/
|
|
371
|
+
declare const HfMediaSyncTab: React__default.FC<HfMediaSyncTabProps>;
|
|
392
372
|
|
|
393
373
|
interface TagManagerPanelProps {
|
|
394
374
|
workspaceTags: WorkspaceTags;
|
|
@@ -849,19 +829,8 @@ declare function writeHFEvent<P>(namespace: string, token: string, type: string,
|
|
|
849
829
|
|
|
850
830
|
declare function getHFToken(): string | null;
|
|
851
831
|
declare function setHFToken(token: string): void;
|
|
852
|
-
interface HFProjectMeta {
|
|
853
|
-
id: string;
|
|
854
|
-
name: string;
|
|
855
|
-
path: string;
|
|
856
|
-
size: number;
|
|
857
|
-
isLfs: boolean;
|
|
858
|
-
}
|
|
859
832
|
declare function loadHFState(namespace: string, token: string): Promise<HFStateSnapshot | null>;
|
|
860
833
|
declare function hfBootstrapFromLegacy(namespace: string, token: string, onProgress?: (msg: string) => void): Promise<void>;
|
|
861
|
-
declare function hfListProjects(token: string): Promise<HFProjectMeta[]>;
|
|
862
|
-
declare function hfDownloadProject(path: string, token: string): Promise<File>;
|
|
863
|
-
declare function hfUploadProjectForm(_zipBase64: string, _name: string, _token: string): Promise<HFProjectMeta>;
|
|
864
|
-
declare function hfDeleteProject(path: string, token: string): Promise<void>;
|
|
865
834
|
declare function hfUploadImage(base64: string, id: string, token: string, mimeType?: string): Promise<void>;
|
|
866
835
|
declare function hfLoadImageAsBase64(id: string, token: string, namespace?: string, filename?: string, on404?: () => boolean, mimeType?: string, hasThumb?: boolean): Promise<string | null>;
|
|
867
836
|
|
|
@@ -912,4 +881,4 @@ interface UseTagBaseResult {
|
|
|
912
881
|
}
|
|
913
882
|
declare function useTagBase(token: string, namespace: string): UseTagBaseResult;
|
|
914
883
|
|
|
915
|
-
export { AvatarArchitectApp, type AvatarArchitectAppProps, CURRENT_TAG_EVENT_VERSION, CollapsibleCard, CommandResult, CompactDropdown, type CreateFaStoreOptions, type CreatePersistenceCoordinatorOptions, type ExtractedCharacter, FaApp, type FaAppProps, type FaStore, type FaStoreState, FaToolsBadge, FeatureSliceId, FlowTextGenerationOptions, FlowWorkspacePicker, type FlowWorkspacePickerProps, GLOBAL_STYLES, Generation, HFEvent, type HFStateResult, HFStateSnapshot, HistoryPanel, type InMemoryWorkspacePersistence, InspectPanel, LIBRARY_CUTOVER_MARKER, LIBRARY_SLICE_SCHEMA_VERSION, version as LIB_VERSION, LabBlend, LabCompare, LabFrame, LabFrameExtractor, type LabFrameExtractorProps, LabImagePicker, LabItem, LabLoop, LabRemix, LabServices, type LabSlotId, LabsTab, type LegacyMigrationOptions, type LegacyMigrationResult, type LegacyRecentTagRef, type LegacySourceResult, type LibraryCommandName, type LibraryCommands, type LibraryDataSource, type LibraryLegacySource, type LibraryListQuery, type LibraryPage, LibraryView, type LibraryViewItem, type LibraryViewProps, type LibraryViewTag, type LibraryWorkspaceState, ListView, LoadResult, type MediaItem, MediaLibrary, PersistedSlice, type PersistenceCoordinator, PersistenceDescriptor, PillButton,
|
|
884
|
+
export { AvatarArchitectApp, type AvatarArchitectAppProps, CURRENT_TAG_EVENT_VERSION, CollapsibleCard, CommandResult, CompactDropdown, type CreateFaStoreOptions, type CreatePersistenceCoordinatorOptions, type ExtractedCharacter, FaApp, type FaAppProps, type FaStore, type FaStoreState, FaToolsBadge, FeatureSliceId, FlowTextGenerationOptions, FlowWorkspacePicker, type FlowWorkspacePickerProps, GLOBAL_STYLES, Generation, HFEvent, type HFStateResult, HFStateSnapshot, HfMediaSyncTab, HistoryPanel, type InMemoryWorkspacePersistence, InspectPanel, LIBRARY_CUTOVER_MARKER, LIBRARY_SLICE_SCHEMA_VERSION, version as LIB_VERSION, LabBlend, LabCompare, LabFrame, LabFrameExtractor, type LabFrameExtractorProps, LabImagePicker, LabItem, LabLoop, LabRemix, LabServices, type LabSlotId, LabsTab, type LegacyMigrationOptions, type LegacyMigrationResult, type LegacyRecentTagRef, type LegacySourceResult, type LibraryCommandName, type LibraryCommands, type LibraryDataSource, type LibraryLegacySource, type LibraryListQuery, type LibraryPage, LibraryView, type LibraryViewItem, type LibraryViewProps, type LibraryViewTag, type LibraryWorkspaceState, ListView, LoadResult, type MediaItem, MediaLibrary, PersistedSlice, type PersistenceCoordinator, PersistenceDescriptor, PillButton, PromptTab, QueryResult, RequestContext, type RunLibraryLegacyImportOptions, type RunTagsLegacyImportOptions, SCOPE_MAP, type SaveState, SectionLabel, SelectedLabImage, SelectedTag, type SelectionValidation, ServerTab, SetupPanel, SliceContract, type SliceMeta, TAGS_CUTOVER_MARKER, TAGS_SLICE_SCHEMA_VERSION, type TagBase, type TagBaseContext, type TagBaseEvent, type TagBaseMeta, TagBaseSection, type TagBaseSectionProps, type TagBaseTagEntry, type TagBaseTagOption, type TagBaseUser, type TagBaseWorkspaceTags, type TagCommandName, type TagCommands, type TagCreatedEvent, type TagCreatedPayload, type TagEntry, type TagEntryInput, TagManager, TagManagerPanel, type TagManagerProps, type TagManagerSelection, TagOption, type TagQueries, type TagUpdateDelta, type TagUpdatedDelta, type TagUpdatedEvent, type TagUpdatedPayload, type TagViewCategory, type TagViewModel, type TagViewOption, type TagViewScope, type TagsWorkspaceState, type UseTagBaseResult, WorkspacePersistence, WorkspaceTabId, WorkspaceTags, WriteResult, autoLabel, buildBlendInstruction, buildCompareInstruction, buildLoopInstruction, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, createFaStore, createInMemoryLibraryDataSource, createInMemoryWorkspacePersistence, createLibraryDefault, createPersistenceCoordinator, createTagCreatedEvent, createTagUpdatedEvent, createTagsDefault, deriveTagBaseWorkspaceTags, deriveTagViewModel, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, getSessionClientId, groupGenerationsToLabItems, hfBatchArchive, hfBootstrapFromLegacy, hfListDir, hfLoadImageAsBase64, hfUploadImage, hfUploadSmallFile, injectXMPMetadata, libraryContract, libraryReactDescriptor, listCategories, loadHFState, loadPendingEvents, loadTagBase, parseLegacyLibraryFilters, parseLegacyRecentTags, parsePromptFile, runLegacyMigration, runLibraryLegacyImport, runTagsLegacyImport, setHFToken, tagsContract, tagsReactDescriptor, tsFromEventPath, useFaSlice, useFaSliceMeta, useHFState, useKeyboardNavigation, useOnClickOutside, useTagBase, validateTagBaseSelection, writeHFEvent, writeTagEvent };
|