@openplanr/protocol 0.6.0 → 0.6.2

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.
Files changed (55) hide show
  1. package/lib/dashboard/closed-json-contract.mjs +99 -109
  2. package/lib/dashboard/operate-experience-audit-display-contract.d.mts +128 -153
  3. package/lib/dashboard/operate-experience-audit-display-contract.mjs +530 -585
  4. package/lib/dashboard/operate-experience-display-contract.d.mts +415 -437
  5. package/lib/dashboard/operate-experience-display-contract.mjs +768 -831
  6. package/lib/dashboard/operate-experience-surface-contract.d.mts +143 -148
  7. package/lib/dashboard/operate-experience-surface-contract.mjs +72 -73
  8. package/lib/dashboard/operate-review-contract.d.mts +7 -14
  9. package/lib/dashboard/operate-review-contract.mjs +46 -42
  10. package/lib/dashboard/operate-review-display-workspace-contract.d.mts +2 -5
  11. package/lib/dashboard/operate-review-display-workspace-contract.mjs +158 -104
  12. package/lib/dashboard/operate-review-payload-safety.mjs +4 -2
  13. package/lib/dashboard/operate-review-workspace-projection-v2.d.mts +47 -33
  14. package/lib/protocol/index.d.ts +2647 -543
  15. package/package.json +1 -1
  16. package/registries/commands.json +7 -7
  17. package/registries/skills.json +6 -6
  18. package/src/browser-contracts.d.mts +4 -1
  19. package/src/browser-contracts.mjs +16 -5
  20. package/src/canonical-json.d.mts +3 -1
  21. package/src/canonical-json.mjs +57 -20
  22. package/src/compat/live-evidence-v2.mjs +1604 -485
  23. package/src/compat/operate-experience-live-patch.mjs +67 -15
  24. package/src/compat/operating-planning-contracts.mjs +183 -51
  25. package/src/contracts.d.mts +54 -13
  26. package/src/contracts.mjs +655 -345
  27. package/src/design-contracts.mjs +58 -21
  28. package/src/design-handoff-contracts.d.mts +67 -11
  29. package/src/design-handoff-contracts.mjs +243 -98
  30. package/src/design-publication-contracts.mjs +98 -33
  31. package/src/diagram-authoring-contracts.d.mts +422 -78
  32. package/src/diagram-authoring-contracts.mjs +1697 -326
  33. package/src/diagram-contracts.d.mts +4 -1
  34. package/src/diagram-contracts.mjs +16 -4
  35. package/src/enterprise-contracts.d.mts +211 -46
  36. package/src/enterprise-contracts.mjs +727 -175
  37. package/src/errors.mjs +4 -0
  38. package/src/generated/canonical-registries.mjs +13 -13
  39. package/src/index.d.mts +8 -8
  40. package/src/index.mjs +36 -20
  41. package/src/json-schema.d.mts +21 -6
  42. package/src/json-schema.mjs +66 -18
  43. package/src/planning-contracts.d.mts +8 -2
  44. package/src/planning-contracts.mjs +33 -7
  45. package/src/registries.d.mts +11 -3
  46. package/src/registries.mjs +369 -87
  47. package/src/review-experience-contracts.d.mts +7 -2
  48. package/src/review-experience-contracts.mjs +198 -49
  49. package/src/semver.mjs +5 -1
  50. package/src/skill-source-contracts.d.mts +36 -16
  51. package/src/skill-source-contracts.mjs +25 -6
  52. package/src/task-contracts.d.mts +13 -3
  53. package/src/task-contracts.mjs +181 -40
  54. package/src/workspace-contracts.d.mts +38 -10
  55. package/src/workspace-contracts.mjs +147 -33
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openplanr/protocol",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "description": "Canonical OpenPlanr schemas, registries, typed errors, and portable contract validation",
6
6
  "license": "MIT",
@@ -293,7 +293,7 @@
293
293
  "ownerPackage": "openplanr",
294
294
  "source": {
295
295
  "path": "packages/cli/src/cli/commands/diagram/index.ts",
296
- "digest": "sha256:6a5883e12fe9499b343bdff4a481aa94a82f06c4292ed42436e7961eb3883175"
296
+ "digest": "sha256:67aeefb682ad56cf3429a38bd98c913261cea3dbaeaf5e31ab11d873bce4b02a"
297
297
  },
