@openplanr/protocol 0.8.0 → 0.10.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.
Files changed (70) hide show
  1. package/README.md +9 -0
  2. package/package.json +17 -1
  3. package/registries/commands.json +22 -22
  4. package/registries/skills.json +136 -58
  5. package/registry/v1.17.0/commands.json +88 -0
  6. package/schemas/v1.16.0/artifact-envelope.schema.json +408 -0
  7. package/schemas/v1.16.0/design-review-bundle.schema.json +590 -0
  8. package/schemas/v1.17.0/artifact-paste-v2.schema.json +52 -0
  9. package/schemas/v1.17.0/artifact-room-append-v3.schema.json +159 -0
  10. package/schemas/v1.17.0/artifact-room-create-v3.schema.json +111 -0
  11. package/schemas/v1.17.0/artifact-room-descriptor-v3.schema.json +92 -0
  12. package/schemas/v1.17.0/artifact-room-event-v3.schema.json +130 -0
  13. package/schemas/v1.17.0/artifact-room-management-v3.schema.json +47 -0
  14. package/schemas/v1.17.0/artifact-room-read-page-v3.schema.json +308 -0
  15. package/schemas/v1.17.0/company-resource-manifest.schema.json +128 -0
  16. package/schemas/v1.17.0/company-resource-upload-prepare.schema.json +164 -0
  17. package/schemas/v1.17.0/company-resource-upload-receipt.schema.json +63 -0
  18. package/schemas/v1.17.0/company-resource-upload-status.schema.json +123 -0
  19. package/schemas/v1.17.0/diagram-authoring-bundle.schema.json +1117 -0
  20. package/schemas/v1.17.0/diagram-edit-transaction.schema.json +3295 -0
  21. package/schemas/v1.17.0/diagram-presentation.schema.json +37 -0
  22. package/schemas/v1.17.0/diagram-review-bundle.schema.json +2439 -0
  23. package/schemas/v1.17.0/encrypted-resource-manifest.schema.json +131 -0
  24. package/schemas/v1.17.0/encrypted-upload-commit.schema.json +38 -0
  25. package/schemas/v1.17.0/encrypted-upload-prepare.schema.json +234 -0
  26. package/schemas/v1.17.0/encrypted-upload-receipt.schema.json +54 -0
  27. package/schemas/v1.17.0/encrypted-upload-status.schema.json +129 -0
  28. package/schemas/v1.17.0/encrypted-workspace-event-v2.schema.json +79 -0
  29. package/schemas/v1.17.0/encrypted-workspace-v2.schema.json +91 -0
  30. package/schemas/v1.17.0/enterprise-agent-handoff.schema.json +985 -0
  31. package/schemas/v1.17.0/enterprise-artifact-revision.schema.json +115 -0
  32. package/schemas/v1.17.0/enterprise-change-proposal.schema.json +379 -0
  33. package/schemas/v1.17.0/enterprise-evidence-reference.schema.json +159 -0
  34. package/schemas/v1.17.0/enterprise-review-thread.schema.json +298 -0
  35. package/schemas/v1.17.0/enterprise-sync-state.schema.json +189 -0
  36. package/schemas/v1.17.0/preview-bridge-message.schema.json +197 -0
  37. package/schemas/v1.17.0/resource-catalog.schema.json +145 -0
  38. package/schemas/v1.17.0/sharing-crypto-aad.schema.json +36 -0
  39. package/schemas/v1.17.0/workspace-management-v2.schema.json +45 -0
  40. package/schemas/v1.17.0/workspace-rotation-v2.schema.json +61 -0
  41. package/schemas/v1.18.0/runtime-lock.schema.json +122 -0
  42. package/src/bounded-json-data.d.mts +2 -0
  43. package/src/bounded-json-data.mjs +56 -0
  44. package/src/browser-contracts.d.mts +14 -1
  45. package/src/browser-contracts.mjs +16 -0
  46. package/src/canonical-json.mjs +17 -16
  47. package/src/contracts.d.mts +1 -1
  48. package/src/contracts.mjs +97 -3
  49. package/src/diagram-authoring-contracts.d.mts +12 -0
  50. package/src/diagram-authoring-contracts.mjs +174 -1
  51. package/src/enterprise-contract-validation.d.mts +44 -0
  52. package/src/enterprise-contract-validation.mjs +279 -0
  53. package/src/enterprise-contracts.mjs +25 -231
  54. package/src/enterprise-resource-contracts.d.mts +72 -0
  55. package/src/enterprise-resource-contracts.mjs +202 -0
  56. package/src/generated/artifact-envelope-metadata.mjs +769 -0
  57. package/src/generated/canonical-registries.mjs +158 -80
  58. package/src/index.d.mts +21 -0
  59. package/src/index.mjs +23 -0
  60. package/src/large-object-contracts.d.mts +107 -0
  61. package/src/large-object-contracts.mjs +473 -0
  62. package/src/large-object-limits.d.mts +16 -0
  63. package/src/large-object-limits.mjs +17 -0
  64. package/src/registries.mjs +1 -0
  65. package/src/review-experience-contracts.d.mts +1 -0
  66. package/src/review-experience-contracts.mjs +25 -4
  67. package/src/sharing-security-contracts.d.mts +63 -0
  68. package/src/sharing-security-contracts.mjs +403 -0
  69. package/src/studio-presentation-contracts.d.mts +92 -0
  70. package/src/studio-presentation-contracts.mjs +287 -0
