@openplanr/protocol 0.6.1 → 0.7.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 (58) hide show
  1. package/README.md +10 -0
  2. package/lib/dashboard/closed-json-contract.mjs +99 -109
  3. package/lib/dashboard/operate-experience-audit-display-contract.d.mts +128 -153
  4. package/lib/dashboard/operate-experience-audit-display-contract.mjs +530 -585
  5. package/lib/dashboard/operate-experience-display-contract.d.mts +415 -437
  6. package/lib/dashboard/operate-experience-display-contract.mjs +777 -831
  7. package/lib/dashboard/operate-experience-surface-contract.d.mts +143 -148
  8. package/lib/dashboard/operate-experience-surface-contract.mjs +72 -73
  9. package/lib/dashboard/operate-review-contract.d.mts +7 -14
  10. package/lib/dashboard/operate-review-contract.mjs +46 -42
  11. package/lib/dashboard/operate-review-display-workspace-contract.d.mts +2 -5
  12. package/lib/dashboard/operate-review-display-workspace-contract.mjs +158 -104
  13. package/lib/dashboard/operate-review-payload-safety.mjs +4 -2
  14. package/lib/dashboard/operate-review-workspace-projection-v2.d.mts +47 -33
  15. package/lib/protocol/index.d.ts +2647 -543
  16. package/package.json +1 -1
  17. package/registries/artifact-theme.json +64 -0
  18. package/registries/commands.json +40 -40
  19. package/registries/skills.json +5 -5
  20. package/schemas/v1.14.0/artifact-theme.schema.json +316 -0
  21. package/src/browser-contracts.d.mts +4 -1
  22. package/src/browser-contracts.mjs +16 -5
  23. package/src/canonical-json.d.mts +6 -1
  24. package/src/canonical-json.mjs +100 -22
  25. package/src/compat/live-evidence-v2.mjs +1611 -485
  26. package/src/compat/operate-experience-live-patch.mjs +67 -15
  27. package/src/compat/operating-planning-contracts.mjs +183 -51
  28. package/src/contracts.d.mts +54 -13
  29. package/src/contracts.mjs +635 -343
  30. package/src/design-contracts.mjs +58 -21
  31. package/src/design-handoff-contracts.d.mts +67 -11
  32. package/src/design-handoff-contracts.mjs +236 -119
  33. package/src/design-publication-contracts.mjs +98 -33
  34. package/src/diagram-authoring-contracts.d.mts +422 -78
  35. package/src/diagram-authoring-contracts.mjs +1715 -335
  36. package/src/diagram-contracts.d.mts +4 -1
  37. package/src/diagram-contracts.mjs +16 -4
  38. package/src/enterprise-contracts.d.mts +211 -46
  39. package/src/enterprise-contracts.mjs +738 -184
  40. package/src/errors.mjs +4 -0
  41. package/src/generated/canonical-registries.mjs +45 -45
  42. package/src/index.d.mts +8 -8
  43. package/src/index.mjs +36 -20
  44. package/src/json-schema.d.mts +21 -6
  45. package/src/json-schema.mjs +66 -18
  46. package/src/planning-contracts.d.mts +8 -2
  47. package/src/planning-contracts.mjs +33 -7
  48. package/src/registries.d.mts +11 -3
  49. package/src/registries.mjs +369 -87
  50. package/src/review-experience-contracts.d.mts +7 -2
  51. package/src/review-experience-contracts.mjs +198 -49
  52. package/src/semver.mjs +5 -1
  53. package/src/skill-source-contracts.d.mts +36 -16
  54. package/src/skill-source-contracts.mjs +25 -6
  55. package/src/task-contracts.d.mts +13 -3
  56. package/src/task-contracts.mjs +181 -40
  57. package/src/workspace-contracts.d.mts +38 -10
  58. package/src/workspace-contracts.mjs +147 -33
@@ -1,112 +1,456 @@
1
1
  export type DiagramAuthoringDigest = `sha256:${string}`;
2
2
  export type DiagramAuthoringProfile = 'flowchart' | 'process' | 'swimlane' | 'architecture';