298
298
  "authorityClass": "workflow",
299
299
  "machineJson": true,
@@ -377,7 +377,7 @@
377
377
  "ownerPackage": "openplanr",
378
378
  "source": {
379
379
  "path": "docs/generated/utility-command-catalog.json",
380
- "digest": "sha256:3ef32f1b1c3b37ae665bb0328b736cafcc1ad40a158875a8c7f32a7de1da1f54"
380
+ "digest": "sha256:02c19f6bd7d805e1d101c020f64270b17c785b8bffb36184da57a20755b21960"
381
381
  },
382
382
  "authorityClass": "workflow",
383
383
  "machineJson": false,
@@ -482,7 +482,7 @@
482
482
  "ownerPackage": "openplanr",
483
483
  "source": {
484
484
  "path": "packages/cli/src/cli/commands/init-deterministic.ts",
485
- "digest": "sha256:6212d9f0582ab4a8d475b479aae52ed0fedb877c60038b9f88a309d7b93bafd9"
485
+ "digest": "sha256:7bd117fac77363d2233cf91e8ae280cff7da04b6671ad4e0b3bc39af07701747"
486
486
  },
487
487
  "authorityClass": "workflow",
488
488
  "machineJson": false,
@@ -566,7 +566,7 @@
566
566
  "ownerPackage": "openplanr",
567
567
  "source": {
568
568
  "path": "docs/generated/utility-command-catalog.json",
569
- "digest": "sha256:3ef32f1b1c3b37ae665bb0328b736cafcc1ad40a158875a8c7f32a7de1da1f54"
569
+ "digest": "sha256:02c19f6bd7d805e1d101c020f64270b17c785b8bffb36184da57a20755b21960"
570
570
  },
571
571
  "authorityClass": "workflow",
572
572
  "machineJson": true,
@@ -776,7 +776,7 @@
776
776
  "ownerPackage": "openplanr",
777
777
  "source": {
778
778
  "path": "packages/cli/src/cli/commands/setup.ts",
779
- "digest": "sha256:866e47698db7a4f39ff487cac8e27ce1d474a0f078c12200164d414bab32d9a3"
779
+ "digest": "sha256:8cc9b0df403edf08a900baf0e2755db0b9238c9e7465b04fca92b322fd5a5b7d"
780
780
  },
781
781
  "authorityClass": "workflow",
782
782
  "machineJson": false,
@@ -965,7 +965,7 @@
965
965
  "ownerPackage": "openplanr",
966
966
  "source": {
967
967
  "path": "packages/cli/src/cli/commands/upgrade.ts",
968
- "digest": "sha256:5f559c4d6bf7a1b31477f71c195d086021a8f4b8bc62ba78e6eeb6b5f1b1ac5c"
968
+ "digest": "sha256:f88457767ccf7034ee601a9e107f9976c0432632e5aa68463150d590e704bc7e"
969
969
  },
970
970
  "authorityClass": "workflow",
971
971
  "machineJson": false,
@@ -1948,5 +1948,5 @@
1948
1948
  ]
1949
1949
  }
1950
1950
  ],
1951
- "documentDigest": "sha256:ae3955232bf3a97fd1cae7ca01deec957232a64c0c2c3c2fb25a14963c93e310"
1951
+ "documentDigest": "sha256:9f33355d22aaa2ee1d20f91aed15abbeefd85c7a405449acd610a7cfa12e2f46"
1952
1952
  }
@@ -624,7 +624,7 @@
624
624
  "lifecycle": "active",
625
625
  "authorityClass": "planning-write",
626
626
  "source": "skills/planr-design/openplanr.skill.json",
