@deepblend/dsh-blender-contracts 0.23.0 → 0.25.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/lib/camera-fit.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { BlenderError, BlenderErrorCode } from './index.js'
2
+ import { PHOTOGRAPHY_SNAPSHOT_LIMITS, validatePhotographySnapshot, verifyPhotographySnapshot } from './photography-snapshot.js'
2
3
 
3
4
  export const CAMERA_FIT_VERSION = 'deepblend.camera-fit/v1'
4
5
  export const CAMERA_FIT_LIMITS = Object.freeze({ entities: 64, meshes: 128, vertices: 2_000_000,
@@ -13,15 +14,18 @@ const same = (a, b) => JSON.stringify(a) === JSON.stringify(b)
13
14
  const fail = (message, code = BlenderErrorCode.SCENE_VALIDATION_FAILED) => { throw new BlenderError(code, `Camera fit: ${message}`) }
14
15
 
15
16
  export function validateCameraFitSelection(request) {
17
+ if (request?.photography !== undefined) validatePhotographySnapshot(request.photography)
16
18
  const invalid = message => fail(message, BlenderErrorCode.SCENE_PATCH_INVALID)
17
- if (!Array.isArray(request?.entityIds) || !integer(request.entityIds.length, 1, CAMERA_FIT_LIMITS.entities) ||
18
- !request.entityIds.every(id) || new Set(request.entityIds).size !== request.entityIds.length) invalid('select 1–64 distinct mesh entities or complete asset instances.')
19
+ const entityLimit = request?.photography === undefined ? CAMERA_FIT_LIMITS.entities : PHOTOGRAPHY_SNAPSHOT_LIMITS.entities
20
+ if (!Array.isArray(request?.entityIds) || !integer(request.entityIds.length, 1, entityLimit) ||
21
+ !request.entityIds.every(id) || new Set(request.entityIds).size !== request.entityIds.length) invalid(`select 1–${entityLimit} distinct mesh entities or complete asset instances.`)
19
22
  if (!Array.isArray(request.assetInstanceIds) || request.assetInstanceIds.some(x => !request.entityIds.includes(x)) ||
20
23
  new Set(request.assetInstanceIds).size !== request.assetInstanceIds.length) invalid('assetInstanceIds must name distinct selected asset roots.')
21
24
  if (!id(request.cameraId) || !id(request.fittedCameraId) || request.cameraId === request.fittedCameraId) invalid('select a source camera and a distinct new camera ID.')
22
25
  if (!integer(request.frame, 0, 1_000_000) || !Number.isFinite(request.margin) || request.margin < 0 || request.margin > .25 || !hash(request.checkpointSha256)) invalid('an explicit frame, margin from 0 to 0.25 and pinned checkpoint are required.')
23
26
  const baseline = request.baselineCheckpointPath !== undefined || request.baselineCheckpointSha256 !== undefined
24
27
  if (baseline && (typeof request.baselineCheckpointPath !== 'string' || !request.baselineCheckpointPath || !hash(request.baselineCheckpointSha256))) invalid('candidate verification requires both the baseline checkpoint path and SHA256.')
28
+ if (baseline && request.photography !== undefined) invalid('photography sampling requires a saved source, not a fitted candidate.')
25
29
  }
26
30
 
27
31
  function optics(v) {
@@ -36,12 +40,13 @@ export function verifyCameraFitReport(report, request) {
36
40
  validateCameraFitSelection(request)
37
41
  const candidate = request.baselineCheckpointPath !== undefined
38
42
  if (!only(report, ['schemaVersion', 'entityIds', 'assetInstanceIds', 'frame', 'cameraId', 'fittedCameraId', 'margin',
39
- 'checkpointSha256', 'checkpointUnchanged', 'blenderVersion', 'members', 'view', 'camera', candidate ? 'baselineVerification' : 'proposal']) ||
43
+ 'checkpointSha256', 'checkpointUnchanged', 'blenderVersion', 'members', 'view', 'camera', candidate ? 'baselineVerification' : 'proposal', ...(request.photography === undefined ? [] : ['photography'])]) ||
40
44
  Buffer.byteLength(JSON.stringify(report)) > CAMERA_FIT_LIMITS.reportBytes || report.schemaVersion !== CAMERA_FIT_VERSION ||
41
45
  !same(report.entityIds, request.entityIds) || !same(report.assetInstanceIds, request.assetInstanceIds) ||
42
46
  report.frame !== request.frame || report.cameraId !== request.cameraId || report.fittedCameraId !== request.fittedCameraId ||
43
47
  report.margin !== request.margin || report.checkpointSha256 !== request.checkpointSha256 || report.checkpointUnchanged !== true ||
44
48
  typeof report.blenderVersion !== 'string' || !report.blenderVersion || !Array.isArray(report.members) || report.members.length !== request.entityIds.length) fail('the native report differs from the selected frame, source or complete selection.')
49
+ if (request.photography !== undefined) verifyPhotographySnapshot(report.photography, request.photography)
45
50
  const view = report.view, camera = report.camera
46
51
  if (!only(view, ['resolution', 'percentage', 'pixelAspect', 'activeCamera']) ||
47
52
  !(view.activeCamera === null || typeof view.activeCamera === 'string') || !vector(view.resolution, 2) ||
@@ -0,0 +1,32 @@
1
+ import { BlenderError, BlenderErrorCode } from './index.js'
2
+
3
+ export const PHOTOGRAPHY_SNAPSHOT_LIMITS = Object.freeze({ entities: 128, lights: 32 })
4
+
5
+ const only = (v, keys) => v && typeof v === 'object' && !Array.isArray(v) && Object.keys(v).every(k => keys.includes(k))
6
+ const vector = v => Array.isArray(v) && v.length === 3 && v.every(Number.isFinite)
7
+ const fail = message => { throw new BlenderError(BlenderErrorCode.SCENE_VALIDATION_FAILED, `Photography snapshot: ${message}`) }
8
+
9
+ export function validatePhotographySnapshot(selection) {
10
+ if (!only(selection, ['lightIds', 'cameraMustBeStatic']) || typeof selection.cameraMustBeStatic !== 'boolean'
11
+ || !Array.isArray(selection.lightIds) || selection.lightIds.length > PHOTOGRAPHY_SNAPSHOT_LIMITS.lights || new Set(selection.lightIds).size !== selection.lightIds.length
12
+ || selection.lightIds.some(id => typeof id !== 'string' || !/^[A-Za-z][A-Za-z0-9._-]{0,127}$/.test(id))) fail('choose at most 32 distinct named lights and an explicit camera-static requirement.')
13
+ }
14
+
15
+ export function verifyPhotographySnapshot(snapshot, selection) {
16
+ validatePhotographySnapshot(selection)
17
+ if (!only(snapshot, ['schemaVersion', 'staticGeometry', 'staticLights', 'cameraStatic', 'cameraRotationEuler', 'lights'])
18
+ || snapshot.schemaVersion !== 'deepblend.photography-snapshot/v1' || snapshot.staticGeometry !== true || snapshot.staticLights !== true
19
+ || typeof snapshot.cameraStatic !== 'boolean' || selection.cameraMustBeStatic && snapshot.cameraStatic !== true
20
+ || !vector(snapshot.cameraRotationEuler) || !Array.isArray(snapshot.lights) || snapshot.lights.length !== selection.lightIds.length) fail('the runtime did not verify the requested static product and lighting snapshot.')
21
+ for (const [index, light] of snapshot.lights.entries()) {
22
+ const sun = light.type === 'sun', spot = light.type === 'spot'
23
+ if (!only(light, ['id', 'type', 'energy', 'color', 'transform', ...(sun ? ['angle'] : ['size']), ...(spot ? ['spotSize', 'spotBlend'] : [])])
24
+ || light.id !== selection.lightIds[index] || !['area', 'point', 'spot', 'sun'].includes(light.type)
25
+ || !Number.isFinite(light.energy) || light.energy < 0 || !vector(light.color) || light.color.some(c => c < 0 || c > 1)
26
+ || !only(light.transform, ['location', 'rotationEuler', 'scale']) || !vector(light.transform.location)
27
+ || !vector(light.transform.rotationEuler) || !vector(light.transform.scale) || light.transform.scale.some(s => s <= 0)
28
+ || (sun ? !Number.isFinite(light.angle) || light.angle < 0 || light.angle > Math.PI : !Number.isFinite(light.size) || light.size <= 0)
29
+ || spot && (!Number.isFinite(light.spotSize) || light.spotSize <= 0 || light.spotSize > Math.PI || !Number.isFinite(light.spotBlend) || light.spotBlend < 0 || light.spotBlend > 1)) fail('a sampled light differs from the requested identity or supported native settings.')
30
+ }
31
+ return snapshot
32
+ }
@@ -90,6 +90,16 @@ export interface CompileSceneRequest extends RuntimeOptions {
90
90
  /** Copy or move result.blend before resolving; never retain a scratch path as a durable artifact. */
91
91
  onWorkingDirectory?: WorkingDirectoryCallback<CompileReport>;
92
92
  }
93
+ export interface HalfLapInspectionReport extends CompileReport {
94
+ outputBlend: null;
95
+ halfLapInspection: {
96
+ schemaVersion: 'deepblend.half-lap-inspection/v1'; crossings: number; partialCrossings: number; sample: 'partial' | 'full';
97
+ };
98
+ }
99
+ export interface HalfLapInspectionRequest extends Omit<CompileSceneRequest, 'cameraFraming' | 'session' | 'onWorkingDirectory'> {
100
+ joint: { lowerEntityId: string; upperEntityId: string };
101
+ onWorkingDirectory: WorkingDirectoryCallback<HalfLapInspectionReport>;
102
+ }
93
103
  export interface RenderOverrides { engine?: EngineKey; width?: number; height?: number; samples?: number }
94
104
  /** Default world-axis bounds; optional physical object axes include native scale. Neither certifies semantic body dimensions or wall thickness. */
95
105
  export interface GeometryInspectionRequest extends RuntimeOptions {
@@ -116,6 +126,7 @@ export interface GeometryInspectionReport {
116
126
  export type CameraFitRequest = RuntimeOptions & {
117
127
  checkpointPath: string; checkpointSha256: string; entityIds: string[]; assetInstanceIds: string[];
118
128
  frame: number; cameraId: string; fittedCameraId: string; margin: number; jobId?: string;
129
+ photography?: { lightIds: string[]; cameraMustBeStatic: boolean };
119
130
  } & ({ baselineCheckpointPath: string; baselineCheckpointSha256: string }
120
131
  | { baselineCheckpointPath?: never; baselineCheckpointSha256?: never });
121
132
  export interface CameraFitMember {
@@ -133,6 +144,8 @@ export interface CameraFitReport {
133
144
  shift: [number, number]; clipping: [number, number]; fStop?: number; matrixWorld: number[][];
134
145
  focusDistance: number; focusObject: string | null };
135
146
  proposal?: import('./schema-types.js').Camera;
147
+ photography?: { schemaVersion: 'deepblend.photography-snapshot/v1'; staticGeometry: true; staticLights: true;
148
+ cameraStatic: boolean; cameraRotationEuler: Vec3; lights: import('./schema-types.js').Light[] };
136
149
  baselineVerification?: { checkpointSha256: string; checkpointUnchanged: true; selectedGeometryUnchanged: true;
137
150
  originalObjectsUnchanged: true; opticsAndRotationPreserved: true; maxVertexErrorMeters: number;
138
151
  toleranceMeters: number; originalObjectCount: number };
@@ -231,6 +244,8 @@ export interface FrameSequenceHandle {
231
244
  export interface FrameSequenceRequest extends RuntimeOptions {
232
245
  checkpointPath: string; frames: number[]; jobDirectory: string; cameraId?: string; profileName?: string;
233
246
  profile?: RenderProfile; frameRange?: [number, number]; jobId?: string; attemptToken?: string;
247
+ motionFrameAudit?: { entityIds: string[]; assetInstanceIds: string[] };
248
+ motionFrameAuditOnly?: boolean;
234
249
  filePrefix?: string; padding?: number;
235
250
  }
236
251
  export interface ShotCameraSelection {
@@ -291,6 +306,8 @@ export interface BlenderRuntime {
291
306
  invalidateCapabilities(): void;
292
307
  resolveEngineKey(engineKey: EngineKey, options?: RuntimeOptions): Promise<EngineResolution>;
293
308
  compileScene(request: CompileSceneRequest): Promise<RuntimeActionResult<CompileReport>>;
309
+ /** Optional draft inspection. Two PNGs are available to the working-directory callback. */
310
+ compileHalfLapInspection?(request: HalfLapInspectionRequest): Promise<RuntimeActionResult<HalfLapInspectionReport>>;
294
311
  renderPreview(request: RenderPreviewRequest): Promise<RuntimeActionResult<PreviewReport>>;
295
312
  renderViews(request: RenderViewsRequest): Promise<RenderViewsResult>;
296
313
  startFrameSequence(request: FrameSequenceRequest): Promise<FrameSequenceRun>;
@@ -71,6 +71,8 @@ export const SCENE_OPERATION_NAMES = Object.freeze([
71
71
  'project.brief.set',
72
72
  'project.reviewSubject.set',
73
73
  'entity.uv.project',
74
+ 'project.aspectRatio.set',
75
+ 'joint.halfLap.set',
74
76
  ])
75
77
 
76
78
  /** The `id` grammar shared with SceneSpec. */const ID_PATTERN = /^[a-zA-Z][a-zA-Z0-9._-]*$/
@@ -147,6 +149,10 @@ export function validateScenePatch(patch) {
147
149
  }
148
150
  }
149
151
 
152
+ if (op === 'joint.halfLap.set' && operation.lowerEntityId === operation.upperEntityId) {
153
+ errors.push({ code: 'PATCH_OPERATION_INVALID', path: at, message: 'a half lap needs two distinct timber groups' })
154
+ }
155
+
150
156
  if (op === 'entity.transform.update') {
151
157
  const supplied = ['location', 'rotationEuler', 'scale'].filter(key => operation[key] !== undefined)
152
158
  if (supplied.length === 0) {
@@ -547,6 +553,9 @@ export function applyPatchToSpec(spec, patch) {
547
553
  }
548
554
  const dependents = []
549
555
  if (next.project.reviewSubjectId === operation.entityId) dependents.push('review subject')
556
+ if (next.halfLaps?.some(joint => [joint.lowerEntityId, joint.upperEntityId].includes(operation.entityId))) {
557
+ dependents.push('half lap')
558
+ }
550
559
  if (next.entities.some(entity => (entity.modifiers ?? []).some(modifier =>
551
560
  modifier.type === 'boolean' && modifier.targetEntityId === operation.entityId))) {
552
561
  dependents.push('boolean operand')
@@ -955,6 +964,42 @@ export function applyPatchToSpec(spec, patch) {
955
964
  break
956
965
  }
957
966
 
967
+ case 'joint.halfLap.set': {
968
+ const { lowerEntityId, upperEntityId, enabled = true } = operation
969
+ const ids = [lowerEntityId, upperEntityId]
970
+ if (lowerEntityId === upperEntityId) fail('PATCH_OPERATION_INVALID', 'a half lap needs two distinct timber groups')
971
+ const joints = next.halfLaps ?? []
972
+ const found = joints.find(joint => ids.includes(joint.lowerEntityId) && ids.includes(joint.upperEntityId))
973
+ if (enabled) {
974
+ for (const id of ids) {
975
+ if (indexOfId(next.entities, id) < 0) fail('PATCH_TARGET_MISSING', `no entity "${id}" exists in this scene`)
976
+ }
977
+ if (joints.some(joint => joint !== found && (ids.includes(joint.lowerEntityId) || ids.includes(joint.upperEntityId)))) {
978
+ fail('PATCH_TARGET_IN_USE', 'a timber group already belongs to a different half lap; remove that joint first')
979
+ }
980
+ }
981
+ const changed = enabled ? found?.lowerEntityId !== lowerEntityId : found !== undefined
982
+ if (changed) {
983
+ const remaining = joints.filter(joint => joint !== found)
984
+ if (enabled) remaining.push({ lowerEntityId, upperEntityId })
985
+ if (remaining.length) next.halfLaps = remaining.sort((a, b) => a.lowerEntityId.localeCompare(b.lowerEntityId))
986
+ else delete next.halfLaps
987
+ }
988
+ applied.push({
989
+ op, target: lowerEntityId,
990
+ summary: `${enabled ? 'set' : 'removed'} half lap between "${lowerEntityId}" and "${upperEntityId}"`,
991
+ changedPaths: changed ? ['halfLaps'] : [],
992
+ })
993
+ break
994
+ }
995
+
996
+ case 'project.aspectRatio.set': {
997
+ next.project = { ...next.project, aspectRatio: operation.aspectRatio }
998
+ applied.push({ op, target: next.project.id, summary: `set the project aspect ratio to ${operation.aspectRatio}`,
999
+ changedPaths: ['project.aspectRatio'] })
1000
+ break
1001
+ }
1002
+
958
1003
  case 'render.profile.set': {
959
1004
  const existing = next.renderProfiles[operation.profileName]
960
1005
  // A render profile is a COST DECLARATION, and `resolution` is the part of
package/lib/scene-spec.js CHANGED
@@ -34,6 +34,7 @@ export const BOX_DIMENSIONS_FEATURE = 'geometry.primitive.dimensions'
34
34
  export const MESH_GEOMETRY_FEATURE = 'geometry.procedural.mesh'
35
35
  export const SUBDIVISION_FEATURE = 'geometry.modifier.subdivision'
36
36
  export const SURFACE_SCATTER_FEATURE = 'geometry.modifier.surface_scatter'
37
+ export const HALF_LAP_FEATURE = 'geometry.joinery.half_lap'
37
38
 
38
39
  /** Features whose absence must refuse compilation rather than reinterpret the scene. */
39
40
  export function requiredSceneFeatures(spec) {
@@ -42,6 +43,7 @@ export function requiredSceneFeatures(spec) {
42
43
  if (entities.some(entity => entity.type === 'generator' && entity.generator?.shape === 'mesh')) features.push(MESH_GEOMETRY_FEATURE)
43
44
  if (entities.some(entity => entity.modifiers?.some(modifier => modifier.type === 'subdivision'))) features.push(SUBDIVISION_FEATURE)
44
45
  if (entities.some(entity => entity.modifiers?.some(modifier => modifier.type === 'surface_scatter'))) features.push(SURFACE_SCATTER_FEATURE)
46
+ if (spec.halfLaps?.length) features.push(HALF_LAP_FEATURE)
45
47
  return features
46
48
  }
47
49
 
@@ -516,6 +518,31 @@ export function validateSceneSpec(spec) {
516
518
  }
517
519
  for (const id of modifierEntities.keys()) visitModifiers(id)
518
520
 
521
+ const joinedEntities = new Set()
522
+ const movingEntities = new Set((document.animationTracks ?? []).filter(track =>
523
+ (track.targetKind ?? 'entity') === 'entity' && ['location', 'rotationEuler', 'scale'].includes(track.property.split('.')[0]),
524
+ ).map(track => track.targetEntityId))
525
+ for (const [index, joint] of (document.halfLaps ?? []).entries()) {
526
+ for (const field of ['lowerEntityId', 'upperEntityId']) {
527
+ const id = joint[field], path = `halfLaps[${index}].${field}`
528
+ requiresId('entities', id, path, 'half-lap timber group')
529
+ const timber = modifierEntities.get(id)
530
+ if (joinedEntities.has(id)) {
531
+ errors.push({ severity: 'error', code: 'SCENE_HALF_LAP_INVALID', path,
532
+ message: 'a timber group must be distinct and can belong to only one half lap' })
533
+ }
534
+ joinedEntities.add(id)
535
+ if (timber && (timber.type !== 'generator' || timber.generator?.shape !== 'mesh' ||
536
+ timber.generator.vertices.length !== 8 || timber.generator.faces.length !== 6 ||
537
+ timber.modifiers?.some(modifier => !['array', 'mirror'].includes(modifier.type)) ||
538
+ timber.transform?.scale?.some(value => value <= 0) || movingEntities.has(id) ||
539
+ ['armatureId', 'rigidBody', 'cloth', 'softBody', 'fluid'].some(key => timber[key] != null))) {
540
+ errors.push({ severity: 'error', code: 'SCENE_HALF_LAP_INVALID', path,
541
+ message: 'half laps require static box control meshes with positive scales and optional array or mirror modifiers' })
542
+ }
543
+ }
544
+ }
545
+
519
546
  ;(document.lights ?? []).forEach((light, position) => {
520
547
  checkScale(light.transform?.scale, `lights[${position}].transform.scale`, errors, light.id)
521
548
  })
@@ -1013,6 +1040,7 @@ export function sceneProjection(spec) {
1013
1040
  shots: spec.shots ?? [],
1014
1041
  animationTracks: spec.animationTracks ?? [],
1015
1042
  renderProfiles: spec.renderProfiles ?? {},
1043
+ ...(spec.halfLaps?.length ? { halfLaps: spec.halfLaps } : {}),
1016
1044
  // ABSENCE IS PRESERVED, for the same reason `applyPatchToSpec` preserves it: a
1017
1045
  // scene that never mentions a world must keep the digest it was recorded with.
1018
1046
  // `world: spec.world ?? null` here would silently re-digest every revision in
@@ -1134,6 +1162,7 @@ export function summarizeSceneSpec(document, context = {}) {
1134
1162
  // against the manifest and conclude the revision was corrupt.
1135
1163
  digest: context.digest ?? sceneSpecDigest(document),
1136
1164
  schemaVersion: spec.schemaVersion,
1165
+ ...(spec.halfLaps?.length ? { halfLaps: structuredClone(spec.halfLaps) } : {}),
1137
1166
  project: {
1138
1167
  id: spec.project.id,
1139
1168
  title: spec.project.title,
@@ -1,7 +1,7 @@
1
1
  /** Generated by deepblend/tools/generate-sdk-types.mjs. Do not edit.
2
2
  * Types describe JSON shape. Numeric bounds, ID grammar and references still require validation. */
3
3
 
4
- /** Source SHA-256: a2bc3f59a2694da379aad5132d38052dfe98d2b690a5e7bf181b4b7d7bfb1d82 */
4
+ /** Source SHA-256: 26178d840f13b9f4d65f071e8edea665635aed11a0a8b52c136d0e34827340f7 */
5
5
  export namespace SceneSpecSchema {
6
6
  export type Id = string;
7
7
  export type World = { "color"?: SceneSpecSchema.UnitColor; "strength"?: number; "environment"?: { "assetId": SceneSpecSchema.Id; "rotation"?: number; }; };
@@ -38,11 +38,11 @@ export namespace SceneSpecSchema {
38
38
  export type MaterialTangent = ({ "mode": "uv"; "uvMap": string; }) | ({ "mode": "radial"; "axis": "x" | "y" | "z"; });
39
39
  export type ReferenceImage = { "id": SceneSpecSchema.Id; "assetId": SceneSpecSchema.Id; "sha256": string; "label": string; "purposes": Array<"geometry" | "materials" | "lighting" | "goalFit">; "notes"?: string; };
40
40
  export type ReferenceImages = Array<SceneSpecSchema.ReferenceImage>;
41
- export type Document = { "schemaVersion": "deepblend.scene/v1"; "project": SceneSpecSchema.Project; "assets"?: Array<SceneSpecSchema.Asset>; "armatures"?: Array<SceneSpecSchema.Armature>; "simulation"?: { "gravity"?: number; "bake"?: boolean; }; "materials"?: Array<SceneSpecSchema.Material>; "entities": Array<SceneSpecSchema.Entity>; "lights"?: Array<SceneSpecSchema.Light>; "cameras": Array<SceneSpecSchema.Camera>; "shots"?: Array<SceneSpecSchema.Shot>; "animationTracks"?: Array<SceneSpecSchema.AnimationTrack>; "renderProfiles": SceneSpecSchema.RenderProfiles; "world"?: SceneSpecSchema.World; };
41
+ export type Document = { "schemaVersion": "deepblend.scene/v1"; "project": SceneSpecSchema.Project; "halfLaps"?: Array<{ "lowerEntityId": SceneSpecSchema.Id; "upperEntityId": SceneSpecSchema.Id; }>; "assets"?: Array<SceneSpecSchema.Asset>; "armatures"?: Array<SceneSpecSchema.Armature>; "simulation"?: { "gravity"?: number; "bake"?: boolean; }; "materials"?: Array<SceneSpecSchema.Material>; "entities": Array<SceneSpecSchema.Entity>; "lights"?: Array<SceneSpecSchema.Light>; "cameras": Array<SceneSpecSchema.Camera>; "shots"?: Array<SceneSpecSchema.Shot>; "animationTracks"?: Array<SceneSpecSchema.AnimationTrack>; "renderProfiles": SceneSpecSchema.RenderProfiles; "world"?: SceneSpecSchema.World; };
42
42
  }
43
43
  export type SceneSpec = SceneSpecSchema.Document;
44
44
 
45
- /** Source SHA-256: d2bb4d3c1d1cb8d288d29f94d3458008fe31e0ffed8cd66e1f9936a6fcf593b0 */
45
+ /** Source SHA-256: 65d39eeb5a9825ac1b846063db6159b45164a0223e9a613b223b0757e3583f82 */
46
46
  export namespace ScenePatchSchema {
47
47
  export type Id = string;
48
48
  export type License = { "source"?: string; "commercialUse"?: boolean; "attribution"?: string; };
@@ -60,7 +60,7 @@ export namespace ScenePatchSchema {
60
60
  export type Camera = { "id": ScenePatchSchema.Id; "role"?: "active-camera" | "three-quarter" | "top" | "detail"; "lens"?: ScenePatchSchema.PositiveNumber; "sensorWidth"?: ScenePatchSchema.PositiveNumber; "clipping"?: [ScenePatchSchema.PositiveNumber, ScenePatchSchema.PositiveNumber]; "transform"?: { "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }; "targetEntityId"?: string; "targetPoint"?: ScenePatchSchema.Vec3; "fStop"?: ScenePatchSchema.PositiveNumber; "sensorHeight"?: ScenePatchSchema.PositiveNumber; "sensorFit"?: "AUTO" | "HORIZONTAL" | "VERTICAL"; "shift"?: [number, number]; "focusDistance"?: ScenePatchSchema.PositiveNumber; };
61
61
  export type AnimationTrack = { "id": ScenePatchSchema.Id; "targetKind"?: "entity" | "camera" | "material"; "targetEntityId": string; "property": "location.x" | "location.y" | "location.z" | "rotationEuler.x" | "rotationEuler.y" | "rotationEuler.z" | "scale.x" | "scale.y" | "scale.z" | "emissionStrength" | "roughness" | "metallic" | "ior" | "alpha" | "coatWeight" | "transmissionWeight" | "baseColor.r" | "baseColor.g" | "baseColor.b" | "emissionColor.r" | "emissionColor.g" | "emissionColor.b" | "anisotropic" | "anisotropicRotation"; "keyframes": Array<{ "frame": number; "value": number; "interpolation"?: "constant" | "linear" | "bezier" | "ease_in" | "ease_out" | "ease_in_out"; }>; };
62
62
  export type RenderProfile = { "engine"?: "eevee" | "cycles" | "workbench"; "resolution"?: [number, number]; "samples"?: number; "filmTransparent"?: boolean; "colorManagement"?: { "viewTransform"?: "Standard" | "AgX" | "Filmic" | "False Color" | "Raw"; "look"?: string; "exposure"?: number; }; "maxSamplesBudget"?: number; "raytracing"?: boolean; };
63
- export type Operation = ({ "op": "entity.transform.update"; "entityId": ScenePatchSchema.Id; "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }) | ({ "op": "entity.visibility.set"; "entityId": ScenePatchSchema.Id; "visible": boolean; }) | ({ "op": "entity.tags.set"; "entityId": ScenePatchSchema.Id; "tags": Array<string>; }) | ({ "op": "entity.add"; "entity": ScenePatchSchema.Entity; }) | ({ "op": "entity.remove"; "entityId": ScenePatchSchema.Id; }) | ({ "op": "entity.material.set"; "entityId": ScenePatchSchema.Id; "materialId": string | null; }) | ({ "op": "material.texture.set"; "materialId": ScenePatchSchema.Id; "texture": (ScenePatchSchema.ProceduralTexture) | (null); }) | ({ "op": "material.add"; "material": { "id": ScenePatchSchema.Id; "shader": "principled" | "emission" | "glass"; "parameters"?: ScenePatchSchema.MaterialParameters; "texture"?: ScenePatchSchema.ProceduralTexture; "images"?: ScenePatchSchema.MaterialImages; "tangent"?: ScenePatchSchema.MaterialTangent; }; }) | ({ "op": "material.parameter.update"; "materialId": ScenePatchSchema.Id; "parameter": "baseColor" | "metallic" | "roughness" | "ior" | "alpha" | "emissionColor" | "emissionStrength" | "coatWeight" | "transmissionWeight" | "anisotropic" | "anisotropicRotation"; "value": (number) | (ScenePatchSchema.UnitColor); }) | ({ "op": "light.add"; "light": ScenePatchSchema.Light; }) | ({ "op": "light.update"; "lightId": ScenePatchSchema.Id; "transform"?: { "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }; "energy"?: ScenePatchSchema.NonNegativeNumber; "color"?: ScenePatchSchema.UnitColor; "size"?: ScenePatchSchema.PositiveNumber; "spotSize"?: number; "spotBlend"?: number; "angle"?: number; }) | ({ "op": "light.remove"; "lightId": ScenePatchSchema.Id; }) | ({ "op": "camera.add"; "camera": ScenePatchSchema.Camera; }) | ({ "op": "camera.update"; "cameraId": ScenePatchSchema.Id; "role"?: "active-camera" | "three-quarter" | "top" | "detail"; "lens"?: ScenePatchSchema.PositiveNumber; "sensorWidth"?: ScenePatchSchema.PositiveNumber; "clipping"?: [ScenePatchSchema.PositiveNumber, ScenePatchSchema.PositiveNumber]; "transform"?: { "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }; "targetEntityId"?: string; "targetPoint"?: ScenePatchSchema.Vec3; "fStop"?: ScenePatchSchema.PositiveNumber; "clearTarget"?: true; "sensorHeight"?: ScenePatchSchema.PositiveNumber; "sensorFit"?: "AUTO" | "HORIZONTAL" | "VERTICAL"; "shift"?: [number, number]; "focusDistance"?: ScenePatchSchema.PositiveNumber; }) | ({ "op": "camera.remove"; "cameraId": ScenePatchSchema.Id; }) | ({ "op": "animation.track.set"; "track": ScenePatchSchema.AnimationTrack; }) | ({ "op": "animation.track.remove"; "trackId": ScenePatchSchema.Id; }) | ({ "op": "shot.set"; "shot": { "id": ScenePatchSchema.Id; "cameraId": string; "frameRange"?: [number, number]; "description"?: string; }; }) | ({ "op": "shot.remove"; "shotId": ScenePatchSchema.Id; }) | ({ "op": "project.frameRange.set"; "frameStart": number; "frameEnd": number; "fps"?: number; }) | ({ "op": "render.profile.set"; "profileName": "preview" | "final"; "profile": ScenePatchSchema.RenderProfile; }) | ({ "op": "world.set"; "world": ScenePatchSchema.World; }) | ({ "op": "asset.add"; "asset": { "id": ScenePatchSchema.Id; "type": "glb" | "gltf" | "fbx" | "obj" | "usd" | "blend" | "png" | "jpg" | "jpeg" | "hdr" | "exr"; "path": string; "sha256"?: string; "license"?: ScenePatchSchema.License; }; }) | ({ "op": "asset.remove"; "assetId": ScenePatchSchema.Id; }) | ({ "op": "entity.generator.set"; "entityId": ScenePatchSchema.Id; "generator": ScenePatchSchema.Generator; }) | ({ "op": "entity.modifiers.set"; "entityId": ScenePatchSchema.Id; "modifiers": Array<ScenePatchSchema.ModelModifier>; }) | ({ "op": "material.images.set"; "materialId": ScenePatchSchema.Id; "images": (ScenePatchSchema.MaterialImages) | (null); }) | ({ "op": "entity.materialBindings.set"; "entityId": ScenePatchSchema.Id; "materialBindings": ScenePatchSchema.MaterialBindings; }) | ({ "op": "material.tangent.set"; "materialId": ScenePatchSchema.Id; "tangent": (ScenePatchSchema.MaterialTangent) | (null); }) | ({ "op": "project.brief.set"; "goal": string; "referenceImages": ScenePatchSchema.ReferenceImages; }) | ({ "op": "project.reviewSubject.set"; "entityId": (ScenePatchSchema.Id) | (null); }) | ({ "op": "entity.uv.project"; "entityId": ScenePatchSchema.Id; "quarterTurns"?: number; "scale"?: number; });
63
+ export type Operation = ({ "op": "entity.transform.update"; "entityId": ScenePatchSchema.Id; "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }) | ({ "op": "entity.visibility.set"; "entityId": ScenePatchSchema.Id; "visible": boolean; }) | ({ "op": "entity.tags.set"; "entityId": ScenePatchSchema.Id; "tags": Array<string>; }) | ({ "op": "entity.add"; "entity": ScenePatchSchema.Entity; }) | ({ "op": "entity.remove"; "entityId": ScenePatchSchema.Id; }) | ({ "op": "entity.material.set"; "entityId": ScenePatchSchema.Id; "materialId": string | null; }) | ({ "op": "material.texture.set"; "materialId": ScenePatchSchema.Id; "texture": (ScenePatchSchema.ProceduralTexture) | (null); }) | ({ "op": "material.add"; "material": { "id": ScenePatchSchema.Id; "shader": "principled" | "emission" | "glass"; "parameters"?: ScenePatchSchema.MaterialParameters; "texture"?: ScenePatchSchema.ProceduralTexture; "images"?: ScenePatchSchema.MaterialImages; "tangent"?: ScenePatchSchema.MaterialTangent; }; }) | ({ "op": "material.parameter.update"; "materialId": ScenePatchSchema.Id; "parameter": "baseColor" | "metallic" | "roughness" | "ior" | "alpha" | "emissionColor" | "emissionStrength" | "coatWeight" | "transmissionWeight" | "anisotropic" | "anisotropicRotation"; "value": (number) | (ScenePatchSchema.UnitColor); }) | ({ "op": "light.add"; "light": ScenePatchSchema.Light; }) | ({ "op": "light.update"; "lightId": ScenePatchSchema.Id; "transform"?: { "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }; "energy"?: ScenePatchSchema.NonNegativeNumber; "color"?: ScenePatchSchema.UnitColor; "size"?: ScenePatchSchema.PositiveNumber; "spotSize"?: number; "spotBlend"?: number; "angle"?: number; }) | ({ "op": "light.remove"; "lightId": ScenePatchSchema.Id; }) | ({ "op": "camera.add"; "camera": ScenePatchSchema.Camera; }) | ({ "op": "camera.update"; "cameraId": ScenePatchSchema.Id; "role"?: "active-camera" | "three-quarter" | "top" | "detail"; "lens"?: ScenePatchSchema.PositiveNumber; "sensorWidth"?: ScenePatchSchema.PositiveNumber; "clipping"?: [ScenePatchSchema.PositiveNumber, ScenePatchSchema.PositiveNumber]; "transform"?: { "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }; "targetEntityId"?: string; "targetPoint"?: ScenePatchSchema.Vec3; "fStop"?: ScenePatchSchema.PositiveNumber; "clearTarget"?: true; "sensorHeight"?: ScenePatchSchema.PositiveNumber; "sensorFit"?: "AUTO" | "HORIZONTAL" | "VERTICAL"; "shift"?: [number, number]; "focusDistance"?: ScenePatchSchema.PositiveNumber; }) | ({ "op": "camera.remove"; "cameraId": ScenePatchSchema.Id; }) | ({ "op": "animation.track.set"; "track": ScenePatchSchema.AnimationTrack; }) | ({ "op": "animation.track.remove"; "trackId": ScenePatchSchema.Id; }) | ({ "op": "shot.set"; "shot": { "id": ScenePatchSchema.Id; "cameraId": string; "frameRange"?: [number, number]; "description"?: string; }; }) | ({ "op": "shot.remove"; "shotId": ScenePatchSchema.Id; }) | ({ "op": "project.frameRange.set"; "frameStart": number; "frameEnd": number; "fps"?: number; }) | ({ "op": "render.profile.set"; "profileName": "preview" | "final"; "profile": ScenePatchSchema.RenderProfile; }) | ({ "op": "world.set"; "world": ScenePatchSchema.World; }) | ({ "op": "asset.add"; "asset": { "id": ScenePatchSchema.Id; "type": "glb" | "gltf" | "fbx" | "obj" | "usd" | "blend" | "png" | "jpg" | "jpeg" | "hdr" | "exr"; "path": string; "sha256"?: string; "license"?: ScenePatchSchema.License; }; }) | ({ "op": "asset.remove"; "assetId": ScenePatchSchema.Id; }) | ({ "op": "entity.generator.set"; "entityId": ScenePatchSchema.Id; "generator": ScenePatchSchema.Generator; }) | ({ "op": "entity.modifiers.set"; "entityId": ScenePatchSchema.Id; "modifiers": Array<ScenePatchSchema.ModelModifier>; }) | ({ "op": "material.images.set"; "materialId": ScenePatchSchema.Id; "images": (ScenePatchSchema.MaterialImages) | (null); }) | ({ "op": "entity.materialBindings.set"; "entityId": ScenePatchSchema.Id; "materialBindings": ScenePatchSchema.MaterialBindings; }) | ({ "op": "material.tangent.set"; "materialId": ScenePatchSchema.Id; "tangent": (ScenePatchSchema.MaterialTangent) | (null); }) | ({ "op": "project.brief.set"; "goal": string; "referenceImages": ScenePatchSchema.ReferenceImages; }) | ({ "op": "project.reviewSubject.set"; "entityId": (ScenePatchSchema.Id) | (null); }) | ({ "op": "entity.uv.project"; "entityId": ScenePatchSchema.Id; "quarterTurns"?: number; "scale"?: number; }) | ({ "op": "project.aspectRatio.set"; "aspectRatio": string; }) | ({ "op": "joint.halfLap.set"; "lowerEntityId": ScenePatchSchema.Id; "upperEntityId": ScenePatchSchema.Id; "enabled"?: boolean; });
64
64
  export type ModelModifier = ({ "type": "solidify"; "thickness": number; "offset"?: number; }) | ({ "type": "mirror"; "axis": "x" | "y" | "z"; "merge"?: boolean; }) | ({ "type": "array"; "count": number; "offset": ScenePatchSchema.Vec3; }) | ({ "type": "boolean"; "operation": "union" | "difference" | "intersect"; "targetEntityId": ScenePatchSchema.Id; }) | ({ "type": "bevel"; "width": number; "segments"?: number; "angle"?: number; "miterInner"?: "arc" | "sharp"; }) | ({ "type": "subdivision"; "levels": number; "scheme"?: "catmull-clark" | "simple"; "boundaryMode"?: "all" | "preserve-corners"; }) | ({ "type": "surface_scatter"; "targetEntityIds": Array<ScenePatchSchema.Id>; "count": number; "seed"?: number; "anchorVertexIndices": Array<number>; "embedDepthMm"?: number; "scaleRange"?: [number, number]; "upwardBias"?: number; });
65
65
  export type ImageBinding = { "assetId": ScenePatchSchema.Id; "scale"?: ScenePatchSchema.Vec3; "offset"?: ScenePatchSchema.Vec3; "uvMap"?: string; "channel"?: "r" | "g" | "b" | "a"; "strength"?: number; };
66
66
  export type MaterialImages = { "baseColor"?: ScenePatchSchema.ImageBinding; "roughness"?: ScenePatchSchema.ImageBinding; "metallic"?: ScenePatchSchema.ImageBinding; "normal"?: ScenePatchSchema.ImageBinding; "alpha"?: ScenePatchSchema.ImageBinding; "emissionColor"?: ScenePatchSchema.ImageBinding; };
@@ -1855,6 +1855,40 @@
1855
1855
  "description": "UV repetitions per longest local mesh extent; default 1. Larger values repeat the texture more often. Islands overlap and are not packed."
1856
1856
  }
1857
1857
  }
1858
+ },
1859
+ {
1860
+ "type": "object",
1861
+ "additionalProperties": false,
1862
+ "required": ["op", "aspectRatio"],
1863
+ "properties": {
1864
+ "op": { "const": "project.aspectRatio.set" },
1865
+ "aspectRatio": { "type": "string", "pattern": "^[0-9]+:[0-9]+$" }
1866
+ }
1867
+ },
1868
+ {
1869
+ "type": "object",
1870
+ "additionalProperties": false,
1871
+ "required": [
1872
+ "op",
1873
+ "lowerEntityId",
1874
+ "upperEntityId"
1875
+ ],
1876
+ "properties": {
1877
+ "op": {
1878
+ "const": "joint.halfLap.set"
1879
+ },
1880
+ "lowerEntityId": {
1881
+ "$ref": "#/$defs/id"
1882
+ },
1883
+ "upperEntityId": {
1884
+ "$ref": "#/$defs/id"
1885
+ },
1886
+ "enabled": {
1887
+ "type": "boolean",
1888
+ "default": true,
1889
+ "description": "False removes the joint and restores the compiled timber groups."
1890
+ }
1891
+ }
1858
1892
  }
1859
1893
  ]
1860
1894
  },
@@ -20,6 +20,27 @@
20
20
  "project": {
21
21
  "$ref": "#/$defs/project"
22
22
  },
23
+ "halfLaps": {
24
+ "type": "array",
25
+ "maxItems": 32,
26
+ "description": "Complementary half-depth joints between static rectangular timber groups.",
27
+ "items": {
28
+ "type": "object",
29
+ "additionalProperties": false,
30
+ "required": [
31
+ "lowerEntityId",
32
+ "upperEntityId"
33
+ ],
34
+ "properties": {
35
+ "lowerEntityId": {
36
+ "$ref": "#/$defs/id"
37
+ },
38
+ "upperEntityId": {
39
+ "$ref": "#/$defs/id"
40
+ }
41
+ }
42
+ }
43
+ },
23
44
  "assets": {
24
45
  "type": "array",
25
46
  "items": {
package/lib/sdk.d.ts CHANGED
@@ -66,6 +66,7 @@ export function specChangeAudit(hashes?: { specHashBefore?: string | null; specH
66
66
  export function reviewInputsDigest(spec: SceneSpec): string;
67
67
  export interface SceneSummary {
68
68
  revision: string | null; revisionNumber: number | null; digest: string; schemaVersion: SceneSpec['schemaVersion'];
69
+ halfLaps?: NonNullable<SceneSpec['halfLaps']>;
69
70
  project: {
70
71
  id: string; title: string; goal: string | null; referenceImages: ReferenceImage[]; reviewSubjectId: string | null;
71
72
  fps: number; frameStart: number; frameEnd: number; aspectRatio: string; units: 'metric' | 'imperial'; activeCamera: string | null;
package/lib/ui-api.js CHANGED
@@ -45,6 +45,7 @@ export const UI_REST_MARKER = '*'
45
45
  * @type {ReadonlyArray<{ id: string, method: string, path: string, write: boolean, summary: string }>}
46
46
  */
47
47
  export const UI_ROUTES = Object.freeze([
48
+ { id: 'readiness.imageInput', method: 'POST', path: '/deepblend/readiness/image-input', write: true, summary: 'Explicitly test the configured review route with one randomized image input challenge.' },
48
49
  { id: 'capabilities', method: 'GET', path: '/deepblend/capabilities', write: false, summary: 'Blender capabilities and the settings card.' },
49
50
  // The first route this product serves FOR SOMEBODY ELSE TO READ. Everything else on this surface
50
51
  // exists so the workbench can render itself; this one exists so a user can hand a maintainer the
@@ -83,13 +84,21 @@ export const UI_ROUTES = Object.freeze([
83
84
  { id: 'project.review', method: 'POST', path: '/deepblend/projects/:projectId/review', write: true, summary: 'Explicitly render and consult the visual reviewer for one revision.' },
84
85
  { id: 'project.autofix', method: 'POST', path: '/deepblend/projects/:projectId/autofix', write: true, summary: 'Explicitly run a bounded visual correction loop for one revision.' },
85
86
  { id: 'project.patch', method: 'POST', path: '/deepblend/projects/:projectId/patch', write: true, summary: 'Apply a ScenePatch as one atomic revision.' },
87
+ { id: 'project.halfLap.preview', method: 'POST', path: '/deepblend/projects/:projectId/half-lap-preview', write: true, summary: 'Render both slot faces of a draft timber joint without saving a revision.' },
86
88
  { id: 'project.recipeParameters', method: 'GET', path: '/deepblend/projects/:projectId/recipe-parameters', write: false, summary: 'Read saved assembly controls at one revision.' },
87
89
  { id: 'project.recipeParameters.update', method: 'POST', path: '/deepblend/projects/:projectId/recipe-parameters', write: true, summary: 'Save bounded assembly dimensions as an atomic revision.' },
88
90
  { id: 'project.surfacePlacement', method: 'POST', path: '/deepblend/projects/:projectId/surface-placement', write: true, summary: 'Measure and save an explicit entity or complete supported lamp placement.' },
89
91
  { id: 'project.cameraFit', method: 'POST', path: '/deepblend/projects/:projectId/camera-fit', write: true, summary: 'Save a new static camera after independently verifying complete selected geometry fits the frame.' },
92
+ { id: 'project.photographyReuse', method: 'POST', path: '/deepblend/projects/:projectId/photography-reuse', write: true, summary: 'Explicitly inspect saved product bounds and return an adapted photography draft without saving a scene.' },
90
93
  { id: 'project.restore', method: 'POST', path: '/deepblend/projects/:projectId/restore', write: true, summary: 'Move the current revision pointer to a saved revision, preserving history without creating a new revision.' },
91
94
  { id: 'project.jobs', method: 'GET', path: '/deepblend/projects/:projectId/jobs', write: false, summary: 'Render/export jobs of a project.' },
92
95
  { id: 'project.job', method: 'GET', path: '/deepblend/projects/:projectId/jobs/:jobId', write: false, summary: 'One job with its live progress.' },
96
+ { id: 'project.job.video', method: 'GET', path: '/deepblend/projects/:projectId/jobs/:jobId/video', write: false, summary: 'Download the verified video for one explicit job and revision.' },
97
+ { id: 'project.job.frame', method: 'GET', path: '/deepblend/projects/:projectId/jobs/:jobId/frames/:frame', write: false, summary: 'Download a provenance-bound frame from a completed render job.' },
98
+ { id: 'project.motionPreview.create', method: 'POST', path: '/deepblend/projects/:projectId/motion-previews', write: true, summary: 'Render a private camera motion candidate without publishing a revision.' },
99
+ { id: 'project.motionPreview.video', method: 'GET', path: '/deepblend/projects/:projectId/motion-previews/:candidateId/video', write: false, summary: 'Play a verified private camera motion preview.' },
100
+ { id: 'project.motionPreview.save', method: 'POST', path: '/deepblend/projects/:projectId/motion-previews/:candidateId/save', write: true, summary: 'Save the explicitly accepted camera motion candidate.' },
101
+ { id: 'project.motionPreview.discard', method: 'POST', path: '/deepblend/projects/:projectId/motion-previews/:candidateId/discard', write: true, summary: 'Discard an unpublished camera motion candidate.' },
93
102
  { id: 'project.job.cancel', method: 'POST', path: '/deepblend/projects/:projectId/jobs/:jobId/cancel', write: true, summary: 'Cancel a running job and verify the process is gone.' },
94
103
  { id: 'project.render', method: 'POST', path: '/deepblend/projects/:projectId/render', write: true, summary: 'Start a delivery render (or resume one).' },
95
104
  { id: 'project.editableSnapshots.create', method: 'POST', path: '/deepblend/projects/:projectId/editable-snapshots', write: true, summary: 'Prepare or resume an immutable editable snapshot of one explicit revision.' },
@@ -285,9 +294,13 @@ const DIFF_COLLECTIONS = Object.freeze([
285
294
  export function buildRevisionDiff(from, to, context = {}) {
286
295
  /** @type {Record<string, unknown>} */
287
296
  const collections = {}
288
- for (const { key, idField } of DIFF_COLLECTIONS) {
289
- const before = new Map((from?.[key] ?? []).map(item => [item[idField], item]))
290
- const after = new Map((to?.[key] ?? []).map(item => [item[idField], item]))
297
+ const comparable = DIFF_COLLECTIONS.map(({ key, idField }) => ({ key, identify: item => item[idField] }))
298
+ if (from?.halfLaps?.length || to?.halfLaps?.length) {
299
+ comparable.push({ key: 'halfLaps', identify: joint => [joint.lowerEntityId, joint.upperEntityId].sort().join(' / ') })
300
+ }
301
+ for (const { key, identify } of comparable) {
302
+ const before = new Map((from?.[key] ?? []).map(item => [identify(item), item]))
303
+ const after = new Map((to?.[key] ?? []).map(item => [identify(item), item]))
291
304
  const added = [...after.keys()].filter(id => !before.has(id)).sort()
292
305
  const removed = [...before.keys()].filter(id => !after.has(id)).sort()
293
306
  const changed = []
@@ -408,9 +421,12 @@ export function buildSceneTree(spec, context = {}) {
408
421
  fps: spec?.project?.fps ?? null,
409
422
  frameStart: spec?.project?.frameStart ?? null,
410
423
  frameEnd: spec?.project?.frameEnd ?? null,
424
+ aspectRatio: spec?.project?.aspectRatio ?? null,
411
425
  activeCamera: spec?.project?.activeCamera ?? null,
412
426
  },
427
+ renderProfiles: clone(spec?.renderProfiles ?? null),
413
428
  world: clone(spec?.world ?? null),
429
+ ...(spec?.halfLaps?.length ? { halfLaps: clone(spec.halfLaps) } : {}),
414
430
  reviewSubject: clone(resolveSubject(spec)),
415
431
  assetParts: clone(assetParts),
416
432
  counts: {
@@ -483,6 +499,7 @@ export function buildQaView({ projectId, revision, validation = null, review = n
483
499
  artistic: clone(review?.referenceInputError ? { status: 'unassessable', dimensions: {} } : review?.artistic ?? { status: 'unassessable', dimensions: {} }),
484
500
  referenceImages: clone(review?.referenceImages ?? []),
485
501
  reviewInputsDigest: review?.reviewInputsDigest ?? null,
502
+ inputScope: clone(review?.inputScope ?? null),
486
503
  referenceInputError: clone(review?.referenceInputError ?? null),
487
504
  iteration: review?.iteration ?? null,
488
505
  subjectId: review?.subjectId ?? null,
@@ -580,7 +597,7 @@ export function buildJobView(job, options) {
580
597
  // from a list written here: a second opinion about which statuses are
581
598
  // terminal is exactly the copy that rots (D38, D43, D57, D60).
582
599
  cancelable: live,
583
- resumable: ['failed', 'cancelled', 'recovering'].includes(job.status),
600
+ resumable: job.persistencePending !== true && ['failed', 'cancelled', 'recovering'].includes(job.status),
584
601
  deliverable: job.status === 'completed' && job.delivery !== null,
585
602
  approval: buildApprovalView({ record: { expectedFrames: expected, warnings: job.warnings ?? [] }, threshold: options?.threshold ?? Number.POSITIVE_INFINITY }),
586
603
  detail: describeJobForHuman(job),
@@ -622,6 +639,7 @@ function describeFrameProvenance(provenance) {
622
639
  */
623
640
  export function describeJobForHuman(job) {
624
641
  const frames = `${job.completedFrames ?? 0}/${job.expectedFrames ?? 0} 帧`
642
+ if (job.persistencePending === true) return `任务已停止,但结果尚未保存:${frames}。请检查磁盘空间及写入权限后刷新,再继续任务。`
625
643
  switch (job.status) {
626
644
  case 'queued': return `排队中:${frames}`
627
645
  case 'running': return job.estimatedRemainingMs === null || job.estimatedRemainingMs === undefined
@@ -629,7 +647,8 @@ export function describeJobForHuman(job) {
629
647
  : `渲染中:${frames},预计还剩 ${formatDuration(job.estimatedRemainingMs)}`
630
648
  case 'stopping': return `正在停止:${frames}`
631
649
  case 'recovering': return `进程已消失,可从缺失帧继续:${frames}`
632
- case 'completed': return job.delivery === null ? `已完成:${frames}` : `已交付:${frames},视频已校验`
650
+ case 'completed': return job.delivery === null ? `已完成:${frames}`
651
+ : job.delivery?.kind === 'still' ? `已交付:${frames},图片来源已核验` : `已交付:${frames},视频已校验`
633
652
  case 'failed': return `失败(${job.errorCode ?? '未分类'}):${frames},可继续渲染`
634
653
  case 'cancelled': return `已取消:${frames},可继续渲染`
635
654
  default: return `${job.status}:${frames}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepblend/dsh-blender-contracts",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "type": "module",
5
5
  "description": "DeepBlend Studio Service Definition, protocol contracts, and stable error codes.",
6
6
  "main": "lib/index.js",