@rslsp1/fa-app-tools 1.2.7 → 1.2.9

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.
@@ -58,13 +58,31 @@ async function hfUploadProject(zipBase64, name, token) {
58
58
  if (!preRes.ok) throw new Error(`HF preupload failed: ${preRes.status} ${preRes.statusText}`);
59
59
  const preData = await preRes.json();
60
60
  const fileInfo = preData.files?.[0];
61
- if (fileInfo?.uploadMode === "lfs" && fileInfo?.uploadUrl) {
61
+ const debugInfo = JSON.stringify({ uploadMode: fileInfo?.uploadMode, hasUploadUrl: !!fileInfo?.uploadUrl, hasVerifyUrl: !!fileInfo?.verifyUrl, headerKeys: Object.keys(fileInfo?.header || {}), verifyHeaderKeys: Object.keys(fileInfo?.verifyHeader || {}) });
62
+ if (!fileInfo?.uploadMode) throw new Error(`HF preupload kein fileInfo: ${JSON.stringify(preData)}`);
63
+ if (fileInfo.uploadMode === "lfs") {
64
+ if (!fileInfo.uploadUrl) throw new Error(`HF preupload: kein uploadUrl \u2014 ${debugInfo}`);
62
65
  const uploadRes = await fetch(fileInfo.uploadUrl, {
63
66
  method: "PUT",
64
67
  headers: { "Content-Type": "application/octet-stream", ...fileInfo.header || {} },
65
68
  body: bytes
66
69
  });
67
- if (!uploadRes.ok) throw new Error(`HF LFS upload failed: ${uploadRes.status}`);
70
+ if (!uploadRes.ok) {
71
+ const uploadErr = await uploadRes.text().catch(() => "");
72
+ throw new Error(`HF LFS upload failed: ${uploadRes.status} \u2014 ${uploadErr.slice(0, 200)}`);
73
+ }
74
+ if (fileInfo.verifyUrl) {
75
+ const verifyRes = await fetch(fileInfo.verifyUrl, {
76
+ method: "POST",
77
+ headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json", ...fileInfo.verifyHeader || {} },
78
+ body: JSON.stringify({ oid, size })
79
+ });
80
+ if (!verifyRes.ok) {
81
+ const verifyErr = await verifyRes.text().catch(() => "");
82
+ throw new Error(`HF LFS verify failed: ${verifyRes.status} \u2014 ${verifyErr.slice(0, 200)}`);
83
+ }
84
+ }
85
+ } else if (fileInfo.uploadMode === "regular") {
68
86
  }
69
87
  const commitRes = await fetch(`${HF_BASE}/api/datasets/${HF_REPO}/commit/main`, {
70
88
  method: "POST",
@@ -6,7 +6,7 @@ import {
6
6
  hfListProjects,
7
7
  hfUploadProject,
8
8
  setHFToken
9
- } from "./chunk-3GEDIA7J.mjs";
9
+ } from "./chunk-5FBMUNEP.mjs";
10
10
  export {
11
11
  HF_TOKEN_KEY,
12
12
  getHFToken,
package/dist/index.d.mts CHANGED
@@ -448,6 +448,6 @@ declare function buildLoopInstruction(rounds: Array<{
448
448
  declare function autoLabel(index: number): string;
449
449
  declare function buildReferenceImageMediaIds(images: SelectedLabImage[]): string[];
450
450
 
451
- declare const LIB_VERSION = "1.2.7";
451
+ declare const LIB_VERSION = "1.2.9";
452
452
 
453
453
  export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type ExtractedCharacter, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, HistoryPanel, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type WorkspaceTags, autoLabel, buildBlendInstruction, buildCompareInstruction, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, groupGenerationsToLabItems, importProjectFromZip, injectXMPMetadata, interpretSdkError, parsePromptFile, parsePromptResponse, useKeyboardNavigation, useOnClickOutside };
package/dist/index.d.ts CHANGED
@@ -448,6 +448,6 @@ declare function buildLoopInstruction(rounds: Array<{
448
448
  declare function autoLabel(index: number): string;
449
449
  declare function buildReferenceImageMediaIds(images: SelectedLabImage[]): string[];
450
450
 
451
- declare const LIB_VERSION = "1.2.7";
451
+ declare const LIB_VERSION = "1.2.9";
452
452
 
453
453
  export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type ExtractedCharacter, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, HistoryPanel, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type WorkspaceTags, autoLabel, buildBlendInstruction, buildCompareInstruction, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, groupGenerationsToLabItems, importProjectFromZip, injectXMPMetadata, interpretSdkError, parsePromptFile, parsePromptResponse, useKeyboardNavigation, useOnClickOutside };
package/dist/index.js CHANGED
@@ -326,13 +326,31 @@ async function hfUploadProject(zipBase64, name, token) {
326
326
  if (!preRes.ok) throw new Error(`HF preupload failed: ${preRes.status} ${preRes.statusText}`);
327
327
  const preData = await preRes.json();
328
328
  const fileInfo = preData.files?.[0];
329
- if (fileInfo?.uploadMode === "lfs" && fileInfo?.uploadUrl) {
329
+ const debugInfo = JSON.stringify({ uploadMode: fileInfo?.uploadMode, hasUploadUrl: !!fileInfo?.uploadUrl, hasVerifyUrl: !!fileInfo?.verifyUrl, headerKeys: Object.keys(fileInfo?.header || {}), verifyHeaderKeys: Object.keys(fileInfo?.verifyHeader || {}) });
330
+ if (!fileInfo?.uploadMode) throw new Error(`HF preupload kein fileInfo: ${JSON.stringify(preData)}`);
331
+ if (fileInfo.uploadMode === "lfs") {
332
+ if (!fileInfo.uploadUrl) throw new Error(`HF preupload: kein uploadUrl \u2014 ${debugInfo}`);
330
333
  const uploadRes = await fetch(fileInfo.uploadUrl, {
331
334
  method: "PUT",
332
335
  headers: { "Content-Type": "application/octet-stream", ...fileInfo.header || {} },
333
336
  body: bytes
334
337
  });
335
- if (!uploadRes.ok) throw new Error(`HF LFS upload failed: ${uploadRes.status}`);
338
+ if (!uploadRes.ok) {
339
+ const uploadErr = await uploadRes.text().catch(() => "");
340
+ throw new Error(`HF LFS upload failed: ${uploadRes.status} \u2014 ${uploadErr.slice(0, 200)}`);
341
+ }
342
+ if (fileInfo.verifyUrl) {
343
+ const verifyRes = await fetch(fileInfo.verifyUrl, {
344
+ method: "POST",
345
+ headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json", ...fileInfo.verifyHeader || {} },
346
+ body: JSON.stringify({ oid, size })
347
+ });
348
+ if (!verifyRes.ok) {
349
+ const verifyErr = await verifyRes.text().catch(() => "");
350
+ throw new Error(`HF LFS verify failed: ${verifyRes.status} \u2014 ${verifyErr.slice(0, 200)}`);
351
+ }
352
+ }
353
+ } else if (fileInfo.uploadMode === "regular") {
336
354
  }
337
355
  const commitRes = await fetch(`${HF_BASE}/api/datasets/${HF_REPO}/commit/main`, {
338
356
  method: "POST",
@@ -3886,29 +3904,42 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3886
3904
  !projectLoaded && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-white/20 text-[10px] text-center", children: "Baum, Bilder und Einstellungen wiederherstellen" })
3887
3905
  ] }),
3888
3906
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col items-center gap-2 w-full max-w-[280px]", children: [
3889
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex gap-2 w-full", children: [
3890
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3891
- "input",
3892
- {
3893
- type: "password",
3894
- value: hfTokenInput,
3895
- onChange: (e) => setHfTokenInput(e.target.value),
3896
- onKeyDown: (e) => e.key === "Enter" && hfTokenInput.trim() && setHfToken(hfTokenInput.trim()),
3897
- placeholder: "HF Token (hf_\u2026)",
3898
- className: "flex-1 rounded-xl px-3 text-[11px] font-mono outline-none",
3899
- style: { height: 44, background: "rgba(255,255,255,0.05)", border: "1px solid rgba(255,255,255,0.1)", color: "rgba(255,255,255,0.7)" }
3900
- }
3901
- ),
3902
- hfTokenInput.trim() && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3903
- "button",
3904
- {
3905
- onClick: () => setHfToken(hfTokenInput.trim()),
3906
- className: "px-3 rounded-xl text-[11px] font-bold text-white",
3907
- style: { background: "#f59e0b", height: 44 },
3908
- children: "OK"
3909
- }
3910
- )
3911
- ] }),
3907
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3908
+ "form",
3909
+ {
3910
+ onSubmit: (e) => {
3911
+ e.preventDefault();
3912
+ if (hfTokenInput.trim()) setHfToken(hfTokenInput.trim());
3913
+ },
3914
+ className: "flex gap-2 w-full",
3915
+ autoComplete: "on",
3916
+ children: [
3917
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { type: "text", name: "username", value: "hf-token", readOnly: true, autoComplete: "username", className: "hidden" }),
3918
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3919
+ "input",
3920
+ {
3921
+ type: "password",
3922
+ name: "password",
3923
+ autoComplete: "current-password",
3924
+ value: hfTokenInput,
3925
+ onChange: (e) => setHfTokenInput(e.target.value),
3926
+ placeholder: "HF Token (hf_\u2026)",
3927
+ className: "flex-1 rounded-xl px-3 text-[11px] font-mono outline-none",
3928
+ style: { height: 44, background: "rgba(255,255,255,0.05)", border: "1px solid rgba(255,255,255,0.1)", color: "rgba(255,255,255,0.7)" }
3929
+ }
3930
+ ),
3931
+ hfTokenInput.trim() && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3932
+ "button",
3933
+ {
3934
+ type: "submit",
3935
+ className: "px-3 rounded-xl text-[11px] font-bold text-white",
3936
+ style: { background: "#f59e0b", height: 44 },
3937
+ children: "OK"
3938
+ }
3939
+ )
3940
+ ]
3941
+ }
3942
+ ),
3912
3943
  hfToken && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3913
