@deepblend/dsh-blender-contracts 0.16.0 → 0.17.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/index.js CHANGED
@@ -715,6 +715,7 @@ export {
715
715
 
716
716
  export { ASSET_HEAD_BYTES, assetContentVerdict, describeAssetContent } from './asset-content.js'
717
717
  export { redactHome, redactUrl } from './redact.js'
718
+ export { specChangeAudit } from './spec-change-audit.js'
718
719
  export { assertKnownConfigKeys, declaredConfigKeys, describeUnknownConfigKeys } from './config-surface.js'
719
720
 
720
721
  export {
@@ -13,6 +13,8 @@
13
13
  * Owner: DeepBlend Studio — M1
14
14
  */
15
15
 
16
+ import { specChangeAudit } from './spec-change-audit.js'
17
+
16
18
  /**
17
19
  * @typedef {object} JobReference
18
20
  * @property {string} jobId
@@ -69,7 +71,7 @@ export function toCanonicalRevisionSummary({ manifest, checkpointPath = null })
69
71
  stage: manifest.stage ?? null,
70
72
  idempotencyKey: manifest.idempotencyKey ?? null,
71
73
  sceneChanged: manifest.digestBefore !== manifest.digestAfter,
72
- specChanged: manifest.specChanged === true,
74
+ ...specChangeAudit(manifest),
73
75
  checkpoint: checkpointPath,
74
76
  previews: manifest.previews ?? [],
75
77
  validation: manifest.validation ?? null,
@@ -19,6 +19,7 @@
19
19
  import { compileSchema, formatIssues } from './json-schema.js'
20
20
  import { collectionForKind, sceneSpecDigest, specHash } from './scene-spec.js'
21
21
  import { referenceImageIssues } from './reference-images.js'
22
+ import { specChangeAudit } from './spec-change-audit.js'
22
23
  import scenePatchSchema from './schemas/scene-patch.schema.json' with { type: 'json' }
23
24
 
24
25
  const validatePatchStructure = compileSchema(scenePatchSchema, { id: 'scene-patch.schema.json' })
@@ -1082,7 +1083,7 @@ export function applyPatchToSpec(spec, patch) {
1082
1083
  * @param {AppliedOperation[]} input.operations
1083
1084
  * @param {object} input.request - the accepted patch, recorded verbatim.
1084
1085
  * @param {{ revision: string, baseRevision: string, digestBefore: string, digestAfter: string,
1085
- * specHashBefore?: string, specHashAfter?: string }} input.revision
1086
+ * specHashBefore?: string|null, specHashAfter?: string|null }} input.revision
1086
1087
  * @param {import('./scene-spec.js').SceneSpecIssue[]} input.notices
1087
1088
  * @returns {Record<string, unknown>}
1088
1089
  */
@@ -1096,11 +1097,10 @@ export function buildOperationManifest({ operations, request, revision, notices
1096
1097
  specHashBefore: revision.specHashBefore ?? null,
1097
1098
  specHashAfter: revision.specHashAfter ?? null,
1098
1099
  // Two different questions, two different answers. `sceneChanged` excludes
1099
- // project metadata and brief by design (see sceneSpecDigest); `specChanged` covers the
1100
- // whole document, so the frame range counts.
1100
+ // project metadata and brief by design (see sceneSpecDigest). The full-source
1101
+ // audit includes these fields and reports missing historical hashes as unknown.
1101
1102
  sceneChanged: revision.digestBefore !== revision.digestAfter,
1102
- specChanged: (revision.specHashBefore ?? null) !== null
1103
- && revision.specHashBefore !== revision.specHashAfter,
1103
+ ...specChangeAudit(revision),
1104
1104
  idempotencyKey: request.idempotencyKey,
1105
1105
  actor: request.actor ?? null,
1106
1106
  stage: request.stage ?? null,
package/lib/sdk.d.ts CHANGED
@@ -50,6 +50,14 @@ export function compileSceneSpec(spec: SceneSpec): {
50
50
  export function sceneSpecCanonicalText(spec: SceneSpec): string;
51
51
  export function sceneSpecDigest(spec: SceneSpec): string;
52
52
  export function specHash(spec: SceneSpec): string;
53
+ export type SpecChangeStatus = 'changed' | 'unchanged' | 'unknown';
54
+ export interface SpecChangeAudit {
55
+ /** Conservative compatibility flag: true means not proven unchanged. Use specChangeStatus for display. */
56
+ specChanged: boolean;
57
+ specChangeStatus: SpecChangeStatus;
58
+ }
59
+ /** Derives evidence from canonical full-document hashes, ignoring stored booleans/statuses. */
60
+ export function specChangeAudit(hashes?: { specHashBefore?: string | null; specHashAfter?: string | null }): SpecChangeAudit;
53
61
  export function reviewInputsDigest(spec: SceneSpec): string;
54
62
  export interface SceneSummary {
55
63
  revision: string | null; revisionNumber: number | null; digest: string; schemaVersion: SceneSpec['schemaVersion'];
@@ -85,13 +93,15 @@ export interface OperationManifest {
85
93
  schemaVersion: 'deepblend.operation-manifest/v1'; revision: string; baseRevision: string;
86
94
  digestBefore: string; digestAfter: string; specHashBefore: string | null; specHashAfter: string | null;
87
95
  sceneChanged: boolean; specChanged: boolean; idempotencyKey: string | undefined;
96
+ /** Absent in historical v1 records. Derive with specChangeAudit before displaying them. */
97
+ specChangeStatus?: SpecChangeStatus;
88
98
  actor: string | null; stage: string | null; note: string | null; savedCheckpoint: boolean; renderedPreview: boolean;
89
99
  operationCount: number; operations: AppliedOperation[]; notices: SceneSpecIssue[];
90
100
  }
91
101
  export function buildOperationManifest(input: {
92
102
  operations: AppliedOperation[]; notices: SceneSpecIssue[]; request: ScenePatch;
93
- revision: { revision: string; baseRevision: string; digestBefore: string; digestAfter: string; specHashBefore?: string; specHashAfter?: string };
94
- }): OperationManifest;
103
+ revision: { revision: string; baseRevision: string; digestBefore: string; digestAfter: string; specHashBefore?: string | null; specHashAfter?: string | null };
104
+ }): OperationManifest & SpecChangeAudit;
95
105
  export const RECIPE_SCHEMA_VERSION: 'deepblend.recipe/v1';
96
106
  export const RECIPE_CAPABILITIES: ReadonlyArray<RecipeCapability>;
97
107
  export const RECIPE_LIMITS: Readonly<{ sceneBytes: number; previewBytes: number; previewPixels: number }>;
package/lib/sdk.js CHANGED
@@ -11,6 +11,7 @@ export {
11
11
  BlenderError, BlenderErrorCode, BlenderWarningCode, isBlenderError,
12
12
  } from './index.js'
13
13
  export { canonicalStringify, canonicalPretty, sha256, sha256Canonical } from './canonical.js'
14
+ export { specChangeAudit } from './spec-change-audit.js'
14
15
  export {
15
16
  validateSceneSpec, compileSceneSpec, sceneSpecCanonicalText, sceneSpecDigest, specHash,
16
17
  reviewInputsDigest, summarizeSceneSpec,
@@ -0,0 +1,16 @@
1
+ /** Compare canonical full-document hashes without treating missing history as evidence. */
2
+ const fullHash = value => typeof value === 'string' && /^[a-f0-9]{64}$/i.test(value) ? value.toLowerCase() : null
3
+
4
+ /**
5
+ * Stored legacy booleans/statuses are deliberately ignored. No document is rewritten.
6
+ * `specChanged` remains a conservative compatibility flag: true means not proven unchanged.
7
+ * User-facing conclusions must use `specChangeStatus`, including its explicit unknown state.
8
+ * These are canonical SceneSpec hashes, not file-byte SHA256 or render-only scene digests.
9
+ * @param {{ specHashBefore?: string|null, specHashAfter?: string|null }} [hashes]
10
+ * @returns {{ specChanged: boolean, specChangeStatus: 'changed'|'unchanged'|'unknown' }}
11
+ */
12
+ export function specChangeAudit(hashes = {}) {
13
+ const before = fullHash(hashes.specHashBefore), after = fullHash(hashes.specHashAfter)
14
+ const specChangeStatus = before === null || after === null ? 'unknown' : before === after ? 'unchanged' : 'changed'
15
+ return { specChanged: specChangeStatus !== 'unchanged', specChangeStatus }
16
+ }
package/lib/ui-api.js CHANGED
@@ -90,6 +90,10 @@ export const UI_ROUTES = Object.freeze([
90
90
  { id: 'project.job', method: 'GET', path: '/deepblend/projects/:projectId/jobs/:jobId', write: false, summary: 'One job with its live progress.' },
91
91
  { 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.' },
92
92
  { id: 'project.render', method: 'POST', path: '/deepblend/projects/:projectId/render', write: true, summary: 'Start a delivery render (or resume one).' },
93
+ { 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.' },
94
+ { id: 'project.editableSnapshots.get', method: 'GET', path: '/deepblend/projects/:projectId/editable-snapshots/:exportId', write: false, summary: 'Read the fixed snapshot request and preparation state.' },
95
+ { id: 'project.editableSnapshots.cancel', method: 'POST', path: '/deepblend/projects/:projectId/editable-snapshots/:exportId/cancel', write: true, summary: 'Cancel unfinished snapshot preparation without removing a ready export.' },
96
+ { id: 'project.editableSnapshots.download', method: 'GET', path: '/deepblend/projects/:projectId/editable-snapshots/:exportId/download', write: false, summary: 'Download a verified ready snapshot through a bounded stream.' },
93
97
  { id: 'artifacts.open', method: 'GET', path: '/deepblend/artifacts/:projectId/*', write: false, summary: 'Serve one project-relative artifact (a preview PNG).' },
94
98
  ])
95
99
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepblend/dsh-blender-contracts",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "type": "module",
5
5
  "description": "DeepBlend Studio Service Definition, protocol contracts, and stable error codes.",
6
6
  "main": "lib/index.js",