@rslsp1/fa-app-tools 7.2.0 → 8.0.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/{chunk-5QA6DTJ6.mjs → chunk-VVGASAYT.mjs} +1620 -733
- package/dist/index.d.mts +26 -4
- package/dist/index.d.ts +26 -4
- package/dist/index.js +1487 -660
- package/dist/index.mjs +3 -3
- package/dist/szenen.d.mts +661 -9
- package/dist/szenen.d.ts +661 -9
- package/dist/szenen.js +1619 -578
- package/dist/szenen.mjs +163 -2
- package/package.json +6 -2
package/dist/szenen.mjs
CHANGED
|
@@ -63,13 +63,16 @@ import {
|
|
|
63
63
|
checkSzenenBatchOrigin,
|
|
64
64
|
checkTitle,
|
|
65
65
|
checkWriteDraftInput,
|
|
66
|
+
claimWon,
|
|
66
67
|
collectImageBatches,
|
|
67
68
|
collectImageGenerationOrders,
|
|
69
|
+
collectImageJobs,
|
|
68
70
|
collectPromptRuns,
|
|
69
71
|
collectSceneDerivationRecoveries,
|
|
70
72
|
collectSceneDerivations,
|
|
71
73
|
collectVersionRefs,
|
|
72
74
|
compileSchemas,
|
|
75
|
+
contextOfRun,
|
|
73
76
|
createClientDerivationPort,
|
|
74
77
|
createClientRunPort,
|
|
75
78
|
createEventLogDerivationPersistence,
|
|
@@ -86,6 +89,7 @@ import {
|
|
|
86
89
|
createHfImageLibrary,
|
|
87
90
|
createHfImageStore,
|
|
88
91
|
createImageGenerationPort,
|
|
92
|
+
createImageJobPort,
|
|
89
93
|
createSimulationSceneDerivationPort,
|
|
90
94
|
createSimulationTextGenerationPort,
|
|
91
95
|
derivationPoliciesOf,
|
|
@@ -100,6 +104,7 @@ import {
|
|
|
100
104
|
findExecutableImageModel,
|
|
101
105
|
findImageBatch,
|
|
102
106
|
findImageGenerationOrder,
|
|
107
|
+
findImageJob,
|
|
103
108
|
findPromptRun,
|
|
104
109
|
findSceneDerivation,
|
|
105
110
|
findSceneDerivationRecovery,
|
|
@@ -108,8 +113,11 @@ import {
|
|
|
108
113
|
formatSeedListe,
|
|
109
114
|
freezeDraftChain,
|
|
110
115
|
freezeSceneWorkingState,
|
|
116
|
+
generationBatchIdOf,
|
|
111
117
|
gesamtHerkunft,
|
|
112
118
|
getSzenenSchemas,
|
|
119
|
+
groupKeyOf,
|
|
120
|
+
groupOf,
|
|
113
121
|
gruppiereZuItems,
|
|
114
122
|
hasPlacementCapability,
|
|
115
123
|
isKnownElementType,
|
|
@@ -119,14 +127,19 @@ import {
|
|
|
119
127
|
istSzenenSnapshotDatei,
|
|
120
128
|
istZipDatei,
|
|
121
129
|
itemIdForRun,
|
|
130
|
+
itemsAusBestand,
|
|
131
|
+
jobsForPromptRun,
|
|
122
132
|
ladeVorschauen,
|
|
123
133
|
leseBilderAusZip,
|
|
124
134
|
linkFor,
|
|
135
|
+
locatorAus,
|
|
125
136
|
locatorTeile,
|
|
126
137
|
logRevisionOf,
|
|
127
138
|
mergeSnapshotAndPending,
|
|
128
139
|
mergeSzenenBatchOrigin,
|
|
140
|
+
mimeTypAus,
|
|
129
141
|
mitDefaultVorlage,
|
|
142
|
+
namingElementOf,
|
|
130
143
|
noticeFor,
|
|
131
144
|
ordersForPromptRun,
|
|
132
145
|
ordneSeedsZu,
|
|
@@ -154,9 +167,12 @@ import {
|
|
|
154
167
|
sceneOnlyCapabilities,
|
|
155
168
|
scopeOfPath,
|
|
156
169
|
seedFehlerText,
|
|
170
|
+
selectPromptRuns,
|
|
157
171
|
selectableTargetModels,
|
|
158
172
|
showChain,
|
|
173
|
+
siblingsOf,
|
|
159
174
|
simulatedAnswerFor,
|
|
175
|
+
sourceOf,
|
|
160
176
|
szenenSnapshotFilename,
|
|
161
177
|
typAusBytes,
|
|
162
178
|
unclassifiedPublishRules,
|
|
@@ -166,7 +182,7 @@ import {
|
|
|
166
182
|
validateElementVersion,
|
|
167
183
|
validatePayload,
|
|
168
184
|
withReference
|
|
169
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-VVGASAYT.mjs";
|
|
170
186
|
import {
|
|
171
187
|
ContractViolation,
|
|
172
188
|
STYLE_PAYLOAD,
|
|
@@ -505,7 +521,7 @@ function createMemoryViewPort(options = {}) {
|
|
|
505
521
|
const itemMedien = /* @__PURE__ */ new Map();
|
|
506
522
|
const runs = {
|
|
507
523
|
async listRunsForShot(shotVersionId) {
|
|
508
|
-
return ok(laeufe.filter((l) => l
|
|
524
|
+
return ok(laeufe.filter((l) => groupKeyOf(l) === `published:${shotVersionId}`));
|
|
509
525
|
},
|
|
510
526
|
async getRun(runId) {
|
|
511
527
|
return ok(laeufe.find((l) => l.run_id === runId) ?? null);
|
|
@@ -589,6 +605,12 @@ function createMemoryViewPort(options = {}) {
|
|
|
589
605
|
return ok(laeufe.filter(
|
|
590
606
|
(r) => r.source?.kind === "scene_direct" && r.source.scene.element_id === sceneElementId
|
|
591
607
|
));
|
|
608
|
+
},
|
|
609
|
+
// P1-A: die gemeinsame Sicht. Auch hier nur die **Form** — gefiltert wird
|
|
610
|
+
// mit `selectPromptRuns()`, derselben Funktion wie im Client und im
|
|
611
|
+
// Server. Ein eigener Filter waere eine zweite Wahrheit.
|
|
612
|
+
async listAllRuns(filter) {
|
|
613
|
+
return ok(selectPromptRuns(laeufe, filter));
|
|
592
614
|
}
|
|
593
615
|
};
|
|
594
616
|
const itemPort = {
|
|
@@ -1650,6 +1672,120 @@ function checkSceneDerivationRecoveryRecord(candidate) {
|
|
|
1650
1672
|
}
|
|
1651
1673
|
return { ok: true };
|
|
1652
1674
|
}
|
|
1675
|
+
|
|
1676
|
+
// src/lib/szenen/scenePromptOperation.ts
|
|
1677
|
+
var MCP_CLIENT_PROVIDER = "mcp_client";
|
|
1678
|
+
var UNVERIFIED_MODEL_ID = "mcp-client-unspecified";
|
|
1679
|
+
var istText2 = (wert) => typeof wert === "string" && wert.trim().length > 0;
|
|
1680
|
+
function collectPromptOperations(events) {
|
|
1681
|
+
const nachId = /* @__PURE__ */ new Map();
|
|
1682
|
+
for (const event of events) {
|
|
1683
|
+
if (event.type !== SZENEN_EVENT_TYPES.promptOperationPrepared) continue;
|
|
1684
|
+
const payload = event.payload;
|
|
1685
|
+
if (!payload || !istText2(payload.operation_id)) continue;
|
|
1686
|
+
if (nachId.has(payload.operation_id)) continue;
|
|
1687
|
+
nachId.set(payload.operation_id, payload);
|
|
1688
|
+
}
|
|
1689
|
+
return [...nachId.values()];
|
|
1690
|
+
}
|
|
1691
|
+
function findPromptOperation(events, operationId) {
|
|
1692
|
+
return collectPromptOperations(events).find((v) => v.operation_id === operationId) ?? null;
|
|
1693
|
+
}
|
|
1694
|
+
async function preparePromptOperation(input) {
|
|
1695
|
+
const now = input.now ?? (() => /* @__PURE__ */ new Date());
|
|
1696
|
+
const eingefroren = await freezeSceneWorkingState({
|
|
1697
|
+
sceneElementId: input.sceneElementId,
|
|
1698
|
+
store: input.store,
|
|
1699
|
+
resolver: input.resolver,
|
|
1700
|
+
contextChain: input.contextChain,
|
|
1701
|
+
userInstruction: input.userInstruction ?? null
|
|
1702
|
+
});
|
|
1703
|
+
if (eingefroren.kind !== "ok") return eingefroren;
|
|
1704
|
+
const rendererInput = eingefroren.input;
|
|
1705
|
+
return {
|
|
1706
|
+
kind: "ok",
|
|
1707
|
+
operation: {
|
|
1708
|
+
operation_id: input.operationId,
|
|
1709
|
+
scene: eingefroren.scene,
|
|
1710
|
+
context_id: input.contextId,
|
|
1711
|
+
user_instruction: input.userInstruction ?? null,
|
|
1712
|
+
renderer_input: rendererInput,
|
|
1713
|
+
renderer_instruction: buildSystemInstruction2(rendererInput),
|
|
1714
|
+
renderer_payload: buildUserPrompt2(rendererInput),
|
|
1715
|
+
response_contract: responseContractOf(rendererInput),
|
|
1716
|
+
prepared_by: input.preparedBy,
|
|
1717
|
+
created_at: now().toISOString()
|
|
1718
|
+
}
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
function responseContractOf(input) {
|
|
1722
|
+
const model = input.target_model ?? {};
|
|
1723
|
+
return {
|
|
1724
|
+
format: "json",
|
|
1725
|
+
required_fields: ["positive", "negative", "feedback", "visibility", "notes"],
|
|
1726
|
+
negative_prompt_allowed: model.supports_negative_prompt === true,
|
|
1727
|
+
node_ids: input.scene.nodes.map((node) => node.node_id),
|
|
1728
|
+
prompt_language: typeof model.prompt_language === "string" ? model.prompt_language : "en"
|
|
1729
|
+
};
|
|
1730
|
+
}
|
|
1731
|
+
function completePromptOperation(input) {
|
|
1732
|
+
const now = input.now ?? (() => /* @__PURE__ */ new Date());
|
|
1733
|
+
const { operation } = input;
|
|
1734
|
+
const geparst = parseRunResponse(input.response);
|
|
1735
|
+
if (!geparst.ok) {
|
|
1736
|
+
return {
|
|
1737
|
+
kind: "rejected",
|
|
1738
|
+
message: `Die Antwort zu Vorgang ${operation.operation_id} ist nicht verwertbar: ${geparst.message}`
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
const geprueft = checkRunResponse(geparst.value, operation.renderer_input);
|
|
1742
|
+
if (!geprueft.ok) {
|
|
1743
|
+
return {
|
|
1744
|
+
kind: "rejected",
|
|
1745
|
+
message: `Die Antwort zu Vorgang ${operation.operation_id} passt nicht zur eingefrorenen Eingabe: ${geprueft.message}`
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
const origin = {
|
|
1749
|
+
host: "mcp",
|
|
1750
|
+
...istText2(input.declaredModelId) ? { declared_model_id: input.declaredModelId } : {},
|
|
1751
|
+
renderer_instruction_was_system_prompt: false
|
|
1752
|
+
};
|
|
1753
|
+
return {
|
|
1754
|
+
kind: "ok",
|
|
1755
|
+
record: {
|
|
1756
|
+
run_id: input.runId,
|
|
1757
|
+
// Keine fingierten Kennungen (D-98/D-75) — genau wie beim
|
|
1758
|
+
// Szene-Direktlauf des bestehenden Pfads.
|
|
1759
|
+
shot_version_id: "",
|
|
1760
|
+
shot_element_id: "",
|
|
1761
|
+
scene_setup_version_id: "",
|
|
1762
|
+
camera_id: "",
|
|
1763
|
+
target_model_version_id: operation.renderer_input.target_model_resolution?.version_id ?? "",
|
|
1764
|
+
provider: MCP_CLIENT_PROVIDER,
|
|
1765
|
+
model_id: UNVERIFIED_MODEL_ID,
|
|
1766
|
+
// Die Renderer-Anweisung, wie sie der Vorgang eingefroren hat — nicht
|
|
1767
|
+
// eine zweite, jetzt neu gebaute Fassung.
|
|
1768
|
+
system_prompt: operation.renderer_instruction,
|
|
1769
|
+
input_payload: operation.renderer_input,
|
|
1770
|
+
status: "succeeded",
|
|
1771
|
+
failure: null,
|
|
1772
|
+
output: geprueft.output,
|
|
1773
|
+
raw_output: input.response,
|
|
1774
|
+
source: { kind: "scene_direct", scene: operation.scene },
|
|
1775
|
+
operation_id: operation.operation_id,
|
|
1776
|
+
execution_origin: origin,
|
|
1777
|
+
created_at: now().toISOString()
|
|
1778
|
+
}
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
function runOfOperation(runs, operationId) {
|
|
1782
|
+
return runs.find(
|
|
1783
|
+
(run) => run.operation_id === operationId
|
|
1784
|
+
) ?? null;
|
|
1785
|
+
}
|
|
1786
|
+
function sameResponseAs(run, response) {
|
|
1787
|
+
return (run.raw_output ?? "") === response;
|
|
1788
|
+
}
|
|
1653
1789
|
export {
|
|
1654
1790
|
ALL_PUBLISH_RULES,
|
|
1655
1791
|
CATALOGUE_TYPES,
|
|
@@ -1661,6 +1797,7 @@ export {
|
|
|
1661
1797
|
DERIVABLE_TYPES,
|
|
1662
1798
|
ELEMENT_VERSION_SCHEMA_FILE,
|
|
1663
1799
|
FLOW_EXECUTION_PATH,
|
|
1800
|
+
MCP_CLIENT_PROVIDER,
|
|
1664
1801
|
PROBE_VERSION_ID,
|
|
1665
1802
|
PROMPT_RULE_EFFECT,
|
|
1666
1803
|
REFERENCE_FIELD,
|
|
@@ -1680,6 +1817,7 @@ export {
|
|
|
1680
1817
|
SZENEN_SNAPSHOT_SCHEMA_VERSION,
|
|
1681
1818
|
SzenenView,
|
|
1682
1819
|
UNCHECKED_PUBLISH_RULES,
|
|
1820
|
+
UNVERIFIED_MODEL_ID,
|
|
1683
1821
|
UPLOAD_MAX_BYTES,
|
|
1684
1822
|
UnsupportedSchemaError,
|
|
1685
1823
|
VersionDagError,
|
|
@@ -1721,14 +1859,19 @@ export {
|
|
|
1721
1859
|
checkSzenenBatchOrigin,
|
|
1722
1860
|
checkTitle,
|
|
1723
1861
|
checkWriteDraftInput,
|
|
1862
|
+
claimWon,
|
|
1724
1863
|
collectImageBatches,
|
|
1725
1864
|
collectImageGenerationOrders,
|
|
1865
|
+
collectImageJobs,
|
|
1866
|
+
collectPromptOperations,
|
|
1726
1867
|
collectPromptRuns,
|
|
1727
1868
|
collectProviderChecks,
|
|
1728
1869
|
collectSceneDerivationRecoveries,
|
|
1729
1870
|
collectSceneDerivations,
|
|
1730
1871
|
collectVersionRefs,
|
|
1731
1872
|
compileSchemas,
|
|
1873
|
+
completePromptOperation,
|
|
1874
|
+
contextOfRun,
|
|
1732
1875
|
createBrowserTextGenerationPort,
|
|
1733
1876
|
createClientDerivationPort,
|
|
1734
1877
|
createClientRunPort,
|
|
@@ -1746,6 +1889,7 @@ export {
|
|
|
1746
1889
|
createHfImageLibrary,
|
|
1747
1890
|
createHfImageStore,
|
|
1748
1891
|
createImageGenerationPort,
|
|
1892
|
+
createImageJobPort,
|
|
1749
1893
|
createInMemoryEventChannel,
|
|
1750
1894
|
createMemoryViewPort,
|
|
1751
1895
|
createSimulationSceneDerivationPort,
|
|
@@ -1764,6 +1908,8 @@ export {
|
|
|
1764
1908
|
findExecutableImageModel,
|
|
1765
1909
|
findImageBatch,
|
|
1766
1910
|
findImageGenerationOrder,
|
|
1911
|
+
findImageJob,
|
|
1912
|
+
findPromptOperation,
|
|
1767
1913
|
findPromptRun,
|
|
1768
1914
|
findProviderCheck,
|
|
1769
1915
|
findSceneDerivation,
|
|
@@ -1773,8 +1919,11 @@ export {
|
|
|
1773
1919
|
formatSeedListe,
|
|
1774
1920
|
freezeDraftChain,
|
|
1775
1921
|
freezeSceneWorkingState,
|
|
1922
|
+
generationBatchIdOf,
|
|
1776
1923
|
gesamtHerkunft,
|
|
1777
1924
|
getSzenenSchemas,
|
|
1925
|
+
groupKeyOf,
|
|
1926
|
+
groupOf,
|
|
1778
1927
|
gruppiereZuItems,
|
|
1779
1928
|
hasPlacementCapability,
|
|
1780
1929
|
isKnownElementType,
|
|
@@ -1784,14 +1933,19 @@ export {
|
|
|
1784
1933
|
istSzenenSnapshotDatei,
|
|
1785
1934
|
istZipDatei,
|
|
1786
1935
|
itemIdForRun,
|
|
1936
|
+
itemsAusBestand,
|
|
1937
|
+
jobsForPromptRun,
|
|
1787
1938
|
ladeVorschauen,
|
|
1788
1939
|
leseBilderAusZip,
|
|
1789
1940
|
linkFor,
|
|
1941
|
+
locatorAus,
|
|
1790
1942
|
locatorTeile,
|
|
1791
1943
|
logRevisionOf,
|
|
1792
1944
|
mergeSnapshotAndPending,
|
|
1793
1945
|
mergeSzenenBatchOrigin,
|
|
1946
|
+
mimeTypAus,
|
|
1794
1947
|
mitDefaultVorlage,
|
|
1948
|
+
namingElementOf,
|
|
1795
1949
|
noticeFor,
|
|
1796
1950
|
ordersForPromptRun,
|
|
1797
1951
|
ordneSeedsZu,
|
|
@@ -1801,6 +1955,7 @@ export {
|
|
|
1801
1955
|
parseSzenenSnapshot,
|
|
1802
1956
|
preferredHeadRevisionOf,
|
|
1803
1957
|
preferredVersionId,
|
|
1958
|
+
preparePromptOperation,
|
|
1804
1959
|
promptDiagnosticsOf,
|
|
1805
1960
|
publishedHeadsOf,
|
|
1806
1961
|
recoveriesForRun,
|
|
@@ -1813,19 +1968,25 @@ export {
|
|
|
1813
1968
|
resolveShotPayload,
|
|
1814
1969
|
resolveTargetModelOver,
|
|
1815
1970
|
resolverFromQueries,
|
|
1971
|
+
responseContractOf,
|
|
1816
1972
|
roundOfRun,
|
|
1817
1973
|
rulesWithoutPromptEffect,
|
|
1818
1974
|
runElementStoreContract,
|
|
1975
|
+
runOfOperation,
|
|
1819
1976
|
runPromptDerivation,
|
|
1820
1977
|
runPublishChecks,
|
|
1821
1978
|
runSceneDerivation,
|
|
1822
1979
|
runStoreDifferential,
|
|
1980
|
+
sameResponseAs,
|
|
1823
1981
|
sceneOnlyCapabilities,
|
|
1824
1982
|
scopeOfPath,
|
|
1825
1983
|
seedFehlerText,
|
|
1984
|
+
selectPromptRuns,
|
|
1826
1985
|
selectableTargetModels,
|
|
1827
1986
|
showChain,
|
|
1987
|
+
siblingsOf,
|
|
1828
1988
|
simulatedAnswerFor,
|
|
1989
|
+
sourceOf,
|
|
1829
1990
|
szenenSnapshotFilename,
|
|
1830
1991
|
totalModelCalls,
|
|
1831
1992
|
typAusBytes,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslsp1/fa-app-tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.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",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "node scripts/sync-szenen-styles.js && tsup",
|
|
30
30
|
"prepublishOnly": "npm run build",
|
|
31
|
-
"test": "vitest run"
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"mutation:szenen": "stryker run stryker.szenen.conf.mjs"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|
|
34
35
|
"react": ">=18"
|
|
@@ -39,9 +40,12 @@
|
|
|
39
40
|
"zustand": "^5.0.14"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
43
|
+
"@stryker-mutator/core": "9.6.1",
|
|
44
|
+
"@stryker-mutator/vitest-runner": "9.6.1",
|
|
42
45
|
"@testing-library/dom": "^10.4.1",
|
|
43
46
|
"@testing-library/react": "^16.3.2",
|
|
44
47
|
"@types/react": "^19.0.0",
|
|
48
|
+
"@vitest/coverage-v8": "2.1.9",
|
|
45
49
|
"@xyflow/react": "^12.10.2",
|
|
46
50
|
"jsdom": "^29.1.1",
|
|
47
51
|
"motion": "^12.40.0",
|