@company-semantics/contracts 0.17.0 → 0.19.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.19.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,6 +46,7 @@
46
46
  "guard:version-tag:json": "npx tsx scripts/ci/version-tag-guard.ts --json",
47
47
  "guard:test": "vitest run scripts/ci/__tests__",
48
48
  "release": "npx tsx scripts/release.ts",
49
+ "prepublishOnly": "pnpm guard:version-tag",
49
50
  "test": "vitest run scripts/ci/__tests__"
50
51
  },
51
52
  "packageManager": "pnpm@10.25.0",
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,77 @@ 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
+ * Data lifecycle phase for coloring/filtering.
93
+ * Secondary annotation — does not affect layout.
94
+ *
95
+ * v0.19.0: New type for pipeline visualization
96
+ */
97
+ export type PipelinePhase =
98
+ | 'source' // External data origin
99
+ | 'ingest' // Data collection and intake
100
+ | 'normalize' // Schema alignment and transformation
101
+ | 'evaluate' // Analysis and decision-making
102
+ | 'store' // Persistence and retrieval
103
+ | 'surface' // Presentation and delivery
104
+
105
+ /**
106
+ * Diagram projection modes.
107
+ * One graph, filtered by mode.
108
+ *
109
+ * v0.18.0: New type for multi-view diagrams
110
+ */
111
+ export type DiagramMode =
112
+ | 'file' // Future: file-level (not implemented)
113
+ | 'capability' // All capabilities visible
114
+ | 'repo' // Repo containers + direct children only
115
+ | 'architecture' // Repo + exported capabilities only
45
116
 
46
117
  /**
47
118
  * A node in the diagram graph.
@@ -69,6 +140,8 @@ export interface DiagramNode {
69
140
  /**
70
141
  * An edge connecting two nodes.
71
142
  * Represents a semantic relationship, not a visual connector.
143
+ *
144
+ * v0.18.0: Added direction for authority semantics
72
145
  */
73
146
  export interface DiagramEdge {
74
147
  /** Source node ID */
@@ -77,6 +150,15 @@ export interface DiagramEdge {
77
150
  to: string
78
151
  /** Type of relationship */
79
152
  relation: DiagramEdgeRelation
153
+ /**
154
+ * Direction semantics for authority.
155
+ * - forward: Can only be updated from source (most common)
156
+ * - backward: Can only be updated from target
157
+ * - bidirectional: Can be updated from both sides (rare, explicit)
158
+ *
159
+ * Defaults to 'forward' if not specified.
160
+ */
161
+ direction?: EdgeDirection
80
162
  }
81
163
 
82
164
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * System Diagram Types (v0.17.0)
2
+ * System Diagram Types (v0.19.0)
3
3
  *
4
4
  * Schema for the system diagram feature.
5
5
  * These types define the contract between:
@@ -11,6 +11,12 @@
11
11
  * - Site displays interactive React Flow diagram
12
12
  * - Snapshots pushed via CI automation
13
13
  *
14
+ * v0.19.0: PipelinePhase annotation for data lifecycle visualization
15
+ * v0.18.0: Semantic architecture diagram transformation
16
+ * - Edge semantics (invokes, emits, authorizes, reads)
17
+ * - FlowStage for architecture layers
18
+ * - DiagramMode for projections
19
+ * - 'repo' node kind
14
20
  * v0.17.0: Removed ASCII rendering (React Flow only)
15
21
  * v0.6.0: meta is now opaque (Record<string, unknown>), engine interprets
16
22
  */
@@ -65,6 +71,10 @@ export interface SystemCapabilityManifest {
65
71
  export type {
66
72
  DiagramNodeKind,
67
73
  DiagramEdgeRelation,
74
+ EdgeDirection,
75
+ FlowStage,
76
+ PipelinePhase,
77
+ DiagramMode,
68
78
  DiagramNode,
69
79
  DiagramEdge,
70
80
  DiagramSpec,