627
- "sourceDigest": "sha256:b6fb1882f9147414964469f6e3b8089c2ca8d55c0f4a7f92e66b5a107db68051",
627
+ "sourceDigest": "sha256:f766320e0acf0d321f996ad6b3115a2e7d4d386b10d760de1ba056b2b3b1e735",
628
628
  "triggerPolicy": {
629
629
  "include": [
630
630
  "Create an initial product design direction",
@@ -685,7 +685,7 @@
685
685
  "lifecycle": "active",
686
686
  "authorityClass": "planning-write",
687
687
  "source": "skills/planr-design-loop/openplanr.skill.json",
688
- "sourceDigest": "sha256:e74d98bbf31c030727e6cf2bd306b760d1bba2449bbb247148fe6c1dbc684f7b",
688
+ "sourceDigest": "sha256:3e1c445f7e16605852ca252e13f4be26152ca536c4c3a0411ad30e3f2568579b",
689
689
  "triggerPolicy": {
690
690
  "include": [
691
691
  "Explore multiple design directions or variants",
@@ -746,7 +746,7 @@
746
746
  "lifecycle": "active",
747
747
  "authorityClass": "review-evidence",
748
748
  "source": "skills/planr-design-review/openplanr.skill.json",
749
- "sourceDigest": "sha256:388904d851b0da0e6bc9171db229f80facca68a417bb4e458bf5eebf6cd12be3",
749
+ "sourceDigest": "sha256:0344f576cc93658bcd7265fbac08908d08f4ef4d9aa05b6fdfed63a249e51632",
750
750
  "triggerPolicy": {
751
751
  "include": [
752
752
  "Review or critique an existing OpenPlanr design",
@@ -803,7 +803,7 @@
803
803
  {
804
804
  "skillId": "planr-diagram",
805
805
  "skillVersion": "1.1.0",
806
- "description": "Create, inspect, verify, or rerender professional offline diagrams. Use for architecture, process, sequence, data, state, or relationship visuals from intent or source.",
806
+ "description": "Create, edit, inspect, verify, or rerender professional offline diagrams. Use for architecture, process, sequence, data, state, or relationship visuals from intent or source.",
807
807
  "lifecycle": "active",
808
808
  "authorityClass": "artifact-authoring",
809
809
  "source": "skills/planr-diagram/openplanr.skill.json",
@@ -1179,7 +1179,7 @@
1179
1179
  "lifecycle": "active",
1180
1180
  "authorityClass": "planning-write",
1181
1181
  "source": "skills/planr-plan/openplanr.skill.json",
1182
- "sourceDigest": "sha256:e91d221a286bd91b3b7a2343cea8c73564cb3401b968854d38bcf8a9790131f1",
1182
+ "sourceDigest": "sha256:5d747d2be313ac2e06534936043744f663939e8d72644c31936daa42f2bc500c",
1183
1183
  "triggerPolicy": {
1184
1184
  "include": [
1185
1185
  "Decompose a specification into user stories and implementation tasks",
@@ -1664,5 +1664,5 @@
1664
1664
  }
1665
1665
  ],
1666
1666
  "compatibilityAliases": [],
1667
- "documentDigest": "sha256:0da63b57a763dda5fb771e48109adb301e20c1f3bea6c423dc77361f421a4562"
1667
+ "documentDigest": "sha256:63f0c16bcbca6cdf811e606835e91c2474f37122903e4e84d43a357159d58786"
1668
1668
  }
@@ -3,5 +3,8 @@ export declare const PROTOCOL_V16_CONTRACTS: Readonly<Record<string, string>>;
3
3
  export declare const PROTOCOL_V17_CONTRACTS: Readonly<Record<string, string>>;
4
4
  export declare const PROTOCOL_V18_CONTRACTS: Readonly<Record<string, string>>;
5
5
  export declare const PROTOCOL_V111_CONTRACTS: Readonly<Record<string, string>>;
6
- export declare function protocolAssetUrl(kind: string, options?: { protocolVersion?: '1.5.0' | '1.6.0' | '1.7.0' | '1.8.0' | '1.11.0' | '1.13.0' }): URL;
6
+ export declare function protocolAssetUrl(
7
+ kind: string,
8
+ options?: { protocolVersion?: '1.5.0' | '1.6.0' | '1.7.0' | '1.8.0' | '1.11.0' | '1.13.0' },
9
+ ): URL;
7
10
  export declare const PROTOCOL_V113_CONTRACTS: Readonly<Record<string, string>>;
@@ -1,11 +1,13 @@
1
+ // @ts-check
2
+ import { DESIGN_HANDOFF_CONTRACT_FILES } from './design-handoff-contracts.mjs';
3
+ import { DIAGRAM_AUTHORING_CONTRACT_FILES } from './diagram-authoring-contracts.mjs';
1
4
  import {
2
5
  PROTOCOL_V16_CONTRACT_FILES,
3
6
  PROTOCOL_V17_CONTRACT_FILES,
4
7
  PROTOCOL_V18_CONTRACT_FILES,
5
8
  } from './skill-source-contracts.mjs';
6
- import { DESIGN_HANDOFF_CONTRACT_FILES } from './design-handoff-contracts.mjs';
7
- import { DIAGRAM_AUTHORING_CONTRACT_FILES } from './diagram-authoring-contracts.mjs';
8
9
 
10
+ /** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V15_CONTRACTS} */
9
11
  export const PROTOCOL_V15_CONTRACTS = Object.freeze({
10
12
  'command-catalog': 'command-catalog.schema.json',
11
13
  'generated-asset-manifest': 'generated-asset-manifest.schema.json',
@@ -18,17 +20,22 @@ export const PROTOCOL_V15_CONTRACTS = Object.freeze({
18
20
  'skill-catalog': 'skill-catalog.schema.json',
19
21
  'task-kind-registry': 'task-kind-registry.schema.json',
20
22
  'task-manifest': 'task-manifest.schema.json',
21
- 'task-output-manifest': 'task-output-manifest.schema.json'
23
+ 'task-output-manifest': 'task-output-manifest.schema.json',
22
24
  });
23
25
 
26
+ /** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V16_CONTRACTS} */
24
27
  export const PROTOCOL_V16_CONTRACTS = PROTOCOL_V16_CONTRACT_FILES;
28
+ /** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V17_CONTRACTS} */
25
29
  export const PROTOCOL_V17_CONTRACTS = PROTOCOL_V17_CONTRACT_FILES;
30
+ /** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V18_CONTRACTS} */
26
31
  export const PROTOCOL_V18_CONTRACTS = PROTOCOL_V18_CONTRACT_FILES;
32
+ /** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V111_CONTRACTS} */
27
33
  export const PROTOCOL_V111_CONTRACTS = Object.freeze({
28
34
  'design-review-metadata-payload': 'design-review-metadata-payload.schema.json',
29
35
  ...DESIGN_HANDOFF_CONTRACT_FILES,
30
36
  });
31
37
 
38
+ /** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V113_CONTRACTS} */
32
39
  export const PROTOCOL_V113_CONTRACTS = DIAGRAM_AUTHORING_CONTRACT_FILES;
33
40
 
34
41
  const PROTOCOL_CONTRACTS_BY_VERSION = Object.freeze({
@@ -40,10 +47,14 @@ const PROTOCOL_CONTRACTS_BY_VERSION = Object.freeze({
40
47
  '1.13.0': PROTOCOL_V113_CONTRACTS,
41
48
  });
42
49
 
43
- /** Resolve a packaged schema asset without a source checkout or Node-only API. */
50
+ /**
51
+ * Resolve a packaged schema asset without a source checkout or Node-only API.
52
+ * @type {typeof import('./browser-contracts.d.mts').protocolAssetUrl}
53
+ */
44
54
  export function protocolAssetUrl(kind, { protocolVersion = '1.5.0' } = {}) {
45
55
  const contracts = Object.hasOwn(PROTOCOL_CONTRACTS_BY_VERSION, protocolVersion)
46
- ? PROTOCOL_CONTRACTS_BY_VERSION[protocolVersion] : null;
56
+ ? PROTOCOL_CONTRACTS_BY_VERSION[protocolVersion]
57
+ : null;
47
58
  const filename = contracts && Object.hasOwn(contracts, kind) ? contracts[kind] : null;
48
59
  if (!filename) {
49
60
  throw new RangeError(`Unknown browser-safe Protocol contract: ${kind}@${protocolVersion}`);
@@ -1,5 +1,7 @@
1
1
  export declare function canonicalizeJson(value: unknown): string;
2
2
  export declare function sha256Hex(value: string | Uint8Array): string;
3
3
  export declare function sha256Jcs(value: unknown): `sha256:${string}`;
4
- export declare function withDocumentDigest<T extends Record<string, unknown>>(value: T): T & { documentDigest: `sha256:${string}` };
4
+ export declare function withDocumentDigest<T extends Record<string, unknown>>(
5
+ value: T,
6
+ ): T & { documentDigest: `sha256:${string}` };
5
7
  export declare function verifyDocumentDigest(value: unknown): boolean;
@@ -1,3 +1,4 @@
1
+ // @ts-check
1
2
  const hasOwn = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
2
3
 
3
4
  function assertUnicodeScalarString(value, path) {
@@ -26,14 +27,16 @@ function serialize(value, path, seen) {
26
27
  if (!Number.isFinite(value)) throw new TypeError(`JCS requires a finite number at ${path}.`);
27
28
  return JSON.stringify(value);
28
29
  }
29
- if (typeof value !== 'object') throw new TypeError(`JCS cannot canonicalize ${typeof value} at ${path}.`);
30
+ if (typeof value !== 'object')
31
+ throw new TypeError(`JCS cannot canonicalize ${typeof value} at ${path}.`);
30
32
  if (seen.has(value)) throw new TypeError(`JCS cannot canonicalize a cycle at ${path}.`);
31
33
  seen.add(value);
32
34
  try {
33
35
  if (Array.isArray(value)) {
34
36
  const entries = [];
35
37
  for (let index = 0; index < value.length; index += 1) {
36
- if (!hasOwn(value, index)) throw new TypeError(`JCS cannot canonicalize a sparse array at ${path}[${index}].`);
38
+ if (!hasOwn(value, index))
39
+ throw new TypeError(`JCS cannot canonicalize a sparse array at ${path}[${index}].`);
37
40
  entries.push(serialize(value[index], `${path}[${index}]`, seen));
38
41
  }
39
42
  return `[${entries.join(',')}]`;
@@ -42,17 +45,22 @@ function serialize(value, path, seen) {
42
45
  if (prototype !== Object.prototype && prototype !== null) {
43
46
  throw new TypeError(`JCS requires a plain JSON object at ${path}.`);
44
47
  }
45
- const entries = Object.keys(value).sort().map((key) => {
46
- assertUnicodeScalarString(key, `${path} key`);
47
- return `${JSON.stringify(key)}:${serialize(value[key], `${path}.${key}`, seen)}`;
48
- });
48
+ const entries = Object.keys(value)
49
+ .sort()
50
+ .map((key) => {
51
+ assertUnicodeScalarString(key, `${path} key`);
52
+ return `${JSON.stringify(key)}:${serialize(value[key], `${path}.${key}`, seen)}`;
53
+ });
49
54
  return `{${entries.join(',')}}`;
50
55
  } finally {
51
56
  seen.delete(value);
52
57
  }
53
58
  }
54
59
 
55
- /** RFC 8785 JSON canonicalization for already parsed JSON values. */
60
+ /**
61
+ * RFC 8785 JSON canonicalization for already parsed JSON values.
62
+ * @type {typeof import('./canonical-json.d.mts').canonicalizeJson}
63
+ */
56
64
  export function canonicalizeJson(value) {
57
65
  return serialize(value, '$', new Set());
58
66
  }
@@ -70,10 +78,16 @@ const SHA256_K = new Uint32Array([
70
78
 
71
79
  const rotr = (value, bits) => (value >>> bits) | (value << (32 - bits));
72
80
 
73
- /** Dependency-free synchronous SHA-256 for browser and Node runtimes. */
81
+ /**
82
+ * Dependency-free synchronous SHA-256 for browser and Node runtimes.
83
+ * @type {typeof import('./canonical-json.d.mts').sha256Hex}
84
+ */
74
85
  export function sha256Hex(value) {
75
86
  const candidate = typeof value === 'string' ? new TextEncoder().encode(value) : value;
76
- if (!ArrayBuffer.isView(candidate) || Object.prototype.toString.call(candidate) !== '[object Uint8Array]') {
87
+ if (
88
+ !ArrayBuffer.isView(candidate) ||
89
+ Object.prototype.toString.call(candidate) !== '[object Uint8Array]'
90
+ ) {
77
91
  throw new TypeError('sha256Hex expects a string or Uint8Array.');
78
92
  }
79
93
  const input = new Uint8Array(candidate.buffer, candidate.byteOffset, candidate.byteLength);
@@ -99,12 +113,20 @@ export function sha256Hex(value) {
99
113
  for (let offset = 0; offset < bytes.length; offset += 64) {
100
114
  for (let index = 0; index < 16; index += 1) words[index] = view.getUint32(offset + index * 4);
101
115
  for (let index = 16; index < 64; index += 1) {
102
- const s0 = rotr(words[index - 15], 7) ^ rotr(words[index - 15], 18) ^ (words[index - 15] >>> 3);
103
- const s1 = rotr(words[index - 2], 17) ^ rotr(words[index - 2], 19) ^ (words[index - 2] >>> 10);
116
+ const s0 =
117
+ rotr(words[index - 15], 7) ^ rotr(words[index - 15], 18) ^ (words[index - 15] >>> 3);
118
+ const s1 =
119
+ rotr(words[index - 2], 17) ^ rotr(words[index - 2], 19) ^ (words[index - 2] >>> 10);
104
120
  words[index] = (words[index - 16] + s0 + words[index - 7] + s1) >>> 0;
105
121
  }
106
- let a = h0; let b = h1; let c = h2; let d = h3;
107
- let e = h4; let f = h5; let g = h6; let h = h7;
122
+ let a = h0;
123
+ let b = h1;
124
+ let c = h2;
125
+ let d = h3;
126
+ let e = h4;
127
+ let f = h5;
128
+ let g = h6;
129
+ let h = h7;
108
130
  for (let index = 0; index < 64; index += 1) {
109
131
  const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
110
132
  const choice = (e & f) ^ (~e & g);
@@ -112,27 +134,42 @@ export function sha256Hex(value) {
112
134
  const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
113
135
  const majority = (a & b) ^ (a & c) ^ (b & c);
114
136
  const temp2 = (s0 + majority) >>> 0;
115
- h = g; g = f; f = e; e = (d + temp1) >>> 0;
116
- d = c; c = b; b = a; a = (temp1 + temp2) >>> 0;
137
+ h = g;
138
+ g = f;
139
+ f = e;
140
+ e = (d + temp1) >>> 0;
141
+ d = c;
142
+ c = b;
143
+ b = a;
144
+ a = (temp1 + temp2) >>> 0;
117
145
  }
118
- h0 = (h0 + a) >>> 0; h1 = (h1 + b) >>> 0;
119
- h2 = (h2 + c) >>> 0; h3 = (h3 + d) >>> 0;
120
- h4 = (h4 + e) >>> 0; h5 = (h5 + f) >>> 0;
121
- h6 = (h6 + g) >>> 0; h7 = (h7 + h) >>> 0;
146
+ h0 = (h0 + a) >>> 0;
147
+ h1 = (h1 + b) >>> 0;
148
+ h2 = (h2 + c) >>> 0;
149
+ h3 = (h3 + d) >>> 0;
150
+ h4 = (h4 + e) >>> 0;
151
+ h5 = (h5 + f) >>> 0;
152
+ h6 = (h6 + g) >>> 0;
153
+ h7 = (h7 + h) >>> 0;
122
154
  }
123
- return [h0, h1, h2, h3, h4, h5, h6, h7].map((part) => part.toString(16).padStart(8, '0')).join('');
155
+ return [h0, h1, h2, h3, h4, h5, h6, h7]
156
+ .map((part) => part.toString(16).padStart(8, '0'))
157
+ .join('');
124
158
  }
125
159
 
160
+ /** @type {typeof import('./canonical-json.d.mts').sha256Jcs} */
126
161
  export function sha256Jcs(value) {
127
162
  return `sha256:${sha256Hex(canonicalizeJson(value))}`;
128
163
  }
129
164
 
165
+ /** @type {typeof import('./canonical-json.d.mts').withDocumentDigest} */
130
166
  export function withDocumentDigest(value) {
131
167
  const copy = { ...value };
132
168
  delete copy.documentDigest;
133
169
  return { ...copy, documentDigest: sha256Jcs(copy) };
134
170
  }
135
171
 
172
+ /** @type {typeof import('./canonical-json.d.mts').verifyDocumentDigest} */
136
173
  export function verifyDocumentDigest(value) {
137
174
  if (!value || typeof value !== 'object' || Array.isArray(value)) return false;
138
175
  const copy = { ...value };