@openplanr/protocol 0.7.3 → 0.8.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.
@@ -0,0 +1,157 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openplanr.dev/schemas/v1.15.0/diagram-review-feedback.schema.json",
4
+ "x-openplanr-contract": {
5
+ "id": "diagram-review-feedback",
6
+ "version": "1.15.0"
7
+ },
8
+ "oneOf": [
9
+ {
10
+ "type": "object",
11
+ "properties": {
12
+ "kind": {
13
+ "const": "comment"
14
+ },
15
+ "author": {
16
+ "type": "string",
17
+ "minLength": 1,
18
+ "maxLength": 160
19
+ },
20
+ "reviewOf": {
21
+ "type": "string",
22
+ "pattern": "^[a-f0-9]{64}$"
23
+ },
24
+ "createdAt": {
25
+ "type": "string",
26
+ "format": "date-time"
27
+ },
28
+ "commentId": {
29
+ "type": "string",
30
+ "minLength": 1,
31
+ "maxLength": 160
32
+ },
33
+ "body": {
34
+ "type": "string",
35
+ "maxLength": 8192,
36
+ "minLength": 1
37
+ },
38
+ "target": {
39
+ "type": "object",
40
+ "properties": {
41
+ "elementId": {
42
+ "type": "string",
43
+ "minLength": 1,
44
+ "maxLength": 160
45
+ },
46
+ "x": {
47
+ "type": "number",
48
+ "minimum": 0,
49
+ "maximum": 1
50
+ },
51
+ "y": {
52
+ "type": "number",
53
+ "minimum": 0,
54
+ "maximum": 1
55
+ }
56
+ },
57
+ "required": [],
58
+ "additionalProperties": false
59
+ }
60
+ },
61
+ "required": [
62
+ "kind",
63
+ "author",
64
+ "reviewOf",
65
+ "createdAt",
66
+ "commentId",
67
+ "body",
68
+ "target"
69
+ ],
70
+ "additionalProperties": false
71
+ },
72
+ {
73
+ "type": "object",
74
+ "properties": {
75
+ "kind": {
76
+ "const": "reply"
77
+ },
78
+ "author": {
79
+ "type": "string",
80
+ "minLength": 1,
81
+ "maxLength": 160
82
+ },
83
+ "reviewOf": {
84
+ "type": "string",
85
+ "pattern": "^[a-f0-9]{64}$"
86
+ },
87
+ "createdAt": {
88
+ "type": "string",
89
+ "format": "date-time"
90
+ },
91
+ "commentId": {
92
+ "type": "string",
93
+ "minLength": 1,
94
+ "maxLength": 160
95
+ },
96
+ "body": {
97
+ "type": "string",
98
+ "maxLength": 8192,
99
+ "minLength": 1
100
+ },
101
+ "parentId": {
102
+ "type": "string",
103
+ "minLength": 1,
104
+ "maxLength": 160
105
+ }
106
+ },
107
+ "required": [
108
+ "kind",
109
+ "author",
110
+ "reviewOf",
111
+ "createdAt",
112
+ "commentId",
113
+ "body",
114
+ "parentId"
115
+ ],
116
+ "additionalProperties": false
117
+ },
118
+ {
119
+ "type": "object",
120
+ "properties": {
121
+ "kind": {
122
+ "const": "resolve"
123
+ },
124
+ "author": {
125
+ "type": "string",
126
+ "minLength": 1,
127
+ "maxLength": 160
128
+ },
129
+ "reviewOf": {
130
+ "type": "string",
131
+ "pattern": "^[a-f0-9]{64}$"
132
+ },
133
+ "createdAt": {
134
+ "type": "string",
135
+ "format": "date-time"
136
+ },
137
+ "commentId": {
138
+ "type": "string",
139
+ "minLength": 1,
140
+ "maxLength": 160
141
+ },
142
+ "resolved": {
143
+ "type": "boolean"
144
+ }
145
+ },
146
+ "required": [
147
+ "kind",
148
+ "author",
149
+ "reviewOf",
150
+ "createdAt",
151
+ "commentId",
152
+ "resolved"
153
+ ],
154
+ "additionalProperties": false
155
+ }
156
+ ]
157
+ }
@@ -0,0 +1,108 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openplanr.dev/schemas/v1.15.0/diagram-review-workspace.schema.json",
4
+ "x-openplanr-contract": {
5
+ "id": "diagram-review-workspace",
6
+ "version": "1.15.0"
7
+ },
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "schemaVersion": {
12
+ "const": "1.0.0"
13
+ },
14
+ "id": {
15
+ "type": "string",
16
+ "pattern": "^[A-Za-z0-9_-]{22,64}$"
17
+ },
18
+ "version": {
19
+ "type": "integer",
20
+ "minimum": 1,
21
+ "maximum": 2147483647
22
+ },
23
+ "epoch": {
24
+ "type": "integer",
25
+ "minimum": 1,
26
+ "maximum": 2147483647
27
+ },
28
+ "currentRevision": {
29
+ "type": "string",
30
+ "pattern": "^[A-Za-z0-9_-]{22,64}$"
31
+ },
32
+ "commentsPaused": {
33
+ "type": "boolean"
34
+ },
35
+ "ownerPublicKey": {
36
+ "type": "object",
37
+ "additionalProperties": false,
38
+ "required": [
39
+ "kty",
40
+ "crv",
41
+ "x",
42
+ "y"
43
+ ],
44
+ "properties": {
45
+ "kty": {
46
+ "const": "EC"
47
+ },
48
+ "crv": {
49
+ "const": "P-256"
50
+ },
51
+ "x": {
52
+ "type": "string",
53
+ "pattern": "^[A-Za-z0-9_-]+$",
54
+ "minLength": 43,
55
+ "maxLength": 43
56
+ },
57
+ "y": {
58
+ "type": "string",
59
+ "pattern": "^[A-Za-z0-9_-]+$",
60
+ "minLength": 43,
61
+ "maxLength": 43
62
+ },
63
+ "ext": {
64
+ "type": "boolean"
65
+ },
66
+ "key_ops": {
67
+ "type": "array",
68
+ "items": {
69
+ "const": "verify"
70
+ },
71
+ "maxItems": 1
72
+ }
73
+ }
74
+ },
75
+ "keyring": {
76
+ "type": "object",
77
+ "additionalProperties": false,
78
+ "required": [
79
+ "iv",
80
+ "ciphertext"
81
+ ],
82
+ "properties": {
83
+ "iv": {
84
+ "type": "string",
85
+ "pattern": "^[A-Za-z0-9_-]+$",
86
+ "minLength": 16,
87
+ "maxLength": 16
88
+ },
89
+ "ciphertext": {
90
+ "type": "string",
91
+ "pattern": "^[A-Za-z0-9_-]+$",
92
+ "minLength": 22,
93
+ "maxLength": 6990507
94
+ }
95
+ }
96
+ }
97
+ },
98
+ "required": [
99
+ "schemaVersion",
100
+ "id",
101
+ "version",
102
+ "epoch",
103
+ "currentRevision",
104
+ "commentsPaused",
105
+ "ownerPublicKey",
106
+ "keyring"
107
+ ]
108
+ }
@@ -0,0 +1,170 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openplanr.dev/schemas/v1.15.0/diagram-workspace-create.schema.json",
4
+ "x-openplanr-contract": {
5
+ "id": "diagram-workspace-create",
6
+ "version": "1.15.0"
7
+ },
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "schemaVersion": {
12
+ "const": "1.0.0"
13
+ },
14
+ "id": {
15
+ "type": "string",
16
+ "pattern": "^[A-Za-z0-9_-]{22,64}$"
17
+ },
18
+ "ownerPublicKey": {
19
+ "type": "object",
20
+ "additionalProperties": false,
21
+ "required": [
22
+ "kty",
23
+ "crv",
24
+ "x",
25
+ "y"
26
+ ],
27
+ "properties": {
28
+ "kty": {
29
+ "const": "EC"
30
+ },
31
+ "crv": {
32
+ "const": "P-256"
33
+ },
34
+ "x": {
35
+ "type": "string",
36
+ "pattern": "^[A-Za-z0-9_-]+$",
37
+ "minLength": 43,
38
+ "maxLength": 43
39
+ },
40
+ "y": {
41
+ "type": "string",
42
+ "pattern": "^[A-Za-z0-9_-]+$",
43
+ "minLength": 43,
44
+ "maxLength": 43
45
+ },
46
+ "ext": {
47
+ "type": "boolean"
48
+ },
49
+ "key_ops": {
50
+ "type": "array",
51
+ "items": {
52
+ "const": "verify"
53
+ },
54
+ "maxItems": 1
55
+ }
56
+ }
57
+ },
58
+ "ownerAuthHash": {
59
+ "type": "string",
60
+ "pattern": "^[a-f0-9]{64}$"
61
+ },
62
+ "reviewerAuthHash": {
63
+ "type": "string",
64
+ "pattern": "^[a-f0-9]{64}$"
65
+ },
66
+ "epoch": {
67
+ "const": 1
68
+ },
69
+ "keyring": {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "required": [
73
+ "iv",
74
+ "ciphertext"
75
+ ],
76
+ "properties": {
77
+ "iv": {
78
+ "type": "string",
79
+ "pattern": "^[A-Za-z0-9_-]+$",
80
+ "minLength": 16,
81
+ "maxLength": 16
82
+ },
83
+ "ciphertext": {
84
+ "type": "string",
85
+ "pattern": "^[A-Za-z0-9_-]+$",
86
+ "minLength": 22,
87
+ "maxLength": 6990507
88
+ }
89
+ }
90
+ },
91
+ "revision": {
92
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
93
+ "$id": "https://openplanr.dev/schemas/v1.9.0/design-workspace-revision.schema.json",
94
+ "x-openplanr-contract": {
95
+ "id": "design-workspace-revision",
96
+ "version": "1.9.0"
97
+ },
98
+ "type": "object",
99
+ "additionalProperties": false,
100
+ "properties": {
101
+ "id": {
102
+ "type": "string",
103
+ "pattern": "^[A-Za-z0-9_-]{22,64}$"
104
+ },
105
+ "epoch": {
106
+ "type": "integer",
107
+ "minimum": 1,
108
+ "maximum": 2147483647
109
+ },
110
+ "reviewOf": {
111
+ "type": "string",
112
+ "pattern": "^[a-f0-9]{64}$"
113
+ },
114
+ "createdAt": {
115
+ "type": "string",
116
+ "format": "date-time"
117
+ },
118
+ "iv": {
119
+ "type": "string",
120
+ "pattern": "^[A-Za-z0-9_-]+$",
121
+ "minLength": 16,
122
+ "maxLength": 16
123
+ },
124
+ "ciphertext": {
125
+ "type": "string",
126
+ "pattern": "^[A-Za-z0-9_-]+$",
127
+ "minLength": 22,
128
+ "maxLength": 6990507
129
+ },
130
+ "signature": {
131
+ "type": "string",
132
+ "pattern": "^[A-Za-z0-9_-]+$",
133
+ "minLength": 86,
134
+ "maxLength": 86
135
+ }
136
+ },
137
+ "required": [
138
+ "id",
139
+ "epoch",
140
+ "reviewOf",
141
+ "createdAt",
142
+ "iv",
143
+ "ciphertext",
144
+ "signature"
145
+ ]
146
+ },
147
+ "operationId": {
148
+ "type": "string",
149
+ "pattern": "^[A-Za-z0-9_-]{22,64}$"
150
+ },
151
+ "signature": {
152
+ "type": "string",
153
+ "pattern": "^[A-Za-z0-9_-]+$",
154
+ "minLength": 86,
155
+ "maxLength": 86
156
+ }
157
+ },
158
+ "required": [
159
+ "schemaVersion",
160
+ "id",
161
+ "ownerPublicKey",
162
+ "ownerAuthHash",
163
+ "reviewerAuthHash",
164
+ "epoch",
165
+ "keyring",
166
+ "revision",
167
+ "operationId",
168
+ "signature"
169
+ ]
170
+ }
@@ -0,0 +1,97 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openplanr.dev/schemas/v1.15.0/diagram-workspace-event.schema.json",
4
+ "x-openplanr-contract": {
5
+ "id": "diagram-workspace-event",
6
+ "version": "1.15.0"
7
+ },
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "id": {
12
+ "type": "string",
13
+ "pattern": "^[A-Za-z0-9_-]{22,64}$"
14
+ },
15
+ "revisionId": {
16
+ "type": "string",
17
+ "pattern": "^[A-Za-z0-9_-]{22,64}$"
18
+ },
19
+ "reviewOf": {
20
+ "type": "string",
21
+ "pattern": "^[a-f0-9]{64}$"
22
+ },
23
+ "epoch": {
24
+ "type": "integer",
25
+ "minimum": 1,
26
+ "maximum": 2147483647
27
+ },
28
+ "iv": {
29
+ "type": "string",
30
+ "pattern": "^[A-Za-z0-9_-]+$",
31
+ "minLength": 16,
32
+ "maxLength": 16
33
+ },
34
+ "ciphertext": {
35
+ "type": "string",
36
+ "pattern": "^[A-Za-z0-9_-]+$",
37
+ "minLength": 22,
38
+ "maxLength": 6990507
39
+ },
40
+ "publicKey": {
41
+ "type": "object",
42
+ "additionalProperties": false,
43
+ "required": [
44
+ "kty",
45
+ "crv",
46
+ "x",
47
+ "y"
48
+ ],
49
+ "properties": {
50
+ "kty": {
51
+ "const": "EC"
52
+ },
53
+ "crv": {
54
+ "const": "P-256"
55
+ },
56
+ "x": {
57
+ "type": "string",
58
+ "pattern": "^[A-Za-z0-9_-]+$",
59
+ "minLength": 43,
60
+ "maxLength": 43
61
+ },
62
+ "y": {
63
+ "type": "string",
64
+ "pattern": "^[A-Za-z0-9_-]+$",
65
+ "minLength": 43,
66
+ "maxLength": 43
67
+ },
68
+ "ext": {
69
+ "type": "boolean"
70
+ },
71
+ "key_ops": {
72
+ "type": "array",
73
+ "items": {
74
+ "const": "verify"
75
+ },
76
+ "maxItems": 1
77
+ }
78
+ }
79
+ },
80
+ "signature": {
81
+ "type": "string",
82
+ "pattern": "^[A-Za-z0-9_-]+$",
83
+ "minLength": 86,
84
+ "maxLength": 86
85
+ }
86
+ },
87
+ "required": [
88
+ "id",
89
+ "revisionId",
90
+ "reviewOf",
91
+ "epoch",
92
+ "iv",
93
+ "ciphertext",
94
+ "publicKey",
95
+ "signature"
96
+ ]
97
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openplanr.dev/schemas/v1.15.0/diagram-workspace-revision.schema.json",
4
+ "x-openplanr-contract": {
5
+ "id": "diagram-workspace-revision",
6
+ "version": "1.15.0"
7
+ },
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "id": {
12
+ "type": "string",
13
+ "pattern": "^[A-Za-z0-9_-]{22,64}$"
14
+ },
15
+ "epoch": {
16
+ "type": "integer",
17
+ "minimum": 1,
18
+ "maximum": 2147483647
19
+ },
20
+ "reviewOf": {
21
+ "type": "string",
22
+ "pattern": "^[a-f0-9]{64}$"
23
+ },
24
+ "createdAt": {
25
+ "type": "string",
26
+ "format": "date-time"
27
+ },
28
+ "iv": {
29
+ "type": "string",
30
+ "pattern": "^[A-Za-z0-9_-]+$",
31
+ "minLength": 16,
32
+ "maxLength": 16
33
+ },
34
+ "ciphertext": {
35
+ "type": "string",
36
+ "pattern": "^[A-Za-z0-9_-]+$",
37
+ "minLength": 22,
38
+ "maxLength": 6990507
39
+ },
40
+ "signature": {
41
+ "type": "string",
42
+ "pattern": "^[A-Za-z0-9_-]+$",
43
+ "minLength": 86,
44
+ "maxLength": 86
45
+ }
46
+ },
47
+ "required": [
48
+ "id",
49
+ "epoch",
50
+ "reviewOf",
51
+ "createdAt",
52
+ "iv",
53
+ "ciphertext",
54
+ "signature"
55
+ ]
56
+ }
@@ -5,6 +5,15 @@ 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?: { protocolVersion?: '1.5.0' | '1.6.0' | '1.7.0' | '1.8.0' | '1.11.0' | '1.13.0' },
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';
10
+ },
9
11
  ): URL;