3
- export type DiagramAuthoringNodeKind = 'process' | 'start' | 'end' | 'decision' | 'data-store' | 'component';
4
- export type DiagramAuthoringRelationKind = 'association' | 'dependency' | 'flow' | 'message' | 'transition';
5
- export type DiagramAuthoringContractKind = 'diagram-document' | 'diagram-presentation' | 'diagram-authoring-bundle' | 'diagram-edit-transaction' | 'diagram-source-map' | 'diagram-fidelity-report' | 'diagram-manifest' | 'diagram-change-proposal' | 'diagram-publication-state' | 'diagram-authoring-capabilities';
6
- export type DiagramEditOperationClass = 'insert-elements' | 'update-semantics' | 'remove-elements' | 'set-membership-order' | 'set-geometry' | 'set-appearance-locks';
3
+ export type DiagramAuthoringNodeKind =
4
+ | 'process'
5
+ | 'start'
6
+ | 'end'
7
+ | 'decision'
8
+ | 'data-store'
9
+ | 'component';
10
+ export type DiagramAuthoringRelationKind =
11
+ | 'association'
12
+ | 'dependency'
13
+ | 'flow'
14
+ | 'message'
15
+ | 'transition';
16
+ export type DiagramAuthoringContractKind =
17
+ | 'diagram-document'
18
+ | 'diagram-presentation'
19
+ | 'diagram-authoring-bundle'
20
+ | 'diagram-edit-transaction'
21
+ | 'diagram-source-map'
22
+ | 'diagram-fidelity-report'
23
+ | 'diagram-manifest'
24
+ | 'diagram-change-proposal'
25
+ | 'diagram-publication-state'
26
+ | 'diagram-authoring-capabilities';
27
+ export type DiagramEditOperationClass =
28
+ | 'insert-elements'
29
+ | 'update-semantics'
30
+ | 'remove-elements'
31
+ | 'set-membership-order'
32
+ | 'set-geometry'
33
+ | 'set-appearance-locks';
7
34
  export type DiagramAuthoringSchema = Readonly<Record<string, unknown>>;
8
- export interface DiagramAuthoringValidationError { path: string; rule: string; detail: string }
9
- export interface DiagramAuthoringEnvelope<K extends string> { kind: K; schemaVersion: '1.0.0'; protocolVersion: '1.13.0' }
10
- export interface DiagramAuthoringNode { id: string; label: string; kind: DiagramAuthoringNodeKind; description: string | null }
11
- export interface DiagramAuthoringRelation { id: string; from: string; to: string; kind: DiagramAuthoringRelationKind; direction: 'forward' | 'both' | 'none'; label: string | null; weight: number | null }
12
- export interface DiagramAuthoringContainer { id: string; label: string; members: string[] }
13
- export interface DiagramAuthoringAnnotation { id: string; text: string; targetId: string | null }
14
- export interface DiagramAuthoringAccessibility { title: string; description: string; readingOrder: string[] }
35
+ export interface DiagramAuthoringValidationError {
36
+ path: string;
37
+ rule: string;
38
+ detail: string;
39
+ }
40
+ export interface DiagramAuthoringEnvelope<K extends string> {
41
+ kind: K;
42
+ schemaVersion: '1.0.0';
43
+ protocolVersion: '1.13.0';
44
+ }
45
+ export interface DiagramAuthoringNode {
46
+ id: string;
47
+ label: string;
48
+ kind: DiagramAuthoringNodeKind;
49
+ description: string | null;
50
+ }
51
+ export interface DiagramAuthoringRelation {
52
+ id: string;
53
+ from: string;
54
+ to: string;
55
+ kind: DiagramAuthoringRelationKind;
56
+ direction: 'forward' | 'both' | 'none';
57
+ label: string | null;
58
+ weight: number | null;
59
+ }
60
+ export interface DiagramAuthoringContainer {
61
+ id: string;
62
+ label: string;
63
+ members: string[];
64
+ }
65
+ export interface DiagramAuthoringAnnotation {
66
+ id: string;
67
+ text: string;
68
+ targetId: string | null;
69
+ }
70
+ export interface DiagramAuthoringAccessibility {
71
+ title: string;
72
+ description: string;
73
+ readingOrder: string[];
74
+ }
15
75
  export interface DiagramAuthoringDocument extends DiagramAuthoringEnvelope<'planr-diagram'> {
16
- diagramId: string; title: string; summary: string; audience: 'engineer' | 'executive' | 'mixed';
76
+ diagramId: string;
77
+ title: string;
78
+ summary: string;
79
+ audience: 'engineer' | 'executive' | 'mixed';
17
80
  grammar: { id: DiagramAuthoringProfile; version: '1.0.0' };
18
- nodes: DiagramAuthoringNode[]; relations: DiagramAuthoringRelation[]; groups: DiagramAuthoringContainer[]; lanes: DiagramAuthoringContainer[];
19
- events: never[]; series: never[]; axes: never[]; sets: never[];
20
- annotations: DiagramAuthoringAnnotation[]; emphasis: Array<{ targetId: string; level: 'primary' | 'secondary' | 'muted' }>;
21
- laneOrder: string[]; accessibility: DiagramAuthoringAccessibility; documentDigest: DiagramAuthoringDigest;
22
- }
23
- export interface DiagramBounds { x: number; y: number; width: number; height: number }
24
- export interface DiagramBoundaryAttachment { side: 'top' | 'right' | 'bottom' | 'left'; offset: number }
25
- export interface DiagramRoute { mode: 'automatic' | 'manual'; strategy: 'straight' | 'orthogonal'; from: DiagramBoundaryAttachment; to: DiagramBoundaryAttachment; points: Array<{ x: number; y: number }> }
81
+ nodes: DiagramAuthoringNode[];
82
+ relations: DiagramAuthoringRelation[];
83
+ groups: DiagramAuthoringContainer[];
84
+ lanes: DiagramAuthoringContainer[];
85
+ events: never[];
86
+ series: never[];
87
+ axes: never[];
88
+ sets: never[];
89
+ annotations: DiagramAuthoringAnnotation[];
90
+ emphasis: Array<{ targetId: string; level: 'primary' | 'secondary' | 'muted' }>;
91
+ laneOrder: string[];
92
+ accessibility: DiagramAuthoringAccessibility;
93
+ documentDigest: DiagramAuthoringDigest;
94
+ }
95
+ export interface DiagramBounds {
96
+ x: number;
97
+ y: number;
98
+ width: number;
99
+ height: number;
100
+ }
101
+ export interface DiagramBoundaryAttachment {
102
+ side: 'top' | 'right' | 'bottom' | 'left';
103
+ offset: number;
104
+ }
105
+ export interface DiagramRoute {
106
+ mode: 'automatic' | 'manual';
107
+ strategy: 'straight' | 'orthogonal';
108
+ from: DiagramBoundaryAttachment;
109
+ to: DiagramBoundaryAttachment;
110
+ points: Array<{ x: number; y: number }>;
111
+ }
26
112
  export interface DiagramAppearance {
27
- shape: 'rectangle' | 'rounded-rectangle' | 'ellipse' | 'diamond' | 'cylinder' | 'text' | 'container' | 'connector';
113
+ shape:
114
+ | 'rectangle'
115
+ | 'rounded-rectangle'
116
+ | 'ellipse'
117
+ | 'diamond'
118
+ | 'cylinder'
119
+ | 'text'
120
+ | 'container'
121
+ | 'connector';
28
122
  fill: 'surface' | 'accent' | 'success' | 'warning' | 'danger' | 'transparent';
29
- stroke: 'default' | 'accent' | 'muted' | 'danger' | 'none'; strokeWidth: number;
30
- strokeStyle: 'solid' | 'dashed' | 'dotted'; fontSize: number; textAlign: 'left' | 'center' | 'right';
123
+ stroke: 'default' | 'accent' | 'muted' | 'danger' | 'none';
124
+ strokeWidth: number;
125
+ strokeStyle: 'solid' | 'dashed' | 'dotted';
126
+ fontSize: number;
127
+ textAlign: 'left' | 'center' | 'right';
128
+ }
129
+ export interface DiagramGeometryLocks {
130
+ position: boolean;
131
+ size: boolean;
132
+ route: boolean;
133
+ }
134
+ export interface DiagramGeometry {
135
+ bounds: DiagramBounds | null;
136
+ route: DiagramRoute | null;
137
+ label: { x: number; y: number; width: number } | null;
138
+ zIndex: number;
139
+ }
140
+ export interface DiagramPlacement extends DiagramGeometry {
141
+ elementId: string;
142
+ appearance: DiagramAppearance;
143
+ locks: DiagramGeometryLocks;
31
144
  }
