@rslsp1/fa-app-tools 8.0.0 → 9.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
@@ -8,6 +8,11 @@ import {
8
8
  DERIVABLE_TYPES,
9
9
  ELEMENT_VERSION_SCHEMA_FILE,
10
10
  FLOW_EXECUTION_PATH,
11
+ GENERAL_POLICY_SUBTYPE,
12
+ MANUAL_MODEL_ID,
13
+ MANUAL_NODE_STATE,
14
+ MANUAL_PROVIDER,
15
+ MANUAL_VISIBILITY_BASIS,
11
16
  MAX_PROPOSAL_TITLE_LENGTH,
12
17
  PROBE_VERSION_ID,
13
18
  PROMPT_RULE_EFFECT,
@@ -33,6 +38,7 @@ import {
33
38
  assessDerivationResponse,
34
39
  batchesForPromptRun,
35
40
  bildPfad,
41
+ buildManualPromptRunRecord,
36
42
  buildSystemInstruction,
37
43
  buildSystemInstruction2,
38
44
  buildSzenenSnapshot,
@@ -135,6 +141,7 @@ import {
135
141
  locatorAus,
136
142
  locatorTeile,
137
143
  logRevisionOf,
144
+ manualEntryOf,
138
145
  mergeSnapshotAndPending,
139
146
  mergeSzenenBatchOrigin,
140
147
  mimeTypAus,
@@ -154,6 +161,7 @@ import {
154
161
  recoveryStatusOf,
155
162
  reduceElementEvents,
156
163
  resolveArea,
164
+ resolveGeneralScenePolicies,
157
165
  resolveScenePayload,
158
166
  resolveShot,
159
167
  resolveShotPayload,
@@ -165,6 +173,7 @@ import {
165
173
  runPublishChecks,
166
174
  runSceneDerivation,
167
175
  sceneOnlyCapabilities,
176
+ scenePolicyFingerprint,
168
177
  scopeOfPath,
169
178
  seedFehlerText,
170
179
  selectPromptRuns,
@@ -172,6 +181,7 @@ import {
172
181
  showChain,
173
182
  siblingsOf,
174
183
  simulatedAnswerFor,
184
+ sortScenePolicies,
175
185
  sourceOf,
176
186
  szenenSnapshotFilename,
177
187
  typAusBytes,
@@ -182,7 +192,7 @@ import {
182
192
  validateElementVersion,
183
193
  validatePayload,
184
194
  withReference
185
- } from "./chunk-VVGASAYT.mjs";
195
+ } from "./chunk-33L6XAHI.mjs";
186
196
  import {
187
197
  ContractViolation,
188
198
  STYLE_PAYLOAD,
@@ -601,6 +611,34 @@ function createMemoryViewPort(options = {}) {
601
611
  laeufe.push(lauf);
602
612
  return done(lauf);
603
613
  },
614
+ // ── Der manuell erfasste Lauf derselben Szene (Schritt 01) ────────────
615
+ //
616
+ // Auch hier nur die **Form**, und zwar ueber `buildManualPromptRunRecord()`
617
+ // — dieselbe Funktion, die der echte Port benutzt. Ein hier nachgebauter
618
+ // Datensatz waere die zweite Wahrheit, an der eine Ansicht gruen testete
619
+ // und im Host scheiterte. Was der Speicherport nicht abbildet, ist das
620
+ // Einfrieren: Es braucht einen echten Bestand.
621
+ async addManualSceneRun(input) {
622
+ const gebaut = buildManualPromptRunRecord({
623
+ runId: ids(),
624
+ scene: {
625
+ element_id: input.sceneElementId,
626
+ draft_id: `draft-${input.sceneElementId}`,
627
+ revision: 1,
628
+ version_id: null
629
+ },
630
+ input: {
631
+ scene: { nodes: [] }
632
+ },
633
+ promptText: input.promptText,
634
+ note: input.note ?? null,
635
+ derivedFromRunId: input.derivedFromRunId ?? null,
636
+ enteredBy: input.enteredBy
637
+ });
638
+ if (gebaut.kind !== "ok") return { kind: "rejected", message: gebaut.message };
639
+ laeufe.push(gebaut.record);
640
+ return done(gebaut.record);
641
+ },
604
642
  async listRunsForScene(sceneElementId) {
605
643
  return ok(laeufe.filter(
606
644
  (r) => r.source?.kind === "scene_direct" && r.source.scene.element_id === sceneElementId
@@ -1267,6 +1305,47 @@ function pruefeLaufherkunft(quelle) {
1267
1305
  }
1268
1306
  return { ok: true };
1269
1307
  }
1308
+ function pruefeHandeingabe(record) {
1309
+ const block = record.manual_entry;
1310
+ if (block === void 0) return { ok: true };
1311
+ if (!isObject(block)) {
1312
+ return { ok: false, message: '"manual_entry" muss ein Objekt sein.' };
1313
+ }
1314
+ if (block.entered_manually !== true) {
1315
+ return {
1316
+ ok: false,
1317
+ message: '"manual_entry.entered_manually" muss true sein. Ein Block, der das nicht sagt, ist kein Nachweis einer Handeingabe.'
1318
+ };
1319
+ }
1320
+ if (!istText(block.entered_by)) {
1321
+ return { ok: false, message: '"manual_entry.entered_by" fehlt oder ist leer.' };
1322
+ }
1323
+ if (block.note !== null && typeof block.note !== "string") {
1324
+ return {
1325
+ ok: false,
1326
+ message: '"manual_entry.note" muss eine Zeichenkette oder null sein \u2014 ohne Notiz gehoert null hin, kein fehlendes Feld.'
1327
+ };
1328
+ }
1329
+ if (block.derived_from_run_id !== null && !istText(block.derived_from_run_id)) {
1330
+ return {
1331
+ ok: false,
1332
+ message: '"manual_entry.derived_from_run_id" muss eine run_id oder null sein. Eine leere Kennung belegt keinen Ursprung.'
1333
+ };
1334
+ }
1335
+ if (record.status !== "succeeded") {
1336
+ return {
1337
+ ok: false,
1338
+ message: `Ein manuell erfasster Lauf hat den Status "succeeded" \u2014 er traegt einen vorgegebenen Prompttext. Angekommen ist ${JSON.stringify(record.status)}.`
1339
+ };
1340
+ }
1341
+ if (record.provider !== MANUAL_PROVIDER || record.model_id !== MANUAL_MODEL_ID) {
1342
+ return {
1343
+ ok: false,
1344
+ message: `Ein manuell erfasster Lauf traegt provider "${MANUAL_PROVIDER}" und model_id "${MANUAL_MODEL_ID}"; angekommen sind ${JSON.stringify(record.provider)} und ${JSON.stringify(record.model_id)}. Formuliert hat ein Mensch \u2014 ein Modell als Urheber waere eine Falschaussage.`
1345
+ };
1346
+ }
1347
+ return { ok: true };
1348
+ }
1270
1349
  function checkPromptRunRecord(candidate) {
1271
1350
  if (candidate === null || typeof candidate !== "object" || Array.isArray(candidate)) {
1272
1351
  return {
@@ -1316,6 +1395,8 @@ function checkPromptRunRecord(candidate) {
1316
1395
  message: `"status" muss succeeded oder failed sein, angekommen ist ${JSON.stringify(record.status)}.`
1317
1396
  };
1318
1397
  }
1398
+ const handeingabe = pruefeHandeingabe(record);
1399
+ if (!handeingabe.ok) return handeingabe;
1319
1400
  const eingabe = record.input_payload;
1320
1401
  if (eingabe === null || typeof eingabe !== "object") {
1321
1402
  return { ok: false, message: '"input_payload" fehlt \u2014 ohne sie ist der Lauf nicht pruefbar.' };
@@ -1698,7 +1779,8 @@ async function preparePromptOperation(input) {
1698
1779
  store: input.store,
1699
1780
  resolver: input.resolver,
1700
1781
  contextChain: input.contextChain,
1701
- userInstruction: input.userInstruction ?? null
1782
+ userInstruction: input.userInstruction ?? null,
1783
+ targetModelElementId: input.targetModelElementId ?? null
1702
1784
  });
1703
1785
  if (eingefroren.kind !== "ok") return eingefroren;
1704
1786
  const rendererInput = eingefroren.input;
@@ -1797,6 +1879,11 @@ export {
1797
1879
  DERIVABLE_TYPES,
1798
1880
  ELEMENT_VERSION_SCHEMA_FILE,
1799
1881
  FLOW_EXECUTION_PATH,
1882
+ GENERAL_POLICY_SUBTYPE,
1883
+ MANUAL_MODEL_ID,
1884
+ MANUAL_NODE_STATE,
1885
+ MANUAL_PROVIDER,
1886
+ MANUAL_VISIBILITY_BASIS,
1800
1887
  MCP_CLIENT_PROVIDER,
1801
1888
  PROBE_VERSION_ID,
1802
1889
  PROMPT_RULE_EFFECT,
@@ -1827,6 +1914,7 @@ export {
1827
1914
  bildPfad,
1828
1915
  buildSystemInstruction as buildDerivationSystemInstruction,
1829
1916
  buildUserPrompt as buildDerivationUserPrompt,
1917
+ buildManualPromptRunRecord,
1830
1918
  buildSystemInstruction2 as buildSystemInstruction,
1831
1919
  buildSzenenSnapshot,
1832
1920
  buildUserPrompt2 as buildUserPrompt,
@@ -1941,6 +2029,7 @@ export {
1941
2029
  locatorAus,
1942
2030
  locatorTeile,
1943
2031
  logRevisionOf,
2032
+ manualEntryOf,
1944
2033
  mergeSnapshotAndPending,
1945
2034
  mergeSzenenBatchOrigin,
1946
2035
  mimeTypAus,
@@ -1962,6 +2051,7 @@ export {
1962
2051
  recoveryStatusOf,
1963
2052
  reduceElementEvents,
1964
2053
  resolveArea,
2054
+ resolveGeneralScenePolicies,
1965
2055
  resolvePreferredHead,
1966
2056
  resolveScenePayload,
1967
2057
  resolveShot,
@@ -1979,6 +2069,7 @@ export {
1979
2069
  runStoreDifferential,
1980
2070
  sameResponseAs,
1981
2071
  sceneOnlyCapabilities,
2072
+ scenePolicyFingerprint,
1982
2073
  scopeOfPath,
1983
2074
  seedFehlerText,
1984
2075
  selectPromptRuns,
@@ -1986,6 +2077,7 @@ export {
1986
2077
  showChain,
1987
2078
  siblingsOf,
1988
2079
  simulatedAnswerFor,
2080
+ sortScenePolicies,
1989
2081
  sourceOf,
1990
2082
  szenenSnapshotFilename,
1991
2083
  totalModelCalls,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "8.0.0",
3
+ "version": "9.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",