10
12
  export declare const PROTOCOL_V113_CONTRACTS: Readonly<Record<string, string>>;
13
+
14
+ export declare const PROTOCOL_V115_CONTRACTS: Readonly<Record<string, string>>;
15
+ export declare function validateDiagramReviewArtifact(
16
+ kind: string,
17
+ value: unknown,
18
+ options?: { protocolVersion?: string },
19
+ ): Array<{ path: string; rule: string; detail: string }>;
@@ -1,6 +1,12 @@
1
1
  // @ts-check
2
2
  import { DESIGN_HANDOFF_CONTRACT_FILES } from './design-handoff-contracts.mjs';
3
3
  import { DIAGRAM_AUTHORING_CONTRACT_FILES } from './diagram-authoring-contracts.mjs';
4
+ import {
5
+ assertDiagramReviewBundle,
6
+ assertDiagramReviewFeedback,
7
+ assertDiagramWorkspaceContract,
8
+ DIAGRAM_REVIEW_SCHEMAS,
9
+ } from './diagram-review-contracts.mjs';
4
10
  import {
5
11
  PROTOCOL_V16_CONTRACT_FILES,
6
12
  PROTOCOL_V17_CONTRACT_FILES,
@@ -38,6 +44,35 @@ export const PROTOCOL_V111_CONTRACTS = Object.freeze({
38
44
  /** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V113_CONTRACTS} */
39
45
  export const PROTOCOL_V113_CONTRACTS = DIAGRAM_AUTHORING_CONTRACT_FILES;
40
46
 
47
+ /** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V115_CONTRACTS} */
48
+ export const PROTOCOL_V115_CONTRACTS = Object.freeze(
49
+ Object.fromEntries(
50
+ Object.keys(DIAGRAM_REVIEW_SCHEMAS).map((kind) => [kind, `${kind}.schema.json`]),
51
+ ),
52
+ );
53
+
54
+ /** Keep semantic checks and inert-data safety identical in Node, browsers and Workers.
55
+ * @type {typeof import('./browser-contracts.d.mts').validateDiagramReviewArtifact}
56
+ */
57
+ export function validateDiagramReviewArtifact(kind, value, { protocolVersion = '1.15.0' } = {}) {
58
+ if (protocolVersion !== '1.15.0' || !Object.hasOwn(DIAGRAM_REVIEW_SCHEMAS, kind))
59
+ throw new RangeError(`Unknown diagram review Protocol contract: ${kind}@${protocolVersion}`);
60
+ try {
61
+ if (kind === 'diagram-review-bundle') assertDiagramReviewBundle(value);
62
+ else if (kind === 'diagram-review-feedback') assertDiagramReviewFeedback(value);
63
+ else assertDiagramWorkspaceContract(value, kind);
64
+ return [];
65
+ } catch (error) {
66
+ return [
67
+ {
68
+ path: '$',
69
+ rule: 'diagram-review-contract',
70
+ detail: error instanceof Error ? error.message : 'Invalid diagram review data.',
71
+ },
72
+ ];
73
+ }
74
+ }
75
+
41
76
  const PROTOCOL_CONTRACTS_BY_VERSION = Object.freeze({
42
77
  '1.5.0': PROTOCOL_V15_CONTRACTS,
43
78
  '1.6.0': PROTOCOL_V16_CONTRACTS,
@@ -45,6 +80,7 @@ const PROTOCOL_CONTRACTS_BY_VERSION = Object.freeze({
45
80
  '1.8.0': PROTOCOL_V18_CONTRACTS,
46
81
  '1.11.0': PROTOCOL_V111_CONTRACTS,
47
82
  '1.13.0': PROTOCOL_V113_CONTRACTS,
83
+ '1.15.0': PROTOCOL_V115_CONTRACTS,
48
84
  });
49
85
 
50
86
  /**
@@ -63,6 +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
67
  export declare function validateProtocolArtifact(
67
68
  kind: string,
68
69
  value: unknown,