@company-semantics/contracts 0.17.0 → 0.18.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.ts CHANGED
@@ -23,17 +23,19 @@ export type InsightConfidence = 'low' | 'medium' | 'high'
23
23
  // Invariant enforcement phases (4.0 Observe → 4.1 Stabilize → 4.2 Enforce)
24
24
  export type InvariantPhase = 'observe' | 'stabilize' | 'enforce'
25
25
 
26
- // System diagram types (Living ASCII Diagram)
27
- // @see docs/LIVING_ASCII_DIAGRAM_SPEC.md
26
+ // System diagram types
28
27
  export type {
29
28
  // Layer-based manifest (source of truth)
30
29
  FeatureStatus,
31
30
  SystemCapability,
32
31
  SystemLayer,
33
32
  SystemCapabilityManifest,
34
- // Graph-based diagram spec (v0.4.0)
33
+ // Graph-based diagram spec (v0.18.0)
35
34
  DiagramNodeKind,
36
35
  DiagramEdgeRelation,
36
+ EdgeDirection,
37
+ FlowStage,
38
+ DiagramMode,
37
39
  DiagramNode,
38
40
  DiagramEdge,
39
41
  DiagramSpec,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Diagram Specification Types (v0.17.0)
2
+ * Diagram Specification Types (v0.18.0)
3
3
  *
4
4
  * Tree-based semantic model for system diagrams.
5
5
  * These types define MEANING, not presentation.
@@ -9,6 +9,16 @@
9
9
  * - parentId creates hierarchy (tree structure), not edges
10
10
  * - Graphs can be rendered as React Flow, SVG, canvas, or any future format
11
11
  * - meta is opaque — engine interprets, contracts stay neutral
12
+ * - Edges represent semantic flow, not imports
13
+ * - Direction is encoded in edge data (authority in edge, not node)
14
+ *
15
+ * v0.18.0 changes:
16
+ * - BREAKING: DiagramEdgeRelation expanded (invokes, emits, authorizes, reads)
17
+ * - BREAKING: FlowStage renamed to architecture layers
18
+ * - Added 'repo' to DiagramNodeKind
19
+ * - Added EdgeDirection to DiagramEdge
20
+ * - Added DiagramMode for diagram projections
21
+ * - Added FlowStage for architecture layering
12
22
  *
13
23
  * v0.17.0 changes:
14
24
  * - BREAKING: Removed 'ascii' field from DiagramSnapshot (React Flow only)
@@ -32,16 +42,63 @@ import type { FeatureStatus } from './index.js'
32
42
 
33
43
  /**
34
44
  * The semantic role of a node in the diagram.
45
+ * v0.18.0: Added 'repo' for repository-level containment
35
46
  */
36
- export type DiagramNodeKind = 'group' | 'feature' | 'artifact'
47
+ export type DiagramNodeKind = 'repo' | 'group' | 'feature' | 'artifact'
37
48
 
38
49
  /**
39
50
  * The semantic relationship between nodes.
40
51
  * Note: 'contains' removed in v0.4.0 — hierarchy now via parentId
41
52
  *
42
- * v0.5.0: Added 'feedback' and 'async' for richer flow semantics
53
+ * v0.18.0: Expanded to include authority-aware relations
54
+ * - invokes: Active call (e.g., app invokes MCP tool)
55
+ * - emits: Produces events/data (e.g., edge emits to backend)
56
+ * - authorizes: Trust boundary (e.g., backend authorizes access)
57
+ * - reads: Passive consumption (e.g., app reads strategy)
58
+ * - depends_on: Build/type dependency
59
+ * - feedback: Bidirectional loop
60
+ */
61
+ export type DiagramEdgeRelation =
62
+ | 'invokes'
63
+ | 'emits'
64
+ | 'authorizes'
65
+ | 'reads'
66
+ | 'depends_on'
67
+ | 'feedback'
68
+
69
+ /**
70
+ * Edge direction semantics.
71
+ * Determines which end of the edge has authority to update it.
72
+ *
73
+ * v0.18.0: New type for explicit directionality
74
+ */
75
+ export type EdgeDirection = 'forward' | 'backward' | 'bidirectional'
76
+
77
+ /**
78
+ * Architecture layers for horizontal organization.
79
+ * The primary organizing axis - determines which column a node belongs to.
80
+ *
81
+ * v0.18.0: Renamed from processing-pipeline to architecture-layer semantics
43
82
  */
44
- export type DiagramEdgeRelation = 'flows_to' | 'depends_on' | 'feedback' | 'async'
83
+ export type FlowStage =
84
+ | 'clients' // CLIENTS (ALL MCP CONSUMERS)
85
+ | 'authority' // MCP AUTHORITY & TOOL GATEWAY
86
+ | 'truth' // SEMANTIC TRUTH, STRATEGY, & EVIDENCE (AWS)
87
+ | 'edge' // EDGE INGESTION & MCP ADAPTERS
88
+ | 'evaluation' // EVALUATION, GUIDANCE, & AGENTS (MCP)
89
+ | 'governance' // CI / GOVERNANCE
90
+
91
+ /**
92
+ * Diagram projection modes.
93
+ * One graph, filtered by mode.
94
+ *
95
+ * v0.18.0: New type for multi-view diagrams
96
+ */
97
+ export type DiagramMode =
98
+ | 'file' // Future: file-level (not implemented)
99
+ | 'capability' // All capabilities visible
100
+ | 'repo' // Repo containers + direct children only
101
+ | 'architecture' // Repo + exported capabilities only
45
102
 
46
103
  /**
47
104
  * A node in the diagram graph.
@@ -69,6 +126,8 @@ export interface DiagramNode {
69
126
  /**
70
127
  * An edge connecting two nodes.
71
128
  * Represents a semantic relationship, not a visual connector.
129
+ *
130
+ * v0.18.0: Added direction for authority semantics
72
131
  */
73
132
  export interface DiagramEdge {
74
133
  /** Source node ID */
@@ -77,6 +136,15 @@ export interface DiagramEdge {
77
136
  to: string
78
137
  /** Type of relationship */
79
138
  relation: DiagramEdgeRelation
139
+ /**
140
+ * Direction semantics for authority.
141
+ * - forward: Can only be updated from source (most common)
142
+ * - backward: Can only be updated from target
143
+ * - bidirectional: Can be updated from both sides (rare, explicit)
144
+ *
145
+ * Defaults to 'forward' if not specified.
146
+ */
147
+ direction?: EdgeDirection
80
148
  }
81
149
 
82
150
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * System Diagram Types (v0.17.0)
2
+ * System Diagram Types (v0.18.0)
3
3
  *
4
4
  * Schema for the system diagram feature.
5
5
  * These types define the contract between:
@@ -11,6 +11,11 @@
11
11
  * - Site displays interactive React Flow diagram
12
12
  * - Snapshots pushed via CI automation
13
13
  *
14
+ * v0.18.0: Semantic architecture diagram transformation
15
+ * - Edge semantics (invokes, emits, authorizes, reads)
16
+ * - FlowStage for architecture layers
17
+ * - DiagramMode for projections
18
+ * - 'repo' node kind
14
19
  * v0.17.0: Removed ASCII rendering (React Flow only)
15
20
  * v0.6.0: meta is now opaque (Record<string, unknown>), engine interprets
16
21
  */
@@ -65,6 +70,9 @@ export interface SystemCapabilityManifest {
65
70
  export type {
66
71
  DiagramNodeKind,
67
72
  DiagramEdgeRelation,
73
+ EdgeDirection,
74
+ FlowStage,
75
+ DiagramMode,
68
76
  DiagramNode,
69
77
  DiagramEdge,
70
78
  DiagramSpec,