@openplanr/protocol 0.7.3 → 0.9.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/README.md +22 -0
- package/package.json +21 -1
- package/registries/commands.json +11 -11
- package/registries/skills.json +89 -11
- package/registry/v1.17.0/commands.json +88 -0
- package/schemas/v1.15.0/diagram-review-bundle.schema.json +1280 -0
- package/schemas/v1.15.0/diagram-review-feedback.schema.json +157 -0
- package/schemas/v1.15.0/diagram-review-workspace.schema.json +108 -0
- package/schemas/v1.15.0/diagram-workspace-create.schema.json +170 -0
- package/schemas/v1.15.0/diagram-workspace-event.schema.json +97 -0
- package/schemas/v1.15.0/diagram-workspace-revision.schema.json +56 -0
- package/schemas/v1.16.0/artifact-envelope.schema.json +408 -0
- package/schemas/v1.16.0/design-review-bundle.schema.json +590 -0
- package/schemas/v1.17.0/artifact-paste-v2.schema.json +52 -0
- package/schemas/v1.17.0/artifact-room-append-v3.schema.json +159 -0
- package/schemas/v1.17.0/artifact-room-create-v3.schema.json +111 -0
- package/schemas/v1.17.0/artifact-room-descriptor-v3.schema.json +92 -0
- package/schemas/v1.17.0/artifact-room-event-v3.schema.json +130 -0
- package/schemas/v1.17.0/artifact-room-management-v3.schema.json +47 -0
- package/schemas/v1.17.0/artifact-room-read-page-v3.schema.json +308 -0
- package/schemas/v1.17.0/company-resource-manifest.schema.json +128 -0
- package/schemas/v1.17.0/company-resource-upload-prepare.schema.json +164 -0
- package/schemas/v1.17.0/company-resource-upload-receipt.schema.json +63 -0
- package/schemas/v1.17.0/company-resource-upload-status.schema.json +123 -0
- package/schemas/v1.17.0/diagram-authoring-bundle.schema.json +1117 -0
- package/schemas/v1.17.0/diagram-edit-transaction.schema.json +3295 -0
- package/schemas/v1.17.0/diagram-presentation.schema.json +37 -0
- package/schemas/v1.17.0/diagram-review-bundle.schema.json +2439 -0
- package/schemas/v1.17.0/encrypted-resource-manifest.schema.json +131 -0
- package/schemas/v1.17.0/encrypted-upload-commit.schema.json +38 -0
- package/schemas/v1.17.0/encrypted-upload-prepare.schema.json +234 -0
- package/schemas/v1.17.0/encrypted-upload-receipt.schema.json +54 -0
- package/schemas/v1.17.0/encrypted-upload-status.schema.json +129 -0
- package/schemas/v1.17.0/encrypted-workspace-event-v2.schema.json +79 -0
- package/schemas/v1.17.0/encrypted-workspace-v2.schema.json +91 -0
- package/schemas/v1.17.0/enterprise-agent-handoff.schema.json +985 -0
- package/schemas/v1.17.0/enterprise-artifact-revision.schema.json +115 -0
- package/schemas/v1.17.0/enterprise-change-proposal.schema.json +379 -0
- package/schemas/v1.17.0/enterprise-evidence-reference.schema.json +159 -0
- package/schemas/v1.17.0/enterprise-review-thread.schema.json +298 -0
- package/schemas/v1.17.0/enterprise-sync-state.schema.json +189 -0
- package/schemas/v1.17.0/preview-bridge-message.schema.json +197 -0
- package/schemas/v1.17.0/resource-catalog.schema.json +145 -0
- package/schemas/v1.17.0/sharing-crypto-aad.schema.json +36 -0
- package/schemas/v1.17.0/workspace-management-v2.schema.json +45 -0
- package/schemas/v1.17.0/workspace-rotation-v2.schema.json +61 -0
- package/src/bounded-json-data.d.mts +2 -0
- package/src/bounded-json-data.mjs +56 -0
- package/src/browser-contracts.d.mts +23 -1
- package/src/browser-contracts.mjs +52 -0
- package/src/canonical-json.mjs +17 -16
- package/src/contracts.d.mts +1 -0
- package/src/contracts.mjs +106 -5
- package/src/diagram-authoring-contracts.d.mts +12 -0
- package/src/diagram-authoring-contracts.mjs +174 -1
- package/src/diagram-review-contracts.d.mts +73 -0
- package/src/diagram-review-contracts.mjs +250 -0
- package/src/enterprise-contract-validation.d.mts +44 -0
- package/src/enterprise-contract-validation.mjs +279 -0
- package/src/enterprise-contracts.mjs +25 -231
- package/src/enterprise-resource-contracts.d.mts +72 -0
- package/src/enterprise-resource-contracts.mjs +202 -0
- package/src/generated/artifact-envelope-metadata.mjs +769 -0
- package/src/generated/canonical-registries.mjs +100 -22
- package/src/index.d.mts +22 -0
- package/src/index.mjs +26 -0
- package/src/large-object-contracts.d.mts +107 -0
- package/src/large-object-contracts.mjs +473 -0
- package/src/large-object-limits.d.mts +16 -0
- package/src/large-object-limits.mjs +17 -0
- package/src/registries.mjs +1 -0
- package/src/review-experience-contracts.d.mts +1 -0
- package/src/review-experience-contracts.mjs +25 -4
- package/src/sharing-security-contracts.d.mts +63 -0
- package/src/sharing-security-contracts.mjs +403 -0
- package/src/studio-presentation-contracts.d.mts +92 -0
- 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,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
|
+
}
|
|
@@ -5,6 +5,28 @@ export declare const PROTOCOL_V18_CONTRACTS: Readonly<Record<string, string>>;
|
|
|
5
5
|
export declare const PROTOCOL_V111_CONTRACTS: Readonly<Record<string, string>>;
|
|
6
6
|
export declare function protocolAssetUrl(
|
|
7
7
|
kind: string,
|
|
8
|
-
options?: {
|
|
8
|
+
options?: {
|
|
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';
|
|
19
|
+
},
|
|
9
20
|
): URL;
|
|
10
21
|
export declare const PROTOCOL_V113_CONTRACTS: Readonly<Record<string, string>>;
|
|
22
|
+
|
|
23
|
+
export declare const PROTOCOL_V115_CONTRACTS: Readonly<Record<string, string>>;
|
|
24
|
+
export declare function validateDiagramReviewArtifact(
|
|
25
|
+
kind: string,
|
|
26
|
+
value: unknown,
|
|
27
|
+
options?: { protocolVersion?: string },
|
|
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,6 +1,14 @@
|
|
|
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';
|
|
5
|
+
import {
|
|
6
|
+
assertDiagramReviewBundle,
|
|
7
|
+
assertDiagramReviewFeedback,
|
|
8
|
+
assertDiagramWorkspaceContract,
|
|
9
|
+
DIAGRAM_REVIEW_SCHEMAS,
|
|
10
|
+
} from './diagram-review-contracts.mjs';
|
|
11
|
+
import { LARGE_OBJECT_SCHEMAS } from './large-object-contracts.mjs';
|
|
4
12
|
import {
|
|
5
13
|
PROTOCOL_V16_CONTRACT_FILES,
|
|
6
14
|
PROTOCOL_V17_CONTRACT_FILES,
|
|
@@ -38,6 +46,47 @@ export const PROTOCOL_V111_CONTRACTS = Object.freeze({
|
|
|
38
46
|
/** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V113_CONTRACTS} */
|
|
39
47
|
export const PROTOCOL_V113_CONTRACTS = DIAGRAM_AUTHORING_CONTRACT_FILES;
|
|
40
48
|
|
|
49
|
+
/** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V115_CONTRACTS} */
|
|
50
|
+
export const PROTOCOL_V115_CONTRACTS = Object.freeze(
|
|
51
|
+
Object.fromEntries(
|
|
52
|
+
Object.keys(DIAGRAM_REVIEW_SCHEMAS).map((kind) => [kind, `${kind}.schema.json`]),
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
/** Keep semantic checks and inert-data safety identical in Node, browsers and Workers.
|
|
57
|
+
* @type {typeof import('./browser-contracts.d.mts').validateDiagramReviewArtifact}
|
|
58
|
+
*/
|
|
59
|
+
export function validateDiagramReviewArtifact(kind, value, { protocolVersion = '1.15.0' } = {}) {
|
|
60
|
+
if (protocolVersion !== '1.15.0' || !Object.hasOwn(DIAGRAM_REVIEW_SCHEMAS, kind))
|
|
61
|
+
throw new RangeError(`Unknown diagram review Protocol contract: ${kind}@${protocolVersion}`);
|
|
62
|
+
try {
|
|
63
|
+
if (kind === 'diagram-review-bundle') assertDiagramReviewBundle(value);
|
|
64
|
+
else if (kind === 'diagram-review-feedback') assertDiagramReviewFeedback(value);
|
|
65
|
+
else assertDiagramWorkspaceContract(value, kind);
|
|
66
|
+
return [];
|
|
67
|
+
} catch (error) {
|
|
68
|
+
return [
|
|
69
|
+
{
|
|
70
|
+
path: '$',
|
|
71
|
+
rule: 'diagram-review-contract',
|
|
72
|
+
detail: error instanceof Error ? error.message : 'Invalid diagram review data.',
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
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
|
+
|
|
41
90
|
const PROTOCOL_CONTRACTS_BY_VERSION = Object.freeze({
|
|
42
91
|
'1.5.0': PROTOCOL_V15_CONTRACTS,
|
|
43
92
|
'1.6.0': PROTOCOL_V16_CONTRACTS,
|
|
@@ -45,6 +94,9 @@ const PROTOCOL_CONTRACTS_BY_VERSION = Object.freeze({
|
|
|
45
94
|
'1.8.0': PROTOCOL_V18_CONTRACTS,
|
|
46
95
|
'1.11.0': PROTOCOL_V111_CONTRACTS,
|
|
47
96
|
'1.13.0': PROTOCOL_V113_CONTRACTS,
|
|
97
|
+
'1.15.0': PROTOCOL_V115_CONTRACTS,
|
|
98
|
+
'1.16.0': PROTOCOL_V116_CONTRACTS,
|
|
99
|
+
'1.17.0': PROTOCOL_V117_CONTRACTS,
|
|
48
100
|
});
|
|
49
101
|
|
|
50
102
|
/**
|
package/src/canonical-json.mjs
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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)
|
|
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])
|
|
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)
|
|
137
|
+
const temp2 = (s0 + majority) | 0;
|
|
137
138
|
h = g;
|
|
138
139
|
g = f;
|
|
139
140
|
f = e;
|
|
140
|
-
e = (d + temp1)
|
|
141
|
+
e = (d + temp1) | 0;
|
|
141
142
|
d = c;
|
|
142
143
|
c = b;
|
|
143
144
|
b = a;
|
|
144
|
-
a = (temp1 + temp2)
|
|
145
|
+
a = (temp1 + temp2) | 0;
|
|
145
146
|
}
|
|
146
|
-
h0 = (h0 + a)
|
|
147
|
-
h1 = (h1 + b)
|
|
148
|
-
h2 = (h2 + c)
|
|
149
|
-
h3 = (h3 + d)
|
|
150
|
-
h4 = (h4 + e)
|
|
151
|
-
h5 = (h5 + f)
|
|
152
|
-
h6 = (h6 + g)
|
|
153
|
-
h7 = (h7 + h)
|
|
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
|
|
package/src/contracts.d.mts
CHANGED
|
@@ -63,6 +63,7 @@ export declare function resolveOperateExperienceSchemaV2(
|
|
|
63
63
|
kind: string,
|
|
64
64
|
options?: { protocolVersion?: string },
|
|
65
65
|
): ResolvedProtocolSchema;
|
|
66
|
+
/** Includes semantic validation for exact diagram readers and additive Protocol 1.17 contracts. */
|
|
66
67
|
export declare function validateProtocolArtifact(
|
|
67
68
|
kind: string,
|
|
68
69
|
value: unknown,
|