@unified-product-graph/core 0.12.7 → 0.13.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/index.cjs CHANGED
@@ -38,7 +38,10 @@ __export(index_exports, {
38
38
  MARKET_COMPETITIVE_PLAYBOOK: () => MARKET_COMPETITIVE_PLAYBOOK,
39
39
  OPERATIONS_QUALITY_PLAYBOOK: () => OPERATIONS_QUALITY_PLAYBOOK,
40
40
  PRODUCT_DELIVERY_PLAYBOOK: () => PRODUCT_DELIVERY_PLAYBOOK,
41
+ PROPERTY_MODIFIERS: () => PROPERTY_MODIFIERS,
42
+ PROPERTY_MODIFIER_SEMANTICS: () => PROPERTY_MODIFIER_SEMANTICS,
41
43
  PROPERTY_SCALE_MAP: () => PROPERTY_SCALE_MAP,
44
+ RECORD_ENTITY_TYPES: () => RECORD_ENTITY_TYPES,
42
45
  REFLECT_MODES: () => REFLECT_MODES,
43
46
  REGISTRY_PRODUCT_ID: () => REGISTRY_PRODUCT_ID,
44
47
  STRATEGY_OUTCOMES_PLAYBOOK: () => STRATEGY_OUTCOMES_PLAYBOOK,
@@ -140,6 +143,7 @@ __export(index_exports, {
140
143
  getDomainIdForType: () => getDomainIdForType,
141
144
  getDomainsInRing: () => getDomainsInRing,
142
145
  getEdgePropertySchema: () => getEdgePropertySchema,
146
+ getEntityModifierSummary: () => getEntityModifierSummary,
143
147
  getEnumScale: () => getEnumScale,
144
148
  getEnumValueMeta: () => getEnumValueMeta,
145
149
  getGuideForDomain: () => getGuideForDomain,
@@ -155,6 +159,7 @@ __export(index_exports, {
155
159
  getPropertiesForScale: () => getPropertiesForScale,
156
160
  getPropertyDefaultScale: () => getPropertyDefaultScale,
157
161
  getPropertyMigrations: () => getPropertyMigrations,
162
+ getPropertyModifier: () => getPropertyModifier,
158
163
  getPropertySchema: () => getPropertySchema,
159
164
  getRegion: () => getRegion,
160
165
  getRegionForEntityType: () => getRegionForEntityType,
@@ -171,6 +176,7 @@ __export(index_exports, {
171
176
  getValidChildren: () => getValidChildren,
172
177
  getVisibleTypes: () => getVisibleTypes,
173
178
  hasStatusMigration: () => hasStatusMigration,
179
+ isAggregateShapedProperty: () => isAggregateShapedProperty,
174
180
  isCanonical: () => isCanonical,
175
181
  isCanonicalProductStage: () => isCanonicalProductStage,
176
182
  isContainmentFreeType: () => isContainmentFreeType,
@@ -183,9 +189,12 @@ __export(index_exports, {
183
189
  isLifecyclePlannedType: () => isLifecyclePlannedType,
184
190
  isPolymorphicEdge: () => isPolymorphicEdge,
185
191
  isPortfolio: () => isPortfolio,
192
+ isRecordEntity: () => isRecordEntity,
186
193
  isRegisteredPolymorphicEdge: () => isRegisteredPolymorphicEdge,
194
+ isRuntimeStateShapedProperty: () => isRuntimeStateShapedProperty,
187
195
  isSubSequenceStep: () => isSubSequenceStep,
188
196
  isUPGDocument: () => isUPGDocument,
197
+ listPropertiesByModifier: () => listPropertiesByModifier,
189
198
  listStatusMigrations: () => listStatusMigrations,
190
199
  listTreePatternSummaries: () => listTreePatternSummaries,
191
200
  migrateEdge: () => migrateEdge,
@@ -2050,7 +2059,9 @@ var UPG_EDGE_CATALOG = {
2050
2059
  persona_belongs_to_market_segment: { forward_verb: "belongs_to", reverse_verb: "includes_persona", classification: "cross-domain", source_type: "persona", target_type: "market_segment" },
2051
2060
  revenue_stream_priced_by_pricing_strategy: { forward_verb: "priced_by", reverse_verb: "prices", classification: "cross-domain", source_type: "revenue_stream", target_type: "pricing_strategy" },
2052
2061
  revenue_stream_drives_outcome: { forward_verb: "drives", reverse_verb: "driven_by", classification: "cross-domain", source_type: "revenue_stream", target_type: "outcome" },
2053
- revenue_stream_measured_by_metric_cross_domain: { forward_verb: "measured_by", reverse_verb: "measures", classification: "cross-domain", source_type: "revenue_stream", target_type: "metric" },
2062
+ // revenue_stream_measured_by_metric_cross_domain dropped in 0.13.0 Wave 1 (UPG-685 T0.1):
2063
+ // a cross-domain-classified shadow of revenue_stream_measured_by_metric (same measured_by
2064
+ // verbs); pickCanonicalEdge never returned it. Dual-read to the canonical in UPG_EDGE_MIGRATIONS.
2054
2065
  pricing_tier_targets_behavioral_segment: { forward_verb: "targets", reverse_verb: "targeted_by", classification: "cross-domain", source_type: "pricing_tier", target_type: "behavioral_segment" },
2055
2066
  key_resource_enables_value_proposition: { forward_verb: "enables", reverse_verb: "enabled_by", classification: "cross-domain", source_type: "key_resource", target_type: "value_proposition" },
2056
2067
  // 4.3 Go-To-Market Domain
@@ -3817,7 +3828,12 @@ var UPG_VALID_CHILDREN = {
3817
3828
  ],
3818
3829
  // ── Data & Analytics hierarchy ───────────────────────────────────────────────
3819
3830
  data_source: ["metric", "data_pipeline", "data_lineage", "event_schema"],
3820
- metric: ["metric", "outcome", "data_quality_rule", "metric_quality_assessment"],
3831
+ // UPG-685 T0.4 (0.13.0 Wave 1): `outcome` removed as a metric child. It closed a
3832
+ // containment cycle (outcome ⊃ metric ⊃ outcome) and was backed only by the CAUSAL
3833
+ // `metric_drives_outcome` edge, not a hierarchy edge — the "metric leads to outcome"
3834
+ // meaning lives correctly on that causal edge. The real containment (outcome ⊃ metric)
3835
+ // is kept. Sub-metric trees (metric ⊃ metric) stay.
3836
+ metric: ["metric", "data_quality_rule", "metric_quality_assessment"],
3821
3837
  data_domain: ["data_product", "data_source", "glossary_term", "data_model", "dashboard"],
3822
3838
  dashboard: ["report", "experiment_run"],
3823
3839
  // ── Content & Knowledge hierarchy ────────────────────────────────────────────
@@ -4220,43 +4236,6 @@ var SOLUTION_LIFECYCLE = {
4220
4236
  }
4221
4237
  ]
4222
4238
  };
4223
- var HYPOTHESIS_LIFECYCLE = {
4224
- entity_type: "hypothesis",
4225
- initial_phase: "untested",
4226
- terminal_phases: ["resolved"],
4227
- phases: [
4228
- {
4229
- id: "untested",
4230
- label: "Untested",
4231
- description: "The belief is stated. No experiment has been designed or run.",
4232
- transitions_to: ["testing"]
4233
- },
4234
- {
4235
- id: "testing",
4236
- label: "Testing",
4237
- description: "An experiment is actively running to test this hypothesis. Evidence is being gathered.",
4238
- transitions_to: ["resolved"]
4239
- },
4240
- {
4241
- id: "resolved",
4242
- label: "Resolved",
4243
- description: "The hypothesis has been tested and a conclusion reached. The resolved phase has two states: validated (belief held) or invalidated (belief did not hold).",
4244
- transitions_to: [],
4245
- core_states: [
4246
- {
4247
- id: "validated",
4248
- label: "Validated",
4249
- description: "Evidence supports the hypothesis. The belief held. Learnings can inform solution design."
4250
- },
4251
- {
4252
- id: "invalidated",
4253
- label: "Invalidated",
4254
- description: "Evidence contradicts the hypothesis. The belief did not hold. Learnings prevent investment in the wrong direction."
4255
- }
4256
- ]
4257
- }
4258
- ]
4259
- };
4260
4239
  var HYPOTHESIS_CLAIM_LIFECYCLE = {
4261
4240
  entity_type: "hypothesis",
4262
4241
  initial_phase: "drafted",
@@ -6409,9 +6388,7 @@ var UPG_LIFECYCLES = [
6409
6388
  OPPORTUNITY_LIFECYCLE,
6410
6389
  SOLUTION_LIFECYCLE,
6411
6390
  HYPOTHESIS_CLAIM_LIFECYCLE,
6412
- // v0.4.0 canonical (re-promoted as 'hypothesis')
6413
- HYPOTHESIS_LIFECYCLE,
6414
- // pre-v0.2.8 legacy (retained for migration compat)
6391
+ // canonical 'hypothesis' lifecycle. The pre-v0.2.8 legacy binding (untested → testing → resolved) was removed in 0.13.0 Wave 1 (UPG-685 T0.3): it was a dead second binding for the same entity_type, always shadowed by this one, and the legacy-status remap lives in UPG_*_MIGRATIONS, not a live lifecycle.
6415
6392
  EXPERIMENT_LIFECYCLE,
6416
6393
  EXPERIMENT_PLAN_LIFECYCLE,
6417
6394
  EXPERIMENT_RUN_LIFECYCLE,
@@ -9019,6 +8996,7 @@ var UPG_EDGE_MIGRATIONS = {
9019
8996
  { kind: "rename", from: "value_proposition_targets_persona_cross_domain", to: "value_proposition_targets_persona", requires_source_type: "value_proposition", requires_target_type: "persona", reason: "Duplicate collapse (UPG-677). Byte-identical shadow of value_proposition_targets_persona; the suffixed twin never resolved." },
9020
8997
  { kind: "rename", from: "metric_measures_metric_cross_domain", to: "metric_measures_metric", requires_source_type: "metric", requires_target_type: "metric", reason: "Duplicate collapse (UPG-677). Byte-identical shadow of metric_measures_metric; the suffixed twin never resolved." },
9021
8998
  { kind: "rename", from: "insight_validates_need_cross_domain", to: "insight_validates_need", requires_source_type: "insight", requires_target_type: "need", reason: "Duplicate collapse (UPG-677). Byte-identical shadow of insight_validates_need; the suffixed twin never resolved." },
8999
+ { kind: "rename", from: "revenue_stream_measured_by_metric_cross_domain", to: "revenue_stream_measured_by_metric", requires_source_type: "revenue_stream", requires_target_type: "metric", reason: "Duplicate collapse (UPG-685 T0.1, 0.13.0 Wave 1). Cross-domain-classified shadow of revenue_stream_measured_by_metric (same measured_by/measures verbs); pickCanonicalEdge never returned it (the semantic key wins the pair; revenue_stream_drives_metric serves the cross-domain ask). Verb-preserving collapse onto the semantic canonical." },
9022
9000
  // ── Tier 2: tense / suffix twins ──
9023
9001
  { kind: "rename", from: "metric_decomposed_into_metric", to: "metric_decomposes_into_metric", requires_source_type: "metric", requires_target_type: "metric", reason: "Duplicate collapse (UPG-677). Tense-twin of the active-voice metric_decomposes_into_metric." },
9024
9002
  { kind: "rename", from: "product_decided_via_decision_hierarchy", to: "product_decided_via_decision", requires_source_type: "product", requires_target_type: "decision", reason: "Duplicate collapse (UPG-677). Suffix-twin of product_decided_via_decision." },
@@ -19423,6 +19401,62 @@ function isUPGDocument(doc) {
19423
19401
  return validateUPGDocument(doc).valid;
19424
19402
  }
19425
19403
 
19404
+ // src/properties/property-modifiers.ts
19405
+ var PROPERTY_MODIFIERS = ["derived", "snapshot", "volatile"];
19406
+ var PROPERTY_MODIFIER_SEMANTICS = {
19407
+ derived: "Computed from edges/children at read-time; never hand-authored. A stored value that contradicts the graph is a smell.",
19408
+ snapshot: "A stale-stamped cache of a live reading; SHOULD pair with a `*_as_of` timestamp. Definition entities carry live state only as a snapshot.",
19409
+ volatile: "An environment-specific pointer (URL / path / id) that may rot or be stripped on export; not portable modeling knowledge."
19410
+ };
19411
+ function listPropertiesByModifier(modifier) {
19412
+ const out = [];
19413
+ for (const [type, props] of Object.entries(UPG_PROPERTY_SCHEMA)) {
19414
+ for (const [property, def] of Object.entries(props)) {
19415
+ const m = def?.modifier;
19416
+ if (!m) continue;
19417
+ if (modifier && m !== modifier) continue;
19418
+ out.push({ type, property, modifier: m });
19419
+ }
19420
+ }
19421
+ return out;
19422
+ }
19423
+ function getPropertyModifier(entityType, property) {
19424
+ return UPG_PROPERTY_SCHEMA[entityType]?.[property]?.modifier;
19425
+ }
19426
+ function getEntityModifierSummary(entityType) {
19427
+ const props = UPG_PROPERTY_SCHEMA[entityType];
19428
+ if (!props) return void 0;
19429
+ const summary = { derived: [], snapshot: [], volatile: [] };
19430
+ let any = false;
19431
+ for (const [property, def] of Object.entries(props)) {
19432
+ const m = def?.modifier;
19433
+ if (!m) continue;
19434
+ summary[m].push(property);
19435
+ any = true;
19436
+ }
19437
+ return any ? summary : void 0;
19438
+ }
19439
+ var RECORD_ENTITY_TYPES = /* @__PURE__ */ new Set([
19440
+ "ai_cost_tracker",
19441
+ "eval_run",
19442
+ "test_result",
19443
+ "agent_session",
19444
+ "cohort",
19445
+ "ai_trace",
19446
+ "workflow_run"
19447
+ ]);
19448
+ function isRecordEntity(entityType) {
19449
+ return RECORD_ENTITY_TYPES.has(entityType);
19450
+ }
19451
+ function isAggregateShapedProperty(name, def) {
19452
+ if (def?.type !== "number") return false;
19453
+ return name.endsWith("_count") || name === "headcount";
19454
+ }
19455
+ function isRuntimeStateShapedProperty(name, def) {
19456
+ if (def?.type !== "number") return false;
19457
+ return /_rate$/.test(name) || /_pct$/.test(name) || /^current_/.test(name) || /_remaining$/.test(name) || /_p\d+_/.test(name) || /^monthly_/.test(name) || /_per_/.test(name);
19458
+ }
19459
+
19426
19460
  // src/properties/edge-property-validation.ts
19427
19461
  function validateEdgeProperties(edgeType, properties) {
19428
19462
  const schema = getEdgePropertySchema(edgeType);
@@ -21032,6 +21066,29 @@ var UPG_TREE_PATTERNS = [
21032
21066
  // readable money-model overview; `depth` extends into the metric -> metric
21033
21067
  // decomposition waterfall.
21034
21068
  natural_depth: 3
21069
+ },
21070
+ {
21071
+ id: "north_star",
21072
+ label: "North Star impact",
21073
+ description: "A north-star metric, the input/sub-metrics it decomposes into, and the outcomes it drives. The metric-rooted, leading-indicator view: outcomes hang off the metric by influence (the causal `drives` edge), distinct from the OKR view where the outcome sits on top and the metric measures it.",
21074
+ framework_id: "north-star-metric",
21075
+ region: "strategy_outcomes",
21076
+ gap_policy: "all-optional",
21077
+ anchor_type: "metric",
21078
+ // A north-star tree roots at a metric by definition; no fallback (no metric =
21079
+ // no north-star view, honestly empty rather than rooting elsewhere).
21080
+ fallback_anchors: [],
21081
+ child_map: {
21082
+ // A metric decomposes into its input/sub-metrics (the `metric_decomposes_into_metric`
21083
+ // hierarchy) AND drives the outcomes it predicts (the causal `metric_drives_outcome`).
21084
+ // The outcome is a child by INFLUENCE, not containment — the leading-to-lagging chain.
21085
+ // Following the causal edge by type-adjacency (cf. `strategy`'s initiative -> outcome)
21086
+ // is how the metric-rooted view renders without re-creating the metric ⊃ outcome
21087
+ // containment cycle removed in UPG-685 T0.4. The assembler's `seen` set terminates the
21088
+ // metric -> metric recursion for free.
21089
+ metric: [opt("metric"), opt("outcome")]
21090
+ },
21091
+ natural_depth: 3
21035
21092
  }
21036
21093
  ];
21037
21094
  var UPG_TREE_PATTERNS_BY_ID = Object.fromEntries(
@@ -28440,11 +28497,6 @@ var UPG_REGIONS = [
28440
28497
  edge_id: "key_result_quantified_by_metric",
28441
28498
  crosses_into: "strategy_outcomes"
28442
28499
  },
28443
- {
28444
- direction: "import",
28445
- edge_id: "revenue_stream_measured_by_metric_cross_domain",
28446
- crosses_into: "business_gtm_growth"
28447
- },
28448
28500
  {
28449
28501
  direction: "import",
28450
28502
  edge_id: "service_level_objective_tracks_metric",
@@ -29465,7 +29517,7 @@ function isCanonical(text) {
29465
29517
  }
29466
29518
 
29467
29519
  // src/index.ts
29468
- var UPG_VERSION = "0.12.7";
29520
+ var UPG_VERSION = "0.13.0";
29469
29521
  var UPG_FORMAT_VERSION = "0.4.0";
29470
29522
  var MARKDOWN_FORMAT_VERSION = "0.1";
29471
29523
  var UPG_TYPES = getTypes();
@@ -29548,7 +29600,10 @@ var UPG_META_COUNT = UPG_ENTITY_META.length;
29548
29600
  MARKET_COMPETITIVE_PLAYBOOK,
29549
29601
  OPERATIONS_QUALITY_PLAYBOOK,
29550
29602
  PRODUCT_DELIVERY_PLAYBOOK,
29603
+ PROPERTY_MODIFIERS,
29604
+ PROPERTY_MODIFIER_SEMANTICS,
29551
29605
  PROPERTY_SCALE_MAP,
29606
+ RECORD_ENTITY_TYPES,
29552
29607
  REFLECT_MODES,
29553
29608
  REGISTRY_PRODUCT_ID,
29554
29609
  STRATEGY_OUTCOMES_PLAYBOOK,
@@ -29650,6 +29705,7 @@ var UPG_META_COUNT = UPG_ENTITY_META.length;
29650
29705
  getDomainIdForType,
29651
29706
  getDomainsInRing,
29652
29707
  getEdgePropertySchema,
29708
+ getEntityModifierSummary,
29653
29709
  getEnumScale,
29654
29710
  getEnumValueMeta,
29655
29711
  getGuideForDomain,
@@ -29665,6 +29721,7 @@ var UPG_META_COUNT = UPG_ENTITY_META.length;
29665
29721
  getPropertiesForScale,
29666
29722
  getPropertyDefaultScale,
29667
29723
  getPropertyMigrations,
29724
+ getPropertyModifier,
29668
29725
  getPropertySchema,
29669
29726
  getRegion,
29670
29727
  getRegionForEntityType,
@@ -29681,6 +29738,7 @@ var UPG_META_COUNT = UPG_ENTITY_META.length;
29681
29738
  getValidChildren,
29682
29739
  getVisibleTypes,
29683
29740
  hasStatusMigration,
29741
+ isAggregateShapedProperty,
29684
29742
  isCanonical,
29685
29743
  isCanonicalProductStage,
29686
29744
  isContainmentFreeType,
@@ -29693,9 +29751,12 @@ var UPG_META_COUNT = UPG_ENTITY_META.length;
29693
29751
  isLifecyclePlannedType,
29694
29752
  isPolymorphicEdge,
29695
29753
  isPortfolio,
29754
+ isRecordEntity,
29696
29755
  isRegisteredPolymorphicEdge,
29756
+ isRuntimeStateShapedProperty,
29697
29757
  isSubSequenceStep,
29698
29758
  isUPGDocument,
29759
+ listPropertiesByModifier,
29699
29760
  listStatusMigrations,
29700
29761
  listTreePatternSummaries,
29701
29762
  migrateEdge,