@rslsp1/fa-app-tools 5.1.0 → 6.1.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/dist/szenen.mjs CHANGED
@@ -4,6 +4,7 @@ import {
4
4
  CHAIN_EDGES,
5
5
  CHAIN_LINK_FIELDS,
6
6
  CapabilityAnchorError,
7
+ DEFAULT_SEED_VORLAGE,
7
8
  DERIVABLE_TYPES,
8
9
  ELEMENT_VERSION_SCHEMA_FILE,
9
10
  FLOW_EXECUTION_PATH,
@@ -22,6 +23,7 @@ import {
22
23
  SZENEN_SCHEMAS,
23
24
  SzenenView,
24
25
  UNCHECKED_PUBLISH_RULES,
26
+ UPLOAD_MAX_BYTES,
25
27
  UnsupportedSchemaError,
26
28
  acceptProposalTitle,
27
29
  areasFor,
@@ -99,8 +101,10 @@ import {
99
101
  findSceneDerivationRecovery,
100
102
  firstError,
101
103
  formatSchemaErrors,
104
+ formatSeedListe,
102
105
  freezeDraftChain,
103
106
  freezeSceneWorkingState,
107
+ gesamtHerkunft,
104
108
  getSzenenSchemas,
105
109
  gruppiereZuItems,
106
110
  hasPlacementCapability,
@@ -108,16 +112,21 @@ import {
108
112
  isOk,
109
113
  isProjectionCurrent,
110
114
  isSzenenItemId,
115
+ istZipDatei,
111
116
  itemIdForRun,
112
117
  ladeVorschauen,
118
+ leseBilderAusZip,
113
119
  linkFor,
114
120
  locatorTeile,
115
121
  logRevisionOf,
116
122
  mergeSzenenBatchOrigin,
123
+ mitDefaultVorlage,
117
124
  noticeFor,
118
125
  ordersForPromptRun,
126
+ ordneSeedsZu,
119
127
  parseDerivationResponse,
120
128
  parseRunResponse,
129
+ parseSeedListe,
121
130
  preferredHeadRevisionOf,
122
131
  promptDiagnosticsOf,
123
132
  publishedHeadsOf,
@@ -137,6 +146,7 @@ import {
137
146
  runSceneDerivation,
138
147
  sceneOnlyCapabilities,
139
148
  scopeOfPath,
149
+ seedFehlerText,
140
150
  selectableTargetModels,
141
151
  showChain,
142
152
  simulatedAnswerFor,
@@ -148,7 +158,7 @@ import {
148
158
  validateElementVersion,
149
159
  validatePayload,
150
160
  withReference
151
- } from "./chunk-3MUI4ZV7.mjs";
161
+ } from "./chunk-GHKN2VX3.mjs";
152
162
  import {
153
163
  ContractViolation,
154
164
  STYLE_PAYLOAD,
@@ -824,11 +834,16 @@ function createMemoryViewPort(options = {}) {
824
834
  const neueBilder = input.images.map((bild, offset) => ({
825
835
  media_ref: `${input.generationBatchId}-${startPosition + offset}`,
826
836
  position: startPosition + offset,
837
+ generation_batch_id: input.generationBatchId,
827
838
  model: bild.model ?? null,
828
839
  seed: bild.seed ?? null,
829
840
  width: bild.width ?? null,
830
841
  height: bild.height ?? null
831
842
  }));
843
+ const importOrigins = [
844
+ ...vorhandenesItem?.origins ?? [],
845
+ { generation_batch_id: input.generationBatchId, source_kind: "external_import" }
846
+ ];
832
847
  const neu = {
833
848
  item_id: vorhandenesItem?.item_id ?? `szn-mem-batch-${input.generationBatchId}`,
834
849
  prompt_run_id: input.runId,
@@ -836,7 +851,8 @@ function createMemoryViewPort(options = {}) {
836
851
  ...vorhandenesItem?.generation_batch_ids ?? [],
837
852
  input.generationBatchId
838
853
  ],
839
- source_kind: vorhandenesItem?.source_kind ?? "external_import",
854
+ source_kind: gesamtHerkunft(importOrigins),
855
+ origins: importOrigins,
840
856
  title: vorhandenesItem?.title ?? input.title ?? `Batch aus Lauf ${input.runId}`,
841
857
  images: [...vorhandenesItem?.images ?? [], ...neueBilder]
842
858
  };
@@ -890,11 +906,16 @@ function createMemoryViewPort(options = {}) {
890
906
  const neueBilder = input.images.map((bild, offset) => ({
891
907
  media_ref: `${input.generationBatchId}-${startPosition + offset}`,
892
908
  position: startPosition + offset,
909
+ generation_batch_id: input.generationBatchId,
893
910
  model: bild.model ?? null,
894
911
  seed: bild.seed ?? null,
895
912
  width: bild.width ?? null,
896
913
  height: bild.height ?? null
897
914
  }));
915
+ const genOrigins = [
916
+ ...vorhandenesItem?.origins ?? [],
917
+ { generation_batch_id: input.generationBatchId, source_kind: "generated_in_app" }
918
+ ];
898
919
  const neu = {
899
920
  item_id: vorhandenesItem?.item_id ?? `szn-mem-gen-${input.generationBatchId}`,
900
921
  prompt_run_id: input.runId,
@@ -902,7 +923,8 @@ function createMemoryViewPort(options = {}) {
902
923
  ...vorhandenesItem?.generation_batch_ids ?? [],
903
924
  input.generationBatchId
904
925
  ],
905
- source_kind: "generated_in_app",
926
+ source_kind: gesamtHerkunft(genOrigins),
927
+ origins: genOrigins,
906
928
  title: vorhandenesItem?.title ?? `Batch aus Lauf ${input.runId}`,
907
929
  images: [...vorhandenesItem?.images ?? [], ...neueBilder]
908
930
  };
@@ -933,6 +955,31 @@ function createMemoryViewPort(options = {}) {
933
955
  }
934
956
  }
935
957
  });
958
+ const seedVorlagen = [...options.seedTemplates ?? []];
959
+ let seedVorlagenZaehler = 0;
960
+ const seedTemplatePort = {
961
+ async listSeedTemplates() {
962
+ if (options.seedTemplatesFehler) {
963
+ return { kind: "error", message: "Vorlagenbestand nicht lesbar (Simulation).", retryable: true };
964
+ }
965
+ return ok(seedVorlagen);
966
+ },
967
+ async saveSeedTemplate(input) {
968
+ const vorlage = {
969
+ id: `seedtpl-${seedVorlagenZaehler += 1}`,
970
+ name: input.name,
971
+ seeds: input.seeds
972
+ };
973
+ seedVorlagen.push(vorlage);
974
+ return done(vorlage);
975
+ },
976
+ async deleteSeedTemplate(id) {
977
+ const index = seedVorlagen.findIndex((v) => String(v.id) === String(id));
978
+ if (index < 0) return { kind: "error", message: `Seed-Vorlage nicht gefunden: ${id}`, retryable: false };
979
+ seedVorlagen.splice(index, 1);
980
+ return done(null);
981
+ }
982
+ };
936
983
  const port = {
937
984
  elements,
938
985
  context: {
@@ -950,6 +997,9 @@ function createMemoryViewPort(options = {}) {
950
997
  if (options.derivation !== false) port.derivation = derivationPort;
951
998
  if (options.imageBatchHistory !== false) port.imageBatchHistory = imageBatchHistoryPort;
952
999
  if (options.imageBatchWrite !== false) port.imageBatchWrite = imageBatchWritePort;
1000
+ if (options.seedTemplates !== void 0 || options.seedTemplatesFehler) {
1001
+ port.seedTemplates = seedTemplatePort;
1002
+ }
953
1003
  if (options.imageGeneration !== false) port.imageGeneration = imageGenerationPort;
954
1004
  return port;
955
1005
  }
@@ -1598,6 +1648,7 @@ export {
1598
1648
  CHAIN_LINK_FIELDS,
1599
1649
  CapabilityAnchorError,
1600
1650
  ContractViolation,
1651
+ DEFAULT_SEED_VORLAGE,
1601
1652
  DERIVABLE_TYPES,
1602
1653
  ELEMENT_VERSION_SCHEMA_FILE,
1603
1654
  FLOW_EXECUTION_PATH,
@@ -1617,6 +1668,7 @@ export {
1617
1668
  SZENEN_SCHEMAS,
1618
1669
  SzenenView,
1619
1670
  UNCHECKED_PUBLISH_RULES,
1671
+ UPLOAD_MAX_BYTES,
1620
1672
  UnsupportedSchemaError,
1621
1673
  VersionDagError,
1622
1674
  areasFor,
@@ -1705,8 +1757,10 @@ export {
1705
1757
  findSceneDerivationRecovery,
1706
1758
  firstError,
1707
1759
  formatSchemaErrors,
1760
+ formatSeedListe,
1708
1761
  freezeDraftChain,
1709
1762
  freezeSceneWorkingState,
1763
+ gesamtHerkunft,
1710
1764
  getSzenenSchemas,
1711
1765
  gruppiereZuItems,
1712
1766
  hasPlacementCapability,
@@ -1714,16 +1768,21 @@ export {
1714
1768
  isOk,
1715
1769
  isProjectionCurrent,
1716
1770
  isSzenenItemId,
1771
+ istZipDatei,
1717
1772
  itemIdForRun,
1718
1773
  ladeVorschauen,
1774
+ leseBilderAusZip,
1719
1775
  linkFor,
1720
1776
  locatorTeile,
1721
1777
  logRevisionOf,
1722
1778
  mergeSzenenBatchOrigin,
1779
+ mitDefaultVorlage,
1723
1780
  noticeFor,
1724
1781
  ordersForPromptRun,
1782
+ ordneSeedsZu,
1725
1783
  parseDerivationResponse,
1726
1784
  parseRunResponse,
1785
+ parseSeedListe,
1727
1786
  preferredHeadRevisionOf,
1728
1787
  preferredVersionId,
1729
1788
  promptDiagnosticsOf,
@@ -1747,6 +1806,7 @@ export {
1747
1806
  runStoreDifferential,
1748
1807
  sceneOnlyCapabilities,
1749
1808
  scopeOfPath,
1809
+ seedFehlerText,
1750
1810
  selectableTargetModels,
1751
1811
  showChain,
1752
1812
  simulatedAnswerFor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "5.1.0",
3
+ "version": "6.1.0",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",