skill-tree 0.1.1 → 0.1.3
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/cli/index.js +68 -1171
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.mjs +10664 -74
- package/dist/cli/index.mjs.map +1 -0
- package/dist/index.d.mts +23 -1072
- package/dist/index.d.ts +23 -1072
- package/dist/index.js +175 -1834
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +14091 -125
- package/dist/index.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-5QGJJCVX.mjs +0 -15392
- package/dist/chunk-Q6SFFUDU.mjs +0 -15874
package/dist/index.d.mts
CHANGED
|
@@ -431,28 +431,6 @@ interface StorageAdapter {
|
|
|
431
431
|
getVersionHistory(skillId: string): Promise<SkillVersion[]>;
|
|
432
432
|
getLineage(skillId: string): Promise<SkillLineage | null>;
|
|
433
433
|
searchSkills(query: string): Promise<Skill[]>;
|
|
434
|
-
/** Save a learning candidate */
|
|
435
|
-
saveCandidate?(candidate: LearningCandidateRecord): Promise<void>;
|
|
436
|
-
/** Get a candidate by ID */
|
|
437
|
-
getCandidate?(id: string): Promise<LearningCandidateRecord | null>;
|
|
438
|
-
/** List candidates with optional filtering */
|
|
439
|
-
listCandidates?(filter?: CandidateFilter): Promise<LearningCandidateRecord[]>;
|
|
440
|
-
/** Update candidate status */
|
|
441
|
-
updateCandidateStatus?(id: string, status: 'pending' | 'promoted' | 'rejected', details?: {
|
|
442
|
-
promotedToSkillId?: string;
|
|
443
|
-
rejectionReason?: string;
|
|
444
|
-
}): Promise<boolean>;
|
|
445
|
-
/** Delete a candidate */
|
|
446
|
-
deleteCandidate?(id: string): Promise<boolean>;
|
|
447
|
-
/** Save anti-patterns for a skill */
|
|
448
|
-
saveAntiPatterns?(skillId: string, patterns: AntiPatternRecord[]): Promise<void>;
|
|
449
|
-
/** Get anti-patterns for a skill */
|
|
450
|
-
getAntiPatterns?(skillId: string): Promise<AntiPatternRecord[]>;
|
|
451
|
-
/** List all anti-patterns */
|
|
452
|
-
listAntiPatterns?(): Promise<Array<{
|
|
453
|
-
skillId: string;
|
|
454
|
-
patterns: AntiPatternRecord[];
|
|
455
|
-
}>>;
|
|
456
434
|
/** Place a skill in the taxonomy tree */
|
|
457
435
|
placeInTaxonomy?(skillId: string, taxonomy: SkillTaxonomy): Promise<void>;
|
|
458
436
|
/** Get sync states for all remotes */
|
|
@@ -470,51 +448,6 @@ interface StorageAdapter {
|
|
|
470
448
|
/** Record a fork relationship on the source skill's lineage */
|
|
471
449
|
recordFork?(sourceSkillId: string, fork: SkillFork): Promise<void>;
|
|
472
450
|
}
|
|
473
|
-
/**
|
|
474
|
-
* Learning candidate record for storage
|
|
475
|
-
*/
|
|
476
|
-
interface LearningCandidateRecord {
|
|
477
|
-
id: string;
|
|
478
|
-
kind: 'skill' | 'strategy' | 'pattern' | 'error-fix';
|
|
479
|
-
name: string;
|
|
480
|
-
content: unknown;
|
|
481
|
-
confidence: number;
|
|
482
|
-
source: {
|
|
483
|
-
trajectoryId: string;
|
|
484
|
-
provider: string;
|
|
485
|
-
extractedAt: Date;
|
|
486
|
-
turnRange?: [number, number];
|
|
487
|
-
};
|
|
488
|
-
tags?: string[];
|
|
489
|
-
reasoning?: string;
|
|
490
|
-
createdAt: Date;
|
|
491
|
-
updatedAt: Date;
|
|
492
|
-
status: 'pending' | 'promoted' | 'rejected';
|
|
493
|
-
promotedToSkillId?: string;
|
|
494
|
-
rejectionReason?: string;
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Filter for listing candidates
|
|
498
|
-
*/
|
|
499
|
-
interface CandidateFilter {
|
|
500
|
-
kind?: ('skill' | 'strategy' | 'pattern' | 'error-fix')[];
|
|
501
|
-
status?: ('pending' | 'promoted' | 'rejected')[];
|
|
502
|
-
minConfidence?: number;
|
|
503
|
-
createdAfter?: Date;
|
|
504
|
-
createdBefore?: Date;
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* Anti-pattern record for storage
|
|
508
|
-
*/
|
|
509
|
-
interface AntiPatternRecord {
|
|
510
|
-
id: string;
|
|
511
|
-
pattern: string;
|
|
512
|
-
description: string;
|
|
513
|
-
context?: string;
|
|
514
|
-
severity: 'warning' | 'error';
|
|
515
|
-
learnedAt: Date;
|
|
516
|
-
occurrences: number;
|
|
517
|
-
}
|
|
518
451
|
interface SkillFilter {
|
|
519
452
|
status?: SkillStatus[];
|
|
520
453
|
tags?: string[];
|
|
@@ -2063,6 +1996,26 @@ interface UpstreamConflict {
|
|
|
2063
1996
|
base?: unknown;
|
|
2064
1997
|
}
|
|
2065
1998
|
|
|
1999
|
+
/**
|
|
2000
|
+
* Check if a directory has a .skilltree directory
|
|
2001
|
+
*/
|
|
2002
|
+
declare function hasSkilltreeDir(repoRoot: string): Promise<boolean>;
|
|
2003
|
+
/**
|
|
2004
|
+
* Discovered skill location
|
|
2005
|
+
*/
|
|
2006
|
+
interface DiscoveredSkill {
|
|
2007
|
+
/** Skill ID (derived from path) */
|
|
2008
|
+
id: string;
|
|
2009
|
+
/** Full path to the SKILL.md file */
|
|
2010
|
+
filePath: string;
|
|
2011
|
+
/** Directory containing the skill */
|
|
2012
|
+
directory: string;
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
* Discover all skills in a .skilltree directory
|
|
2016
|
+
*/
|
|
2017
|
+
declare function discoverSkills(repoRoot: string): Promise<DiscoveredSkill[]>;
|
|
2018
|
+
|
|
2066
2019
|
/**
|
|
2067
2020
|
* Quality gates for skill extraction
|
|
2068
2021
|
* Inspired by Claudeception's quality criteria
|
|
@@ -2654,389 +2607,6 @@ declare class SkillMerger {
|
|
|
2654
2607
|
*/
|
|
2655
2608
|
declare function createSkillMerger(storage: StorageAdapter, config?: MergeConfig): SkillMerger;
|
|
2656
2609
|
|
|
2657
|
-
/**
|
|
2658
|
-
* The kind of knowledge represented by a learning candidate
|
|
2659
|
-
*/
|
|
2660
|
-
type LearningKind = 'skill' | 'strategy' | 'pattern' | 'error-fix';
|
|
2661
|
-
/**
|
|
2662
|
-
* Status of a learning candidate in its lifecycle
|
|
2663
|
-
*/
|
|
2664
|
-
type CandidateStatus = 'pending' | 'promoted' | 'rejected';
|
|
2665
|
-
/**
|
|
2666
|
-
* A candidate piece of knowledge extracted from trajectories.
|
|
2667
|
-
* skill-tree owns this interface; providers convert their output to it.
|
|
2668
|
-
*/
|
|
2669
|
-
interface LearningCandidate {
|
|
2670
|
-
/** What kind of knowledge is this */
|
|
2671
|
-
kind: LearningKind;
|
|
2672
|
-
/** Unique identifier (provider-generated, used as skill.id in SkillBank) */
|
|
2673
|
-
id: string;
|
|
2674
|
-
/** Human-readable name */
|
|
2675
|
-
name: string;
|
|
2676
|
-
/** Core content - structure varies by kind */
|
|
2677
|
-
content: LearningContent;
|
|
2678
|
-
/** How confident are we in this extraction (0-1) */
|
|
2679
|
-
confidence: number;
|
|
2680
|
-
/** Which steps contributed to this learning */
|
|
2681
|
-
attribution?: StepAttribution[];
|
|
2682
|
-
/** Where this came from */
|
|
2683
|
-
source: LearningSource;
|
|
2684
|
-
/** Optional embedding for similarity search/deduplication */
|
|
2685
|
-
embedding?: number[];
|
|
2686
|
-
/** Optional tags inferred during extraction */
|
|
2687
|
-
tags?: string[];
|
|
2688
|
-
/** Optional reasoning explaining why this was extracted */
|
|
2689
|
-
reasoning?: string;
|
|
2690
|
-
/** When the candidate was created */
|
|
2691
|
-
createdAt?: Date;
|
|
2692
|
-
/** When the candidate was last updated */
|
|
2693
|
-
updatedAt?: Date;
|
|
2694
|
-
/** Current status in the lifecycle */
|
|
2695
|
-
status?: CandidateStatus;
|
|
2696
|
-
/** If promoted, the ID of the skill it became */
|
|
2697
|
-
promotedToSkillId?: string;
|
|
2698
|
-
/** If rejected, the reason */
|
|
2699
|
-
rejectionReason?: string;
|
|
2700
|
-
}
|
|
2701
|
-
/**
|
|
2702
|
-
* Content structure for different learning kinds
|
|
2703
|
-
*/
|
|
2704
|
-
type LearningContent = SkillContent | StrategyContent | PatternContent | ErrorFixContent;
|
|
2705
|
-
interface SkillContent {
|
|
2706
|
-
kind: 'skill';
|
|
2707
|
-
/** What problem does this skill solve */
|
|
2708
|
-
problem: string;
|
|
2709
|
-
/** Step-by-step solution */
|
|
2710
|
-
solution: string;
|
|
2711
|
-
/** How to verify it worked */
|
|
2712
|
-
verification: string;
|
|
2713
|
-
/** Trigger conditions for when to apply */
|
|
2714
|
-
triggers?: TriggerSpec[];
|
|
2715
|
-
/** Example usage */
|
|
2716
|
-
examples?: ExampleSpec[];
|
|
2717
|
-
}
|
|
2718
|
-
interface StrategyContent {
|
|
2719
|
-
kind: 'strategy';
|
|
2720
|
-
/** When to apply this strategy (situation description) */
|
|
2721
|
-
situation: string;
|
|
2722
|
-
/** What to do (suggestion/approach) */
|
|
2723
|
-
suggestion: string;
|
|
2724
|
-
/** Optional parameters that can be tuned */
|
|
2725
|
-
parameters?: Record<string, unknown>;
|
|
2726
|
-
}
|
|
2727
|
-
interface PatternContent {
|
|
2728
|
-
kind: 'pattern';
|
|
2729
|
-
/** The pattern (regex or description) */
|
|
2730
|
-
pattern: string;
|
|
2731
|
-
/** What this pattern represents */
|
|
2732
|
-
description: string;
|
|
2733
|
-
/** Concrete examples of this pattern */
|
|
2734
|
-
examples: string[];
|
|
2735
|
-
}
|
|
2736
|
-
interface ErrorFixContent {
|
|
2737
|
-
kind: 'error-fix';
|
|
2738
|
-
/** Error pattern to match (regex or keywords) */
|
|
2739
|
-
errorPattern: string;
|
|
2740
|
-
/** How to fix this error */
|
|
2741
|
-
fix: string;
|
|
2742
|
-
/** How often this error has been seen */
|
|
2743
|
-
frequency?: number;
|
|
2744
|
-
/** Example error messages */
|
|
2745
|
-
errorExamples?: string[];
|
|
2746
|
-
}
|
|
2747
|
-
/**
|
|
2748
|
-
* Trigger specification for skills
|
|
2749
|
-
*/
|
|
2750
|
-
interface TriggerSpec {
|
|
2751
|
-
type: 'error' | 'pattern' | 'context' | 'keyword' | 'custom';
|
|
2752
|
-
value: string;
|
|
2753
|
-
description?: string;
|
|
2754
|
-
}
|
|
2755
|
-
/**
|
|
2756
|
-
* Example specification for skills
|
|
2757
|
-
*/
|
|
2758
|
-
interface ExampleSpec {
|
|
2759
|
-
scenario: string;
|
|
2760
|
-
before: string;
|
|
2761
|
-
after: string;
|
|
2762
|
-
}
|
|
2763
|
-
/**
|
|
2764
|
-
* Attribution of learning to specific trajectory steps.
|
|
2765
|
-
* Used by credit assignment strategies.
|
|
2766
|
-
*/
|
|
2767
|
-
interface StepAttribution {
|
|
2768
|
-
/** Turn index in the trajectory */
|
|
2769
|
-
turnIndex: number;
|
|
2770
|
-
/** Attribution score (0-1), how much this step contributed */
|
|
2771
|
-
score: number;
|
|
2772
|
-
/** Optional explanation of why this step matters */
|
|
2773
|
-
reasoning?: string;
|
|
2774
|
-
}
|
|
2775
|
-
/**
|
|
2776
|
-
* Tracks where a learning candidate came from
|
|
2777
|
-
*/
|
|
2778
|
-
interface LearningSource {
|
|
2779
|
-
/** Which provider extracted this */
|
|
2780
|
-
provider: string;
|
|
2781
|
-
/** Trajectory it was extracted from */
|
|
2782
|
-
trajectoryId: string;
|
|
2783
|
-
/** Turn range within the trajectory */
|
|
2784
|
-
turnRange: [number, number];
|
|
2785
|
-
/** When extraction happened */
|
|
2786
|
-
extractedAt: Date;
|
|
2787
|
-
/** Additional provider-specific metadata */
|
|
2788
|
-
metadata?: Record<string, unknown>;
|
|
2789
|
-
}
|
|
2790
|
-
/**
|
|
2791
|
-
* Declares what a learning provider can do.
|
|
2792
|
-
* Used by SkillBank to determine how to interact with the provider.
|
|
2793
|
-
*/
|
|
2794
|
-
interface ProviderCapabilities {
|
|
2795
|
-
/** Provider accumulates trajectories for batch processing */
|
|
2796
|
-
accumulating: boolean;
|
|
2797
|
-
/** Provider accepts outcome feedback for refinement */
|
|
2798
|
-
feedbackEnabled: boolean;
|
|
2799
|
-
/** Provider manages its own persistent state */
|
|
2800
|
-
persistent: boolean;
|
|
2801
|
-
/** Minimum trajectories before meaningful extraction (if accumulating) */
|
|
2802
|
-
minTrajectories?: number;
|
|
2803
|
-
/** Kinds of learning this provider extracts */
|
|
2804
|
-
supportedKinds: LearningKind[];
|
|
2805
|
-
}
|
|
2806
|
-
/**
|
|
2807
|
-
* Interface for learning providers.
|
|
2808
|
-
*
|
|
2809
|
-
* Providers analyze trajectories and produce learning candidates.
|
|
2810
|
-
* Each provider manages its own internal state and persistence.
|
|
2811
|
-
* Candidate IDs are provider-generated and used consistently in SkillBank.
|
|
2812
|
-
*
|
|
2813
|
-
* skill-tree includes a naive provider out of the box.
|
|
2814
|
-
* External engines like cognitive-core can implement this interface.
|
|
2815
|
-
*/
|
|
2816
|
-
interface LearningProvider {
|
|
2817
|
-
/** Provider name for identification */
|
|
2818
|
-
readonly name: string;
|
|
2819
|
-
/** Provider description */
|
|
2820
|
-
readonly description?: string;
|
|
2821
|
-
/** Provider capabilities */
|
|
2822
|
-
readonly capabilities: ProviderCapabilities;
|
|
2823
|
-
/**
|
|
2824
|
-
* Analyze a trajectory and extract learning candidates.
|
|
2825
|
-
*
|
|
2826
|
-
* For accumulating providers, may return empty candidates until
|
|
2827
|
-
* internal thresholds are met or flush() is called.
|
|
2828
|
-
*
|
|
2829
|
-
* Provider handles its own trajectory format conversion internally.
|
|
2830
|
-
*/
|
|
2831
|
-
analyze(trajectory: Trajectory, options?: AnalyzeOptions): Promise<AnalyzeResult>;
|
|
2832
|
-
/**
|
|
2833
|
-
* Analyze multiple trajectories together.
|
|
2834
|
-
* Enables cross-trajectory pattern detection.
|
|
2835
|
-
*/
|
|
2836
|
-
analyzeBatch?(trajectories: Trajectory[], options?: AnalyzeOptions): Promise<AnalyzeResult>;
|
|
2837
|
-
/**
|
|
2838
|
-
* Force extraction from accumulated trajectories.
|
|
2839
|
-
* Only meaningful for accumulating providers.
|
|
2840
|
-
*/
|
|
2841
|
-
flush?(): Promise<AnalyzeResult>;
|
|
2842
|
-
/**
|
|
2843
|
-
* Record outcome when a candidate is applied.
|
|
2844
|
-
* Provider updates its internal state and returns updates for SkillBank.
|
|
2845
|
-
*/
|
|
2846
|
-
recordOutcome?(feedback: OutcomeFeedback): Promise<OutcomeResult>;
|
|
2847
|
-
/**
|
|
2848
|
-
* Initialize provider (load persisted state, etc.)
|
|
2849
|
-
*/
|
|
2850
|
-
initialize?(): Promise<void>;
|
|
2851
|
-
/**
|
|
2852
|
-
* Shutdown cleanly (persist state, release resources)
|
|
2853
|
-
*/
|
|
2854
|
-
shutdown?(): Promise<void>;
|
|
2855
|
-
/**
|
|
2856
|
-
* Check if a candidate is a duplicate of existing candidates (optional).
|
|
2857
|
-
* Used for deduplication during extraction.
|
|
2858
|
-
*/
|
|
2859
|
-
isDuplicate?(candidate: LearningCandidate, existing: LearningCandidate[]): boolean;
|
|
2860
|
-
/**
|
|
2861
|
-
* Compute similarity between two candidates (optional).
|
|
2862
|
-
* Returns 0-1 similarity score.
|
|
2863
|
-
*/
|
|
2864
|
-
computeSimilarity?(a: LearningCandidate, b: LearningCandidate): number;
|
|
2865
|
-
}
|
|
2866
|
-
/**
|
|
2867
|
-
* Options for analyze operations
|
|
2868
|
-
*/
|
|
2869
|
-
interface AnalyzeOptions {
|
|
2870
|
-
/** Specific turn range to analyze */
|
|
2871
|
-
turnRange?: [number, number];
|
|
2872
|
-
/** Minimum confidence threshold */
|
|
2873
|
-
minConfidence?: number;
|
|
2874
|
-
/** Kinds of learning to extract */
|
|
2875
|
-
kinds?: LearningKind[];
|
|
2876
|
-
/** Additional context to consider */
|
|
2877
|
-
context?: string;
|
|
2878
|
-
/** Skip validation/quality gates */
|
|
2879
|
-
skipValidation?: boolean;
|
|
2880
|
-
/** Force immediate extraction (skip accumulation for accumulating providers) */
|
|
2881
|
-
forceImmediate?: boolean;
|
|
2882
|
-
}
|
|
2883
|
-
/**
|
|
2884
|
-
* Result of analyzing trajectory(ies)
|
|
2885
|
-
*/
|
|
2886
|
-
interface AnalyzeResult {
|
|
2887
|
-
/** Newly extracted candidates */
|
|
2888
|
-
candidates: LearningCandidate[];
|
|
2889
|
-
/** Updates to existing candidates */
|
|
2890
|
-
updates?: CandidateUpdate[];
|
|
2891
|
-
/** Candidates to demote */
|
|
2892
|
-
demotions?: CandidateDemotion[];
|
|
2893
|
-
/** Anti-patterns discovered */
|
|
2894
|
-
antiPatterns?: AntiPattern[];
|
|
2895
|
-
/** Provider state after analysis */
|
|
2896
|
-
providerState?: {
|
|
2897
|
-
pendingCount: number;
|
|
2898
|
-
readyForFlush: boolean;
|
|
2899
|
-
};
|
|
2900
|
-
/** Analysis metadata */
|
|
2901
|
-
metadata: {
|
|
2902
|
-
trajectoriesAnalyzed: number;
|
|
2903
|
-
durationMs: number;
|
|
2904
|
-
};
|
|
2905
|
-
}
|
|
2906
|
-
/**
|
|
2907
|
-
* Feedback about a candidate's outcome when applied
|
|
2908
|
-
*/
|
|
2909
|
-
interface OutcomeFeedback {
|
|
2910
|
-
/** Which candidate was applied (provider-generated ID) */
|
|
2911
|
-
candidateId: string;
|
|
2912
|
-
/** Did it work? */
|
|
2913
|
-
success: boolean;
|
|
2914
|
-
/** Trajectory where it was applied */
|
|
2915
|
-
trajectoryId: string;
|
|
2916
|
-
/** Context that might explain success/failure */
|
|
2917
|
-
context?: string;
|
|
2918
|
-
/** How it failed (if !success) */
|
|
2919
|
-
failureMode?: string;
|
|
2920
|
-
/** User signal if available */
|
|
2921
|
-
userSignal?: 'positive' | 'negative' | 'neutral';
|
|
2922
|
-
}
|
|
2923
|
-
/**
|
|
2924
|
-
* Result of recording an outcome
|
|
2925
|
-
*/
|
|
2926
|
-
interface OutcomeResult {
|
|
2927
|
-
/** Whether outcome was recorded by provider */
|
|
2928
|
-
recorded: boolean;
|
|
2929
|
-
/** Updates to apply to stored skills */
|
|
2930
|
-
updates?: CandidateUpdate[];
|
|
2931
|
-
/** New anti-patterns discovered */
|
|
2932
|
-
antiPatterns?: AntiPattern[];
|
|
2933
|
-
}
|
|
2934
|
-
/**
|
|
2935
|
-
* Update to an existing candidate/skill
|
|
2936
|
-
*/
|
|
2937
|
-
interface CandidateUpdate {
|
|
2938
|
-
/** Candidate ID (provider-generated, used as skill.id in SkillBank) */
|
|
2939
|
-
candidateId: string;
|
|
2940
|
-
/** New trigger to add */
|
|
2941
|
-
addTrigger?: TriggerSpec;
|
|
2942
|
-
/** Context-specific refinement */
|
|
2943
|
-
refinement?: {
|
|
2944
|
-
context: string;
|
|
2945
|
-
addition: string;
|
|
2946
|
-
source: 'success' | 'failure' | 'manual';
|
|
2947
|
-
};
|
|
2948
|
-
/** Confidence adjustment (-1 to +1) */
|
|
2949
|
-
confidenceAdjustment?: number;
|
|
2950
|
-
/** Increment success counter */
|
|
2951
|
-
incrementSuccess?: boolean;
|
|
2952
|
-
/** Increment failure counter */
|
|
2953
|
-
incrementFailure?: boolean;
|
|
2954
|
-
}
|
|
2955
|
-
/**
|
|
2956
|
-
* Demotion of an existing candidate/skill
|
|
2957
|
-
*/
|
|
2958
|
-
interface CandidateDemotion {
|
|
2959
|
-
candidateId: string;
|
|
2960
|
-
reason: string;
|
|
2961
|
-
newConfidence: number;
|
|
2962
|
-
deprecate?: boolean;
|
|
2963
|
-
}
|
|
2964
|
-
/**
|
|
2965
|
-
* Anti-pattern: context where a candidate should NOT be used.
|
|
2966
|
-
* Stored as separate metadata in SkillBank.
|
|
2967
|
-
*/
|
|
2968
|
-
interface AntiPattern {
|
|
2969
|
-
/** Unique ID (provider-generated) */
|
|
2970
|
-
id: string;
|
|
2971
|
-
/** Which candidate this applies to */
|
|
2972
|
-
candidateId: string;
|
|
2973
|
-
/** Pattern/context where candidate should NOT be used */
|
|
2974
|
-
pattern: string;
|
|
2975
|
-
/** Why it doesn't work in this context */
|
|
2976
|
-
reason: string;
|
|
2977
|
-
/** Trajectory where this was discovered */
|
|
2978
|
-
discoveredFrom: string;
|
|
2979
|
-
/** When discovered */
|
|
2980
|
-
createdAt: Date;
|
|
2981
|
-
}
|
|
2982
|
-
/**
|
|
2983
|
-
* Configuration for the naive learning provider
|
|
2984
|
-
*/
|
|
2985
|
-
interface NaiveProviderConfig {
|
|
2986
|
-
/** LLM provider for automatic extraction (optional) */
|
|
2987
|
-
llmProvider?: LLMProvider;
|
|
2988
|
-
/** Minimum confidence for extraction */
|
|
2989
|
-
minConfidence?: number;
|
|
2990
|
-
/** Whether to run quality gates */
|
|
2991
|
-
runQualityGates?: boolean;
|
|
2992
|
-
/** Credit assignment strategy */
|
|
2993
|
-
creditStrategy?: 'simple' | 'uniform' | 'llm';
|
|
2994
|
-
}
|
|
2995
|
-
/**
|
|
2996
|
-
* Configuration for cognitive-core provider
|
|
2997
|
-
*/
|
|
2998
|
-
interface CognitiveCoreProviderConfig {
|
|
2999
|
-
/** Base path for cognitive-core's persistent storage */
|
|
3000
|
-
storagePath?: string;
|
|
3001
|
-
/** Minimum trajectories before batch extraction */
|
|
3002
|
-
minTrajectories?: number;
|
|
3003
|
-
/** Similarity threshold for playbook deduplication */
|
|
3004
|
-
deduplicationThreshold?: number;
|
|
3005
|
-
/** Credit assignment strategy */
|
|
3006
|
-
creditStrategy?: 'simple' | 'contribution' | 'llm';
|
|
3007
|
-
/** Whether to convert trajectories to ReAct format */
|
|
3008
|
-
convertToReAct?: boolean;
|
|
3009
|
-
}
|
|
3010
|
-
/**
|
|
3011
|
-
* Result of a learning analysis operation (legacy format)
|
|
3012
|
-
* @deprecated Use AnalyzeResult instead
|
|
3013
|
-
*/
|
|
3014
|
-
interface AnalysisResult {
|
|
3015
|
-
/** Candidates that passed all checks */
|
|
3016
|
-
candidates: LearningCandidate[];
|
|
3017
|
-
/** Candidates that were rejected (with reasons) */
|
|
3018
|
-
rejected: RejectedCandidate[];
|
|
3019
|
-
/** Provider that performed the analysis */
|
|
3020
|
-
provider: string;
|
|
3021
|
-
/** How long analysis took (ms) */
|
|
3022
|
-
durationMs: number;
|
|
3023
|
-
/** Trajectories analyzed */
|
|
3024
|
-
trajectoriesAnalyzed: number;
|
|
3025
|
-
}
|
|
3026
|
-
/**
|
|
3027
|
-
* A candidate that was rejected during analysis
|
|
3028
|
-
*/
|
|
3029
|
-
interface RejectedCandidate {
|
|
3030
|
-
/** The rejected candidate */
|
|
3031
|
-
candidate: Partial<LearningCandidate>;
|
|
3032
|
-
/** Why it was rejected */
|
|
3033
|
-
reason: string;
|
|
3034
|
-
/** Which check failed */
|
|
3035
|
-
failedCheck?: string;
|
|
3036
|
-
/** Score if applicable */
|
|
3037
|
-
score?: number;
|
|
3038
|
-
}
|
|
3039
|
-
|
|
3040
2610
|
/**
|
|
3041
2611
|
* Types for the hooks and activation system
|
|
3042
2612
|
*/
|
|
@@ -3546,55 +3116,11 @@ interface SkillBankConfig {
|
|
|
3546
3116
|
config?: ComposerConfig;
|
|
3547
3117
|
};
|
|
3548
3118
|
}
|
|
3549
|
-
/**
|
|
3550
|
-
* Result of learning from trajectories
|
|
3551
|
-
*/
|
|
3552
|
-
interface LearnResult {
|
|
3553
|
-
/** Number of skills created */
|
|
3554
|
-
skillsCreated: number;
|
|
3555
|
-
/** Number of skills updated */
|
|
3556
|
-
skillsUpdated: number;
|
|
3557
|
-
/** Number of skills demoted */
|
|
3558
|
-
skillsDemoted: number;
|
|
3559
|
-
/** Number of anti-patterns added */
|
|
3560
|
-
antiPatternsAdded: number;
|
|
3561
|
-
/** Provider state (if accumulating) */
|
|
3562
|
-
providerState?: {
|
|
3563
|
-
pendingCount: number;
|
|
3564
|
-
readyForFlush: boolean;
|
|
3565
|
-
};
|
|
3566
|
-
/** IDs of created skills */
|
|
3567
|
-
createdSkillIds: string[];
|
|
3568
|
-
/** IDs of updated skills */
|
|
3569
|
-
updatedSkillIds: string[];
|
|
3570
|
-
}
|
|
3571
|
-
/**
|
|
3572
|
-
* Options for finding skills
|
|
3573
|
-
*/
|
|
3574
|
-
interface FindSkillsOptions {
|
|
3575
|
-
/** Current context to check against anti-patterns */
|
|
3576
|
-
context?: string;
|
|
3577
|
-
/** Exclude skills with matching anti-patterns */
|
|
3578
|
-
excludeAntiPatternMatches?: boolean;
|
|
3579
|
-
/** Maximum results */
|
|
3580
|
-
maxResults?: number;
|
|
3581
|
-
/** Minimum similarity threshold */
|
|
3582
|
-
minSimilarity?: number;
|
|
3583
|
-
}
|
|
3584
3119
|
/**
|
|
3585
3120
|
* Unified query input for findSkills().
|
|
3586
3121
|
* Accepts either a plain string or a structured MatchContext.
|
|
3587
3122
|
*/
|
|
3588
3123
|
type SkillQuery = string | MatchContext;
|
|
3589
|
-
/**
|
|
3590
|
-
* Skill match with anti-pattern awareness
|
|
3591
|
-
*/
|
|
3592
|
-
interface SkillMatchWithAntiPatterns extends MatchResult {
|
|
3593
|
-
/** Anti-patterns that apply in current context */
|
|
3594
|
-
relevantAntiPatterns?: AntiPattern[];
|
|
3595
|
-
/** Warnings based on anti-patterns or low confidence */
|
|
3596
|
-
warnings?: string[];
|
|
3597
|
-
}
|
|
3598
3124
|
/**
|
|
3599
3125
|
* Main SkillBank class
|
|
3600
3126
|
*/
|
|
@@ -3608,10 +3134,6 @@ declare class SkillBank {
|
|
|
3608
3134
|
private eventHandlers;
|
|
3609
3135
|
private initialized;
|
|
3610
3136
|
private autoIndexOnInit;
|
|
3611
|
-
/** Learning providers for meta-learning integration */
|
|
3612
|
-
private learningProviders;
|
|
3613
|
-
/** Anti-patterns stored separately as metadata */
|
|
3614
|
-
private antiPatterns;
|
|
3615
3137
|
/** Namespace configuration for multi-tier skill trees */
|
|
3616
3138
|
private namespaceConfig?;
|
|
3617
3139
|
/** Federation manager for remote repository connections */
|
|
@@ -3704,122 +3226,6 @@ declare class SkillBank {
|
|
|
3704
3226
|
* Set LLM provider for automatic extraction
|
|
3705
3227
|
*/
|
|
3706
3228
|
setLLMProvider(provider: LLMProvider): void;
|
|
3707
|
-
/**
|
|
3708
|
-
* Register a learning provider.
|
|
3709
|
-
* Learning providers analyze trajectories and produce learning candidates.
|
|
3710
|
-
* Use this to integrate external learning engines like cognitive-core.
|
|
3711
|
-
*/
|
|
3712
|
-
registerLearningProvider(provider: LearningProvider): Promise<void>;
|
|
3713
|
-
/**
|
|
3714
|
-
* Get a registered learning provider by name
|
|
3715
|
-
*/
|
|
3716
|
-
getLearningProvider(name: string): LearningProvider | undefined;
|
|
3717
|
-
/**
|
|
3718
|
-
* List all registered learning providers
|
|
3719
|
-
*/
|
|
3720
|
-
listLearningProviders(): LearningProvider[];
|
|
3721
|
-
/**
|
|
3722
|
-
* Learn from a trajectory using a learning provider.
|
|
3723
|
-
* This is the primary integration point for meta-learning engines.
|
|
3724
|
-
*
|
|
3725
|
-
* For accumulating providers, this may not return immediate results.
|
|
3726
|
-
* Use flushProviders() to force extraction from accumulated trajectories.
|
|
3727
|
-
*/
|
|
3728
|
-
learnFrom(trajectory: Trajectory, options?: AnalyzeOptions & {
|
|
3729
|
-
provider?: string;
|
|
3730
|
-
}): Promise<LearnResult>;
|
|
3731
|
-
/**
|
|
3732
|
-
* Learn from multiple trajectories.
|
|
3733
|
-
* Providers that support batch analysis can find cross-trajectory patterns.
|
|
3734
|
-
*/
|
|
3735
|
-
learnFromBatch(trajectories: Trajectory[], options?: AnalyzeOptions & {
|
|
3736
|
-
provider?: string;
|
|
3737
|
-
}): Promise<LearnResult>;
|
|
3738
|
-
/**
|
|
3739
|
-
* Force extraction from all accumulating providers.
|
|
3740
|
-
*/
|
|
3741
|
-
flushProviders(): Promise<LearnResult>;
|
|
3742
|
-
/**
|
|
3743
|
-
* Record outcome when a skill is applied.
|
|
3744
|
-
* Provider updates internal state and returns updates for SkillBank.
|
|
3745
|
-
*/
|
|
3746
|
-
recordOutcome(feedback: OutcomeFeedback, providerName?: string): Promise<void>;
|
|
3747
|
-
/**
|
|
3748
|
-
* Process an AnalyzeResult: store candidates, apply updates, etc.
|
|
3749
|
-
*/
|
|
3750
|
-
private processAnalyzeResult;
|
|
3751
|
-
/**
|
|
3752
|
-
* Store a non-skill candidate for later review
|
|
3753
|
-
*/
|
|
3754
|
-
private storeCandidateForReview;
|
|
3755
|
-
/**
|
|
3756
|
-
* Apply an update to an existing skill
|
|
3757
|
-
*/
|
|
3758
|
-
private applyUpdate;
|
|
3759
|
-
/**
|
|
3760
|
-
* Apply a demotion to an existing skill
|
|
3761
|
-
*/
|
|
3762
|
-
private applyDemotion;
|
|
3763
|
-
/**
|
|
3764
|
-
* Get anti-patterns for a skill
|
|
3765
|
-
*/
|
|
3766
|
-
getAntiPatterns(skillId: string): Promise<AntiPattern[]>;
|
|
3767
|
-
/**
|
|
3768
|
-
* Add an anti-pattern
|
|
3769
|
-
*/
|
|
3770
|
-
addAntiPattern(antiPattern: AntiPattern): Promise<void>;
|
|
3771
|
-
/**
|
|
3772
|
-
* Remove an anti-pattern by ID
|
|
3773
|
-
*/
|
|
3774
|
-
removeAntiPattern(antiPatternId: string): Promise<boolean>;
|
|
3775
|
-
/**
|
|
3776
|
-
* List pending learning candidates for review
|
|
3777
|
-
*/
|
|
3778
|
-
listCandidates(filter?: CandidateFilter): Promise<LearningCandidateRecord[]>;
|
|
3779
|
-
/**
|
|
3780
|
-
* Get a specific candidate by ID
|
|
3781
|
-
*/
|
|
3782
|
-
getCandidate(id: string): Promise<LearningCandidateRecord | null>;
|
|
3783
|
-
/**
|
|
3784
|
-
* Promote a candidate to a skill
|
|
3785
|
-
* Works for strategy, pattern, and error-fix candidates that were stored for review
|
|
3786
|
-
*/
|
|
3787
|
-
promoteCandidate(candidateId: string): Promise<Skill | null>;
|
|
3788
|
-
/**
|
|
3789
|
-
* Reject a candidate with a reason
|
|
3790
|
-
*/
|
|
3791
|
-
rejectCandidate(candidateId: string, reason: string): Promise<boolean>;
|
|
3792
|
-
/**
|
|
3793
|
-
* Delete a candidate
|
|
3794
|
-
*/
|
|
3795
|
-
deleteCandidate(candidateId: string): Promise<boolean>;
|
|
3796
|
-
/**
|
|
3797
|
-
* Find skills with anti-pattern awareness
|
|
3798
|
-
*/
|
|
3799
|
-
findSkillsWithAntiPatterns(query: string, options?: FindSkillsOptions): Promise<SkillMatchWithAntiPatterns[]>;
|
|
3800
|
-
/**
|
|
3801
|
-
* Extract learning candidates from a trajectory using a learning provider.
|
|
3802
|
-
* @deprecated Use learnFrom() instead
|
|
3803
|
-
*/
|
|
3804
|
-
extractLearnings(trajectory: Trajectory, options?: AnalyzeOptions & {
|
|
3805
|
-
provider?: string;
|
|
3806
|
-
}): Promise<LearningCandidate[]>;
|
|
3807
|
-
/**
|
|
3808
|
-
* Extract learning candidates from multiple trajectories.
|
|
3809
|
-
* @deprecated Use learnFromBatch() instead
|
|
3810
|
-
*/
|
|
3811
|
-
extractLearningsBatch(trajectories: Trajectory[], options?: AnalyzeOptions & {
|
|
3812
|
-
provider?: string;
|
|
3813
|
-
}): Promise<LearningCandidate[]>;
|
|
3814
|
-
/**
|
|
3815
|
-
* Promote a learning candidate to a versioned skill.
|
|
3816
|
-
* This converts the raw learning into a curated, versioned skill.
|
|
3817
|
-
*/
|
|
3818
|
-
promoteToSkill(candidate: LearningCandidate, options?: {
|
|
3819
|
-
author?: string;
|
|
3820
|
-
tags?: string[];
|
|
3821
|
-
status?: Skill['status'];
|
|
3822
|
-
}): Promise<Skill>;
|
|
3823
3229
|
/**
|
|
3824
3230
|
* Validate a skill and store the result
|
|
3825
3231
|
* Returns the validation result, or null if validation is not enabled
|
|
@@ -4325,7 +3731,6 @@ interface SkillBankStats {
|
|
|
4325
3731
|
byTag: Record<string, number>;
|
|
4326
3732
|
avgSuccessRate: number;
|
|
4327
3733
|
totalUsage: number;
|
|
4328
|
-
totalAntiPatterns: number;
|
|
4329
3734
|
/** Namespace breakdown (if namespace config is enabled) */
|
|
4330
3735
|
byScope?: {
|
|
4331
3736
|
personal: number;
|
|
@@ -4557,8 +3962,6 @@ declare abstract class BaseStorageAdapter implements StorageAdapter {
|
|
|
4557
3962
|
declare class MemoryStorageAdapter extends BaseStorageAdapter {
|
|
4558
3963
|
private skills;
|
|
4559
3964
|
private lineages;
|
|
4560
|
-
private candidates;
|
|
4561
|
-
private antiPatterns;
|
|
4562
3965
|
initialize(): Promise<void>;
|
|
4563
3966
|
saveSkill(skill: Skill): Promise<void>;
|
|
4564
3967
|
getSkill(id: string, version?: string): Promise<Skill | null>;
|
|
@@ -4574,20 +3977,6 @@ declare class MemoryStorageAdapter extends BaseStorageAdapter {
|
|
|
4574
3977
|
* Clear all stored skills (for testing)
|
|
4575
3978
|
*/
|
|
4576
3979
|
clear(): void;
|
|
4577
|
-
saveCandidate(candidate: LearningCandidateRecord): Promise<void>;
|
|
4578
|
-
getCandidate(id: string): Promise<LearningCandidateRecord | null>;
|
|
4579
|
-
listCandidates(filter?: CandidateFilter): Promise<LearningCandidateRecord[]>;
|
|
4580
|
-
updateCandidateStatus(id: string, status: 'pending' | 'promoted' | 'rejected', details?: {
|
|
4581
|
-
promotedToSkillId?: string;
|
|
4582
|
-
rejectionReason?: string;
|
|
4583
|
-
}): Promise<boolean>;
|
|
4584
|
-
deleteCandidate(id: string): Promise<boolean>;
|
|
4585
|
-
saveAntiPatterns(skillId: string, patterns: AntiPatternRecord[]): Promise<void>;
|
|
4586
|
-
getAntiPatterns(skillId: string): Promise<AntiPatternRecord[]>;
|
|
4587
|
-
listAntiPatterns(): Promise<Array<{
|
|
4588
|
-
skillId: string;
|
|
4589
|
-
patterns: AntiPatternRecord[];
|
|
4590
|
-
}>>;
|
|
4591
3980
|
recordFork(sourceSkillId: string, fork: SkillFork): Promise<void>;
|
|
4592
3981
|
}
|
|
4593
3982
|
|
|
@@ -4718,22 +4107,6 @@ declare class FilesystemStorageAdapter extends BaseStorageAdapter {
|
|
|
4718
4107
|
* Generate content hash
|
|
4719
4108
|
*/
|
|
4720
4109
|
private hashContent;
|
|
4721
|
-
private get candidatesDir();
|
|
4722
|
-
private get antiPatternsDir();
|
|
4723
|
-
saveCandidate(candidate: LearningCandidateRecord): Promise<void>;
|
|
4724
|
-
getCandidate(id: string): Promise<LearningCandidateRecord | null>;
|
|
4725
|
-
listCandidates(filter?: CandidateFilter): Promise<LearningCandidateRecord[]>;
|
|
4726
|
-
updateCandidateStatus(id: string, status: 'pending' | 'promoted' | 'rejected', details?: {
|
|
4727
|
-
promotedToSkillId?: string;
|
|
4728
|
-
rejectionReason?: string;
|
|
4729
|
-
}): Promise<boolean>;
|
|
4730
|
-
deleteCandidate(id: string): Promise<boolean>;
|
|
4731
|
-
saveAntiPatterns(skillId: string, patterns: AntiPatternRecord[]): Promise<void>;
|
|
4732
|
-
getAntiPatterns(skillId: string): Promise<AntiPatternRecord[]>;
|
|
4733
|
-
listAntiPatterns(): Promise<Array<{
|
|
4734
|
-
skillId: string;
|
|
4735
|
-
patterns: AntiPatternRecord[];
|
|
4736
|
-
}>>;
|
|
4737
4110
|
recordFork(sourceSkillId: string, fork: SkillFork): Promise<void>;
|
|
4738
4111
|
}
|
|
4739
4112
|
|
|
@@ -4864,7 +4237,7 @@ interface TaxonomyTreeNode {
|
|
|
4864
4237
|
* Storage migration utility
|
|
4865
4238
|
*
|
|
4866
4239
|
* Migrates skill data between storage backends (memory, filesystem, SQLite).
|
|
4867
|
-
* Copies skills, version history,
|
|
4240
|
+
* Copies skills, version history, and lineage.
|
|
4868
4241
|
*/
|
|
4869
4242
|
|
|
4870
4243
|
/**
|
|
@@ -4875,10 +4248,6 @@ interface MigrationOptions {
|
|
|
4875
4248
|
skills?: boolean;
|
|
4876
4249
|
/** Migrate version history and lineage */
|
|
4877
4250
|
lineage?: boolean;
|
|
4878
|
-
/** Migrate learning candidates (if supported by both backends) */
|
|
4879
|
-
candidates?: boolean;
|
|
4880
|
-
/** Migrate anti-patterns (if supported by both backends) */
|
|
4881
|
-
antiPatterns?: boolean;
|
|
4882
4251
|
/** Called for each item migrated */
|
|
4883
4252
|
onProgress?: (item: MigrationProgressItem) => void;
|
|
4884
4253
|
/** Whether to overwrite existing items in the target */
|
|
@@ -4888,7 +4257,7 @@ interface MigrationOptions {
|
|
|
4888
4257
|
* Progress item for migration callbacks
|
|
4889
4258
|
*/
|
|
4890
4259
|
interface MigrationProgressItem {
|
|
4891
|
-
type: 'skill' | 'lineage'
|
|
4260
|
+
type: 'skill' | 'lineage';
|
|
4892
4261
|
id: string;
|
|
4893
4262
|
status: 'migrated' | 'skipped' | 'error';
|
|
4894
4263
|
error?: string;
|
|
@@ -4917,16 +4286,6 @@ interface MigrationResult {
|
|
|
4917
4286
|
skipped: number;
|
|
4918
4287
|
errors: number;
|
|
4919
4288
|
};
|
|
4920
|
-
candidates: {
|
|
4921
|
-
migrated: number;
|
|
4922
|
-
skipped: number;
|
|
4923
|
-
errors: number;
|
|
4924
|
-
};
|
|
4925
|
-
antiPatterns: {
|
|
4926
|
-
migrated: number;
|
|
4927
|
-
skipped: number;
|
|
4928
|
-
errors: number;
|
|
4929
|
-
};
|
|
4930
4289
|
};
|
|
4931
4290
|
}
|
|
4932
4291
|
/**
|
|
@@ -5825,414 +5184,6 @@ declare function combineHandlers(...handlers: HookHandler[]): HookHandler;
|
|
|
5825
5184
|
*/
|
|
5826
5185
|
declare function conditionalHook(filter: (context: any) => boolean, handler: HookHandler): HookHandler;
|
|
5827
5186
|
|
|
5828
|
-
/**
|
|
5829
|
-
* Naive Learning Provider
|
|
5830
|
-
*
|
|
5831
|
-
* Wraps skill-tree's built-in extraction logic as a LearningProvider.
|
|
5832
|
-
* This provides a baseline implementation that works without external dependencies.
|
|
5833
|
-
*
|
|
5834
|
-
* @packageDocumentation
|
|
5835
|
-
*/
|
|
5836
|
-
|
|
5837
|
-
/**
|
|
5838
|
-
* Naive learning provider using skill-tree's built-in extractors.
|
|
5839
|
-
*
|
|
5840
|
-
* Features:
|
|
5841
|
-
* - Manual extraction (no LLM required)
|
|
5842
|
-
* - Automatic extraction (requires LLM provider)
|
|
5843
|
-
* - Simple credit assignment strategies
|
|
5844
|
-
* - Quality gate integration
|
|
5845
|
-
*
|
|
5846
|
-
* This is a non-accumulating provider that returns results immediately.
|
|
5847
|
-
* It does not support outcome feedback or persistent state.
|
|
5848
|
-
*/
|
|
5849
|
-
declare class NaiveLearningProvider implements LearningProvider {
|
|
5850
|
-
readonly name = "naive";
|
|
5851
|
-
readonly description = "Built-in extraction using heuristics and optional LLM analysis";
|
|
5852
|
-
readonly capabilities: ProviderCapabilities;
|
|
5853
|
-
private manualExtractor;
|
|
5854
|
-
private automaticExtractor;
|
|
5855
|
-
private config;
|
|
5856
|
-
constructor(config?: NaiveProviderConfig);
|
|
5857
|
-
/**
|
|
5858
|
-
* Set or update the LLM provider
|
|
5859
|
-
*/
|
|
5860
|
-
setLLMProvider(provider: LLMProvider): void;
|
|
5861
|
-
/**
|
|
5862
|
-
* Analyze a trajectory and extract learning candidates
|
|
5863
|
-
*/
|
|
5864
|
-
analyze(trajectory: Trajectory, options?: AnalyzeOptions): Promise<AnalyzeResult>;
|
|
5865
|
-
/**
|
|
5866
|
-
* Batch analysis - runs individual analysis on each trajectory.
|
|
5867
|
-
* A more sophisticated provider could do cross-trajectory pattern detection.
|
|
5868
|
-
*/
|
|
5869
|
-
analyzeBatch(trajectories: Trajectory[], options?: AnalyzeOptions): Promise<AnalyzeResult>;
|
|
5870
|
-
/**
|
|
5871
|
-
* Check if a candidate is a duplicate based on name/content similarity
|
|
5872
|
-
*/
|
|
5873
|
-
isDuplicate(candidate: LearningCandidate, existing: LearningCandidate[]): boolean;
|
|
5874
|
-
/**
|
|
5875
|
-
* Compute similarity between two candidates (basic implementation)
|
|
5876
|
-
*/
|
|
5877
|
-
computeSimilarity(a: LearningCandidate, b: LearningCandidate): number;
|
|
5878
|
-
/**
|
|
5879
|
-
* Convert an ExtractionResult to a LearningCandidate
|
|
5880
|
-
*/
|
|
5881
|
-
private extractionResultToCandidate;
|
|
5882
|
-
/**
|
|
5883
|
-
* Convert a Skill to LearningContent
|
|
5884
|
-
*/
|
|
5885
|
-
private skillToContent;
|
|
5886
|
-
/**
|
|
5887
|
-
* Infer the kind of learning from a skill
|
|
5888
|
-
*/
|
|
5889
|
-
private inferKind;
|
|
5890
|
-
/**
|
|
5891
|
-
* Compute step attribution using the configured strategy
|
|
5892
|
-
*/
|
|
5893
|
-
private computeAttribution;
|
|
5894
|
-
/**
|
|
5895
|
-
* Simple credit assignment: exponential decay from end.
|
|
5896
|
-
* Last step gets most credit, earlier steps get less.
|
|
5897
|
-
*/
|
|
5898
|
-
private simpleCredit;
|
|
5899
|
-
/**
|
|
5900
|
-
* Uniform credit assignment: all steps get equal credit.
|
|
5901
|
-
*/
|
|
5902
|
-
private uniformCredit;
|
|
5903
|
-
/**
|
|
5904
|
-
* Generate reasoning for attribution
|
|
5905
|
-
*/
|
|
5906
|
-
private getAttributionReasoning;
|
|
5907
|
-
/**
|
|
5908
|
-
* Deduplicate candidates by ID
|
|
5909
|
-
*/
|
|
5910
|
-
private deduplicateCandidates;
|
|
5911
|
-
/**
|
|
5912
|
-
* Normalize a name for comparison
|
|
5913
|
-
*/
|
|
5914
|
-
private normalizeName;
|
|
5915
|
-
/**
|
|
5916
|
-
* Tokenize text into words
|
|
5917
|
-
*/
|
|
5918
|
-
private tokenize;
|
|
5919
|
-
/**
|
|
5920
|
-
* Compute Jaccard similarity between two arrays
|
|
5921
|
-
*/
|
|
5922
|
-
private jaccardSimilarity;
|
|
5923
|
-
}
|
|
5924
|
-
/**
|
|
5925
|
-
* Create a naive learning provider with the given configuration
|
|
5926
|
-
*/
|
|
5927
|
-
declare function createNaiveProvider(config?: NaiveProviderConfig): NaiveLearningProvider;
|
|
5928
|
-
|
|
5929
|
-
/**
|
|
5930
|
-
* Cognitive Core Learning Provider
|
|
5931
|
-
*
|
|
5932
|
-
* Adapts cognitive-core's learning pipeline and playbook system
|
|
5933
|
-
* to skill-tree's LearningProvider interface.
|
|
5934
|
-
*
|
|
5935
|
-
* Features:
|
|
5936
|
-
* - Accumulating provider with batch extraction
|
|
5937
|
-
* - Outcome feedback for playbook refinement
|
|
5938
|
-
* - Persistent state via cognitive-core's MemorySystem
|
|
5939
|
-
* - Cross-trajectory pattern detection
|
|
5940
|
-
*
|
|
5941
|
-
* This provider uses dependency injection - consumers provide the
|
|
5942
|
-
* cognitive-core components rather than importing them directly.
|
|
5943
|
-
*
|
|
5944
|
-
* @packageDocumentation
|
|
5945
|
-
*/
|
|
5946
|
-
|
|
5947
|
-
/**
|
|
5948
|
-
* Cognitive-core Step type
|
|
5949
|
-
*/
|
|
5950
|
-
interface CCStep {
|
|
5951
|
-
thought?: string;
|
|
5952
|
-
action: string;
|
|
5953
|
-
observation: string;
|
|
5954
|
-
timestamp?: Date;
|
|
5955
|
-
metadata?: Record<string, unknown>;
|
|
5956
|
-
attributionScore?: number;
|
|
5957
|
-
}
|
|
5958
|
-
/**
|
|
5959
|
-
* Cognitive-core Task type
|
|
5960
|
-
*/
|
|
5961
|
-
interface CCTask {
|
|
5962
|
-
id: string;
|
|
5963
|
-
domain: string;
|
|
5964
|
-
description: string;
|
|
5965
|
-
context?: Record<string, unknown>;
|
|
5966
|
-
metadata?: Record<string, unknown>;
|
|
5967
|
-
}
|
|
5968
|
-
/**
|
|
5969
|
-
* Cognitive-core Outcome type
|
|
5970
|
-
*/
|
|
5971
|
-
interface CCOutcome {
|
|
5972
|
-
success: boolean;
|
|
5973
|
-
partialScore?: number;
|
|
5974
|
-
solution?: unknown;
|
|
5975
|
-
errorInfo?: string;
|
|
5976
|
-
}
|
|
5977
|
-
/**
|
|
5978
|
-
* Cognitive-core Trajectory type
|
|
5979
|
-
*/
|
|
5980
|
-
interface CCTrajectory {
|
|
5981
|
-
id: string;
|
|
5982
|
-
task: CCTask;
|
|
5983
|
-
steps: CCStep[];
|
|
5984
|
-
outcome: CCOutcome;
|
|
5985
|
-
agentId: string;
|
|
5986
|
-
timestamp?: Date;
|
|
5987
|
-
metadata?: Record<string, unknown>;
|
|
5988
|
-
}
|
|
5989
|
-
/**
|
|
5990
|
-
* Cognitive-core Playbook type
|
|
5991
|
-
*/
|
|
5992
|
-
interface CCPlaybook {
|
|
5993
|
-
id: string;
|
|
5994
|
-
name: string;
|
|
5995
|
-
applicability: {
|
|
5996
|
-
situations: string[];
|
|
5997
|
-
triggers: string[];
|
|
5998
|
-
antiPatterns: string[];
|
|
5999
|
-
domains: string[];
|
|
6000
|
-
};
|
|
6001
|
-
guidance: {
|
|
6002
|
-
strategy: string;
|
|
6003
|
-
tactics: string[];
|
|
6004
|
-
steps?: string[];
|
|
6005
|
-
codeExample?: string;
|
|
6006
|
-
};
|
|
6007
|
-
verification: {
|
|
6008
|
-
successIndicators: string[];
|
|
6009
|
-
failureIndicators: string[];
|
|
6010
|
-
rollbackStrategy?: string;
|
|
6011
|
-
};
|
|
6012
|
-
evolution: {
|
|
6013
|
-
version: string;
|
|
6014
|
-
createdFrom: string[];
|
|
6015
|
-
failures: Array<{
|
|
6016
|
-
trajectoryId: string;
|
|
6017
|
-
context: string;
|
|
6018
|
-
failureMode: string;
|
|
6019
|
-
timestamp: Date;
|
|
6020
|
-
}>;
|
|
6021
|
-
refinements: Array<{
|
|
6022
|
-
context: string;
|
|
6023
|
-
addition: string;
|
|
6024
|
-
source: 'failure' | 'success' | 'manual';
|
|
6025
|
-
addedAt: Date;
|
|
6026
|
-
}>;
|
|
6027
|
-
successCount: number;
|
|
6028
|
-
failureCount: number;
|
|
6029
|
-
lastUsed?: Date;
|
|
6030
|
-
};
|
|
6031
|
-
confidence: number;
|
|
6032
|
-
complexity: 'simple' | 'moderate' | 'complex';
|
|
6033
|
-
estimatedEffort: number;
|
|
6034
|
-
embedding?: number[];
|
|
6035
|
-
createdAt: Date;
|
|
6036
|
-
updatedAt: Date;
|
|
6037
|
-
}
|
|
6038
|
-
/**
|
|
6039
|
-
* Process result from LearningPipeline
|
|
6040
|
-
*/
|
|
6041
|
-
interface CCProcessResult {
|
|
6042
|
-
trajectoryId: string;
|
|
6043
|
-
stored: boolean;
|
|
6044
|
-
analysis: {
|
|
6045
|
-
success: boolean;
|
|
6046
|
-
abstractable: boolean;
|
|
6047
|
-
};
|
|
6048
|
-
playbookExtracted: boolean;
|
|
6049
|
-
}
|
|
6050
|
-
/**
|
|
6051
|
-
* Batch result from LearningPipeline
|
|
6052
|
-
*/
|
|
6053
|
-
interface CCBatchResult {
|
|
6054
|
-
trajectoriesProcessed: number;
|
|
6055
|
-
playbooksExtracted: number;
|
|
6056
|
-
experiencesPruned: number;
|
|
6057
|
-
successRate: number;
|
|
6058
|
-
}
|
|
6059
|
-
/**
|
|
6060
|
-
* Interface for cognitive-core's LearningPipeline
|
|
6061
|
-
*/
|
|
6062
|
-
interface CCLearningPipeline {
|
|
6063
|
-
processTrajectory(trajectory: CCTrajectory): Promise<CCProcessResult>;
|
|
6064
|
-
shouldRunBatch(): boolean;
|
|
6065
|
-
runBatchLearning(): Promise<CCBatchResult>;
|
|
6066
|
-
getAccumulatedCount(): number;
|
|
6067
|
-
clearAccumulated(): void;
|
|
6068
|
-
}
|
|
6069
|
-
/**
|
|
6070
|
-
* Interface for cognitive-core's PlaybookLibrary
|
|
6071
|
-
*/
|
|
6072
|
-
interface CCPlaybookLibrary {
|
|
6073
|
-
getAll(): Promise<CCPlaybook[]>;
|
|
6074
|
-
get(id: string): Promise<CCPlaybook | undefined>;
|
|
6075
|
-
add(playbook: CCPlaybook): Promise<void>;
|
|
6076
|
-
recordSuccess(id: string, trajectoryId: string): Promise<void>;
|
|
6077
|
-
recordFailure(id: string, trajectoryId: string, context: string, failureMode: string): Promise<void>;
|
|
6078
|
-
}
|
|
6079
|
-
/**
|
|
6080
|
-
* Interface for cognitive-core's MemorySystem (subset we need)
|
|
6081
|
-
*/
|
|
6082
|
-
interface CCMemorySystem {
|
|
6083
|
-
init(): Promise<void>;
|
|
6084
|
-
close(): Promise<void>;
|
|
6085
|
-
playbooks: CCPlaybookLibrary;
|
|
6086
|
-
recordPlaybookUsage(id: string, trajectoryId: string, success: boolean, context?: string, failureMode?: string): Promise<void>;
|
|
6087
|
-
}
|
|
6088
|
-
/**
|
|
6089
|
-
* Factory interface for creating cognitive-core components
|
|
6090
|
-
*/
|
|
6091
|
-
interface CognitiveCoreFactory {
|
|
6092
|
-
createMemorySystem(storagePath: string): CCMemorySystem;
|
|
6093
|
-
createLearningPipeline(memory: CCMemorySystem, config: {
|
|
6094
|
-
creditStrategy?: 'simple' | 'contribution';
|
|
6095
|
-
minTrajectories?: number;
|
|
6096
|
-
deduplicationThreshold?: number;
|
|
6097
|
-
}): CCLearningPipeline;
|
|
6098
|
-
createTrajectory(params: {
|
|
6099
|
-
id: string;
|
|
6100
|
-
task: CCTask;
|
|
6101
|
-
steps: CCStep[];
|
|
6102
|
-
outcome: CCOutcome;
|
|
6103
|
-
agentId: string;
|
|
6104
|
-
metadata?: Record<string, unknown>;
|
|
6105
|
-
}): CCTrajectory;
|
|
6106
|
-
createTask(params: {
|
|
6107
|
-
id: string;
|
|
6108
|
-
domain: string;
|
|
6109
|
-
description: string;
|
|
6110
|
-
context?: Record<string, unknown>;
|
|
6111
|
-
}): CCTask;
|
|
6112
|
-
createStep(params: {
|
|
6113
|
-
thought?: string;
|
|
6114
|
-
action: string;
|
|
6115
|
-
observation: string;
|
|
6116
|
-
}): CCStep;
|
|
6117
|
-
}
|
|
6118
|
-
/**
|
|
6119
|
-
* Extended config that includes the factory
|
|
6120
|
-
*/
|
|
6121
|
-
interface CognitiveCoreProviderOptions extends CognitiveCoreProviderConfig {
|
|
6122
|
-
factory: CognitiveCoreFactory;
|
|
6123
|
-
}
|
|
6124
|
-
/**
|
|
6125
|
-
* Cognitive Core learning provider using cognitive-core's learning pipeline.
|
|
6126
|
-
*
|
|
6127
|
-
* This is an accumulating provider that batches trajectories before extraction.
|
|
6128
|
-
* It uses cognitive-core's MemorySystem for persistence and PlaybookLibrary
|
|
6129
|
-
* for storing/matching learned patterns.
|
|
6130
|
-
*
|
|
6131
|
-
* Usage:
|
|
6132
|
-
* ```typescript
|
|
6133
|
-
* import { createMemorySystem, createLearningPipeline, createTrajectory, createTask, createStep } from 'cognitive-core';
|
|
6134
|
-
*
|
|
6135
|
-
* const provider = new CognitiveCoreProvider({
|
|
6136
|
-
* storagePath: './.memory',
|
|
6137
|
-
* factory: {
|
|
6138
|
-
* createMemorySystem,
|
|
6139
|
-
* createLearningPipeline,
|
|
6140
|
-
* createTrajectory,
|
|
6141
|
-
* createTask,
|
|
6142
|
-
* createStep,
|
|
6143
|
-
* },
|
|
6144
|
-
* });
|
|
6145
|
-
* ```
|
|
6146
|
-
*/
|
|
6147
|
-
declare class CognitiveCoreProvider implements LearningProvider {
|
|
6148
|
-
readonly name = "cognitive-core";
|
|
6149
|
-
readonly description = "Advanced learning using cognitive-core with batch extraction and feedback";
|
|
6150
|
-
readonly capabilities: ProviderCapabilities;
|
|
6151
|
-
private memory;
|
|
6152
|
-
private pipeline;
|
|
6153
|
-
private factory;
|
|
6154
|
-
private config;
|
|
6155
|
-
private initialized;
|
|
6156
|
-
private playbookIdCache;
|
|
6157
|
-
constructor(options: CognitiveCoreProviderOptions);
|
|
6158
|
-
/**
|
|
6159
|
-
* Initialize the provider (load persisted state)
|
|
6160
|
-
*/
|
|
6161
|
-
initialize(): Promise<void>;
|
|
6162
|
-
/**
|
|
6163
|
-
* Shutdown cleanly (persist state, release resources)
|
|
6164
|
-
*/
|
|
6165
|
-
shutdown(): Promise<void>;
|
|
6166
|
-
/**
|
|
6167
|
-
* Analyze a trajectory and accumulate for batch learning.
|
|
6168
|
-
* Returns empty candidates until flush() or batch threshold.
|
|
6169
|
-
*/
|
|
6170
|
-
analyze(trajectory: Trajectory, options?: AnalyzeOptions): Promise<AnalyzeResult>;
|
|
6171
|
-
/**
|
|
6172
|
-
* Analyze multiple trajectories together.
|
|
6173
|
-
* Enables better cross-trajectory pattern detection.
|
|
6174
|
-
*/
|
|
6175
|
-
analyzeBatch(trajectories: Trajectory[], options?: AnalyzeOptions): Promise<AnalyzeResult>;
|
|
6176
|
-
/**
|
|
6177
|
-
* Force extraction from accumulated trajectories.
|
|
6178
|
-
*/
|
|
6179
|
-
flush(options?: AnalyzeOptions): Promise<AnalyzeResult>;
|
|
6180
|
-
/**
|
|
6181
|
-
* Record outcome when a candidate/playbook is applied.
|
|
6182
|
-
* Updates playbook confidence and may generate refinements.
|
|
6183
|
-
*/
|
|
6184
|
-
recordOutcome(feedback: OutcomeFeedback): Promise<OutcomeResult>;
|
|
6185
|
-
/**
|
|
6186
|
-
* Check if a candidate is a duplicate based on playbook similarity
|
|
6187
|
-
*/
|
|
6188
|
-
isDuplicate(candidate: LearningCandidate, existing: LearningCandidate[]): boolean;
|
|
6189
|
-
/**
|
|
6190
|
-
* Compute similarity between two candidates
|
|
6191
|
-
*/
|
|
6192
|
-
computeSimilarity(a: LearningCandidate, b: LearningCandidate): number;
|
|
6193
|
-
/**
|
|
6194
|
-
* Run batch extraction and convert results to LearningCandidates
|
|
6195
|
-
*/
|
|
6196
|
-
private runBatchExtraction;
|
|
6197
|
-
/**
|
|
6198
|
-
* Convert a skill-tree Trajectory to cognitive-core Trajectory format
|
|
6199
|
-
*/
|
|
6200
|
-
private convertTrajectory;
|
|
6201
|
-
/**
|
|
6202
|
-
* Convert an assistant turn to a cognitive-core Step
|
|
6203
|
-
*/
|
|
6204
|
-
private turnToStep;
|
|
6205
|
-
/**
|
|
6206
|
-
* Convert a cognitive-core Playbook to a LearningCandidate
|
|
6207
|
-
*/
|
|
6208
|
-
private playbookToCandidate;
|
|
6209
|
-
/**
|
|
6210
|
-
* Create appropriate content type for the inferred kind
|
|
6211
|
-
*/
|
|
6212
|
-
private createContentForKind;
|
|
6213
|
-
/**
|
|
6214
|
-
* Infer the kind of learning from a playbook
|
|
6215
|
-
*/
|
|
6216
|
-
private inferKind;
|
|
6217
|
-
/**
|
|
6218
|
-
* Extract triggers from playbook applicability
|
|
6219
|
-
*/
|
|
6220
|
-
private extractTriggers;
|
|
6221
|
-
/**
|
|
6222
|
-
* Tokenize text into words
|
|
6223
|
-
*/
|
|
6224
|
-
private tokenize;
|
|
6225
|
-
/**
|
|
6226
|
-
* Compute Jaccard similarity between two arrays
|
|
6227
|
-
*/
|
|
6228
|
-
private jaccardSimilarity;
|
|
6229
|
-
}
|
|
6230
|
-
/**
|
|
6231
|
-
* Create a cognitive-core learning provider with the given configuration.
|
|
6232
|
-
* Requires a factory that provides cognitive-core components.
|
|
6233
|
-
*/
|
|
6234
|
-
declare function createCognitiveCoreProvider(options: CognitiveCoreProviderOptions): CognitiveCoreProvider;
|
|
6235
|
-
|
|
6236
5187
|
/**
|
|
6237
5188
|
* LoadoutCompiler - Compiles skills from flexible criteria
|
|
6238
5189
|
*
|
|
@@ -7117,4 +6068,4 @@ declare function createMcpServer(graphServer: SkillGraphServer, config?: McpServ
|
|
|
7117
6068
|
*/
|
|
7118
6069
|
declare const VERSION = "0.1.0";
|
|
7119
6070
|
|
|
7120
|
-
export { type ActivationCallback, type ActivationCheckResult, type ActivationConfig, ActivationManager, type ActivationState, type ActivationTrigger, AdapterRegistry, type AgentConfig, AgentsGenerator, type AgentsGeneratorConfig, AgentsParser, AgentsSync,
|
|
6071
|
+
export { type ActivationCallback, type ActivationCheckResult, type ActivationConfig, ActivationManager, type ActivationState, type ActivationTrigger, AdapterRegistry, type AgentConfig, AgentsGenerator, type AgentsGeneratorConfig, AgentsParser, AgentsSync, AnthropicAdapter, AutomaticExtractor, BaseExtractor, type BaseHookContext, BaseSessionAdapter, BaseStorageAdapter, type BatchConfig, BatchProcessor, type BatchProgress, type BatchResult, type BumpType, ClaudeCodeAdapter, type CompatibilityCheckResult, type CompatibilityIssue, type ComposerConfig, type CompositionConflict, type CompositionMode, type CompositionResult, type CompositionSuggestion$1 as CompositionSuggestion, type CompoundSkill, type ConflictConfig, type ConflictResolution$1 as ConflictResolution, ConflictStore, type ConflictStrategy, DEFAULT_ACTIVATION_CONFIG, DEFAULT_AGENTS_CONFIG, DEFAULT_METRICS_CONFIG, DEFAULT_QUALITY_GATES, DEFAULT_VALIDATOR_CONFIG, type DeduplicationStrategy, DependencyGraph, type DependencyType, type DiscoveredSkill, type EmbeddingProvider, type EmbeddingProviderOptions, type EvictionStrategy, type ExecutionOrder, type ExpandTrigger, type ExpandTriggerConfig, type ExtractOptions, type ExtractionConfig, type ExtractionHookContext, type ExtractionResult, type FeedbackEvent, type FetchResult, FileMetricsStorage, FilesystemStorageAdapter, type FilesystemStorageConfig, type ForkOptions, GenericAdapter, type GenericAdapterConfig, GitSyncAdapter, type GitSyncAdapterOptions, type SyncResult as GitSyncResult, type GraphEdge, type GraphNode, type GraphServerConfig, type HookContext, type HookEvent, type HookExecutionResult, type HookHandler, type HookPriority, HookRegistry, type HookResult, type LLMOptions, type LLMProvider, LineageTracker, type LineageTree, LoadoutCompiler, type LoadoutCompilerConfig, type LoadoutCriteria, type LoadoutSource, type LoadoutState, type LoadoutView, type ManualExtractionRequest, ManualExtractor, type MatchContext, type MatchResult, type MatcherConfig, type McpServerConfig, type ToolResult as McpToolResult, MemoryMetricsStorage, MemoryStorageAdapter, type MergeConfig, type MergeConflict, type MergePreview, type MergeResult, type MergeStrategy, type MergeSuggestion, type MetricsConfig, type MetricsStorage, MetricsTracker, type MigrationOptions, type MigrationProgressItem, type MigrationResult, type NewVersionOptions, OpenAIAdapter, OpenAIEmbedding, type ParsedAgentSkill, type ParsedAgentsFile, type ParsedVersion, type ProjectContext, ProjectDetector, type PullOptions, type PushOptions, type QualityGate, QualityGateEvaluator, type QualityGateResult, type QualityHookContext, type RegisterHookOptions, type RegisteredHook, type RemoteConfig, type RollbackOptions, SQLiteStorageAdapter, type SQLiteStorageConfig, SemanticMatcher, type ServingEvent, type ServingEventHandler, type SessionAdapter, type SessionHookContext, type SessionInput, SimpleHashEmbedding, type Skill, type SkillAccessControl, SkillBank, type SkillBankConfig, type SkillBankStats, type SkillChange, type SkillComponent, SkillComposer, type SkillConflict, type SkillDiffChanges, type SkillEmbeddingField, type SkillExample, type SkillFilter, type SkillFork, type SkillFormat, SkillGraphServer, type SkillHookContext, type SkillLineage, type SkillMergeResult, SkillMerger, type SkillMetrics, type SkillMetricsSnapshot, type SkillNamespace, type SkillQuery, type SkillRanking, type SkillScope, type SkillSelector, type SkillServingMetadata, type SkillSource, type SkillState, type SkillStatus, type SkillSummary, type SkillSyncState, type SkillTreeEvent, type SkillTreeEventHandler, SkillTreeMcpServer, type SkillUpstream, type SkillValidationResult, SkillValidator, type SkillVersion, type SkillVisibility, type StorageAdapter, type StorageConfig, type StorageHookContext, type SyncBehaviorConfig, type SyncConfig, type ConflictResolution as SyncConflictResolution, type SyncError, type SyncOptions, type SyncResult$1 as SyncResult, type SyncState, type SyncStatus, type TestCaseResult, type TestRunner, type ToolCall, type ToolDefinition, type ToolHandler, type ToolResult$1 as ToolResult, type Trajectory, type TrajectoryMetadata, type TrajectoryOutcome, type TriggerCondition, type Turn, type UsageEvent, type UsageReport, type UsageTrend, VERSION, type ValidationRecommendation, type ValidationSchedule, type ValidationTestCase, type ValidatorConfig, type VersionChanges, type VersionDiff, ViewRenderer, type ViewRendererConfig, VoyageEmbedding, adapterRegistry, allTools, anthropicAdapter, builtInProfiles, bumpVersion, claudeCodeAdapter, codeReviewProfile, combineHandlers, compareVersions, conditionalHook, cosineSimilarity, createActivationManager, createAgentsGenerator, createAgentsParser, createAgentsSync, createBackupHook, createConflictStore, createDefaultSyncConfig, createExtractionEnrichmentHook, createExtractionValidationHook, createGenericAdapter, createGitSyncAdapter, createLoggingHook, createMcpServer, createMetricsHook, createMetricsTracker, createQualityBypassHook, createQualityLoggingHook, createSaveValidationHook, createSkillBank, createSkillMerger, createSkillValidator, createToolHandlers, debuggingProfile, devopsProfile, discoverSkills, documentationProfile, euclideanDistance, executeToolCall, formatVersion, generateAgentsMd, genericAdapter, getBuiltInProfile, getLatestVersion, getToolDefinition, getToolNames, hasSkilltreeDir, hookRegistry, implementationProfile, importFromAgentsMd, inferBumpType, isCompoundSkill, isValidVersion, listBuiltInProfiles, loadoutAddTool, loadoutListTool, loadoutProfileTool, loadoutRemoveTool, loadoutSearchTool, loadoutSetTool, loadoutTools, migrateStorage, openAIAdapter, parseVersion, refactoringProfile, satisfiesRange, securityProfile, skillCollapseTool, skillExpandTool, skillGetTool, skillTools, skillUseTool, sortVersions, testingProfile, writeAgentsMd };
|