3944
  "button",
3914
3945
  {
@@ -4574,7 +4605,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4574
4605
  }
4575
4606
 
4576
4607
  // src/index.ts
4577
- var LIB_VERSION = "1.2.7";
4608
+ var LIB_VERSION = "1.2.9";
4578
4609
  // Annotate the CommonJS export names for ESM import in node:
4579
4610
  0 && (module.exports = {
4580
4611
  AvatarArchitectApp,
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  hfDeleteProject,
8
8
  hfListProjects,
9
9
  hfUploadProject
10
- } from "./chunk-3GEDIA7J.mjs";
10
+ } from "./chunk-5FBMUNEP.mjs";
11
11
 
12
12
  // src/hooks/useOnClickOutside.ts
13
13
  import { useEffect } from "react";
@@ -1547,7 +1547,7 @@ var ProjectSyncTab = ({
1547
1547
  {
1548
1548
  onClick: async () => {
1549
1549
  try {
1550
- const { hfDownloadProject } = await import("./hfStateService-MQ33VAMR.mjs");
1550
+ const { hfDownloadProject } = await import("./hfStateService-PB325HBF.mjs");
1551
1551
  const file = await hfDownloadProject(p.path, hfToken);
1552
1552
  onHfLoad(file);
1553
1553
  } catch (e) {
@@ -3464,29 +3464,42 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3464
3464
  !projectLoaded && /* @__PURE__ */ jsx20("span", { className: "text-white/20 text-[10px] text-center", children: "Baum, Bilder und Einstellungen wiederherstellen" })
3465
3465
  ] }),
3466
3466
  /* @__PURE__ */ jsxs18("div", { className: "flex flex-col items-center gap-2 w-full max-w-[280px]", children: [
3467
- /* @__PURE__ */ jsxs18("div", { className: "flex gap-2 w-full", children: [
3468
- /* @__PURE__ */ jsx20(
3469
- "input",
3470
- {
3471
- type: "password",
3472
- value: hfTokenInput,
3473
- onChange: (e) => setHfTokenInput(e.target.value),
3474
- onKeyDown: (e) => e.key === "Enter" && hfTokenInput.trim() && setHfToken(hfTokenInput.trim()),
3475
- placeholder: "HF Token (hf_\u2026)",
3476
- className: "flex-1 rounded-xl px-3 text-[11px] font-mono outline-none",
3477
- style: { height: 44, background: "rgba(255,255,255,0.05)", border: "1px solid rgba(255,255,255,0.1)", color: "rgba(255,255,255,0.7)" }
3478
- }
3479
- ),
3480
- hfTokenInput.trim() && /* @__PURE__ */ jsx20(
3481
- "button",
3482
- {
3483
- onClick: () => setHfToken(hfTokenInput.trim()),
3484
- className: "px-3 rounded-xl text-[11px] font-bold text-white",
3485
- style: { background: "#f59e0b", height: 44 },
3486
- children: "OK"
3487
- }
3488
- )
3489
- ] }),
3467
+ /* @__PURE__ */ jsxs18(
3468
+ "form",
3469
+ {
3470
+ onSubmit: (e) => {
3471
+ e.preventDefault();
3472
+ if (hfTokenInput.trim()) setHfToken(hfTokenInput.trim());
3473
+ },
3474
+ className: "flex gap-2 w-full",
3475
+ autoComplete: "on",
3476
+ children: [
3477
+ /* @__PURE__ */ jsx20("input", { type: "text", name: "username", value: "hf-token", readOnly: true, autoComplete: "username", className: "hidden" }),
3478
+ /* @__PURE__ */ jsx20(
3479
+ "input",
3480
+ {
3481
+ type: "password",
3482
+ name: "password",
3483
+ autoComplete: "current-password",
3484
+ value: hfTokenInput,
3485
+ onChange: (e) => setHfTokenInput(e.target.value),
3486
+ placeholder: "HF Token (hf_\u2026)",
3487
+ className: "flex-1 rounded-xl px-3 text-[11px] font-mono outline-none",
3488
+ style: { height: 44, background: "rgba(255,255,255,0.05)", border: "1px solid rgba(255,255,255,0.1)", color: "rgba(255,255,255,0.7)" }
3489
+ }
3490
+ ),
3491
+ hfTokenInput.trim() && /* @__PURE__ */ jsx20(
3492
+ "button",
3493
+ {
3494
+ type: "submit",
3495
+ className: "px-3 rounded-xl text-[11px] font-bold text-white",
3496
+ style: { background: "#f59e0b", height: 44 },
3497
+ children: "OK"
3498
+ }
3499
+ )
3500
+ ]
3501
+ }
3502
+ ),
3490
3503
  hfToken && /* @__PURE__ */ jsxs18(
3491
3504
  "button",
3492
3505
  {
@@ -3494,7 +3507,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3494
3507
  onClick: async () => {
3495
3508
  setIsLoadingFromHF(true);
3496
3509
  try {
3497
- const { hfListProjects: hfListProjects2, hfDownloadProject } = await import("./hfStateService-MQ33VAMR.mjs");
3510
+ const { hfListProjects: hfListProjects2, hfDownloadProject } = await import("./hfStateService-PB325HBF.mjs");
3498
3511
  const projects = await hfListProjects2(hfToken);
3499
3512
  if (projects.length > 0) {
3500
3513
  const file = await hfDownloadProject(projects[0].path, hfToken);
@@ -4152,7 +4165,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4152
4165
  }
4153
4166
 
4154
4167
  // src/index.ts
4155
- var LIB_VERSION = "1.2.7";
4168
+ var LIB_VERSION = "1.2.9";
4156
4169
  export {
4157
4170
  AvatarArchitectApp,
4158
4171
  CollapsibleCard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",