32
- export interface DiagramGeometryLocks { position: boolean; size: boolean; route: boolean }
33
- export interface DiagramGeometry { bounds: DiagramBounds | null; route: DiagramRoute | null; label: { x: number; y: number; width: number } | null; zIndex: number }
34
- export interface DiagramPlacement extends DiagramGeometry { elementId: string; appearance: DiagramAppearance; locks: DiagramGeometryLocks }
35
145
  export interface DiagramPresentation extends DiagramAuthoringEnvelope<'diagram-presentation'> {
36
- diagramId: string; semanticDigest: DiagramAuthoringDigest; coordinateSystem: 'global-canvas';
37
- layout: { direction: 'top-down' | 'left-right' | 'right-left' | 'bottom-up'; detailTier: 'simplified' | 'balanced' | 'faithful' };
146
+ diagramId: string;
147
+ semanticDigest: DiagramAuthoringDigest;
148
+ coordinateSystem: 'global-canvas';
149
+ layout: {
150
+ direction: 'top-down' | 'left-right' | 'right-left' | 'bottom-up';
151
+ detailTier: 'simplified' | 'balanced' | 'faithful';
152
+ };
38
153
  theme: { themeId: 'paper' | 'slate' | 'midnight'; mode: 'light' | 'dark' | 'auto' };
39
- elements: DiagramPlacement[]; presentationDigest: DiagramAuthoringDigest;
154
+ elements: DiagramPlacement[];
155
+ presentationDigest: DiagramAuthoringDigest;
156
+ }
157
+ export interface DiagramAuthoringSnapshot {
158
+ bundleDigest: DiagramAuthoringDigest;
159
+ semanticDigest: DiagramAuthoringDigest;
160
+ presentationDigest: DiagramAuthoringDigest;
40
161
  }