@@ -0,0 +1,145 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openplanr.dev/schemas/v1.17.0/resource-catalog.schema.json",
4
+ "x-openplanr-contract": {
5
+ "id": "resource-catalog",
6
+ "version": "1.17.0"
7
+ },
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "schemaVersion": {
12
+ "const": "1.0.0"
13
+ },
14
+ "kind": {
15
+ "const": "openplanr-resource-catalog"
16
+ },
17
+ "bundle": {
18
+ "type": "object"
19
+ },
20
+ "uniqueHtmlBytes": {
21
+ "type": "integer",
22
+ "minimum": 0,
23
+ "maximum": 104857600
24
+ },
25
+ "totalDecodedBytes": {
26
+ "type": "integer",
27
+ "minimum": 1,
28
+ "maximum": 134217728
29
+ },
30
+ "resources": {
31
+ "type": "array",
32
+ "minItems": 1,
33
+ "maxItems": 1024,
34
+ "items": {
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "properties": {
38
+ "id": {
39
+ "type": "string",
40
+ "pattern": "^r[0-9]{1,4}$"
41
+ },
42
+ "type": {
43
+ "enum": [
44
+ "html-segments",
45
+ "shared-block",
46
+ "asset"
47
+ ]
48
+ },
49
+ "offset": {
50
+ "type": "integer",
51
+ "minimum": 0,
52
+ "maximum": 134217728
53
+ },
54
+ "encodedBytes": {
55
+ "type": "integer",
56
+ "minimum": 1,
57
+ "maximum": 134217728
58
+ },
59
+ "decodedBytes": {
60
+ "type": "integer",
61
+ "minimum": 1,
62
+ "maximum": 134217728
63
+ },
64
+ "codec": {
65
+ "enum": [
66
+ "identity",
67
+ "deflate-raw"
68
+ ]
69
+ },
70
+ "sha256": {
71
+ "type": "string",
72
+ "pattern": "^[a-f0-9]{64}$"
73
+ }
74
+ },
75
+ "required": [
76
+ "id",
77
+ "type",
78
+ "offset",
79
+ "encodedBytes",
80
+ "decodedBytes",
81
+ "codec",
82
+ "sha256"
83
+ ]
84
+ }
85
+ },
86
+ "sources": {
87
+ "type": "array",
88
+ "minItems": 1,
89
+ "maxItems": 256,
90
+ "items": {
91
+ "type": "object",
92
+ "additionalProperties": false,
93
+ "properties": {
94
+ "id": {
95
+ "type": "string",
96
+ "minLength": 1,
97
+ "maxLength": 128
98
+ },
99
+ "resourceId": {
100
+ "type": "string",
101
+ "pattern": "^r[0-9]{1,4}$"
102
+ },
103
+ "htmlBytes": {
104
+ "type": "integer",
105
+ "minimum": 1,
106
+ "maximum": 104857600
107
+ },
108
+ "sha256": {
109
+ "type": "string",
110
+ "pattern": "^[a-f0-9]{64}$"
111
+ }
112
+ },
113
+ "required": [
114
+ "id",
115
+ "resourceId",
116
+ "htmlBytes",
117
+ "sha256"
118
+ ]
119
+ }
120
+ },
121
+ "viewSources": {
122
+ "type": "object",
123
+ "maxProperties": 4096,
124
+ "additionalProperties": {
125
+ "type": "string",
126
+ "minLength": 1,
127
+ "maxLength": 128
128
+ }
129
+ },
130
+ "reviewOf": {
131
+ "type": "string",
132
+ "pattern": "^[a-f0-9]{64}$"
133
+ }
134
+ },
135
+ "required": [
136
+ "schemaVersion",
137
+ "kind",
138
+ "bundle",
139
+ "uniqueHtmlBytes",
140
+ "totalDecodedBytes",
141
+ "resources",
142
+ "sources",
143
+ "viewSources"
144
+ ]
145
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openplanr.dev/schemas/v1.17.0/sharing-crypto-aad.schema.json",
4
+ "x-openplanr-contract": {
5
+ "id": "sharing-crypto-aad",
6
+ "version": "1.17.0"
7
+ },
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "version": {
12
+ "const": "2.0.0"
13
+ },
14
+ "purpose": {
15
+ "enum": [
16
+ "artifact-paste",
17
+ "room-envelope",
18
+ "room-event"
19
+ ]
20
+ },
21
+ "objectId": {
22
+ "type": "string",
23
+ "pattern": "^[A-Za-z0-9_-]{16,128}$"
24
+ },
25
+ "recordId": {
26
+ "type": "string",
27
+ "pattern": "^[A-Za-z0-9._:-]{1,128}$"
28
+ }
29
+ },
30
+ "required": [
31
+ "version",
32
+ "purpose",
33
+ "objectId",
34
+ "recordId"
35
+ ]
36
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openplanr.dev/schemas/v1.17.0/workspace-management-v2.schema.json",
4
+ "x-openplanr-contract": {
5
+ "id": "workspace-management-v2",
6
+ "version": "1.17.0"
7
+ },
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "operationId": {
12
+ "type": "string",
13
+ "pattern": "^[A-Za-z0-9_-]{22,64}$"
14
+ },
15
+ "expectedVersion": {
16
+ "type": "integer",
17
+ "minimum": 1,
18
+ "maximum": 9007199254740991
19
+ },
20
+ "epoch": {
21
+ "type": "integer",
22
+ "minimum": 1,
23
+ "maximum": 9007199254740991
24
+ },
25
+ "action": {
26
+ "enum": [
27
+ "pause",
28
+ "resume",
29
+ "revoke",
30
+ "delete"
31
+ ]
32
+ },
33
+ "signature": {
34
+ "type": "string",
35
+ "pattern": "^[A-Za-z0-9_-]{86}$"
36
+ }
37
+ },
38
+ "required": [
39
+ "operationId",
40
+ "expectedVersion",
41
+ "epoch",
42
+ "action",
43
+ "signature"
44
+ ]
45
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openplanr.dev/schemas/v1.17.0/workspace-rotation-v2.schema.json",
4
+ "x-openplanr-contract": {
5
+ "id": "workspace-rotation-v2",
6
+ "version": "1.17.0"
7
+ },
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "operationId": {
12
+ "type": "string",
13
+ "pattern": "^[A-Za-z0-9_-]{22,64}$"
14
+ },
15
+ "expectedVersion": {
16
+ "type": "integer",
17
+ "minimum": 1,
18
+ "maximum": 9007199254740991
19
+ },
20
+ "epoch": {
21
+ "type": "integer",
22
+ "minimum": 2,
23
+ "maximum": 9007199254740991
24
+ },
25
+ "reviewerAuthHash": {
26
+ "type": "string",
27
+ "pattern": "^[a-f0-9]{64}$"
28
+ },
29
+ "keyring": {
30
+ "type": "object",
31
+ "additionalProperties": false,
32
+ "properties": {
33
+ "iv": {
34
+ "type": "string",
35
+ "pattern": "^[A-Za-z0-9_-]{16}$"
36
+ },
37
+ "ciphertext": {
38
+ "type": "string",
39
+ "pattern": "^[A-Za-z0-9_-]+$",
40
+ "maxLength": 65536
41
+ }
42
+ },
43
+ "required": [
44
+ "iv",
45
+ "ciphertext"
46
+ ]
47
+ },
48
+ "signature": {
49
+ "type": "string",
50
+ "pattern": "^[A-Za-z0-9_-]{86}$"
51
+ }
52
+ },
53
+ "required": [
54
+ "operationId",
55
+ "expectedVersion",
56
+ "epoch",
57
+ "reviewerAuthHash",
58
+ "keyring",
59
+ "signature"
60
+ ]
61
+ }
@@ -0,0 +1,122 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openplanr.dev/schemas/v1.18.0/runtime-lock.schema.json",
4
+ "title": "OpenPlanr project runtime lock",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "generatedAt",
10
+ "manifestDigest",
11
+ "protocolVersion",
12
+ "components",
13
+ "adapters"
14
+ ],
15
+ "properties": {
16
+ "schemaVersion": {
17
+ "const": "1.0.0"
18
+ },
19
+ "generatedAt": {
20
+ "type": "string",
21
+ "format": "date-time"
22
+ },
23
+ "manifestDigest": {
24
+ "type": "string",
25
+ "pattern": "^sha256:[a-f0-9]{64}$"
26
+ },
27
+ "protocolVersion": {
28
+ "type": "string",
29
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
30
+ },
31
+ "components": {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "required": [
35
+ "cli",
36
+ "pipeline",
37
+ "skills"
38
+ ],
39
+ "properties": {
40
+ "cli": {
41
+ "type": "string",
42
+ "pattern": "^\\d+\\.\\d+\\.\\d+"
43
+ },
44
+ "pipeline": {
45
+ "type": "string",
46
+ "pattern": "^\\d+\\.\\d+\\.\\d+"
47
+ },
48
+ "skills": {
49
+ "type": "string",
50
+ "pattern": "^\\d+\\.\\d+\\.\\d+"
51
+ }
52
+ }
53
+ },
54
+ "adapters": {
55
+ "type": "array",
56
+ "items": {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "required": [
60
+ "runtime",
61
+ "version",
62
+ "capabilityLevel",
63
+ "installScope"
64
+ ],
65
+ "properties": {
66
+ "runtime": {
67
+ "type": "string",
68
+ "pattern": "^[a-z][a-z0-9-]*$"
69
+ },
70
+ "version": {
71
+ "type": "string",
72
+ "pattern": "^\\d+\\.\\d+\\.\\d+"
73
+ },
74
+ "capabilityLevel": {
75
+ "type": "string",
76
+ "enum": [
77
+ "artifact",
78
+ "workflow",
79
+ "product"
80
+ ]
81
+ },
82
+ "installScope": {
83
+ "type": "string",
84
+ "enum": [
85
+ "user",
86
+ "project",
87
+ "both"
88
+ ]
89
+ },
90
+ "model": {
91
+ "type": "string",
92
+ "minLength": 1
93
+ }
94
+ }
95
+ }
96
+ },
97
+ "skillModes": {
98
+ "type": "object",
99
+ "additionalProperties": false,
100
+ "properties": {
101
+ "claude-code": {
102
+ "const": "unified-plugin"
103
+ },
104
+ "codex": {
105
+ "type": "string",
106
+ "enum": [
107
+ "direct",
108
+ "unified-plugin",
109
+ "project-rule"
110
+ ]
111
+ },
112
+ "cursor": {
113
+ "const": "project-rule"
114
+ }
115
+ }
116
+ }
117
+ },
118
+ "x-openplanr-contract": {
119
+ "id": "runtime-lock",
120
+ "version": "1.18.0"
121
+ }
122
+ }
@@ -0,0 +1,2 @@
1
+ /** Inspect finite, acyclic JSON data with resource limits before reading schema fields. */
2
+ export declare function assertLargeObjectData<T>(value: T): T;
@@ -0,0 +1,56 @@
1
+ import { assertPlainData } from './canonical-json.mjs';
2
+
3
+ /** Bound hostile input before any resource schema reader or contract field access.
4
+ * @type {typeof import('./bounded-json-data.d.mts').assertLargeObjectData}
5
+ */
6
+ export function assertLargeObjectData(value) {
7
+ const pending = [[value, 0]],
8
+ visited = new Set();
9
+ let nodes = 0;
10
+ for (let next = pending.pop(); next; next = pending.pop()) {
11
+ const [item, depth, exit] = next;
12
+ if (exit) {
13
+ visited.delete(item);
14
+ continue;
15
+ }
16
+ if (++nodes > 250000 || depth > 40)
17
+ throw new RangeError('Large object complexity exceeds its limit.');
18
+ if (item && typeof item === 'object') {
19
+ if (visited.has(item)) throw new TypeError('Large objects require acyclic plain data.');
20
+ visited.add(item);
21
+ pending.push([item, depth, true]);
22
+ const array = Array.isArray(item);
23
+ const prototype = Object.getPrototypeOf(item);
24
+ if (
25
+ array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null
26
+ )
27
+ throw new TypeError('Large objects require plain data.');
28
+ const descriptors = Object.getOwnPropertyDescriptors(item);
29
+ const keys = Reflect.ownKeys(descriptors);
30
+ const length = array ? descriptors.length.value : null;
31
+ if (array && keys.length !== length + 1)
32
+ throw new TypeError('Large objects require dense JSON arrays.');
33
+ for (const key of keys) {
34
+ if (typeof key !== 'string' || ['__proto__', 'constructor', 'prototype'].includes(key))
35
+ throw new TypeError('Large objects cannot contain unsafe or symbolic keys.');
36
+ const descriptor = descriptors[key];
37
+ if (!('value' in descriptor))
38
+ throw new TypeError('Large objects cannot contain accessors.');
39
+ if (!(array && key === 'length') && !descriptor.enumerable)
40
+ throw new TypeError('Large objects require enumerable JSON fields.');
41
+ if (
42
+ array &&
43
+ key !== 'length' &&
44
+ (!Number.isSafeInteger(Number(key)) ||
45
+ Number(key) < 0 ||
46
+ Number(key) >= length ||
47
+ String(Number(key)) !== key)
48
+ )
49
+ throw new TypeError('Large objects require numeric JSON array indices.');
50
+ pending.push([descriptor.value, depth + 1]);
51
+ }
52
+ }
53
+ }
54
+ assertPlainData(value, 'Large object data');
55
+ return value;
56
+ }
@@ -6,7 +6,16 @@ export declare const PROTOCOL_V111_CONTRACTS: Readonly<Record<string, string>>;
6
6
  export declare function protocolAssetUrl(
7
7
  kind: string,
8
8
  options?: {
9
- protocolVersion?: '1.5.0' | '1.6.0' | '1.7.0' | '1.8.0' | '1.11.0' | '1.13.0' | '1.15.0';
9
+ protocolVersion?:
10
+ | '1.5.0'
11
+ | '1.6.0'
12
+ | '1.7.0'
13
+ | '1.8.0'
14
+ | '1.11.0'
15
+ | '1.13.0'
16
+ | '1.15.0'
17
+ | '1.16.0'
18
+ | '1.17.0';
10
19
  },
11
20
  ): URL;
