@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.
- package/README.md +9 -0
- package/package.json +17 -1
- package/registries/commands.json +22 -22
- package/registries/skills.json +136 -58
- package/registry/v1.17.0/commands.json +88 -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/schemas/v1.18.0/runtime-lock.schema.json +122 -0
- package/src/bounded-json-data.d.mts +2 -0
- package/src/bounded-json-data.mjs +56 -0
- package/src/browser-contracts.d.mts +14 -1
- package/src/browser-contracts.mjs +16 -0
- package/src/canonical-json.mjs +17 -16
- package/src/contracts.d.mts +1 -1
- package/src/contracts.mjs +97 -3
- package/src/diagram-authoring-contracts.d.mts +12 -0
- package/src/diagram-authoring-contracts.mjs +174 -1
- 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 +158 -80
- package/src/index.d.mts +21 -0
- package/src/index.mjs +23 -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,202 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
/** Additive Protocol 1.17 revision references for staged company resources. */
|
|
3
|
+
import { assertLargeObjectData } from './bounded-json-data.mjs';
|
|
4
|
+
import { canonicalizeJson, deepFreeze, sha256Hex } from './canonical-json.mjs';
|
|
5
|
+
import {
|
|
6
|
+
assertEnterpriseContractWithSchema,
|
|
7
|
+
assertEnterpriseEvidenceWithSchema,
|
|
8
|
+
assertEnterpriseHandoffWithSchema,
|
|
9
|
+
assertEnterpriseProposalWithSchema,
|
|
10
|
+
assertEnterpriseReviewThreadWithSchema,
|
|
11
|
+
assertEnterpriseSyncWithSchema,
|
|
12
|
+
renderEnterpriseHandoffMarkdownData,
|
|
13
|
+
} from './enterprise-contract-validation.mjs';
|
|
14
|
+
import {
|
|
15
|
+
assertEnterpriseEvidence,
|
|
16
|
+
assertEnterpriseHandoff,
|
|
17
|
+
assertEnterpriseProposal,
|
|
18
|
+
assertEnterpriseReviewThread,
|
|
19
|
+
assertEnterpriseSync,
|
|
20
|
+
ENTERPRISE_AGENT_HANDOFF_SCHEMA,
|
|
21
|
+
ENTERPRISE_CHANGE_PROPOSAL_SCHEMA,
|
|
22
|
+
ENTERPRISE_EVIDENCE_REFERENCE_SCHEMA,
|
|
23
|
+
ENTERPRISE_REVIEW_ANCHOR_SCHEMA,
|
|
24
|
+
ENTERPRISE_REVIEW_THREAD_SCHEMA,
|
|
25
|
+
ENTERPRISE_SYNC_STATE_SCHEMA,
|
|
26
|
+
} from './enterprise-contracts.mjs';
|
|
27
|
+
|
|
28
|
+
const opaqueRevisionId = { type: 'string', pattern: '^[A-Za-z0-9_-]{22,64}$' };
|
|
29
|
+
function copySchema(value) {
|
|
30
|
+
return structuredClone(value);
|
|
31
|
+
}
|
|
32
|
+
const anchor = copySchema(ENTERPRISE_REVIEW_ANCHOR_SCHEMA);
|
|
33
|
+
const revisionId = {
|
|
34
|
+
anyOf: [opaqueRevisionId, anchor.properties.revisionId],
|
|
35
|
+
};
|
|
36
|
+
const nullableRevisionId = { anyOf: [revisionId, { type: 'null' }] };
|
|
37
|
+
|
|
38
|
+
function successor(source, name) {
|
|
39
|
+
const value = structuredClone(source);
|
|
40
|
+
value.$id = `https://openplanr.dev/schemas/v1.17.0/${name}.schema.json`;
|
|
41
|
+
value['x-openplanr-contract'] = { id: name, version: '1.17.0' };
|
|
42
|
+
value.properties.schemaVersion = { const: '1.1.0' };
|
|
43
|
+
value.properties.protocolVersion = { const: '1.17.0' };
|
|
44
|
+
value.required.push('protocolVersion');
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const ENTERPRISE_REVIEW_ANCHOR_V11_SCHEMA = deepFreeze({
|
|
49
|
+
...anchor,
|
|
50
|
+
properties: { ...anchor.properties, revisionId },
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const thread = successor(ENTERPRISE_REVIEW_THREAD_SCHEMA, 'enterprise-review-thread');
|
|
54
|
+
thread.properties.anchor = ENTERPRISE_REVIEW_ANCHOR_V11_SCHEMA;
|
|
55
|
+
thread.properties.addressedRevisionId = revisionId;
|
|
56
|
+
export const ENTERPRISE_REVIEW_THREAD_V11_SCHEMA = deepFreeze(thread);
|
|
57
|
+
|
|
58
|
+
const proposal = successor(ENTERPRISE_CHANGE_PROPOSAL_SCHEMA, 'enterprise-change-proposal');
|
|
59
|
+
proposal.properties.baseRevisionId = revisionId;
|
|
60
|
+
proposal.properties.application.properties.revisionId = revisionId;
|
|
61
|
+
export const ENTERPRISE_CHANGE_PROPOSAL_V11_SCHEMA = deepFreeze(proposal);
|
|
62
|
+
|
|
63
|
+
const evidence = successor(ENTERPRISE_EVIDENCE_REFERENCE_SCHEMA, 'enterprise-evidence-reference');
|
|
64
|
+
evidence.properties.source.oneOf.find(
|
|
65
|
+
(branch) => branch.properties.kind.const === 'artifact',
|
|
66
|
+
).properties.revisionId = revisionId;
|
|
67
|
+
export const ENTERPRISE_EVIDENCE_REFERENCE_V11_SCHEMA = deepFreeze(evidence);
|
|
68
|
+
|
|
69
|
+
const sync = successor(ENTERPRISE_SYNC_STATE_SCHEMA, 'enterprise-sync-state');
|
|
70
|
+
sync.properties.items.items.properties.baseRevisionId = nullableRevisionId;
|
|
71
|
+
sync.properties.items.items.properties.revisionId = nullableRevisionId;
|
|
72
|
+
export const ENTERPRISE_SYNC_STATE_V11_SCHEMA = deepFreeze(sync);
|
|
73
|
+
|
|
74
|
+
const handoff = successor(ENTERPRISE_AGENT_HANDOFF_SCHEMA, 'enterprise-agent-handoff');
|
|
75
|
+
handoff.properties.revisionId = revisionId;
|
|
76
|
+
handoff.properties.threads.items = {
|
|
77
|
+
oneOf: [ENTERPRISE_REVIEW_THREAD_SCHEMA, ENTERPRISE_REVIEW_THREAD_V11_SCHEMA],
|
|
78
|
+
};
|
|
79
|
+
handoff.properties.evidence.items = {
|
|
80
|
+
oneOf: [ENTERPRISE_EVIDENCE_REFERENCE_SCHEMA, ENTERPRISE_EVIDENCE_REFERENCE_V11_SCHEMA],
|
|
81
|
+
};
|
|
82
|
+
export const ENTERPRISE_AGENT_HANDOFF_V11_SCHEMA = deepFreeze(handoff);
|
|
83
|
+
|
|
84
|
+
export const ENTERPRISE_RESOURCE_SCHEMAS = deepFreeze({
|
|
85
|
+
'enterprise-review-thread': ENTERPRISE_REVIEW_THREAD_V11_SCHEMA,
|
|
86
|
+
'enterprise-change-proposal': ENTERPRISE_CHANGE_PROPOSAL_V11_SCHEMA,
|
|
87
|
+
'enterprise-evidence-reference': ENTERPRISE_EVIDENCE_REFERENCE_V11_SCHEMA,
|
|
88
|
+
'enterprise-sync-state': ENTERPRISE_SYNC_STATE_V11_SCHEMA,
|
|
89
|
+
'enterprise-agent-handoff': ENTERPRISE_AGENT_HANDOFF_V11_SCHEMA,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Inspect the own data descriptor without evaluating a version getter. The
|
|
93
|
+
// selected reader then performs its full traversal before accessing fields.
|
|
94
|
+
function isLegacy(value) {
|
|
95
|
+
if (!value || typeof value !== 'object') return false;
|
|
96
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, 'schemaVersion');
|
|
97
|
+
if (descriptor && (!descriptor.enumerable || !Object.hasOwn(descriptor, 'value')))
|
|
98
|
+
throw new TypeError('Enterprise data contains a forbidden property.');
|
|
99
|
+
return descriptor?.value === '1.0.0';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** @returns {ReturnType<typeof import('./enterprise-resource-contracts.d.mts').assertEnterpriseReviewAnchorV11>} */
|
|
103
|
+
export function assertEnterpriseReviewAnchorV11(value) {
|
|
104
|
+
assertLargeObjectData(value);
|
|
105
|
+
return assertEnterpriseContractWithSchema(value, ENTERPRISE_REVIEW_ANCHOR_V11_SCHEMA);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** @returns {ReturnType<typeof import('./enterprise-resource-contracts.d.mts').assertVersionedEnterpriseReviewThread>} */
|
|
109
|
+
export function assertVersionedEnterpriseReviewThread(value) {
|
|
110
|
+
if (isLegacy(value)) return assertEnterpriseReviewThread(value);
|
|
111
|
+
assertLargeObjectData(value);
|
|
112
|
+
return assertEnterpriseReviewThreadWithSchema(value, ENTERPRISE_REVIEW_THREAD_V11_SCHEMA);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** @returns {ReturnType<typeof import('./enterprise-resource-contracts.d.mts').assertVersionedEnterpriseProposal>} */
|
|
116
|
+
export function assertVersionedEnterpriseProposal(value) {
|
|
117
|
+
if (isLegacy(value)) return assertEnterpriseProposal(value);
|
|
118
|
+
assertLargeObjectData(value);
|
|
119
|
+
return assertEnterpriseProposalWithSchema(value, ENTERPRISE_CHANGE_PROPOSAL_V11_SCHEMA);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** @returns {ReturnType<typeof import('./enterprise-resource-contracts.d.mts').assertVersionedEnterpriseEvidence>} */
|
|
123
|
+
export function assertVersionedEnterpriseEvidence(value) {
|
|
124
|
+
if (isLegacy(value)) return assertEnterpriseEvidence(value);
|
|
125
|
+
assertLargeObjectData(value);
|
|
126
|
+
return assertEnterpriseEvidenceWithSchema(value, ENTERPRISE_EVIDENCE_REFERENCE_V11_SCHEMA);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** @returns {ReturnType<typeof import('./enterprise-resource-contracts.d.mts').assertVersionedEnterpriseSync>} */
|
|
130
|
+
export function assertVersionedEnterpriseSync(value) {
|
|
131
|
+
if (isLegacy(value)) return assertEnterpriseSync(value);
|
|
132
|
+
assertLargeObjectData(value);
|
|
133
|
+
return assertEnterpriseSyncWithSchema(value, ENTERPRISE_SYNC_STATE_V11_SCHEMA);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** @returns {ReturnType<typeof import('./enterprise-resource-contracts.d.mts').assertVersionedEnterpriseHandoff>} */
|
|
137
|
+
export function assertVersionedEnterpriseHandoff(value) {
|
|
138
|
+
if (isLegacy(value)) return assertEnterpriseHandoff(value);
|
|
139
|
+
assertLargeObjectData(value);
|
|
140
|
+
return assertEnterpriseHandoffWithSchema(
|
|
141
|
+
value,
|
|
142
|
+
ENTERPRISE_AGENT_HANDOFF_V11_SCHEMA,
|
|
143
|
+
assertVersionedEnterpriseReviewThread,
|
|
144
|
+
assertVersionedEnterpriseEvidence,
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Exact successor dispatch; old versioned values remain available through their named readers. */
|
|
149
|
+
export function assertEnterpriseResourceContract(value, kind) {
|
|
150
|
+
assertLargeObjectData(value);
|
|
151
|
+
if (!Object.hasOwn(ENTERPRISE_RESOURCE_SCHEMAS, kind))
|
|
152
|
+
throw new TypeError('Unknown enterprise resource contract.');
|
|
153
|
+
if (value?.schemaVersion !== '1.1.0')
|
|
154
|
+
throw new TypeError('Unsupported enterprise resource contract version.');
|
|
155
|
+
if (kind === 'enterprise-review-thread') return assertVersionedEnterpriseReviewThread(value);
|
|
156
|
+
if (kind === 'enterprise-change-proposal') return assertVersionedEnterpriseProposal(value);
|
|
157
|
+
if (kind === 'enterprise-evidence-reference') return assertVersionedEnterpriseEvidence(value);
|
|
158
|
+
if (kind === 'enterprise-sync-state') return assertVersionedEnterpriseSync(value);
|
|
159
|
+
return assertVersionedEnterpriseHandoff(value);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** @returns {ReturnType<typeof import('./enterprise-resource-contracts.d.mts').createEnterpriseHandoffV11>} */
|
|
163
|
+
export function createEnterpriseHandoffV11(input) {
|
|
164
|
+
assertLargeObjectData(input);
|
|
165
|
+
const {
|
|
166
|
+
organizationId,
|
|
167
|
+
projectId,
|
|
168
|
+
artifactId,
|
|
169
|
+
revisionId: headRevisionId,
|
|
170
|
+
generatedAt,
|
|
171
|
+
threads = [],
|
|
172
|
+
evidence: references = [],
|
|
173
|
+
unresolvedUncertainties = [],
|
|
174
|
+
} = input;
|
|
175
|
+
const content = {
|
|
176
|
+
kind: 'openplanr-enterprise-agent-handoff',
|
|
177
|
+
schemaVersion: '1.1.0',
|
|
178
|
+
protocolVersion: '1.17.0',
|
|
179
|
+
organizationId,
|
|
180
|
+
projectId,
|
|
181
|
+
artifactId,
|
|
182
|
+
revisionId: headRevisionId,
|
|
183
|
+
generatedAt,
|
|
184
|
+
authority: 'feedback-only',
|
|
185
|
+
contentTrust: 'untrusted',
|
|
186
|
+
threads,
|
|
187
|
+
evidence: references,
|
|
188
|
+
unresolvedUncertainties,
|
|
189
|
+
};
|
|
190
|
+
const value = {
|
|
191
|
+
...JSON.parse(canonicalizeJson(content)),
|
|
192
|
+
contentDigest: sha256Hex(canonicalizeJson(content)),
|
|
193
|
+
};
|
|
194
|
+
assertVersionedEnterpriseHandoff(value);
|
|
195
|
+
return deepFreeze(value);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** @type {typeof import('./enterprise-resource-contracts.d.mts').renderVersionedEnterpriseHandoffMarkdown} */
|
|
199
|
+
export function renderVersionedEnterpriseHandoffMarkdown(value) {
|
|
200
|
+
assertVersionedEnterpriseHandoff(value);
|
|
201
|
+
return renderEnterpriseHandoffMarkdownData(value);
|
|
202
|
+
}
|