@sigloch/graphcode-client 0.5.0 → 0.6.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/dist/panels.d.ts CHANGED
@@ -16,6 +16,7 @@
16
16
  */
17
17
  import type { ReadinessReport, ReadinessGate, CreationCurrency, CreationCurrencyProvider } from './readiness.js';
18
18
  import type { RuleViolation, LiveUpdateEvent } from '@sigloch/contracts/harness';
19
+ import type { Graph } from '@sigloch/graph-api-core';
19
20
  export interface GatePanel {
20
21
  id: string;
21
22
  label: string;
@@ -125,6 +126,23 @@ export declare function creationCurrencyProvider(analysis: Array<{
125
126
  id: string;
126
127
  currency: CreationCurrency;
127
128
  }>): CreationCurrencyProvider;
129
+ /**
130
+ * Real scope-currency for the 5 analysis artifacts (CR-SM-227) — replaces the
131
+ * `ABSENT_CREATION_PROVIDER` placeholder (CR-GVE-225 F10: GVE showed `absent`
132
+ * correctly because no scope-currency check existed yet). Reads the
133
+ * `graphVersion` freshness stamp AF-01..05 (contracts) check for presence of
134
+ * (`SYS.attributes.analysisFreshness.<id>`) and classifies it against the
135
+ * live graphVersion: missing/invalid stamp → absent; stamp older than the
136
+ * current graphVersion → stale; stamp at (or ahead of) it → current.
137
+ * Grober Graph-Versions-Stempel only, no scope-hash — CR-SM-227's declared
138
+ * first-cut limitation ("Achtung" section), not full scope-precise staleness.
139
+ */
140
+ export declare function computeAnalysisCurrency(graph: Pick<Graph, 'nodes'>, currentGraphVersion: number): Array<{
141
+ id: string;
142
+ currency: CreationCurrency;
143
+ }>;
144
+ /** Convenience: build the real CreationCurrencyProvider straight off the graph + its live version. */
145
+ export declare function analysisCreationCurrencyProvider(graph: Pick<Graph, 'nodes'>, currentGraphVersion: number): CreationCurrencyProvider;
128
146
  export interface ImpactPanel {
129
147
  root: string;
130
148
  blastRadiusNodes: number;
package/dist/panels.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { AnalysisArtifactId, AnalysisFreshnessStampSchema } from '@sigloch/contracts/se';
1
2
  function toGatePanel(g) {
2
3
  return { id: g.id, label: g.label, passed: g.passed, score: g.score, blocking: g.blocking, completeness: g.completeness };
3
4
  }
@@ -94,6 +95,34 @@ export function creationCurrencyProvider(analysis) {
94
95
  const m = new Map(analysis.map((a) => [a.id, a.currency]));
95
96
  return (creation) => m.get(creation) ?? 'absent';
96
97
  }
98
+ /**
99
+ * Real scope-currency for the 5 analysis artifacts (CR-SM-227) — replaces the
100
+ * `ABSENT_CREATION_PROVIDER` placeholder (CR-GVE-225 F10: GVE showed `absent`
101
+ * correctly because no scope-currency check existed yet). Reads the
102
+ * `graphVersion` freshness stamp AF-01..05 (contracts) check for presence of
103
+ * (`SYS.attributes.analysisFreshness.<id>`) and classifies it against the
104
+ * live graphVersion: missing/invalid stamp → absent; stamp older than the
105
+ * current graphVersion → stale; stamp at (or ahead of) it → current.
106
+ * Grober Graph-Versions-Stempel only, no scope-hash — CR-SM-227's declared
107
+ * first-cut limitation ("Achtung" section), not full scope-precise staleness.
108
+ */
109
+ export function computeAnalysisCurrency(graph, currentGraphVersion) {
110
+ const sys = graph.nodes.find((n) => n.type === 'SYS');
111
+ const stamps = (sys?.attributes?.analysisFreshness ?? {});
112
+ return AnalysisArtifactId.options.map((id) => {
113
+ const parsed = AnalysisFreshnessStampSchema.safeParse(stamps[id]);
114
+ const currency = !parsed.success
115
+ ? 'absent'
116
+ : parsed.data.graphVersion >= currentGraphVersion
117
+ ? 'current'
118
+ : 'stale';
119
+ return { id, currency };
120
+ });
121
+ }
122
+ /** Convenience: build the real CreationCurrencyProvider straight off the graph + its live version. */
123
+ export function analysisCreationCurrencyProvider(graph, currentGraphVersion) {
124
+ return creationCurrencyProvider(computeAnalysisCurrency(graph, currentGraphVersion));
125
+ }
97
126
  export function impactPanel(impact) {
98
127
  return { root: impact.rootId, blastRadiusNodes: impact.nodeCount, blastRadiusEdges: impact.edgeCount };
99
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigloch/graphcode-client",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",