12
21
  export declare const PROTOCOL_V113_CONTRACTS: Readonly<Record<string, string>>;
@@ -17,3 +26,7 @@ export declare function validateDiagramReviewArtifact(
17
26
  value: unknown,
18
27
  options?: { protocolVersion?: string },
19
28
  ): Array<{ path: string; rule: string; detail: string }>;
29
+
30
+ export declare const PROTOCOL_V116_CONTRACTS: Readonly<Record<string, string>>;
31
+
32
+ export declare const PROTOCOL_V117_CONTRACTS: Readonly<Record<string, string>>;
@@ -1,4 +1,5 @@
1
1
  // @ts-check
2
+
2
3
  import { DESIGN_HANDOFF_CONTRACT_FILES } from './design-handoff-contracts.mjs';
3
4
  import { DIAGRAM_AUTHORING_CONTRACT_FILES } from './diagram-authoring-contracts.mjs';
4
5
  import {
@@ -7,6 +8,7 @@ import {
7
8
  assertDiagramWorkspaceContract,
8
9
  DIAGRAM_REVIEW_SCHEMAS,
9
10
  } from './diagram-review-contracts.mjs';
11
+ import { LARGE_OBJECT_SCHEMAS } from './large-object-contracts.mjs';
10
12
  import {
11
13
  PROTOCOL_V16_CONTRACT_FILES,
12
14
  PROTOCOL_V17_CONTRACT_FILES,
@@ -73,6 +75,18 @@ export function validateDiagramReviewArtifact(kind, value, { protocolVersion = '
73
75
  }
74
76
  }
75
77
 
78
+ /** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V116_CONTRACTS} */
79
+ export const PROTOCOL_V116_CONTRACTS = Object.freeze({
80
+ 'artifact-envelope': 'artifact-envelope.schema.json',
81
+ 'design-review-bundle': 'design-review-bundle.schema.json',
82
+ });
83
+
84
+ export const PROTOCOL_V117_CONTRACTS = Object.freeze(
85
+ Object.fromEntries(
86
+ Object.keys(LARGE_OBJECT_SCHEMAS).map((kind) => [kind, `${kind}.schema.json`]),
87
+ ),
88
+ );
89
+
76
90
  const PROTOCOL_CONTRACTS_BY_VERSION = Object.freeze({
77
91
  '1.5.0': PROTOCOL_V15_CONTRACTS,
78
92
  '1.6.0': PROTOCOL_V16_CONTRACTS,
@@ -81,6 +95,8 @@ const PROTOCOL_CONTRACTS_BY_VERSION = Object.freeze({
81
95
  '1.11.0': PROTOCOL_V111_CONTRACTS,
82
96
  '1.13.0': PROTOCOL_V113_CONTRACTS,
83
97
  '1.15.0': PROTOCOL_V115_CONTRACTS,
98
+ '1.16.0': PROTOCOL_V116_CONTRACTS,
99
+ '1.17.0': PROTOCOL_V117_CONTRACTS,
84
100
  });
85
101
 
86
102
  /**
@@ -65,7 +65,7 @@ export function canonicalizeJson(value) {
65
65
  return serialize(value, '$', new Set());
66
66
  }
67
67
 
68
- const SHA256_K = /* @__PURE__ */ new Uint32Array([
68
+ const SHA256_K = /* @__PURE__ */ new Int32Array([
69
69
  0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
70
70
  0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
71
71
  0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
@@ -108,7 +108,8 @@ export function sha256Hex(value) {
108
108
  let h5 = 0x9b05688c;
109
109
  let h6 = 0x1f83d9ab;
110
110
  let h7 = 0x5be0cd19;
111
- const words = new Uint32Array(64);
111
+ // Signed words retain the same modulo-2^32 bits without promoting each round to unsigned doubles.
112
+ const words = new Int32Array(64);
112
113
 
113
114
  for (let offset = 0; offset < bytes.length; offset += 64) {
114
115
  for (let index = 0; index < 16; index += 1) words[index] = view.getUint32(offset + index * 4);
@@ -117,7 +118,7 @@ export function sha256Hex(value) {
117
118
  rotr(words[index - 15], 7) ^ rotr(words[index - 15], 18) ^ (words[index - 15] >>> 3);
118
119
  const s1 =
119
120
  rotr(words[index - 2], 17) ^ rotr(words[index - 2], 19) ^ (words[index - 2] >>> 10);
120
- words[index] = (words[index - 16] + s0 + words[index - 7] + s1) >>> 0;
121
+ words[index] = (words[index - 16] + s0 + words[index - 7] + s1) | 0;
121
122
  }
122
123
  let a = h0;
123
124
  let b = h1;
@@ -130,30 +131,30 @@ export function sha256Hex(value) {
130
131
  for (let index = 0; index < 64; index += 1) {
131
132
  const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
132
133
  const choice = (e & f) ^ (~e & g);
133
- const temp1 = (h + s1 + choice + SHA256_K[index] + words[index]) >>> 0;
134
+ const temp1 = (h + s1 + choice + SHA256_K[index] + words[index]) | 0;
134
135
  const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
135
136
  const majority = (a & b) ^ (a & c) ^ (b & c);
136
- const temp2 = (s0 + majority) >>> 0;
137
+ const temp2 = (s0 + majority) | 0;
137
138
  h = g;
138
139
  g = f;
139
140
  f = e;
140
- e = (d + temp1) >>> 0;
141
+ e = (d + temp1) | 0;
141
142
  d = c;
142
143
  c = b;
143
144
  b = a;
144
- a = (temp1 + temp2) >>> 0;
145
+ a = (temp1 + temp2) | 0;
145
146
  }
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;
147
+ h0 = (h0 + a) | 0;
148
+ h1 = (h1 + b) | 0;
149
+ h2 = (h2 + c) | 0;
150
+ h3 = (h3 + d) | 0;
151
+ h4 = (h4 + e) | 0;
152
+ h5 = (h5 + f) | 0;
153
+ h6 = (h6 + g) | 0;
154
+ h7 = (h7 + h) | 0;
154
155
  }
155
156
  return [h0, h1, h2, h3, h4, h5, h6, h7]
156
- .map((part) => part.toString(16).padStart(8, '0'))
157
+ .map((part) => (part >>> 0).toString(16).padStart(8, '0'))
157
158
  .join('');
158
159
  }
159
160
 
@@ -63,7 +63,7 @@ export declare function resolveOperateExperienceSchemaV2(
63
63
  kind: string,
64
64
  options?: { protocolVersion?: string },
65
65
  ): ResolvedProtocolSchema;
66
- /** Includes closed diagram review kinds at exact Protocol 1.15.0. */
66
+ /** Includes semantic validation for exact diagram readers and additive Protocol 1.17 contracts. */
67
67
  export declare function validateProtocolArtifact(
68
68
  kind: string,
69
69
  value: unknown,