41
- export interface DiagramAuthoringSnapshot { bundleDigest: DiagramAuthoringDigest; semanticDigest: DiagramAuthoringDigest; presentationDigest: DiagramAuthoringDigest }
42
162
  export interface DiagramSourceMap extends DiagramAuthoringEnvelope<'diagram-source-map'> {
43
- diagramId: string; semanticDigest: DiagramAuthoringDigest; sourceDigest: DiagramAuthoringDigest; sourceByteLength: number; encoding: 'utf-8';
44
- parser: { id: string; version: string }; certificationVersion: 'flowchart-copy-v1';
45
- entries: Array<{ sourceId: string | null; elementIds: string[]; range: { startByte: number; endByte: number } | null; construct: string; confidence: 'exact' | 'ambiguous'; losses: string[] }>;
163
+ diagramId: string;
164
+ semanticDigest: DiagramAuthoringDigest;
165
+ sourceDigest: DiagramAuthoringDigest;
166
+ sourceByteLength: number;
167
+ encoding: 'utf-8';
168
+ parser: { id: string; version: string };
169
+ certificationVersion: 'flowchart-copy-v1';
170
+ entries: Array<{
171
+ sourceId: string | null;
172
+ elementIds: string[];
173
+ range: { startByte: number; endByte: number } | null;
174
+ construct: string;
175
+ confidence: 'exact' | 'ambiguous';
176
+ losses: string[];
177
+ }>;
46
178
  }
