@happyvertical/smrt-facts 0.40.70 → 0.41.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/AGENTS.md +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +121 -91
- package/dist/smrt-knowledge.json +19 -7
- package/package.json +6 -5
package/dist/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": "1.0.0",
|
|
3
3
|
"timestamp": 0,
|
|
4
4
|
"packageName": "@happyvertical/smrt-facts",
|
|
5
|
-
"packageVersion": "0.
|
|
5
|
+
"packageVersion": "0.41.0",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-facts:FactContent": {
|
|
8
8
|
"name": "factcontent",
|
|
@@ -226,12 +226,6 @@
|
|
|
226
226
|
}
|
|
227
227
|
},
|
|
228
228
|
"indexes": [
|
|
229
|
-
{
|
|
230
|
-
"name": "fact_contents_id_idx",
|
|
231
|
-
"columns": [
|
|
232
|
-
"id"
|
|
233
|
-
]
|
|
234
|
-
},
|
|
235
229
|
{
|
|
236
230
|
"name": "fact_contents_fact_id_content_id_idx",
|
|
237
231
|
"columns": [
|
|
@@ -242,9 +236,23 @@
|
|
|
242
236
|
"unique": true
|
|
243
237
|
},
|
|
244
238
|
{
|
|
245
|
-
"name": "
|
|
239
|
+
"name": "fact_contents_slug_context_idx",
|
|
246
240
|
"columns": [
|
|
247
|
-
"
|
|
241
|
+
"slug",
|
|
242
|
+
"context"
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"name": "fact_contents_tenant_id_created_at_idx",
|
|
247
|
+
"columns": [
|
|
248
|
+
"tenant_id",
|
|
249
|
+
"created_at"
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "fact_contents_content_id_idx",
|
|
254
|
+
"columns": [
|
|
255
|
+
"content_id"
|
|
248
256
|
]
|
|
249
257
|
}
|
|
250
258
|
],
|
|
@@ -443,12 +451,6 @@
|
|
|
443
451
|
}
|
|
444
452
|
},
|
|
445
453
|
"indexes": [
|
|
446
|
-
{
|
|
447
|
-
"name": "fact_content_collections_id_idx",
|
|
448
|
-
"columns": [
|
|
449
|
-
"id"
|
|
450
|
-
]
|
|
451
|
-
},
|
|
452
454
|
{
|
|
453
455
|
"name": "fact_content_collections_slug_context_idx",
|
|
454
456
|
"columns": [
|
|
@@ -456,6 +458,12 @@
|
|
|
456
458
|
"context"
|
|
457
459
|
],
|
|
458
460
|
"unique": true
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"name": "fact_content_collections_created_at_idx",
|
|
464
|
+
"columns": [
|
|
465
|
+
"created_at"
|
|
466
|
+
]
|
|
459
467
|
}
|
|
460
468
|
],
|
|
461
469
|
"version": "22be8f54"
|
|
@@ -530,7 +538,7 @@
|
|
|
530
538
|
"default": ""
|
|
531
539
|
},
|
|
532
540
|
"confidence": {
|
|
533
|
-
"type": "
|
|
541
|
+
"type": "decimal",
|
|
534
542
|
"required": false,
|
|
535
543
|
"default": 0
|
|
536
544
|
},
|
|
@@ -652,7 +660,7 @@
|
|
|
652
660
|
],
|
|
653
661
|
"schema": {
|
|
654
662
|
"tableName": "fact_evidences",
|
|
655
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"fact_evidences\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"fact_id\" UUID NOT NULL,\n \"evidence_key\" TEXT NOT NULL DEFAULT '',\n \"status\" TEXT NOT NULL DEFAULT 'supports',\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"source_url\" TEXT DEFAULT '',\n \"source_title\" TEXT DEFAULT '',\n \"quote\" TEXT DEFAULT '',\n \"locator\" TEXT DEFAULT '',\n \"extraction_method\" TEXT DEFAULT '',\n \"confidence\"
|
|
663
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"fact_evidences\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"fact_id\" UUID NOT NULL,\n \"evidence_key\" TEXT NOT NULL DEFAULT '',\n \"status\" TEXT NOT NULL DEFAULT 'supports',\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"source_url\" TEXT DEFAULT '',\n \"source_title\" TEXT DEFAULT '',\n \"quote\" TEXT DEFAULT '',\n \"locator\" TEXT DEFAULT '',\n \"extraction_method\" TEXT DEFAULT '',\n \"confidence\" REAL DEFAULT 0,\n \"metadata\" TEXT DEFAULT '',\n \"tenant_id\" UUID\n);",
|
|
656
664
|
"columns": {
|
|
657
665
|
"id": {
|
|
658
666
|
"type": "UUID",
|
|
@@ -740,7 +748,7 @@
|
|
|
740
748
|
"default": ""
|
|
741
749
|
},
|
|
742
750
|
"confidence": {
|
|
743
|
-
"type": "
|
|
751
|
+
"type": "REAL",
|
|
744
752
|
"notNull": false,
|
|
745
753
|
"unique": false,
|
|
746
754
|
"default": 0
|
|
@@ -759,12 +767,6 @@
|
|
|
759
767
|
}
|
|
760
768
|
},
|
|
761
769
|
"indexes": [
|
|
762
|
-
{
|
|
763
|
-
"name": "fact_evidences_id_idx",
|
|
764
|
-
"columns": [
|
|
765
|
-
"id"
|
|
766
|
-
]
|
|
767
|
-
},
|
|
768
770
|
{
|
|
769
771
|
"name": "fact_evidences_fact_id_evidence_key_idx",
|
|
770
772
|
"columns": [
|
|
@@ -774,13 +776,21 @@
|
|
|
774
776
|
"unique": true
|
|
775
777
|
},
|
|
776
778
|
{
|
|
777
|
-
"name": "
|
|
779
|
+
"name": "fact_evidences_slug_context_idx",
|
|
780
|
+
"columns": [
|
|
781
|
+
"slug",
|
|
782
|
+
"context"
|
|
783
|
+
]
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
"name": "fact_evidences_tenant_id_created_at_idx",
|
|
778
787
|
"columns": [
|
|
779
|
-
"tenant_id"
|
|
788
|
+
"tenant_id",
|
|
789
|
+
"created_at"
|
|
780
790
|
]
|
|
781
791
|
}
|
|
782
792
|
],
|
|
783
|
-
"version": "
|
|
793
|
+
"version": "5554e681"
|
|
784
794
|
}
|
|
785
795
|
},
|
|
786
796
|
"@happyvertical/smrt-facts:FactEvidenceCollection": {
|
|
@@ -935,12 +945,6 @@
|
|
|
935
945
|
}
|
|
936
946
|
},
|
|
937
947
|
"indexes": [
|
|
938
|
-
{
|
|
939
|
-
"name": "fact_evidences_id_idx",
|
|
940
|
-
"columns": [
|
|
941
|
-
"id"
|
|
942
|
-
]
|
|
943
|
-
},
|
|
944
948
|
{
|
|
945
949
|
"name": "fact_evidences_slug_context_idx",
|
|
946
950
|
"columns": [
|
|
@@ -948,6 +952,12 @@
|
|
|
948
952
|
"context"
|
|
949
953
|
],
|
|
950
954
|
"unique": true
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
"name": "fact_evidences_created_at_idx",
|
|
958
|
+
"columns": [
|
|
959
|
+
"created_at"
|
|
960
|
+
]
|
|
951
961
|
}
|
|
952
962
|
],
|
|
953
963
|
"version": "80329e4f"
|
|
@@ -1588,7 +1598,13 @@
|
|
|
1588
1598
|
"cli": true,
|
|
1589
1599
|
"tenantScoped": {
|
|
1590
1600
|
"mode": "optional"
|
|
1591
|
-
}
|
|
1601
|
+
},
|
|
1602
|
+
"conflictColumns": [
|
|
1603
|
+
"tenant_id",
|
|
1604
|
+
"slug",
|
|
1605
|
+
"context",
|
|
1606
|
+
"_meta_type"
|
|
1607
|
+
]
|
|
1592
1608
|
},
|
|
1593
1609
|
"extends": "SmrtObject",
|
|
1594
1610
|
"exportName": "FactSource",
|
|
@@ -1678,15 +1694,10 @@
|
|
|
1678
1694
|
}
|
|
1679
1695
|
},
|
|
1680
1696
|
"indexes": [
|
|
1681
|
-
{
|
|
1682
|
-
"name": "fact_sources_id_idx",
|
|
1683
|
-
"columns": [
|
|
1684
|
-
"id"
|
|
1685
|
-
]
|
|
1686
|
-
},
|
|
1687
1697
|
{
|
|
1688
1698
|
"name": "fact_sources_slug_context_meta_type_idx",
|
|
1689
1699
|
"columns": [
|
|
1700
|
+
"tenant_id",
|
|
1690
1701
|
"slug",
|
|
1691
1702
|
"context",
|
|
1692
1703
|
"_meta_type"
|
|
@@ -1700,9 +1711,16 @@
|
|
|
1700
1711
|
]
|
|
1701
1712
|
},
|
|
1702
1713
|
{
|
|
1703
|
-
"name": "
|
|
1714
|
+
"name": "fact_sources_tenant_id_created_at_idx",
|
|
1704
1715
|
"columns": [
|
|
1705
|
-
"tenant_id"
|
|
1716
|
+
"tenant_id",
|
|
1717
|
+
"created_at"
|
|
1718
|
+
]
|
|
1719
|
+
},
|
|
1720
|
+
{
|
|
1721
|
+
"name": "fact_sources_fact_id_idx",
|
|
1722
|
+
"columns": [
|
|
1723
|
+
"fact_id"
|
|
1706
1724
|
]
|
|
1707
1725
|
}
|
|
1708
1726
|
],
|
|
@@ -1861,12 +1879,6 @@
|
|
|
1861
1879
|
}
|
|
1862
1880
|
},
|
|
1863
1881
|
"indexes": [
|
|
1864
|
-
{
|
|
1865
|
-
"name": "fact_source_collections_id_idx",
|
|
1866
|
-
"columns": [
|
|
1867
|
-
"id"
|
|
1868
|
-
]
|
|
1869
|
-
},
|
|
1870
1882
|
{
|
|
1871
1883
|
"name": "fact_source_collections_slug_context_idx",
|
|
1872
1884
|
"columns": [
|
|
@@ -1874,6 +1886,12 @@
|
|
|
1874
1886
|
"context"
|
|
1875
1887
|
],
|
|
1876
1888
|
"unique": true
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
"name": "fact_source_collections_created_at_idx",
|
|
1892
|
+
"columns": [
|
|
1893
|
+
"created_at"
|
|
1894
|
+
]
|
|
1877
1895
|
}
|
|
1878
1896
|
],
|
|
1879
1897
|
"version": "36f4adef"
|
|
@@ -2115,12 +2133,6 @@
|
|
|
2115
2133
|
}
|
|
2116
2134
|
},
|
|
2117
2135
|
"indexes": [
|
|
2118
|
-
{
|
|
2119
|
-
"name": "fact_subjects_id_idx",
|
|
2120
|
-
"columns": [
|
|
2121
|
-
"id"
|
|
2122
|
-
]
|
|
2123
|
-
},
|
|
2124
2136
|
{
|
|
2125
2137
|
"name": "fact_subjects_fact_id_entity_type_idx",
|
|
2126
2138
|
"columns": [
|
|
@@ -2131,9 +2143,17 @@
|
|
|
2131
2143
|
"unique": true
|
|
2132
2144
|
},
|
|
2133
2145
|
{
|
|
2134
|
-
"name": "
|
|
2146
|
+
"name": "fact_subjects_slug_context_idx",
|
|
2135
2147
|
"columns": [
|
|
2136
|
-
"
|
|
2148
|
+
"slug",
|
|
2149
|
+
"context"
|
|
2150
|
+
]
|
|
2151
|
+
},
|
|
2152
|
+
{
|
|
2153
|
+
"name": "fact_subjects_tenant_id_created_at_idx",
|
|
2154
|
+
"columns": [
|
|
2155
|
+
"tenant_id",
|
|
2156
|
+
"created_at"
|
|
2137
2157
|
]
|
|
2138
2158
|
}
|
|
2139
2159
|
],
|
|
@@ -2342,12 +2362,6 @@
|
|
|
2342
2362
|
}
|
|
2343
2363
|
},
|
|
2344
2364
|
"indexes": [
|
|
2345
|
-
{
|
|
2346
|
-
"name": "fact_subject_collections_id_idx",
|
|
2347
|
-
"columns": [
|
|
2348
|
-
"id"
|
|
2349
|
-
]
|
|
2350
|
-
},
|
|
2351
2365
|
{
|
|
2352
2366
|
"name": "fact_subject_collections_slug_context_idx",
|
|
2353
2367
|
"columns": [
|
|
@@ -2355,6 +2369,12 @@
|
|
|
2355
2369
|
"context"
|
|
2356
2370
|
],
|
|
2357
2371
|
"unique": true
|
|
2372
|
+
},
|
|
2373
|
+
{
|
|
2374
|
+
"name": "fact_subject_collections_created_at_idx",
|
|
2375
|
+
"columns": [
|
|
2376
|
+
"created_at"
|
|
2377
|
+
]
|
|
2358
2378
|
}
|
|
2359
2379
|
],
|
|
2360
2380
|
"version": "0ce73db4"
|
|
@@ -2557,12 +2577,6 @@
|
|
|
2557
2577
|
}
|
|
2558
2578
|
},
|
|
2559
2579
|
"indexes": [
|
|
2560
|
-
{
|
|
2561
|
-
"name": "fact_tags_id_idx",
|
|
2562
|
-
"columns": [
|
|
2563
|
-
"id"
|
|
2564
|
-
]
|
|
2565
|
-
},
|
|
2566
2580
|
{
|
|
2567
2581
|
"name": "fact_tags_fact_id_tag_slug_idx",
|
|
2568
2582
|
"columns": [
|
|
@@ -2572,9 +2586,17 @@
|
|
|
2572
2586
|
"unique": true
|
|
2573
2587
|
},
|
|
2574
2588
|
{
|
|
2575
|
-
"name": "
|
|
2589
|
+
"name": "fact_tags_slug_context_idx",
|
|
2576
2590
|
"columns": [
|
|
2577
|
-
"
|
|
2591
|
+
"slug",
|
|
2592
|
+
"context"
|
|
2593
|
+
]
|
|
2594
|
+
},
|
|
2595
|
+
{
|
|
2596
|
+
"name": "fact_tags_tenant_id_created_at_idx",
|
|
2597
|
+
"columns": [
|
|
2598
|
+
"tenant_id",
|
|
2599
|
+
"created_at"
|
|
2578
2600
|
]
|
|
2579
2601
|
}
|
|
2580
2602
|
],
|
|
@@ -2743,12 +2765,6 @@
|
|
|
2743
2765
|
}
|
|
2744
2766
|
},
|
|
2745
2767
|
"indexes": [
|
|
2746
|
-
{
|
|
2747
|
-
"name": "fact_tag_collections_id_idx",
|
|
2748
|
-
"columns": [
|
|
2749
|
-
"id"
|
|
2750
|
-
]
|
|
2751
|
-
},
|
|
2752
2768
|
{
|
|
2753
2769
|
"name": "fact_tag_collections_slug_context_idx",
|
|
2754
2770
|
"columns": [
|
|
@@ -2756,6 +2772,12 @@
|
|
|
2756
2772
|
"context"
|
|
2757
2773
|
],
|
|
2758
2774
|
"unique": true
|
|
2775
|
+
},
|
|
2776
|
+
{
|
|
2777
|
+
"name": "fact_tag_collections_created_at_idx",
|
|
2778
|
+
"columns": [
|
|
2779
|
+
"created_at"
|
|
2780
|
+
]
|
|
2759
2781
|
}
|
|
2760
2782
|
],
|
|
2761
2783
|
"version": "4bac3c1d"
|
|
@@ -3503,7 +3525,13 @@
|
|
|
3503
3525
|
"cli": true,
|
|
3504
3526
|
"tenantScoped": {
|
|
3505
3527
|
"mode": "optional"
|
|
3506
|
-
}
|
|
3528
|
+
},
|
|
3529
|
+
"conflictColumns": [
|
|
3530
|
+
"tenant_id",
|
|
3531
|
+
"slug",
|
|
3532
|
+
"context",
|
|
3533
|
+
"_meta_type"
|
|
3534
|
+
]
|
|
3507
3535
|
},
|
|
3508
3536
|
"extends": "SmrtObject",
|
|
3509
3537
|
"exportName": "Fact",
|
|
@@ -3619,15 +3647,10 @@
|
|
|
3619
3647
|
}
|
|
3620
3648
|
},
|
|
3621
3649
|
"indexes": [
|
|
3622
|
-
{
|
|
3623
|
-
"name": "facts_id_idx",
|
|
3624
|
-
"columns": [
|
|
3625
|
-
"id"
|
|
3626
|
-
]
|
|
3627
|
-
},
|
|
3628
3650
|
{
|
|
3629
3651
|
"name": "facts_slug_context_meta_type_idx",
|
|
3630
3652
|
"columns": [
|
|
3653
|
+
"tenant_id",
|
|
3631
3654
|
"slug",
|
|
3632
3655
|
"context",
|
|
3633
3656
|
"_meta_type"
|
|
@@ -3641,9 +3664,16 @@
|
|
|
3641
3664
|
]
|
|
3642
3665
|
},
|
|
3643
3666
|
{
|
|
3644
|
-
"name": "
|
|
3667
|
+
"name": "facts_tenant_id_created_at_idx",
|
|
3645
3668
|
"columns": [
|
|
3646
|
-
"tenant_id"
|
|
3669
|
+
"tenant_id",
|
|
3670
|
+
"created_at"
|
|
3671
|
+
]
|
|
3672
|
+
},
|
|
3673
|
+
{
|
|
3674
|
+
"name": "facts_previous_fact_id_idx",
|
|
3675
|
+
"columns": [
|
|
3676
|
+
"previous_fact_id"
|
|
3647
3677
|
]
|
|
3648
3678
|
}
|
|
3649
3679
|
],
|
|
@@ -4019,12 +4049,6 @@
|
|
|
4019
4049
|
}
|
|
4020
4050
|
},
|
|
4021
4051
|
"indexes": [
|
|
4022
|
-
{
|
|
4023
|
-
"name": "fact_collections_id_idx",
|
|
4024
|
-
"columns": [
|
|
4025
|
-
"id"
|
|
4026
|
-
]
|
|
4027
|
-
},
|
|
4028
4052
|
{
|
|
4029
4053
|
"name": "fact_collections_slug_context_idx",
|
|
4030
4054
|
"columns": [
|
|
@@ -4032,6 +4056,12 @@
|
|
|
4032
4056
|
"context"
|
|
4033
4057
|
],
|
|
4034
4058
|
"unique": true
|
|
4059
|
+
},
|
|
4060
|
+
{
|
|
4061
|
+
"name": "fact_collections_created_at_idx",
|
|
4062
|
+
"columns": [
|
|
4063
|
+
"created_at"
|
|
4064
|
+
]
|
|
4035
4065
|
}
|
|
4036
4066
|
],
|
|
4037
4067
|
"version": "3008a4e3"
|
package/dist/smrt-knowledge.json
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
"sensitiveFieldsExcluded": true,
|
|
4
4
|
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
5
5
|
"packageName": "@happyvertical/smrt-facts",
|
|
6
|
-
"packageVersion": "0.
|
|
6
|
+
"packageVersion": "0.41.0",
|
|
7
7
|
"sourceManifestPath": "dist/manifest.json",
|
|
8
8
|
"agentDocPath": "AGENTS.md",
|
|
9
9
|
"sourceHashes": {
|
|
10
|
-
"manifest": "
|
|
11
|
-
"packageJson": "
|
|
12
|
-
"agents": "
|
|
10
|
+
"manifest": "33aa9f4a697cb056fc93fe2bded9f245095b000cac4ff98dd31bb78efd812261",
|
|
11
|
+
"packageJson": "06310d91b5a8fa2b5b16fa5c461a985ef287f78fbefc70f3259dad8f25840d3e",
|
|
12
|
+
"agents": "3dff097c8282b094889f06247bdab664e75e54c85c4025219c82007f57b3a1bd"
|
|
13
13
|
},
|
|
14
14
|
"exports": [
|
|
15
15
|
".",
|
|
@@ -432,9 +432,9 @@
|
|
|
432
432
|
},
|
|
433
433
|
{
|
|
434
434
|
"name": "confidence",
|
|
435
|
-
"type": "
|
|
435
|
+
"type": "decimal",
|
|
436
436
|
"required": false,
|
|
437
|
-
"columnType": "
|
|
437
|
+
"columnType": "REAL",
|
|
438
438
|
"default": 0
|
|
439
439
|
},
|
|
440
440
|
{
|
|
@@ -1111,6 +1111,12 @@
|
|
|
1111
1111
|
"field": "tenantId"
|
|
1112
1112
|
},
|
|
1113
1113
|
"tableStrategy": "sti",
|
|
1114
|
+
"conflictColumns": [
|
|
1115
|
+
"tenant_id",
|
|
1116
|
+
"slug",
|
|
1117
|
+
"context",
|
|
1118
|
+
"_meta_type"
|
|
1119
|
+
],
|
|
1114
1120
|
"surfaces": [
|
|
1115
1121
|
{
|
|
1116
1122
|
"kind": "api",
|
|
@@ -2385,6 +2391,12 @@
|
|
|
2385
2391
|
"field": "tenantId"
|
|
2386
2392
|
},
|
|
2387
2393
|
"tableStrategy": "sti",
|
|
2394
|
+
"conflictColumns": [
|
|
2395
|
+
"tenant_id",
|
|
2396
|
+
"slug",
|
|
2397
|
+
"context",
|
|
2398
|
+
"_meta_type"
|
|
2399
|
+
],
|
|
2388
2400
|
"surfaces": [
|
|
2389
2401
|
{
|
|
2390
2402
|
"kind": "api",
|
|
@@ -3207,5 +3219,5 @@
|
|
|
3207
3219
|
"polymorphicAssociations": 0,
|
|
3208
3220
|
"uuidColumns": 25
|
|
3209
3221
|
},
|
|
3210
|
-
"agentDoc": "# @happyvertical/smrt-facts\n\nDistributed knowledge base with semantic deduplication, provenance tracking, and evolution chains.\n\n## Models\n\n- **Fact**: atomic knowledge unit with `textRefined`, auto-generated embeddings, status (active/pending/superseded), confidence score. Evolution via `previousFactId` (predecessor→successor with corrections/contradictions/refinements). NOT a structural hierarchy — Fact deliberately does not extend `SmrtHierarchical`; `parentId` is reserved for true structural parents elsewhere in the framework.\n- **FactSource**: provenance — URL, type, `credibility` (0-1), extraction timestamp.\n- **FactSubject**: polymorphic entity linking — `entityType` + `entityId` (no FK, string-based). `conflictColumns: ['fact_id', 'entity_type', 'entity_id']`.\n- **FactContent**: join table linking facts to Content. `conflictColumns: ['fact_id', 'content_id', 'relationship']`.\n\n## Semantic Reconciliation\n\n`reconcile()` uses three zones:\n- **≥0.85 similarity**: auto-merge (same fact, update metadata)\n- **0.60–0.85**: AI disambiguation — asks model to decide create/merge/branch\n- **<0.60**: new fact (no match)\n\n## Evolution Chains\n\n`getEvolutionChain()` (root→current), `getLatestInChain()` (highest confidence leaf), `getEvolutionTree()` (BFS all descendants). All traversals use `visited` Set for cycle detection.\n\n## Confidence Scoring\n\n`recalculateConfidence()`: weighted formula from `sourceCount`, `avgSourceCredibility`, `daysSinceLastSource`, `corroborationScore`.\n\n## Gotchas\n\n- **Embedding failures non-fatal**: try/catch with silent fail — doesn't block fact creation\n- **Metadata auto-stringify**: constructor `JSON.stringify`s objects; getters return parsed objects\n- **AI disambiguation fallback**: if AI fails, defaults to branch (safer than merge)\n- **Embeddings config**: `fields: ['textRefined'], autoGenerate: true, combinedField: {...}`\n- **Optional tenancy** with nullable tenantId. `findWithGlobals(tenantId)` for tenant + global facts\n"
|
|
3222
|
+
"agentDoc": "# @happyvertical/smrt-facts\n\nDistributed knowledge base with semantic deduplication, provenance tracking, and evolution chains.\n\n## Models\n\n- **Fact**: atomic knowledge unit with `textRefined`, auto-generated embeddings, status (active/pending/superseded), confidence score. Evolution via `previousFactId` (predecessor→successor with corrections/contradictions/refinements). NOT a structural hierarchy — Fact deliberately does not extend `SmrtHierarchical`; `parentId` is reserved for true structural parents elsewhere in the framework.\n- **FactSource**: provenance — URL, type, `credibility` (0-1), extraction timestamp.\n- **FactSubject**: polymorphic entity linking — `entityType` + `entityId` (no FK, string-based). `conflictColumns: ['fact_id', 'entity_type', 'entity_id']`.\n- **FactContent**: join table linking facts to Content. `conflictColumns: ['fact_id', 'content_id', 'relationship']`.\n\n## Semantic Reconciliation\n\n`reconcile()` uses three zones:\n- **≥0.85 similarity**: auto-merge (same fact, update metadata)\n- **0.60–0.85**: AI disambiguation — asks model to decide create/merge/branch\n- **<0.60**: new fact (no match)\n\n## Evolution Chains\n\n`getEvolutionChain()` (root→current), `getLatestInChain()` (highest confidence leaf), `getEvolutionTree()` (BFS all descendants). All traversals use `visited` Set for cycle detection.\n\n## Confidence Scoring\n\n`recalculateConfidence()`: weighted formula from `sourceCount`, `avgSourceCredibility`, `daysSinceLastSource`, `corroborationScore`.\n\n## Gotchas\n\n- **Embedding failures non-fatal**: try/catch with silent fail — doesn't block fact creation\n- **Metadata auto-stringify**: constructor `JSON.stringify`s objects; getters return parsed objects\n- **AI disambiguation fallback**: if AI fails, defaults to branch (safer than merge)\n- **Embeddings config**: `fields: ['textRefined'], autoGenerate: true, combinedField: {...}`\n- **Optional tenancy** with nullable tenantId. `findWithGlobals(tenantId)` for tenant + global facts\n- **Confidence/credibility must initialize `0.0`, never `0`**: they are rates, not money — inherently fractional. An integer literal compiles to an INTEGER column and a `[0, 1]` score becomes unstorable, so PostgreSQL raises `22P02` while SQLite silently accepts it. `FactEvidence.confidence` carried that bug until #2361; `pnpm --filter @happyvertical/smrt-facts test:postgres` is the lane that holds the line. (Money elsewhere in the framework goes the other way — integer minor units.)\n"
|
|
3211
3223
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-facts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Distributed memory and knowledge management with provenance tracking for SMRT framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
"@happyvertical/logger": "^0.88.0",
|
|
25
25
|
"@happyvertical/sql": "^0.88.0",
|
|
26
26
|
"@happyvertical/utils": "^0.88.0",
|
|
27
|
-
"@happyvertical/smrt-core": "0.
|
|
28
|
-
"@happyvertical/smrt-prompts": "0.
|
|
29
|
-
"@happyvertical/smrt-tenancy": "0.
|
|
27
|
+
"@happyvertical/smrt-core": "0.41.0",
|
|
28
|
+
"@happyvertical/smrt-prompts": "0.41.0",
|
|
29
|
+
"@happyvertical/smrt-tenancy": "0.41.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "24.13.2",
|
|
33
33
|
"typescript": "5.9.3",
|
|
34
34
|
"vite": "8.1.4",
|
|
35
35
|
"vitest": "4.1.10",
|
|
36
|
-
"@happyvertical/smrt-vitest": "0.
|
|
36
|
+
"@happyvertical/smrt-vitest": "0.41.0"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|
|
39
39
|
"ai",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"dev": "vite dev",
|
|
63
63
|
"pretest": "[ -f ../cli/dist/index.js ] && node ../cli/dist/index.js test --manifest-only || true",
|
|
64
64
|
"test": "vitest run",
|
|
65
|
+
"test:postgres": "node ../../scripts/run-with-ci-postgres.mjs -- pnpm exec vitest run src/__tests__/confidence-fields.postgres.test.ts",
|
|
65
66
|
"test:watch": "vitest",
|
|
66
67
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
67
68
|
"verify:pack": "node ../../scripts/verify-package-types-exports.js ."
|