@plur-ai/core 0.3.0 → 0.4.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/chunk-WPD4MPTT.js +348 -0
- package/dist/embeddings-Q76LNQ5B.js +11 -0
- package/dist/index.d.ts +484 -2
- package/dist/index.js +1004 -315
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -260,6 +260,8 @@ declare const EngramSchema: z.ZodObject<{
|
|
|
260
260
|
}>>;
|
|
261
261
|
/** Extensible key-value data for domain-specific fields. */
|
|
262
262
|
structured_data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
263
|
+
/** Polarity classification: 'do' for directives, 'dont' for prohibitions, null for unclassified. */
|
|
264
|
+
polarity: z.ZodDefault<z.ZodNullable<z.ZodEnum<["do", "dont"]>>>;
|
|
263
265
|
}, "strip", z.ZodTypeAny, {
|
|
264
266
|
type: "behavioral" | "architectural" | "procedural" | "terminological";
|
|
265
267
|
status: "active" | "dormant" | "retired" | "candidate";
|
|
@@ -298,6 +300,7 @@ declare const EngramSchema: z.ZodObject<{
|
|
|
298
300
|
negative: number;
|
|
299
301
|
neutral: number;
|
|
300
302
|
};
|
|
303
|
+
polarity: "do" | "dont" | null;
|
|
301
304
|
rationale?: string | undefined;
|
|
302
305
|
contraindications?: string[] | undefined;
|
|
303
306
|
source?: string | undefined;
|
|
@@ -446,6 +449,7 @@ declare const EngramSchema: z.ZodObject<{
|
|
|
446
449
|
contradiction_rate?: number | undefined;
|
|
447
450
|
} | undefined;
|
|
448
451
|
structured_data?: Record<string, unknown> | undefined;
|
|
452
|
+
polarity?: "do" | "dont" | null | undefined;
|
|
449
453
|
}>;
|
|
450
454
|
type Engram = z.infer<typeof EngramSchema>;
|
|
451
455
|
type KnowledgeAnchor = z.infer<typeof KnowledgeAnchorSchema>;
|
|
@@ -611,6 +615,7 @@ declare const PlurConfigSchema: z.ZodObject<{
|
|
|
611
615
|
spread_budget?: number | undefined;
|
|
612
616
|
co_access?: boolean | undefined;
|
|
613
617
|
}>>>;
|
|
618
|
+
allow_secrets: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
614
619
|
}, "strip", z.ZodTypeAny, {
|
|
615
620
|
auto_learn?: boolean | undefined;
|
|
616
621
|
auto_capture?: boolean | undefined;
|
|
@@ -623,6 +628,7 @@ declare const PlurConfigSchema: z.ZodObject<{
|
|
|
623
628
|
spread_budget: number;
|
|
624
629
|
co_access: boolean;
|
|
625
630
|
} | undefined;
|
|
631
|
+
allow_secrets?: boolean | undefined;
|
|
626
632
|
}, {
|
|
627
633
|
auto_learn?: boolean | undefined;
|
|
628
634
|
auto_capture?: boolean | undefined;
|
|
@@ -635,6 +641,7 @@ declare const PlurConfigSchema: z.ZodObject<{
|
|
|
635
641
|
spread_budget?: number | undefined;
|
|
636
642
|
co_access?: boolean | undefined;
|
|
637
643
|
} | undefined;
|
|
644
|
+
allow_secrets?: boolean | undefined;
|
|
638
645
|
}>;
|
|
639
646
|
type PlurConfig = z.infer<typeof PlurConfigSchema>;
|
|
640
647
|
|
|
@@ -666,6 +673,7 @@ interface InjectOptions {
|
|
|
666
673
|
}
|
|
667
674
|
interface InjectionResult {
|
|
668
675
|
directives: string;
|
|
676
|
+
constraints: string;
|
|
669
677
|
consider: string;
|
|
670
678
|
count: number;
|
|
671
679
|
tokens_used: number;
|
|
@@ -684,9 +692,470 @@ interface TimelineQuery {
|
|
|
684
692
|
search?: string;
|
|
685
693
|
}
|
|
686
694
|
|
|
695
|
+
interface TypedRole {
|
|
696
|
+
role: string;
|
|
697
|
+
domain_instance: string;
|
|
698
|
+
}
|
|
699
|
+
interface RelationalTriple {
|
|
700
|
+
subject: TypedRole;
|
|
701
|
+
predicate: string;
|
|
702
|
+
object: TypedRole;
|
|
703
|
+
outcome?: string;
|
|
704
|
+
}
|
|
705
|
+
interface RelationalAnalysis {
|
|
706
|
+
engram_id: string;
|
|
707
|
+
triples: RelationalTriple[];
|
|
708
|
+
goal_context: string;
|
|
709
|
+
is_failure_driven: boolean;
|
|
710
|
+
domain: string;
|
|
711
|
+
polarity: 'do' | 'dont';
|
|
712
|
+
}
|
|
713
|
+
declare function analyzeStructure(engrams: Engram[], llm: LlmFunction): Promise<RelationalAnalysis[]>;
|
|
714
|
+
|
|
715
|
+
interface EngramCluster {
|
|
716
|
+
cluster_id: string;
|
|
717
|
+
members: RelationalAnalysis[];
|
|
718
|
+
domains: string[];
|
|
719
|
+
is_cross_domain: boolean;
|
|
720
|
+
cohesion: number;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Cluster relational analyses by structural similarity.
|
|
724
|
+
* Prefers embedding-based cosine similarity (384-dim BGE vectors) for semantic depth.
|
|
725
|
+
* Falls back to token overlap when @huggingface/transformers is unavailable.
|
|
726
|
+
*/
|
|
727
|
+
declare function clusterByStructure(analyses: RelationalAnalysis[], threshold?: number): Promise<EngramCluster[]>;
|
|
728
|
+
|
|
729
|
+
declare const StructuralTemplateSchema: z.ZodObject<{
|
|
730
|
+
goal_type: z.ZodString;
|
|
731
|
+
constraint_type: z.ZodString;
|
|
732
|
+
outcome_type: z.ZodString;
|
|
733
|
+
template: z.ZodString;
|
|
734
|
+
/** Structural frame — declares which relational pattern this meta-engram uses.
|
|
735
|
+
* Allows flexible analogy beyond rigid [goal]+[constraint]->[outcome]. */
|
|
736
|
+
structure_type: z.ZodDefault<z.ZodEnum<["goal-constraint-outcome", "feedback-loop", "causal-chain", "recursive", "tradeoff", "freeform"]>>;
|
|
737
|
+
/** For patterns that don't fit the standard template fields — the LLM's own structural description */
|
|
738
|
+
freeform_structure: z.ZodOptional<z.ZodString>;
|
|
739
|
+
}, "strip", z.ZodTypeAny, {
|
|
740
|
+
template: string;
|
|
741
|
+
goal_type: string;
|
|
742
|
+
constraint_type: string;
|
|
743
|
+
outcome_type: string;
|
|
744
|
+
structure_type: "goal-constraint-outcome" | "feedback-loop" | "causal-chain" | "recursive" | "tradeoff" | "freeform";
|
|
745
|
+
freeform_structure?: string | undefined;
|
|
746
|
+
}, {
|
|
747
|
+
template: string;
|
|
748
|
+
goal_type: string;
|
|
749
|
+
constraint_type: string;
|
|
750
|
+
outcome_type: string;
|
|
751
|
+
structure_type?: "goal-constraint-outcome" | "feedback-loop" | "causal-chain" | "recursive" | "tradeoff" | "freeform" | undefined;
|
|
752
|
+
freeform_structure?: string | undefined;
|
|
753
|
+
}>;
|
|
754
|
+
declare const EvidenceEntrySchema: z.ZodObject<{
|
|
755
|
+
engram_id: z.ZodString;
|
|
756
|
+
domain: z.ZodString;
|
|
757
|
+
mapping_rationale: z.ZodString;
|
|
758
|
+
alignment_score: z.ZodNumber;
|
|
759
|
+
}, "strip", z.ZodTypeAny, {
|
|
760
|
+
domain: string;
|
|
761
|
+
engram_id: string;
|
|
762
|
+
mapping_rationale: string;
|
|
763
|
+
alignment_score: number;
|
|
764
|
+
}, {
|
|
765
|
+
domain: string;
|
|
766
|
+
engram_id: string;
|
|
767
|
+
mapping_rationale: string;
|
|
768
|
+
alignment_score: number;
|
|
769
|
+
}>;
|
|
770
|
+
declare const FalsificationSchema: z.ZodObject<{
|
|
771
|
+
expected_conditions: z.ZodString;
|
|
772
|
+
expected_exceptions: z.ZodString;
|
|
773
|
+
test_prediction: z.ZodOptional<z.ZodString>;
|
|
774
|
+
}, "strip", z.ZodTypeAny, {
|
|
775
|
+
expected_conditions: string;
|
|
776
|
+
expected_exceptions: string;
|
|
777
|
+
test_prediction?: string | undefined;
|
|
778
|
+
}, {
|
|
779
|
+
expected_conditions: string;
|
|
780
|
+
expected_exceptions: string;
|
|
781
|
+
test_prediction?: string | undefined;
|
|
782
|
+
}>;
|
|
783
|
+
declare const MetaConfidenceSchema: z.ZodObject<{
|
|
784
|
+
evidence_count: z.ZodNumber;
|
|
785
|
+
domain_count: z.ZodNumber;
|
|
786
|
+
structural_depth: z.ZodNumber;
|
|
787
|
+
validation_ratio: z.ZodDefault<z.ZodNumber>;
|
|
788
|
+
composite: z.ZodNumber;
|
|
789
|
+
}, "strip", z.ZodTypeAny, {
|
|
790
|
+
evidence_count: number;
|
|
791
|
+
domain_count: number;
|
|
792
|
+
structural_depth: number;
|
|
793
|
+
validation_ratio: number;
|
|
794
|
+
composite: number;
|
|
795
|
+
}, {
|
|
796
|
+
evidence_count: number;
|
|
797
|
+
domain_count: number;
|
|
798
|
+
structural_depth: number;
|
|
799
|
+
composite: number;
|
|
800
|
+
validation_ratio?: number | undefined;
|
|
801
|
+
}>;
|
|
802
|
+
declare const DomainCoverageSchema: z.ZodObject<{
|
|
803
|
+
validated: z.ZodArray<z.ZodString, "many">;
|
|
804
|
+
failed: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
805
|
+
predicted: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
806
|
+
}, "strip", z.ZodTypeAny, {
|
|
807
|
+
validated: string[];
|
|
808
|
+
failed: string[];
|
|
809
|
+
predicted: string[];
|
|
810
|
+
}, {
|
|
811
|
+
validated: string[];
|
|
812
|
+
failed?: string[] | undefined;
|
|
813
|
+
predicted?: string[] | undefined;
|
|
814
|
+
}>;
|
|
815
|
+
declare const HierarchyPositionSchema: z.ZodObject<{
|
|
816
|
+
level: z.ZodEnum<["mop", "top"]>;
|
|
817
|
+
parent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
818
|
+
children: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
819
|
+
}, "strip", z.ZodTypeAny, {
|
|
820
|
+
level: "mop" | "top";
|
|
821
|
+
parent: string | null;
|
|
822
|
+
children: string[];
|
|
823
|
+
}, {
|
|
824
|
+
level: "mop" | "top";
|
|
825
|
+
parent?: string | null | undefined;
|
|
826
|
+
children?: string[] | undefined;
|
|
827
|
+
}>;
|
|
828
|
+
declare const MetaFieldSchema: z.ZodObject<{
|
|
829
|
+
structure: z.ZodObject<{
|
|
830
|
+
goal_type: z.ZodString;
|
|
831
|
+
constraint_type: z.ZodString;
|
|
832
|
+
outcome_type: z.ZodString;
|
|
833
|
+
template: z.ZodString;
|
|
834
|
+
/** Structural frame — declares which relational pattern this meta-engram uses.
|
|
835
|
+
* Allows flexible analogy beyond rigid [goal]+[constraint]->[outcome]. */
|
|
836
|
+
structure_type: z.ZodDefault<z.ZodEnum<["goal-constraint-outcome", "feedback-loop", "causal-chain", "recursive", "tradeoff", "freeform"]>>;
|
|
837
|
+
/** For patterns that don't fit the standard template fields — the LLM's own structural description */
|
|
838
|
+
freeform_structure: z.ZodOptional<z.ZodString>;
|
|
839
|
+
}, "strip", z.ZodTypeAny, {
|
|
840
|
+
template: string;
|
|
841
|
+
goal_type: string;
|
|
842
|
+
constraint_type: string;
|
|
843
|
+
outcome_type: string;
|
|
844
|
+
structure_type: "goal-constraint-outcome" | "feedback-loop" | "causal-chain" | "recursive" | "tradeoff" | "freeform";
|
|
845
|
+
freeform_structure?: string | undefined;
|
|
846
|
+
}, {
|
|
847
|
+
template: string;
|
|
848
|
+
goal_type: string;
|
|
849
|
+
constraint_type: string;
|
|
850
|
+
outcome_type: string;
|
|
851
|
+
structure_type?: "goal-constraint-outcome" | "feedback-loop" | "causal-chain" | "recursive" | "tradeoff" | "freeform" | undefined;
|
|
852
|
+
freeform_structure?: string | undefined;
|
|
853
|
+
}>;
|
|
854
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
855
|
+
engram_id: z.ZodString;
|
|
856
|
+
domain: z.ZodString;
|
|
857
|
+
mapping_rationale: z.ZodString;
|
|
858
|
+
alignment_score: z.ZodNumber;
|
|
859
|
+
}, "strip", z.ZodTypeAny, {
|
|
860
|
+
domain: string;
|
|
861
|
+
engram_id: string;
|
|
862
|
+
mapping_rationale: string;
|
|
863
|
+
alignment_score: number;
|
|
864
|
+
}, {
|
|
865
|
+
domain: string;
|
|
866
|
+
engram_id: string;
|
|
867
|
+
mapping_rationale: string;
|
|
868
|
+
alignment_score: number;
|
|
869
|
+
}>, "many">;
|
|
870
|
+
domain_coverage: z.ZodObject<{
|
|
871
|
+
validated: z.ZodArray<z.ZodString, "many">;
|
|
872
|
+
failed: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
873
|
+
predicted: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
874
|
+
}, "strip", z.ZodTypeAny, {
|
|
875
|
+
validated: string[];
|
|
876
|
+
failed: string[];
|
|
877
|
+
predicted: string[];
|
|
878
|
+
}, {
|
|
879
|
+
validated: string[];
|
|
880
|
+
failed?: string[] | undefined;
|
|
881
|
+
predicted?: string[] | undefined;
|
|
882
|
+
}>;
|
|
883
|
+
falsification: z.ZodObject<{
|
|
884
|
+
expected_conditions: z.ZodString;
|
|
885
|
+
expected_exceptions: z.ZodString;
|
|
886
|
+
test_prediction: z.ZodOptional<z.ZodString>;
|
|
887
|
+
}, "strip", z.ZodTypeAny, {
|
|
888
|
+
expected_conditions: string;
|
|
889
|
+
expected_exceptions: string;
|
|
890
|
+
test_prediction?: string | undefined;
|
|
891
|
+
}, {
|
|
892
|
+
expected_conditions: string;
|
|
893
|
+
expected_exceptions: string;
|
|
894
|
+
test_prediction?: string | undefined;
|
|
895
|
+
}>;
|
|
896
|
+
confidence: z.ZodObject<{
|
|
897
|
+
evidence_count: z.ZodNumber;
|
|
898
|
+
domain_count: z.ZodNumber;
|
|
899
|
+
structural_depth: z.ZodNumber;
|
|
900
|
+
validation_ratio: z.ZodDefault<z.ZodNumber>;
|
|
901
|
+
composite: z.ZodNumber;
|
|
902
|
+
}, "strip", z.ZodTypeAny, {
|
|
903
|
+
evidence_count: number;
|
|
904
|
+
domain_count: number;
|
|
905
|
+
structural_depth: number;
|
|
906
|
+
validation_ratio: number;
|
|
907
|
+
composite: number;
|
|
908
|
+
}, {
|
|
909
|
+
evidence_count: number;
|
|
910
|
+
domain_count: number;
|
|
911
|
+
structural_depth: number;
|
|
912
|
+
composite: number;
|
|
913
|
+
validation_ratio?: number | undefined;
|
|
914
|
+
}>;
|
|
915
|
+
hierarchy: z.ZodObject<{
|
|
916
|
+
level: z.ZodEnum<["mop", "top"]>;
|
|
917
|
+
parent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
918
|
+
children: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
919
|
+
}, "strip", z.ZodTypeAny, {
|
|
920
|
+
level: "mop" | "top";
|
|
921
|
+
parent: string | null;
|
|
922
|
+
children: string[];
|
|
923
|
+
}, {
|
|
924
|
+
level: "mop" | "top";
|
|
925
|
+
parent?: string | null | undefined;
|
|
926
|
+
children?: string[] | undefined;
|
|
927
|
+
}>;
|
|
928
|
+
pipeline_version: z.ZodString;
|
|
929
|
+
last_validated: z.ZodOptional<z.ZodString>;
|
|
930
|
+
}, "strip", z.ZodTypeAny, {
|
|
931
|
+
confidence: {
|
|
932
|
+
evidence_count: number;
|
|
933
|
+
domain_count: number;
|
|
934
|
+
structural_depth: number;
|
|
935
|
+
validation_ratio: number;
|
|
936
|
+
composite: number;
|
|
937
|
+
};
|
|
938
|
+
structure: {
|
|
939
|
+
template: string;
|
|
940
|
+
goal_type: string;
|
|
941
|
+
constraint_type: string;
|
|
942
|
+
outcome_type: string;
|
|
943
|
+
structure_type: "goal-constraint-outcome" | "feedback-loop" | "causal-chain" | "recursive" | "tradeoff" | "freeform";
|
|
944
|
+
freeform_structure?: string | undefined;
|
|
945
|
+
};
|
|
946
|
+
evidence: {
|
|
947
|
+
domain: string;
|
|
948
|
+
engram_id: string;
|
|
949
|
+
mapping_rationale: string;
|
|
950
|
+
alignment_score: number;
|
|
951
|
+
}[];
|
|
952
|
+
domain_coverage: {
|
|
953
|
+
validated: string[];
|
|
954
|
+
failed: string[];
|
|
955
|
+
predicted: string[];
|
|
956
|
+
};
|
|
957
|
+
falsification: {
|
|
958
|
+
expected_conditions: string;
|
|
959
|
+
expected_exceptions: string;
|
|
960
|
+
test_prediction?: string | undefined;
|
|
961
|
+
};
|
|
962
|
+
hierarchy: {
|
|
963
|
+
level: "mop" | "top";
|
|
964
|
+
parent: string | null;
|
|
965
|
+
children: string[];
|
|
966
|
+
};
|
|
967
|
+
pipeline_version: string;
|
|
968
|
+
last_validated?: string | undefined;
|
|
969
|
+
}, {
|
|
970
|
+
confidence: {
|
|
971
|
+
evidence_count: number;
|
|
972
|
+
domain_count: number;
|
|
973
|
+
structural_depth: number;
|
|
974
|
+
composite: number;
|
|
975
|
+
validation_ratio?: number | undefined;
|
|
976
|
+
};
|
|
977
|
+
structure: {
|
|
978
|
+
template: string;
|
|
979
|
+
goal_type: string;
|
|
980
|
+
constraint_type: string;
|
|
981
|
+
outcome_type: string;
|
|
982
|
+
structure_type?: "goal-constraint-outcome" | "feedback-loop" | "causal-chain" | "recursive" | "tradeoff" | "freeform" | undefined;
|
|
983
|
+
freeform_structure?: string | undefined;
|
|
984
|
+
};
|
|
985
|
+
evidence: {
|
|
986
|
+
domain: string;
|
|
987
|
+
engram_id: string;
|
|
988
|
+
mapping_rationale: string;
|
|
989
|
+
alignment_score: number;
|
|
990
|
+
}[];
|
|
991
|
+
domain_coverage: {
|
|
992
|
+
validated: string[];
|
|
993
|
+
failed?: string[] | undefined;
|
|
994
|
+
predicted?: string[] | undefined;
|
|
995
|
+
};
|
|
996
|
+
falsification: {
|
|
997
|
+
expected_conditions: string;
|
|
998
|
+
expected_exceptions: string;
|
|
999
|
+
test_prediction?: string | undefined;
|
|
1000
|
+
};
|
|
1001
|
+
hierarchy: {
|
|
1002
|
+
level: "mop" | "top";
|
|
1003
|
+
parent?: string | null | undefined;
|
|
1004
|
+
children?: string[] | undefined;
|
|
1005
|
+
};
|
|
1006
|
+
pipeline_version: string;
|
|
1007
|
+
last_validated?: string | undefined;
|
|
1008
|
+
}>;
|
|
1009
|
+
type MetaField = z.infer<typeof MetaFieldSchema>;
|
|
1010
|
+
type StructuralTemplate = z.infer<typeof StructuralTemplateSchema>;
|
|
1011
|
+
type EvidenceEntry = z.infer<typeof EvidenceEntrySchema>;
|
|
1012
|
+
type MetaConfidence = z.infer<typeof MetaConfidenceSchema>;
|
|
1013
|
+
type DomainCoverage = z.infer<typeof DomainCoverageSchema>;
|
|
1014
|
+
type HierarchyPosition = z.infer<typeof HierarchyPositionSchema>;
|
|
1015
|
+
type Falsification = z.infer<typeof FalsificationSchema>;
|
|
1016
|
+
|
|
1017
|
+
interface MemberAlignment {
|
|
1018
|
+
engram_id: string;
|
|
1019
|
+
alignment_score: number;
|
|
1020
|
+
mapping_rationale: string;
|
|
1021
|
+
}
|
|
1022
|
+
interface AlignmentResult {
|
|
1023
|
+
cluster_id: string;
|
|
1024
|
+
common_structure: StructuralTemplate;
|
|
1025
|
+
member_alignments: MemberAlignment[];
|
|
1026
|
+
structural_depth: number;
|
|
1027
|
+
systematicity: number;
|
|
1028
|
+
candidate_inferences: string[];
|
|
1029
|
+
}
|
|
1030
|
+
declare function alignCluster(cluster: EngramCluster, llm: LlmFunction): Promise<AlignmentResult | null>;
|
|
1031
|
+
|
|
1032
|
+
declare function formulateMetaEngram(alignment: AlignmentResult, llm: LlmFunction, existingMetas?: Engram[],
|
|
1033
|
+
/** Distinct domains from the cluster (provided by pipeline orchestrator) */
|
|
1034
|
+
domains?: string[]): Promise<Engram | null>;
|
|
1035
|
+
|
|
1036
|
+
interface ValidationResult {
|
|
1037
|
+
meta_engram_id: string;
|
|
1038
|
+
test_domain: string;
|
|
1039
|
+
prediction_held: boolean;
|
|
1040
|
+
matching_engram_id: string | null;
|
|
1041
|
+
alignment_score: number;
|
|
1042
|
+
rationale: string;
|
|
1043
|
+
}
|
|
1044
|
+
declare function validateMetaEngram(meta: Engram, testEngrams: Engram[], testDomain: string, llm: LlmFunction): Promise<ValidationResult>;
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Organize meta-engrams into MOP/TOP hierarchy.
|
|
1048
|
+
* Purely deterministic: pairwise template similarity, parent-child by domain subsumption.
|
|
1049
|
+
* Returns engrams with updated hierarchy fields.
|
|
1050
|
+
*/
|
|
1051
|
+
declare function organizeHierarchy(metaEngrams: Engram[]): Engram[];
|
|
1052
|
+
|
|
1053
|
+
interface ExtractOptions {
|
|
1054
|
+
/** Whether to run Stage 5 validation (default: false — can be deferred) */
|
|
1055
|
+
run_validation?: boolean;
|
|
1056
|
+
/** Engrams to use for validation (held-out domains) */
|
|
1057
|
+
validation_engrams?: Engram[];
|
|
1058
|
+
/** Existing meta-engrams to check for deduplication */
|
|
1059
|
+
existing_metas?: Engram[];
|
|
1060
|
+
/** Minimum cluster size to attempt alignment (default: 2) */
|
|
1061
|
+
min_cluster_size?: number;
|
|
1062
|
+
}
|
|
1063
|
+
interface ExtractionResult {
|
|
1064
|
+
engrams_analyzed: number;
|
|
1065
|
+
clusters_found: number;
|
|
1066
|
+
alignments_passed: number;
|
|
1067
|
+
meta_engrams_extracted: number;
|
|
1068
|
+
rejected_as_platitudes: number;
|
|
1069
|
+
validation_results: ValidationResult[];
|
|
1070
|
+
results: Engram[];
|
|
1071
|
+
duration_ms: number;
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Full meta-engram extraction pipeline: Stages 1 → 2 → 3 → 4 → 5(optional) → 6
|
|
1075
|
+
*/
|
|
1076
|
+
declare function extractMetaEngrams(engrams: Engram[], llm: LlmFunction, options?: ExtractOptions): Promise<ExtractionResult>;
|
|
1077
|
+
|
|
1078
|
+
/** Patterns that are too generic to be useful as meta-engrams */
|
|
1079
|
+
declare const PLATITUDE_PATTERNS: string[];
|
|
1080
|
+
declare function isPlatitude(statement: string): boolean;
|
|
1081
|
+
|
|
1082
|
+
/** Token-based similarity between two template strings. Used for clustering, dedup, and hierarchy. */
|
|
1083
|
+
declare function tokenSimilarity(a: string, b: string): number;
|
|
1084
|
+
|
|
1085
|
+
declare function classifyPolarity(statement: string): 'dont' | null;
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* Minimal interface for confidence computation.
|
|
1089
|
+
* Accepts any object with these optional fields — works with Engram,
|
|
1090
|
+
* AgentEngram, WireEngram, or any subset.
|
|
1091
|
+
*/
|
|
1092
|
+
interface ConfidenceInput {
|
|
1093
|
+
feedback_signals?: {
|
|
1094
|
+
positive: number;
|
|
1095
|
+
negative: number;
|
|
1096
|
+
neutral: number;
|
|
1097
|
+
};
|
|
1098
|
+
consolidated?: boolean;
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Compute a confidence score (0.0-1.0) from feedback signals.
|
|
1102
|
+
*
|
|
1103
|
+
* Uses sigmoid of net feedback ratio, dampened by sample size.
|
|
1104
|
+
* No feedback → 0.5 (neutral). Heavy positive → approaches 1.0.
|
|
1105
|
+
* Small sample sizes are dampened toward 0.5.
|
|
1106
|
+
*/
|
|
1107
|
+
declare function computeConfidence(input: ConfidenceInput): number;
|
|
1108
|
+
/**
|
|
1109
|
+
* Compute a composite meta-confidence score (0.0-1.0) for a META- engram
|
|
1110
|
+
* based on the richness of its evidence, domain coverage, structural depth,
|
|
1111
|
+
* and validation ratio.
|
|
1112
|
+
*
|
|
1113
|
+
* Weights:
|
|
1114
|
+
* - evidenceCount (capped at 5): 25%
|
|
1115
|
+
* - domainCount (capped at 3): 35%
|
|
1116
|
+
* - structuralDepth (capped at 3): 20%
|
|
1117
|
+
* - validationRatio (0.0–1.0): 20%
|
|
1118
|
+
*/
|
|
1119
|
+
declare function computeMetaConfidence(evidenceCount: number, domainCount: number, structuralDepth: number, validationRatio: number): number;
|
|
1120
|
+
/** Convert numeric confidence to human-readable band */
|
|
1121
|
+
declare function confidenceBand(score: number): 'low' | 'medium' | 'high';
|
|
1122
|
+
|
|
1123
|
+
interface ToolCallRecord {
|
|
1124
|
+
tool: string;
|
|
1125
|
+
args_keys: string;
|
|
1126
|
+
timestamp: string;
|
|
1127
|
+
}
|
|
1128
|
+
declare class SessionBreadcrumbs {
|
|
1129
|
+
private toolCalls;
|
|
1130
|
+
private engramsRecalled;
|
|
1131
|
+
recordToolCall(tool: string, args: Record<string, unknown>): void;
|
|
1132
|
+
recordEngramRecalled(engramId: string): void;
|
|
1133
|
+
getToolCalls(): ToolCallRecord[];
|
|
1134
|
+
getEngramsRecalled(): string[];
|
|
1135
|
+
/**
|
|
1136
|
+
* Returns only engram IDs that have the META- prefix.
|
|
1137
|
+
* These represent meta-engrams injected into the session context.
|
|
1138
|
+
*/
|
|
1139
|
+
getMetaEngramsRecalled(): string[];
|
|
1140
|
+
generateContinuationContext(): string;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* Generate CLAUDE.md guardrails markdown for PLUR install.
|
|
1145
|
+
* Appended to project CLAUDE.md (or equivalent instruction file) during setup.
|
|
1146
|
+
*/
|
|
1147
|
+
declare function generateGuardrails(): string;
|
|
1148
|
+
|
|
687
1149
|
/** Build searchable text from all engram fields */
|
|
688
1150
|
declare function engramSearchText(engram: Engram): string;
|
|
689
1151
|
|
|
1152
|
+
interface SecretMatch {
|
|
1153
|
+
pattern: string;
|
|
1154
|
+
match: string;
|
|
1155
|
+
}
|
|
1156
|
+
/** Scan text for potential secrets. Returns empty array if clean. */
|
|
1157
|
+
declare function detectSecrets(text: string): SecretMatch[];
|
|
1158
|
+
|
|
690
1159
|
interface PlurPaths {
|
|
691
1160
|
root: string;
|
|
692
1161
|
engrams: string;
|
|
@@ -768,9 +1237,15 @@ declare class Plur {
|
|
|
768
1237
|
recallExpanded(query: string, options: RecallOptions & {
|
|
769
1238
|
llm: LlmFunction;
|
|
770
1239
|
}): Promise<Engram[]>;
|
|
1240
|
+
/** List all active engrams, optionally filtered by scope/domain. No search — returns all matches. */
|
|
1241
|
+
list(options?: {
|
|
1242
|
+
scope?: string;
|
|
1243
|
+
domain?: string;
|
|
1244
|
+
min_strength?: number;
|
|
1245
|
+
}): Engram[];
|
|
771
1246
|
/** Filter engrams by scope/domain/strength (shared by both modes) */
|
|
772
1247
|
private _filterEngrams;
|
|
773
|
-
/** Reactivate accessed engrams
|
|
1248
|
+
/** Reactivate accessed engrams and update co-access associations */
|
|
774
1249
|
private _reactivateResults;
|
|
775
1250
|
/** Scored injection within token budget (BM25 only). Returns formatted strings. */
|
|
776
1251
|
inject(task: string, options?: InjectOptions): InjectionResult;
|
|
@@ -779,6 +1254,13 @@ declare class Plur {
|
|
|
779
1254
|
private _formatInjection;
|
|
780
1255
|
/** Update feedback_signals and adjust retrieval_strength. */
|
|
781
1256
|
feedback(id: string, signal: 'positive' | 'negative' | 'neutral'): void;
|
|
1257
|
+
/** Save extracted meta-engrams to the engram store. Skips IDs that already exist. */
|
|
1258
|
+
saveMetaEngrams(metas: Engram[]): {
|
|
1259
|
+
saved: number;
|
|
1260
|
+
skipped: number;
|
|
1261
|
+
};
|
|
1262
|
+
/** Update an existing engram in the store by ID. Returns true if found and updated. */
|
|
1263
|
+
updateEngram(updated: Engram): boolean;
|
|
782
1264
|
/** Set engram status to 'retired'. */
|
|
783
1265
|
forget(id: string, reason?: string): void;
|
|
784
1266
|
/** Capture an episodic memory. */
|
|
@@ -812,4 +1294,4 @@ declare class Plur {
|
|
|
812
1294
|
status(): StatusResult;
|
|
813
1295
|
}
|
|
814
1296
|
|
|
815
|
-
export { type Association, type CaptureContext, type Engram, type Episode, type IngestCandidate, type IngestOptions, type InjectOptions, type InjectionResult, type KnowledgeAnchor, type LearnContext, type LlmFunction, type PackManifest, Plur, type PlurConfig, type PlurPaths, type RecallOptions, type StatusResult, type SyncResult, type SyncStatus, type TimelineQuery, type VersionCheckResult, checkForUpdate, clearVersionCache, detectPlurStorage, engramSearchText, getCachedUpdateCheck };
|
|
1297
|
+
export { type AlignmentResult, type Association, type CaptureContext, type DomainCoverage, DomainCoverageSchema, type Engram, type EngramCluster, type Episode, type EvidenceEntry, EvidenceEntrySchema, type ExtractOptions, type ExtractionResult, type Falsification, FalsificationSchema, type HierarchyPosition, HierarchyPositionSchema, type IngestCandidate, type IngestOptions, type InjectOptions, type InjectionResult, type KnowledgeAnchor, type LearnContext, type LlmFunction, type MemberAlignment, type MetaConfidence, MetaConfidenceSchema, type MetaField, MetaFieldSchema, PLATITUDE_PATTERNS, type PackManifest, Plur, type PlurConfig, type PlurPaths, type RecallOptions, type RelationalAnalysis, type RelationalTriple, SessionBreadcrumbs, type StatusResult, type StructuralTemplate, StructuralTemplateSchema, type SyncResult, type SyncStatus, type TimelineQuery, type TypedRole, type ValidationResult, type VersionCheckResult, alignCluster, analyzeStructure, checkForUpdate, classifyPolarity, clearVersionCache, clusterByStructure, computeConfidence, computeMetaConfidence, confidenceBand, detectPlurStorage, detectSecrets, engramSearchText, extractMetaEngrams, formulateMetaEngram, generateGuardrails, getCachedUpdateCheck, isPlatitude, organizeHierarchy, tokenSimilarity, validateMetaEngram };
|