47
- export interface DiagramAuthoringBundle extends DiagramAuthoringEnvelope<'diagram-authoring-bundle'> {
48
- diagramId: string; document: DiagramAuthoringDocument; presentation: DiagramPresentation;
179
+ export interface DiagramAuthoringBundle
180
+ extends DiagramAuthoringEnvelope<'diagram-authoring-bundle'> {
181
+ diagramId: string;
182
+ document: DiagramAuthoringDocument;
183
+ presentation: DiagramPresentation;
49
184
  originalSource: { format: 'mermaid'; text: string; sourceDigest: DiagramAuthoringDigest } | null;
50
- sourceMap: DiagramSourceMap | null; bundleDigest: DiagramAuthoringDigest;
185
+ sourceMap: DiagramSourceMap | null;
186
+ bundleDigest: DiagramAuthoringDigest;
51
187
  }
52
188
  export type DiagramSemanticEntry =
53
189
  | { collection: 'nodes'; value: DiagramAuthoringNode }
54
190
  | { collection: 'relations'; value: DiagramAuthoringRelation }
55
191
  | { collection: 'groups' | 'lanes'; value: DiagramAuthoringContainer }
56
192
  | { collection: 'annotations'; value: DiagramAuthoringAnnotation };
57
- export interface DiagramMembershipState { groups: Array<{ id: string; members: string[] }>; lanes: Array<{ id: string; members: string[] }>; laneOrder: string[] }
193
+ export interface DiagramMembershipState {
194
+ groups: Array<{ id: string; members: string[] }>;
195
+ lanes: Array<{ id: string; members: string[] }>;
196
+ laneOrder: string[];
197
+ }
58
198
  export type DiagramSemanticUpdate =
59
- | { type: 'update-semantics'; collection: 'nodes'; elementId: string; before: Omit<DiagramAuthoringNode, 'id'>; after: Omit<DiagramAuthoringNode, 'id'> }
60
- | { type: 'update-semantics'; collection: 'relations'; elementId: string; before: Omit<DiagramAuthoringRelation, 'id'>; after: Omit<DiagramAuthoringRelation, 'id'> }
61
- | { type: 'update-semantics'; collection: 'groups' | 'lanes'; elementId: string; before: { label: string }; after: { label: string } }
62
- | { type: 'update-semantics'; collection: 'annotations'; elementId: string; before: Omit<DiagramAuthoringAnnotation, 'id'>; after: Omit<DiagramAuthoringAnnotation, 'id'> }
63
- | { type: 'update-semantics'; collection: 'emphasis'; elementId: string; before: 'primary' | 'secondary' | 'muted' | null; after: 'primary' | 'secondary' | 'muted' | null; index?: number }
64
- | { type: 'update-semantics'; collection: 'document'; before: Pick<DiagramAuthoringDocument, 'title' | 'summary' | 'audience' | 'accessibility'>; after: Pick<DiagramAuthoringDocument, 'title' | 'summary' | 'audience' | 'accessibility'> }
65
- | { type: 'update-semantics'; collection: 'source-map'; before: DiagramSourceMap | null; after: DiagramSourceMap | null };
199
+ | {
200
+ type: 'update-semantics';
201
+ collection: 'nodes';
202
+ elementId: string;
203
+ before: Omit<DiagramAuthoringNode, 'id'>;
204
+ after: Omit<DiagramAuthoringNode, 'id'>;
205
+ }
206
+ | {
207
+ type: 'update-semantics';
208
+ collection: 'relations';
209
+ elementId: string;
210
+ before: Omit<DiagramAuthoringRelation, 'id'>;
211
+ after: Omit<DiagramAuthoringRelation, 'id'>;
212
+ }
213
+ | {
214
+ type: 'update-semantics';
215
+ collection: 'groups' | 'lanes';
216
+ elementId: string;
217
+ before: { label: string };
218
+ after: { label: string };
219
+ }
220
+ | {
221
+ type: 'update-semantics';
222
+ collection: 'annotations';
223
+ elementId: string;
224
+ before: Omit<DiagramAuthoringAnnotation, 'id'>;
225
+ after: Omit<DiagramAuthoringAnnotation, 'id'>;
226
+ }
227
+ | {
228
+ type: 'update-semantics';
229
+ collection: 'emphasis';
230
+ elementId: string;
231
+ before: 'primary' | 'secondary' | 'muted' | null;
232
+ after: 'primary' | 'secondary' | 'muted' | null;
233
+ index?: number;
234
+ }
235
+ | {
236
+ type: 'update-semantics';
237
+ collection: 'document';
238
+ before: Pick<DiagramAuthoringDocument, 'title' | 'summary' | 'audience' | 'accessibility'>;
239
+ after: Pick<DiagramAuthoringDocument, 'title' | 'summary' | 'audience' | 'accessibility'>;
240
+ }
241
+ | {
242
+ type: 'update-semantics';
243
+ collection: 'source-map';
244
+ before: DiagramSourceMap | null;
245
+ after: DiagramSourceMap | null;
246
+ };
66
247
  export type DiagramEditOperation =
67
- | { type: 'insert-elements'; elements: DiagramSemanticEntry[]; presentation: DiagramPlacement[]; positions?: Array<{ elementId: string; semanticIndex: number; presentationIndex: number }> }
248
+ | {
249
+ type: 'insert-elements';
250
+ elements: DiagramSemanticEntry[];
251
+ presentation: DiagramPlacement[];
252
+ positions?: Array<{ elementId: string; semanticIndex: number; presentationIndex: number }>;
253
+ }
68
254
  | { type: 'remove-elements'; elements: DiagramSemanticEntry[]; presentation: DiagramPlacement[] }
69
255
  | DiagramSemanticUpdate
70
256
  | { type: 'set-membership-order'; before: DiagramMembershipState; after: DiagramMembershipState }
71
- | { type: 'set-geometry'; changes: Array<{ elementId: string; before: DiagramGeometry; after: DiagramGeometry }> }
72
- | { type: 'set-appearance-locks'; changes: Array<{ elementId: string; before: { appearance: DiagramAppearance; locks: DiagramGeometryLocks }; after: { appearance: DiagramAppearance; locks: DiagramGeometryLocks } }> };
73
- export interface DiagramEditTransaction extends DiagramAuthoringEnvelope<'diagram-edit-transaction'> { transactionId: string; diagramId: string; base: DiagramAuthoringSnapshot; operations: DiagramEditOperation[]; undoOf: string | null }
74
- export interface DiagramChangeProposal extends DiagramAuthoringEnvelope<'diagram-change-proposal'> { proposalId: string; diagramId: string; base: DiagramAuthoringSnapshot; transaction: DiagramEditTransaction; summary: string; author: { kind: 'human' | 'agent'; id: string }; status: 'proposed' | 'accepted' | 'rejected' | 'stale' }
75
- export interface DiagramPublicationState extends DiagramAuthoringEnvelope<'diagram-publication-state'> { diagramId: string; draft: DiagramAuthoringSnapshot | null; published: DiagramAuthoringSnapshot | null; audience: 'private' | 'company' | 'public'; capabilitySemantics: 'descriptive-only-requires-host-authorization' }
257
+ | {
258
+ type: 'set-geometry';
259
+ changes: Array<{ elementId: string; before: DiagramGeometry; after: DiagramGeometry }>;
260
+ }
261
+ | {
262
+ type: 'set-appearance-locks';
263
+ changes: Array<{
264
+ elementId: string;
265
+ before: { appearance: DiagramAppearance; locks: DiagramGeometryLocks };
266
+ after: { appearance: DiagramAppearance; locks: DiagramGeometryLocks };
267
+ }>;
268
+ };
269
+ export interface DiagramEditTransaction
270
+ extends DiagramAuthoringEnvelope<'diagram-edit-transaction'> {
271
+ transactionId: string;
272
+ diagramId: string;
273
+ base: DiagramAuthoringSnapshot;
274
+ operations: DiagramEditOperation[];
275
+ undoOf: string | null;
276
+ }
277
+ export interface DiagramChangeProposal extends DiagramAuthoringEnvelope<'diagram-change-proposal'> {
278
+ proposalId: string;
279
+ diagramId: string;
280
+ base: DiagramAuthoringSnapshot;
281
+ transaction: DiagramEditTransaction;
282
+ summary: string;
283
+ author: { kind: 'human' | 'agent'; id: string };
284
+ status: 'proposed' | 'accepted' | 'rejected' | 'stale';
285
+ }
286
+ export interface DiagramPublicationState
287
+ extends DiagramAuthoringEnvelope<'diagram-publication-state'> {
288
+ diagramId: string;
289
+ draft: DiagramAuthoringSnapshot | null;
290
+ published: DiagramAuthoringSnapshot | null;
291
+ audience: 'private' | 'company' | 'public';
292
+ capabilitySemantics: 'descriptive-only-requires-host-authorization';
293
+ }
76
294
  export type DiagramFidelity = 'lossless' | 'partial' | 'unsupported';
77
- export interface DiagramFidelityReport extends DiagramAuthoringEnvelope<'diagram-fidelity-report'> { diagramId: string; basis: DiagramAuthoringSnapshot; sourceDigest: DiagramAuthoringDigest | null; sourceFormat: 'mermaid' | 'planr-diagram-bundle'; targetFormat: 'mermaid' | 'planr-diagram-bundle' | 'svg' | 'html' | 'png'; semantic: DiagramFidelity; presentation: DiagramFidelity; sourceText: DiagramFidelity; losses: Array<{ dimension: 'semantic' | 'presentation' | 'sourceText'; code: string; elementIds: string[]; message: string }> }
78
- export interface DiagramAuthoringManifest extends DiagramAuthoringEnvelope<'diagram-manifest'> { diagramId: string; basis: DiagramAuthoringSnapshot; bundle: { path: string; transportDigest: DiagramAuthoringDigest }; renderer: { id: string; version: string }; theme?: { id: string; version: string }; outputs: Array<{ path: string; mediaType: 'image/svg+xml' | 'text/html' | 'image/png'; transportDigest: DiagramAuthoringDigest; fidelity: DiagramFidelityReport }> }
79
- export interface DiagramMermaidConstructCapability { readonly construct: string; readonly import: DiagramFidelity; readonly export: DiagramFidelity; readonly semanticRoundTrip: DiagramFidelity; readonly mapping: string }
295
+ export interface DiagramFidelityReport extends DiagramAuthoringEnvelope<'diagram-fidelity-report'> {
296
+ diagramId: string;
297
+ basis: DiagramAuthoringSnapshot;
298
+ sourceDigest: DiagramAuthoringDigest | null;
299
+ sourceFormat: 'mermaid' | 'planr-diagram-bundle';
300
+ targetFormat: 'mermaid' | 'planr-diagram-bundle' | 'svg' | 'html' | 'png';
301
+ semantic: DiagramFidelity;
302
+ presentation: DiagramFidelity;
303
+ sourceText: DiagramFidelity;
304
+ losses: Array<{
305
+ dimension: 'semantic' | 'presentation' | 'sourceText';
306
+ code: string;
307
+ elementIds: string[];
308
+ message: string;
309
+ }>;
310
+ }
311
+ export interface DiagramAuthoringManifest extends DiagramAuthoringEnvelope<'diagram-manifest'> {
312
+ diagramId: string;
313
+ basis: DiagramAuthoringSnapshot;
314
+ bundle: { path: string; transportDigest: DiagramAuthoringDigest };
315
+ renderer: { id: string; version: string };
316
+ theme?: { id: string; version: string };
317
+ outputs: Array<{
318
+ path: string;
319
+ mediaType: 'image/svg+xml' | 'text/html' | 'image/png';
320
+ transportDigest: DiagramAuthoringDigest;
321
+ fidelity: DiagramFidelityReport;
322
+ }>;
323
+ }
324
+ export interface DiagramMermaidConstructCapability {
325
+ readonly construct: string;
326
+ readonly import: DiagramFidelity;
327
+ readonly export: DiagramFidelity;
328
+ readonly semanticRoundTrip: DiagramFidelity;
329
+ readonly mapping: string;
330
+ }
80
331
  export interface DiagramAuthoringCapability {
81
- readonly grammarId: DiagramAuthoringProfile; readonly authoring: true;
82
- readonly primitives: readonly ('node' | 'relation' | 'group' | 'lane' | 'annotation' | 'emphasis')[];
83
- readonly nodeKinds: readonly DiagramAuthoringNodeKind[]; readonly relationKinds: readonly DiagramAuthoringRelationKind[];
332
+ readonly grammarId: DiagramAuthoringProfile;
333
+ readonly authoring: true;
334
+ readonly primitives: readonly (
335
+ | 'node'
336
+ | 'relation'
337
+ | 'group'
338
+ | 'lane'
339
+ | 'annotation'
340
+ | 'emphasis'
341
+ )[];
342
+ readonly nodeKinds: readonly DiagramAuthoringNodeKind[];
343
+ readonly relationKinds: readonly DiagramAuthoringRelationKind[];
84
344
  readonly operations: readonly DiagramEditOperationClass[];
85
- readonly mermaid: { readonly mode: 'copy'; readonly certificationVersion: 'flowchart-copy-v1'; readonly constructs: readonly DiagramMermaidConstructCapability[]; readonly linkedSource: false };
345
+ readonly mermaid: {
346
+ readonly mode: 'copy';
347
+ readonly certificationVersion: 'flowchart-copy-v1';
348
+ readonly constructs: readonly DiagramMermaidConstructCapability[];
349
+ readonly linkedSource: false;
350
+ };
351
+ }
352
+ export interface DiagramAuthoringCapabilities
353
+ extends DiagramAuthoringEnvelope<'diagram-authoring-capabilities'> {
354
+ readonly version: '1.0.0';
355
+ readonly liveCollaboration: false;
356
+ readonly profiles: readonly DiagramAuthoringCapability[];
357
+ readonly unsupportedGrammars: readonly string[];
358
+ }
359
+ export interface DiagramAuthoringValidationOptions {
360
+ document?: DiagramAuthoringDocument;
361
+ bundle?: DiagramAuthoringBundle;
362
+ baseBundle?: DiagramAuthoringBundle;
363
+ sourceText?: string;
364
+ }
365
+ export interface DiagramLegacyInspection {
366
+ valid: boolean;
367
+ errors: DiagramAuthoringValidationError[];
368
+ diagramId: string | null;
369
+ grammarId: string | null;
370
+ authoringAvailable: boolean;
371
+ requiresDerivedPresentation: boolean;
372
+ unsupportedNodeKinds: string[];
373
+ adoption: 'explicit-save-required';
374
+ sourceModified: false;
86
375
  }
87
- export interface DiagramAuthoringCapabilities extends DiagramAuthoringEnvelope<'diagram-authoring-capabilities'> { readonly version: '1.0.0'; readonly liveCollaboration: false; readonly profiles: readonly DiagramAuthoringCapability[]; readonly unsupportedGrammars: readonly string[] }
88
- export interface DiagramAuthoringValidationOptions { document?: DiagramAuthoringDocument; bundle?: DiagramAuthoringBundle; baseBundle?: DiagramAuthoringBundle; sourceText?: string }
89
- export interface DiagramLegacyInspection { valid: boolean; errors: DiagramAuthoringValidationError[]; diagramId: string | null; grammarId: string | null; authoringAvailable: boolean; requiresDerivedPresentation: boolean; unsupportedNodeKinds: string[]; adoption: 'explicit-save-required'; sourceModified: false }
90
376
  export declare const DIAGRAM_AUTHORING_PROTOCOL_VERSION: '1.13.0';
91
377
  export declare const DIAGRAM_AUTHORING_CONTRACT_VERSION: '1.0.0';
92
378
  export declare const DIAGRAM_EDIT_OPERATION_CLASSES: readonly DiagramEditOperationClass[];
93
- export declare const DIAGRAM_AUTHORING_LIMITS: Readonly<{ depth: 48; values: 500000; textCodeUnits: 8388608; sourceBytes: 1048576; elements: 10000; operations: 256; coordinate: 1000000 }>;
94
- export declare const DIAGRAM_AUTHORING_SCHEMAS: Readonly<Record<DiagramAuthoringContractKind, DiagramAuthoringSchema>>;
95
- export declare const DIAGRAM_AUTHORING_CONTRACT_FILES: Readonly<Record<DiagramAuthoringContractKind, string>>;
379
+ export declare const DIAGRAM_AUTHORING_LIMITS: Readonly<{
380
+ depth: 48;
381
+ values: 500000;
382
+ textCodeUnits: 8388608;
383
+ sourceBytes: 1048576;
384
+ elements: 10000;
385
+ operations: 256;
386
+ coordinate: 1000000;
387
+ }>;
388
+ export declare const DIAGRAM_AUTHORING_SCHEMAS: Readonly<
389
+ Record<DiagramAuthoringContractKind, DiagramAuthoringSchema>
390
+ >;
391
+ export declare const DIAGRAM_AUTHORING_CONTRACT_FILES: Readonly<
392
+ Record<DiagramAuthoringContractKind, string>
393
+ >;
96
394
  export declare const DIAGRAM_AUTHORING_CAPABILITIES: Readonly<DiagramAuthoringCapabilities>;
97
- export declare function getDiagramAuthoringCapability(grammarId: string): DiagramAuthoringCapability | null;
98
- export declare function diagramDocumentDigest(value: Omit<DiagramAuthoringDocument, 'documentDigest'> | DiagramAuthoringDocument | Record<string, unknown>): DiagramAuthoringDigest;
99
- export declare function diagramPresentationDigest(value: Omit<DiagramPresentation, 'presentationDigest'> | DiagramPresentation): DiagramAuthoringDigest;
100
- export declare function diagramAuthoringBundleDigest(value: Omit<DiagramAuthoringBundle, 'bundleDigest'> | DiagramAuthoringBundle): DiagramAuthoringDigest;
101
- export declare function validateDiagramAuthoringArtifact(kind: string, value: unknown, options?: DiagramAuthoringValidationOptions): DiagramAuthoringValidationError[];
102
- export declare function assertDiagramAuthoringArtifact<T>(kind: DiagramAuthoringContractKind, value: T, options?: DiagramAuthoringValidationOptions): T;
103
- export declare function validateDiagramDocument(value: unknown, options?: DiagramAuthoringValidationOptions): DiagramAuthoringValidationError[];
104
- export declare function assertDiagramDocument<T extends DiagramAuthoringDocument>(value: T, options?: DiagramAuthoringValidationOptions): T;
105
- export declare function validateDiagramPresentation(value: unknown, options?: DiagramAuthoringValidationOptions): DiagramAuthoringValidationError[];
106
- export declare function assertDiagramPresentation<T extends DiagramPresentation>(value: T, options?: DiagramAuthoringValidationOptions): T;
107
- export declare function validateDiagramAuthoringBundle(value: unknown, options?: DiagramAuthoringValidationOptions): DiagramAuthoringValidationError[];
108
- export declare function assertDiagramAuthoringBundle<T extends DiagramAuthoringBundle>(value: T, options?: DiagramAuthoringValidationOptions): T;
109
- export declare function validateDiagramEditTransaction(value: unknown, options?: DiagramAuthoringValidationOptions): DiagramAuthoringValidationError[];
110
- export declare function assertDiagramEditTransaction<T extends DiagramEditTransaction>(value: T, options?: DiagramAuthoringValidationOptions): T;
111
- export declare function summarizeDiagramAuthoringContent(bundle: DiagramAuthoringBundle): { elementCount: number; hasVisibleContent: boolean };
395
+ export declare function getDiagramAuthoringCapability(
396
+ grammarId: string,
397
+ ): DiagramAuthoringCapability | null;
398
+ export declare function diagramDocumentDigest(
399
+ value:
400
+ | Omit<DiagramAuthoringDocument, 'documentDigest'>
401
+ | DiagramAuthoringDocument
402
+ | Record<string, unknown>,
403
+ ): DiagramAuthoringDigest;
404
+ export declare function diagramPresentationDigest(
405
+ value: Omit<DiagramPresentation, 'presentationDigest'> | DiagramPresentation,
406
+ ): DiagramAuthoringDigest;
407
+ export declare function diagramAuthoringBundleDigest(
408
+ value: Omit<DiagramAuthoringBundle, 'bundleDigest'> | DiagramAuthoringBundle,
409
+ ): DiagramAuthoringDigest;
410
+ export declare function validateDiagramAuthoringArtifact(
411
+ kind: string,
412
+ value: unknown,
413
+ options?: DiagramAuthoringValidationOptions,
414
+ ): DiagramAuthoringValidationError[];
415
+ export declare function assertDiagramAuthoringArtifact<T>(
416
+ kind: DiagramAuthoringContractKind,
417
+ value: T,
418
+ options?: DiagramAuthoringValidationOptions,
419
+ ): T;
420
+ export declare function validateDiagramDocument(
421
+ value: unknown,
422
+ options?: DiagramAuthoringValidationOptions,
423
+ ): DiagramAuthoringValidationError[];
424
+ export declare function assertDiagramDocument<T extends DiagramAuthoringDocument>(
425
+ value: T,
426
+ options?: DiagramAuthoringValidationOptions,
427
+ ): T;
428
+ export declare function validateDiagramPresentation(
429
+ value: unknown,
430
+ options?: DiagramAuthoringValidationOptions,
431
+ ): DiagramAuthoringValidationError[];
432
+ export declare function assertDiagramPresentation<T extends DiagramPresentation>(
433
+ value: T,
434
+ options?: DiagramAuthoringValidationOptions,
435
+ ): T;
436
+ export declare function validateDiagramAuthoringBundle(
437
+ value: unknown,
438
+ options?: DiagramAuthoringValidationOptions,
439
+ ): DiagramAuthoringValidationError[];
440
+ export declare function assertDiagramAuthoringBundle<T extends DiagramAuthoringBundle>(
441
+ value: T,
442
+ options?: DiagramAuthoringValidationOptions,
443
+ ): T;
444
+ export declare function validateDiagramEditTransaction(
445
+ value: unknown,
446
+ options?: DiagramAuthoringValidationOptions,
447
+ ): DiagramAuthoringValidationError[];
448
+ export declare function assertDiagramEditTransaction<T extends DiagramEditTransaction>(
449
+ value: T,
450
+ options?: DiagramAuthoringValidationOptions,
451
+ ): T;
452
+ export declare function summarizeDiagramAuthoringContent(bundle: DiagramAuthoringBundle): {
453
+ elementCount: number;
454
+ hasVisibleContent: boolean;
455
+ };
112
456
  export declare function inspectLegacyDiagramDocument(value: unknown): DiagramLegacyInspection;