@harness-engineering/graph 0.3.1 → 0.3.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/index.d.mts +260 -1
- package/dist/index.d.ts +260 -1
- package/dist/index.js +1728 -463
- package/dist/index.mjs +1719 -463
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -244,10 +244,27 @@ declare class ContextQL {
|
|
|
244
244
|
private readonly store;
|
|
245
245
|
constructor(store: GraphStore);
|
|
246
246
|
execute(params: ContextQLParams): ContextQLResult;
|
|
247
|
+
private seedRootNodes;
|
|
248
|
+
private runBFS;
|
|
249
|
+
private gatherEdges;
|
|
247
250
|
}
|
|
248
251
|
|
|
249
252
|
declare function project(nodes: readonly GraphNode[], spec: ProjectionSpec | undefined): Partial<GraphNode>[];
|
|
250
253
|
|
|
254
|
+
interface ImpactGroups {
|
|
255
|
+
readonly tests: readonly GraphNode[];
|
|
256
|
+
readonly docs: readonly GraphNode[];
|
|
257
|
+
readonly code: readonly GraphNode[];
|
|
258
|
+
readonly other: readonly GraphNode[];
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Group graph nodes into impact categories (tests, docs, code, other).
|
|
262
|
+
* Excludes the root node from the results.
|
|
263
|
+
*
|
|
264
|
+
* Shared by both the NLQ orchestrator and the MCP get_impact handler.
|
|
265
|
+
*/
|
|
266
|
+
declare function groupNodesByImpact(nodes: readonly GraphNode[], excludeId?: string): ImpactGroups;
|
|
267
|
+
|
|
251
268
|
/**
|
|
252
269
|
* Ingests TypeScript/JavaScript files into the graph via regex-based parsing.
|
|
253
270
|
* Future: upgrade to tree-sitter for full AST parsing.
|
|
@@ -256,8 +273,17 @@ declare class CodeIngestor {
|
|
|
256
273
|
private readonly store;
|
|
257
274
|
constructor(store: GraphStore);
|
|
258
275
|
ingest(rootDir: string): Promise<IngestResult>;
|
|
276
|
+
private processFile;
|
|
277
|
+
private trackCallable;
|
|
259
278
|
private findSourceFiles;
|
|
260
279
|
private extractSymbols;
|
|
280
|
+
private tryExtractFunction;
|
|
281
|
+
private tryExtractClass;
|
|
282
|
+
private tryExtractInterface;
|
|
283
|
+
/** Update brace tracking; returns true when line is consumed (class ended or tracked). */
|
|
284
|
+
private updateClassContext;
|
|
285
|
+
private tryExtractMethod;
|
|
286
|
+
private tryExtractVariable;
|
|
261
287
|
/**
|
|
262
288
|
* Find the closing brace for a construct starting at the given line.
|
|
263
289
|
* Uses a simple brace-counting heuristic. Returns 1-indexed line number.
|
|
@@ -371,6 +397,7 @@ declare class JiraConnector implements GraphConnector {
|
|
|
371
397
|
private readonly httpClient;
|
|
372
398
|
constructor(httpClient?: HttpClient);
|
|
373
399
|
ingest(store: GraphStore, config: ConnectorConfig): Promise<IngestResult>;
|
|
400
|
+
private processIssue;
|
|
374
401
|
}
|
|
375
402
|
|
|
376
403
|
declare class SlackConnector implements GraphConnector {
|
|
@@ -379,6 +406,7 @@ declare class SlackConnector implements GraphConnector {
|
|
|
379
406
|
private readonly httpClient;
|
|
380
407
|
constructor(httpClient?: HttpClient);
|
|
381
408
|
ingest(store: GraphStore, config: ConnectorConfig): Promise<IngestResult>;
|
|
409
|
+
private processChannel;
|
|
382
410
|
}
|
|
383
411
|
|
|
384
412
|
declare class ConfluenceConnector implements GraphConnector {
|
|
@@ -387,6 +415,8 @@ declare class ConfluenceConnector implements GraphConnector {
|
|
|
387
415
|
private readonly httpClient;
|
|
388
416
|
constructor(httpClient?: HttpClient);
|
|
389
417
|
ingest(store: GraphStore, config: ConnectorConfig): Promise<IngestResult>;
|
|
418
|
+
private fetchAllPages;
|
|
419
|
+
private processPage;
|
|
390
420
|
}
|
|
391
421
|
|
|
392
422
|
declare class CIConnector implements GraphConnector {
|
|
@@ -465,6 +495,10 @@ declare class GraphEntropyAdapter {
|
|
|
465
495
|
* 3. Unreachable = code nodes NOT in visited set
|
|
466
496
|
*/
|
|
467
497
|
computeDeadCodeData(): GraphDeadCodeData;
|
|
498
|
+
private findEntryPoints;
|
|
499
|
+
private bfsFromEntryPoints;
|
|
500
|
+
private enqueueOutboundEdges;
|
|
501
|
+
private collectUnreachableNodes;
|
|
468
502
|
/**
|
|
469
503
|
* Count all nodes and edges by type.
|
|
470
504
|
*/
|
|
@@ -495,6 +529,13 @@ declare class GraphComplexityAdapter {
|
|
|
495
529
|
* 5. Compute 95th percentile
|
|
496
530
|
*/
|
|
497
531
|
computeComplexityHotspots(): GraphComplexityResult;
|
|
532
|
+
/**
|
|
533
|
+
* Walk the 'contains' edges to find the file node that contains a given function/method.
|
|
534
|
+
* For methods, walks through the intermediate class node.
|
|
535
|
+
*/
|
|
536
|
+
private findContainingFileId;
|
|
537
|
+
private findParentFileOfClass;
|
|
538
|
+
private getChangeFrequency;
|
|
498
539
|
private computePercentile;
|
|
499
540
|
}
|
|
500
541
|
|
|
@@ -573,6 +614,148 @@ declare class GraphAnomalyAdapter {
|
|
|
573
614
|
private computeRemovalImpact;
|
|
574
615
|
}
|
|
575
616
|
|
|
617
|
+
/**
|
|
618
|
+
* All supported intent categories for natural language graph queries.
|
|
619
|
+
* Runtime-accessible array mirroring NODE_TYPES / EDGE_TYPES pattern.
|
|
620
|
+
*/
|
|
621
|
+
declare const INTENTS: readonly ["impact", "find", "relationships", "explain", "anomaly"];
|
|
622
|
+
/**
|
|
623
|
+
* Intent categories for natural language graph queries.
|
|
624
|
+
*/
|
|
625
|
+
type Intent = (typeof INTENTS)[number];
|
|
626
|
+
/**
|
|
627
|
+
* Result of classifying a natural language question into an intent.
|
|
628
|
+
*/
|
|
629
|
+
interface ClassificationResult {
|
|
630
|
+
readonly intent: Intent;
|
|
631
|
+
readonly confidence: number;
|
|
632
|
+
readonly signals: Readonly<Record<string, number>>;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* An entity mention from the query resolved to a graph node.
|
|
636
|
+
*/
|
|
637
|
+
interface ResolvedEntity {
|
|
638
|
+
readonly raw: string;
|
|
639
|
+
readonly nodeId: string;
|
|
640
|
+
readonly node: GraphNode;
|
|
641
|
+
readonly confidence: number;
|
|
642
|
+
readonly method: 'exact' | 'fusion' | 'path';
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Complete result from askGraph, including intent, entities, summary, and raw data.
|
|
646
|
+
*/
|
|
647
|
+
interface AskGraphResult {
|
|
648
|
+
readonly intent: Intent;
|
|
649
|
+
readonly intentConfidence: number;
|
|
650
|
+
readonly entities: readonly ResolvedEntity[];
|
|
651
|
+
readonly summary: string;
|
|
652
|
+
readonly data: unknown;
|
|
653
|
+
readonly suggestions?: readonly string[];
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Scored multi-signal intent classifier.
|
|
658
|
+
*
|
|
659
|
+
* Combines keyword presence, question-word matching, and verb-pattern matching
|
|
660
|
+
* to classify natural language questions into one of 5 intents with a confidence
|
|
661
|
+
* score between 0 and 1.
|
|
662
|
+
*/
|
|
663
|
+
declare class IntentClassifier {
|
|
664
|
+
/**
|
|
665
|
+
* Classify a natural language question into an intent.
|
|
666
|
+
*
|
|
667
|
+
* @param question - The natural language question to classify
|
|
668
|
+
* @returns ClassificationResult with intent, confidence, and per-signal scores
|
|
669
|
+
*/
|
|
670
|
+
classify(question: string): ClassificationResult;
|
|
671
|
+
/**
|
|
672
|
+
* Score individual signals for an intent against the normalized query.
|
|
673
|
+
*/
|
|
674
|
+
private scoreIntent;
|
|
675
|
+
/**
|
|
676
|
+
* Score keyword signal: uses word-stem matching (checks if any word in the
|
|
677
|
+
* query starts with the keyword). Saturates at 2 matches to avoid penalizing
|
|
678
|
+
* intents with many keywords when only a few appear in the query.
|
|
679
|
+
*/
|
|
680
|
+
private scoreKeywords;
|
|
681
|
+
/**
|
|
682
|
+
* Score question-word signal: 1.0 if the query starts with a matching
|
|
683
|
+
* question word, 0 otherwise.
|
|
684
|
+
*/
|
|
685
|
+
private scoreQuestionWord;
|
|
686
|
+
/**
|
|
687
|
+
* Score verb-pattern signal: any matching pattern yields a strong score.
|
|
688
|
+
* Multiple matches increase score but saturate quickly.
|
|
689
|
+
*/
|
|
690
|
+
private scoreVerbPatterns;
|
|
691
|
+
/**
|
|
692
|
+
* Combine individual signal scores into a single confidence score
|
|
693
|
+
* using additive weighted scoring. Each signal contributes weight * score,
|
|
694
|
+
* and the total weights sum to 1.0 so the result is naturally bounded [0, 1].
|
|
695
|
+
*/
|
|
696
|
+
private combineSignals;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
declare class EntityExtractor {
|
|
700
|
+
/**
|
|
701
|
+
* Extract candidate entity mentions from a natural language query.
|
|
702
|
+
*
|
|
703
|
+
* @param query - The natural language query to extract entities from
|
|
704
|
+
* @returns Array of raw entity strings in priority order, deduplicated
|
|
705
|
+
*/
|
|
706
|
+
extract(query: string): readonly string[];
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Resolves raw entity strings to graph nodes using a 3-step fuzzy cascade:
|
|
711
|
+
*
|
|
712
|
+
* 1. Exact name match via store.findNodes({ name })
|
|
713
|
+
* 2. FusionLayer search (if provided), take top result if score > 0.5
|
|
714
|
+
* 3. Path match on file nodes via path.includes(raw)
|
|
715
|
+
*
|
|
716
|
+
* Each step tags its match with method and confidence.
|
|
717
|
+
* Unresolved entities are silently omitted from results.
|
|
718
|
+
*/
|
|
719
|
+
declare class EntityResolver {
|
|
720
|
+
private readonly store;
|
|
721
|
+
private readonly fusion;
|
|
722
|
+
constructor(store: GraphStore, fusion?: FusionLayer);
|
|
723
|
+
/**
|
|
724
|
+
* Resolve an array of raw entity strings to graph nodes.
|
|
725
|
+
*
|
|
726
|
+
* @param raws - Raw entity strings from EntityExtractor
|
|
727
|
+
* @returns Array of ResolvedEntity for each successfully resolved raw string
|
|
728
|
+
*/
|
|
729
|
+
resolve(raws: readonly string[]): readonly ResolvedEntity[];
|
|
730
|
+
private resolveOne;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Template-based response formatter that generates human-readable summaries
|
|
735
|
+
* from graph operation results, one template per intent.
|
|
736
|
+
*/
|
|
737
|
+
declare class ResponseFormatter {
|
|
738
|
+
/**
|
|
739
|
+
* Format graph operation results into a human-readable summary.
|
|
740
|
+
*
|
|
741
|
+
* @param intent - The classified intent
|
|
742
|
+
* @param entities - Resolved entities from the query
|
|
743
|
+
* @param data - Raw result data (shape varies per intent)
|
|
744
|
+
* @param query - Original natural language query (optional)
|
|
745
|
+
* @returns Human-readable summary string
|
|
746
|
+
*/
|
|
747
|
+
format(intent: Intent, entities: readonly ResolvedEntity[], data: unknown, query?: string): string;
|
|
748
|
+
private formatImpact;
|
|
749
|
+
private formatFind;
|
|
750
|
+
private formatRelationships;
|
|
751
|
+
private formatExplain;
|
|
752
|
+
private formatAnomaly;
|
|
753
|
+
private safeArrayLength;
|
|
754
|
+
private p;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
declare function askGraph(store: GraphStore, question: string): Promise<AskGraphResult>;
|
|
758
|
+
|
|
576
759
|
interface AssembledContext {
|
|
577
760
|
readonly nodes: readonly GraphNode[];
|
|
578
761
|
readonly edges: readonly GraphEdge[];
|
|
@@ -606,6 +789,8 @@ declare class Assembler {
|
|
|
606
789
|
* Assemble context relevant to an intent string within a token budget.
|
|
607
790
|
*/
|
|
608
791
|
assembleContext(intent: string, tokenBudget?: number): AssembledContext;
|
|
792
|
+
private expandSearchResults;
|
|
793
|
+
private truncateToFit;
|
|
609
794
|
/**
|
|
610
795
|
* Compute a token budget allocation across node types.
|
|
611
796
|
*/
|
|
@@ -706,6 +891,80 @@ declare class GraphFeedbackAdapter {
|
|
|
706
891
|
computeHarnessCheckData(): GraphHarnessCheckData;
|
|
707
892
|
}
|
|
708
893
|
|
|
894
|
+
interface TaskDefinition {
|
|
895
|
+
readonly id: string;
|
|
896
|
+
readonly files: readonly string[];
|
|
897
|
+
}
|
|
898
|
+
interface IndependenceCheckParams {
|
|
899
|
+
readonly tasks: readonly TaskDefinition[];
|
|
900
|
+
readonly depth?: number;
|
|
901
|
+
readonly edgeTypes?: readonly string[];
|
|
902
|
+
}
|
|
903
|
+
interface OverlapDetail {
|
|
904
|
+
readonly file: string;
|
|
905
|
+
readonly type: 'direct' | 'transitive';
|
|
906
|
+
readonly via?: string;
|
|
907
|
+
}
|
|
908
|
+
interface PairResult {
|
|
909
|
+
readonly taskA: string;
|
|
910
|
+
readonly taskB: string;
|
|
911
|
+
readonly independent: boolean;
|
|
912
|
+
readonly overlaps: readonly OverlapDetail[];
|
|
913
|
+
}
|
|
914
|
+
interface IndependenceResult {
|
|
915
|
+
readonly tasks: readonly string[];
|
|
916
|
+
readonly analysisLevel: 'graph-expanded' | 'file-only';
|
|
917
|
+
readonly depth: number;
|
|
918
|
+
readonly pairs: readonly PairResult[];
|
|
919
|
+
readonly groups: readonly (readonly string[])[];
|
|
920
|
+
readonly verdict: string;
|
|
921
|
+
}
|
|
922
|
+
declare class TaskIndependenceAnalyzer {
|
|
923
|
+
private readonly store;
|
|
924
|
+
constructor(store?: GraphStore);
|
|
925
|
+
analyze(params: IndependenceCheckParams): IndependenceResult;
|
|
926
|
+
private validate;
|
|
927
|
+
private expandViaGraph;
|
|
928
|
+
private computePairOverlap;
|
|
929
|
+
private buildGroups;
|
|
930
|
+
private generateVerdict;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
type ConflictSeverity = 'high' | 'medium' | 'low';
|
|
934
|
+
interface ConflictDetail {
|
|
935
|
+
readonly taskA: string;
|
|
936
|
+
readonly taskB: string;
|
|
937
|
+
readonly severity: ConflictSeverity;
|
|
938
|
+
readonly reason: string;
|
|
939
|
+
readonly mitigation: string;
|
|
940
|
+
readonly overlaps: readonly OverlapDetail[];
|
|
941
|
+
}
|
|
942
|
+
interface ConflictPrediction {
|
|
943
|
+
readonly tasks: readonly string[];
|
|
944
|
+
readonly analysisLevel: 'graph-expanded' | 'file-only';
|
|
945
|
+
readonly depth: number;
|
|
946
|
+
readonly conflicts: readonly ConflictDetail[];
|
|
947
|
+
readonly groups: readonly (readonly string[])[];
|
|
948
|
+
readonly summary: {
|
|
949
|
+
readonly high: number;
|
|
950
|
+
readonly medium: number;
|
|
951
|
+
readonly low: number;
|
|
952
|
+
readonly regrouped: boolean;
|
|
953
|
+
};
|
|
954
|
+
readonly verdict: string;
|
|
955
|
+
}
|
|
956
|
+
declare class ConflictPredictor {
|
|
957
|
+
private readonly store;
|
|
958
|
+
constructor(store?: GraphStore);
|
|
959
|
+
predict(params: IndependenceCheckParams): ConflictPrediction;
|
|
960
|
+
private classifyPair;
|
|
961
|
+
private severityRank;
|
|
962
|
+
private computePercentile;
|
|
963
|
+
private buildHighSeverityGroups;
|
|
964
|
+
private groupsEqual;
|
|
965
|
+
private generateVerdict;
|
|
966
|
+
}
|
|
967
|
+
|
|
709
968
|
declare const VERSION = "0.2.0";
|
|
710
969
|
|
|
711
|
-
export { type AnomalyDetectionOptions, type AnomalyReport, type ArticulationPoint, type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, CodeIngestor, ConfluenceConnector, type ConnectorConfig, ContextQL, type ContextQLParams, type ContextQLResult, DesignConstraintAdapter, DesignIngestor, type DesignStrictness, type DesignViolation, EDGE_TYPES, type EdgeQuery, type EdgeType, FusionLayer, type FusionResult, GitIngestor, type GitRunner, GraphAnomalyAdapter, type GraphBudget, GraphComplexityAdapter, type GraphComplexityHotspot, type GraphComplexityResult, type GraphConnector, GraphConstraintAdapter, GraphCouplingAdapter, type GraphCouplingFileData, type GraphCouplingResult, type GraphCoverageReport, type GraphDeadCodeData, type GraphDependencyData, type GraphDriftData, type GraphEdge, GraphEdgeSchema, GraphEntropyAdapter, GraphFeedbackAdapter, type GraphFilterResult, type GraphHarnessCheckData, type GraphImpactData, type GraphLayerViolation, type GraphMetadata, type GraphNode, GraphNodeSchema, type GraphSnapshotSummary, GraphStore, type HttpClient, type IngestResult, JiraConnector, KnowledgeIngestor, type LinkResult, NODE_TYPES, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type ProjectionSpec, SlackConnector, type SourceLocation, type StatisticalOutlier, SyncManager, type SyncMetadata, TopologicalLinker, VERSION, type VectorSearchResult, VectorStore, linkToCode, loadGraph, project, saveGraph };
|
|
970
|
+
export { type AnomalyDetectionOptions, type AnomalyReport, type ArticulationPoint, type AskGraphResult, type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, type ClassificationResult, CodeIngestor, type ConflictDetail, type ConflictPrediction, ConflictPredictor, type ConflictSeverity, ConfluenceConnector, type ConnectorConfig, ContextQL, type ContextQLParams, type ContextQLResult, DesignConstraintAdapter, DesignIngestor, type DesignStrictness, type DesignViolation, EDGE_TYPES, type EdgeQuery, type EdgeType, EntityExtractor, EntityResolver, FusionLayer, type FusionResult, GitIngestor, type GitRunner, GraphAnomalyAdapter, type GraphBudget, GraphComplexityAdapter, type GraphComplexityHotspot, type GraphComplexityResult, type GraphConnector, GraphConstraintAdapter, GraphCouplingAdapter, type GraphCouplingFileData, type GraphCouplingResult, type GraphCoverageReport, type GraphDeadCodeData, type GraphDependencyData, type GraphDriftData, type GraphEdge, GraphEdgeSchema, GraphEntropyAdapter, GraphFeedbackAdapter, type GraphFilterResult, type GraphHarnessCheckData, type GraphImpactData, type GraphLayerViolation, type GraphMetadata, type GraphNode, GraphNodeSchema, type GraphSnapshotSummary, GraphStore, type HttpClient, INTENTS, type ImpactGroups, type IndependenceCheckParams, type IndependenceResult, type IngestResult, type Intent, IntentClassifier, JiraConnector, KnowledgeIngestor, type LinkResult, NODE_TYPES, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type OverlapDetail, type PairResult, type ProjectionSpec, type ResolvedEntity, ResponseFormatter, SlackConnector, type SourceLocation, type StatisticalOutlier, SyncManager, type SyncMetadata, type TaskDefinition, TaskIndependenceAnalyzer, TopologicalLinker, VERSION, type VectorSearchResult, VectorStore, askGraph, groupNodesByImpact, linkToCode, loadGraph, project, saveGraph };
|
package/dist/index.d.ts
CHANGED
|
@@ -244,10 +244,27 @@ declare class ContextQL {
|
|
|
244
244
|
private readonly store;
|
|
245
245
|
constructor(store: GraphStore);
|
|
246
246
|
execute(params: ContextQLParams): ContextQLResult;
|
|
247
|
+
private seedRootNodes;
|
|
248
|
+
private runBFS;
|
|
249
|
+
private gatherEdges;
|
|
247
250
|
}
|
|
248
251
|
|
|
249
252
|
declare function project(nodes: readonly GraphNode[], spec: ProjectionSpec | undefined): Partial<GraphNode>[];
|
|
250
253
|
|
|
254
|
+
interface ImpactGroups {
|
|
255
|
+
readonly tests: readonly GraphNode[];
|
|
256
|
+
readonly docs: readonly GraphNode[];
|
|
257
|
+
readonly code: readonly GraphNode[];
|
|
258
|
+
readonly other: readonly GraphNode[];
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Group graph nodes into impact categories (tests, docs, code, other).
|
|
262
|
+
* Excludes the root node from the results.
|
|
263
|
+
*
|
|
264
|
+
* Shared by both the NLQ orchestrator and the MCP get_impact handler.
|
|
265
|
+
*/
|
|
266
|
+
declare function groupNodesByImpact(nodes: readonly GraphNode[], excludeId?: string): ImpactGroups;
|
|
267
|
+
|
|
251
268
|
/**
|
|
252
269
|
* Ingests TypeScript/JavaScript files into the graph via regex-based parsing.
|
|
253
270
|
* Future: upgrade to tree-sitter for full AST parsing.
|
|
@@ -256,8 +273,17 @@ declare class CodeIngestor {
|
|
|
256
273
|
private readonly store;
|
|
257
274
|
constructor(store: GraphStore);
|
|
258
275
|
ingest(rootDir: string): Promise<IngestResult>;
|
|
276
|
+
private processFile;
|
|
277
|
+
private trackCallable;
|
|
259
278
|
private findSourceFiles;
|
|
260
279
|
private extractSymbols;
|
|
280
|
+
private tryExtractFunction;
|
|
281
|
+
private tryExtractClass;
|
|
282
|
+
private tryExtractInterface;
|
|
283
|
+
/** Update brace tracking; returns true when line is consumed (class ended or tracked). */
|
|
284
|
+
private updateClassContext;
|
|
285
|
+
private tryExtractMethod;
|
|
286
|
+
private tryExtractVariable;
|
|
261
287
|
/**
|
|
262
288
|
* Find the closing brace for a construct starting at the given line.
|
|
263
289
|
* Uses a simple brace-counting heuristic. Returns 1-indexed line number.
|
|
@@ -371,6 +397,7 @@ declare class JiraConnector implements GraphConnector {
|
|
|
371
397
|
private readonly httpClient;
|
|
372
398
|
constructor(httpClient?: HttpClient);
|
|
373
399
|
ingest(store: GraphStore, config: ConnectorConfig): Promise<IngestResult>;
|
|
400
|
+
private processIssue;
|
|
374
401
|
}
|
|
375
402
|
|
|
376
403
|
declare class SlackConnector implements GraphConnector {
|
|
@@ -379,6 +406,7 @@ declare class SlackConnector implements GraphConnector {
|
|
|
379
406
|
private readonly httpClient;
|
|
380
407
|
constructor(httpClient?: HttpClient);
|
|
381
408
|
ingest(store: GraphStore, config: ConnectorConfig): Promise<IngestResult>;
|
|
409
|
+
private processChannel;
|
|
382
410
|
}
|
|
383
411
|
|
|
384
412
|
declare class ConfluenceConnector implements GraphConnector {
|
|
@@ -387,6 +415,8 @@ declare class ConfluenceConnector implements GraphConnector {
|
|
|
387
415
|
private readonly httpClient;
|
|
388
416
|
constructor(httpClient?: HttpClient);
|
|
389
417
|
ingest(store: GraphStore, config: ConnectorConfig): Promise<IngestResult>;
|
|
418
|
+
private fetchAllPages;
|
|
419
|
+
private processPage;
|
|
390
420
|
}
|
|
391
421
|
|
|
392
422
|
declare class CIConnector implements GraphConnector {
|
|
@@ -465,6 +495,10 @@ declare class GraphEntropyAdapter {
|
|
|
465
495
|
* 3. Unreachable = code nodes NOT in visited set
|
|
466
496
|
*/
|
|
467
497
|
computeDeadCodeData(): GraphDeadCodeData;
|
|
498
|
+
private findEntryPoints;
|
|
499
|
+
private bfsFromEntryPoints;
|
|
500
|
+
private enqueueOutboundEdges;
|
|
501
|
+
private collectUnreachableNodes;
|
|
468
502
|
/**
|
|
469
503
|
* Count all nodes and edges by type.
|
|
470
504
|
*/
|
|
@@ -495,6 +529,13 @@ declare class GraphComplexityAdapter {
|
|
|
495
529
|
* 5. Compute 95th percentile
|
|
496
530
|
*/
|
|
497
531
|
computeComplexityHotspots(): GraphComplexityResult;
|
|
532
|
+
/**
|
|
533
|
+
* Walk the 'contains' edges to find the file node that contains a given function/method.
|
|
534
|
+
* For methods, walks through the intermediate class node.
|
|
535
|
+
*/
|
|
536
|
+
private findContainingFileId;
|
|
537
|
+
private findParentFileOfClass;
|
|
538
|
+
private getChangeFrequency;
|
|
498
539
|
private computePercentile;
|
|
499
540
|
}
|
|
500
541
|
|
|
@@ -573,6 +614,148 @@ declare class GraphAnomalyAdapter {
|
|
|
573
614
|
private computeRemovalImpact;
|
|
574
615
|
}
|
|
575
616
|
|
|
617
|
+
/**
|
|
618
|
+
* All supported intent categories for natural language graph queries.
|
|
619
|
+
* Runtime-accessible array mirroring NODE_TYPES / EDGE_TYPES pattern.
|
|
620
|
+
*/
|
|
621
|
+
declare const INTENTS: readonly ["impact", "find", "relationships", "explain", "anomaly"];
|
|
622
|
+
/**
|
|
623
|
+
* Intent categories for natural language graph queries.
|
|
624
|
+
*/
|
|
625
|
+
type Intent = (typeof INTENTS)[number];
|
|
626
|
+
/**
|
|
627
|
+
* Result of classifying a natural language question into an intent.
|
|
628
|
+
*/
|
|
629
|
+
interface ClassificationResult {
|
|
630
|
+
readonly intent: Intent;
|
|
631
|
+
readonly confidence: number;
|
|
632
|
+
readonly signals: Readonly<Record<string, number>>;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* An entity mention from the query resolved to a graph node.
|
|
636
|
+
*/
|
|
637
|
+
interface ResolvedEntity {
|
|
638
|
+
readonly raw: string;
|
|
639
|
+
readonly nodeId: string;
|
|
640
|
+
readonly node: GraphNode;
|
|
641
|
+
readonly confidence: number;
|
|
642
|
+
readonly method: 'exact' | 'fusion' | 'path';
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Complete result from askGraph, including intent, entities, summary, and raw data.
|
|
646
|
+
*/
|
|
647
|
+
interface AskGraphResult {
|
|
648
|
+
readonly intent: Intent;
|
|
649
|
+
readonly intentConfidence: number;
|
|
650
|
+
readonly entities: readonly ResolvedEntity[];
|
|
651
|
+
readonly summary: string;
|
|
652
|
+
readonly data: unknown;
|
|
653
|
+
readonly suggestions?: readonly string[];
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Scored multi-signal intent classifier.
|
|
658
|
+
*
|
|
659
|
+
* Combines keyword presence, question-word matching, and verb-pattern matching
|
|
660
|
+
* to classify natural language questions into one of 5 intents with a confidence
|
|
661
|
+
* score between 0 and 1.
|
|
662
|
+
*/
|
|
663
|
+
declare class IntentClassifier {
|
|
664
|
+
/**
|
|
665
|
+
* Classify a natural language question into an intent.
|
|
666
|
+
*
|
|
667
|
+
* @param question - The natural language question to classify
|
|
668
|
+
* @returns ClassificationResult with intent, confidence, and per-signal scores
|
|
669
|
+
*/
|
|
670
|
+
classify(question: string): ClassificationResult;
|
|
671
|
+
/**
|
|
672
|
+
* Score individual signals for an intent against the normalized query.
|
|
673
|
+
*/
|
|
674
|
+
private scoreIntent;
|
|
675
|
+
/**
|
|
676
|
+
* Score keyword signal: uses word-stem matching (checks if any word in the
|
|
677
|
+
* query starts with the keyword). Saturates at 2 matches to avoid penalizing
|
|
678
|
+
* intents with many keywords when only a few appear in the query.
|
|
679
|
+
*/
|
|
680
|
+
private scoreKeywords;
|
|
681
|
+
/**
|
|
682
|
+
* Score question-word signal: 1.0 if the query starts with a matching
|
|
683
|
+
* question word, 0 otherwise.
|
|
684
|
+
*/
|
|
685
|
+
private scoreQuestionWord;
|
|
686
|
+
/**
|
|
687
|
+
* Score verb-pattern signal: any matching pattern yields a strong score.
|
|
688
|
+
* Multiple matches increase score but saturate quickly.
|
|
689
|
+
*/
|
|
690
|
+
private scoreVerbPatterns;
|
|
691
|
+
/**
|
|
692
|
+
* Combine individual signal scores into a single confidence score
|
|
693
|
+
* using additive weighted scoring. Each signal contributes weight * score,
|
|
694
|
+
* and the total weights sum to 1.0 so the result is naturally bounded [0, 1].
|
|
695
|
+
*/
|
|
696
|
+
private combineSignals;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
declare class EntityExtractor {
|
|
700
|
+
/**
|
|
701
|
+
* Extract candidate entity mentions from a natural language query.
|
|
702
|
+
*
|
|
703
|
+
* @param query - The natural language query to extract entities from
|
|
704
|
+
* @returns Array of raw entity strings in priority order, deduplicated
|
|
705
|
+
*/
|
|
706
|
+
extract(query: string): readonly string[];
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Resolves raw entity strings to graph nodes using a 3-step fuzzy cascade:
|
|
711
|
+
*
|
|
712
|
+
* 1. Exact name match via store.findNodes({ name })
|
|
713
|
+
* 2. FusionLayer search (if provided), take top result if score > 0.5
|
|
714
|
+
* 3. Path match on file nodes via path.includes(raw)
|
|
715
|
+
*
|
|
716
|
+
* Each step tags its match with method and confidence.
|
|
717
|
+
* Unresolved entities are silently omitted from results.
|
|
718
|
+
*/
|
|
719
|
+
declare class EntityResolver {
|
|
720
|
+
private readonly store;
|
|
721
|
+
private readonly fusion;
|
|
722
|
+
constructor(store: GraphStore, fusion?: FusionLayer);
|
|
723
|
+
/**
|
|
724
|
+
* Resolve an array of raw entity strings to graph nodes.
|
|
725
|
+
*
|
|
726
|
+
* @param raws - Raw entity strings from EntityExtractor
|
|
727
|
+
* @returns Array of ResolvedEntity for each successfully resolved raw string
|
|
728
|
+
*/
|
|
729
|
+
resolve(raws: readonly string[]): readonly ResolvedEntity[];
|
|
730
|
+
private resolveOne;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Template-based response formatter that generates human-readable summaries
|
|
735
|
+
* from graph operation results, one template per intent.
|
|
736
|
+
*/
|
|
737
|
+
declare class ResponseFormatter {
|
|
738
|
+
/**
|
|
739
|
+
* Format graph operation results into a human-readable summary.
|
|
740
|
+
*
|
|
741
|
+
* @param intent - The classified intent
|
|
742
|
+
* @param entities - Resolved entities from the query
|
|
743
|
+
* @param data - Raw result data (shape varies per intent)
|
|
744
|
+
* @param query - Original natural language query (optional)
|
|
745
|
+
* @returns Human-readable summary string
|
|
746
|
+
*/
|
|
747
|
+
format(intent: Intent, entities: readonly ResolvedEntity[], data: unknown, query?: string): string;
|
|
748
|
+
private formatImpact;
|
|
749
|
+
private formatFind;
|
|
750
|
+
private formatRelationships;
|
|
751
|
+
private formatExplain;
|
|
752
|
+
private formatAnomaly;
|
|
753
|
+
private safeArrayLength;
|
|
754
|
+
private p;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
declare function askGraph(store: GraphStore, question: string): Promise<AskGraphResult>;
|
|
758
|
+
|
|
576
759
|
interface AssembledContext {
|
|
577
760
|
readonly nodes: readonly GraphNode[];
|
|
578
761
|
readonly edges: readonly GraphEdge[];
|
|
@@ -606,6 +789,8 @@ declare class Assembler {
|
|
|
606
789
|
* Assemble context relevant to an intent string within a token budget.
|
|
607
790
|
*/
|
|
608
791
|
assembleContext(intent: string, tokenBudget?: number): AssembledContext;
|
|
792
|
+
private expandSearchResults;
|
|
793
|
+
private truncateToFit;
|
|
609
794
|
/**
|
|
610
795
|
* Compute a token budget allocation across node types.
|
|
611
796
|
*/
|
|
@@ -706,6 +891,80 @@ declare class GraphFeedbackAdapter {
|
|
|
706
891
|
computeHarnessCheckData(): GraphHarnessCheckData;
|
|
707
892
|
}
|
|
708
893
|
|
|
894
|
+
interface TaskDefinition {
|
|
895
|
+
readonly id: string;
|
|
896
|
+
readonly files: readonly string[];
|
|
897
|
+
}
|
|
898
|
+
interface IndependenceCheckParams {
|
|
899
|
+
readonly tasks: readonly TaskDefinition[];
|
|
900
|
+
readonly depth?: number;
|
|
901
|
+
readonly edgeTypes?: readonly string[];
|
|
902
|
+
}
|
|
903
|
+
interface OverlapDetail {
|
|
904
|
+
readonly file: string;
|
|
905
|
+
readonly type: 'direct' | 'transitive';
|
|
906
|
+
readonly via?: string;
|
|
907
|
+
}
|
|
908
|
+
interface PairResult {
|
|
909
|
+
readonly taskA: string;
|
|
910
|
+
readonly taskB: string;
|
|
911
|
+
readonly independent: boolean;
|
|
912
|
+
readonly overlaps: readonly OverlapDetail[];
|
|
913
|
+
}
|
|
914
|
+
interface IndependenceResult {
|
|
915
|
+
readonly tasks: readonly string[];
|
|
916
|
+
readonly analysisLevel: 'graph-expanded' | 'file-only';
|
|
917
|
+
readonly depth: number;
|
|
918
|
+
readonly pairs: readonly PairResult[];
|
|
919
|
+
readonly groups: readonly (readonly string[])[];
|
|
920
|
+
readonly verdict: string;
|
|
921
|
+
}
|
|
922
|
+
declare class TaskIndependenceAnalyzer {
|
|
923
|
+
private readonly store;
|
|
924
|
+
constructor(store?: GraphStore);
|
|
925
|
+
analyze(params: IndependenceCheckParams): IndependenceResult;
|
|
926
|
+
private validate;
|
|
927
|
+
private expandViaGraph;
|
|
928
|
+
private computePairOverlap;
|
|
929
|
+
private buildGroups;
|
|
930
|
+
private generateVerdict;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
type ConflictSeverity = 'high' | 'medium' | 'low';
|
|
934
|
+
interface ConflictDetail {
|
|
935
|
+
readonly taskA: string;
|
|
936
|
+
readonly taskB: string;
|
|
937
|
+
readonly severity: ConflictSeverity;
|
|
938
|
+
readonly reason: string;
|
|
939
|
+
readonly mitigation: string;
|
|
940
|
+
readonly overlaps: readonly OverlapDetail[];
|
|
941
|
+
}
|
|
942
|
+
interface ConflictPrediction {
|
|
943
|
+
readonly tasks: readonly string[];
|
|
944
|
+
readonly analysisLevel: 'graph-expanded' | 'file-only';
|
|
945
|
+
readonly depth: number;
|
|
946
|
+
readonly conflicts: readonly ConflictDetail[];
|
|
947
|
+
readonly groups: readonly (readonly string[])[];
|
|
948
|
+
readonly summary: {
|
|
949
|
+
readonly high: number;
|
|
950
|
+
readonly medium: number;
|
|
951
|
+
readonly low: number;
|
|
952
|
+
readonly regrouped: boolean;
|
|
953
|
+
};
|
|
954
|
+
readonly verdict: string;
|
|
955
|
+
}
|
|
956
|
+
declare class ConflictPredictor {
|
|
957
|
+
private readonly store;
|
|
958
|
+
constructor(store?: GraphStore);
|
|
959
|
+
predict(params: IndependenceCheckParams): ConflictPrediction;
|
|
960
|
+
private classifyPair;
|
|
961
|
+
private severityRank;
|
|
962
|
+
private computePercentile;
|
|
963
|
+
private buildHighSeverityGroups;
|
|
964
|
+
private groupsEqual;
|
|
965
|
+
private generateVerdict;
|
|
966
|
+
}
|
|
967
|
+
|
|
709
968
|
declare const VERSION = "0.2.0";
|
|
710
969
|
|
|
711
|
-
export { type AnomalyDetectionOptions, type AnomalyReport, type ArticulationPoint, type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, CodeIngestor, ConfluenceConnector, type ConnectorConfig, ContextQL, type ContextQLParams, type ContextQLResult, DesignConstraintAdapter, DesignIngestor, type DesignStrictness, type DesignViolation, EDGE_TYPES, type EdgeQuery, type EdgeType, FusionLayer, type FusionResult, GitIngestor, type GitRunner, GraphAnomalyAdapter, type GraphBudget, GraphComplexityAdapter, type GraphComplexityHotspot, type GraphComplexityResult, type GraphConnector, GraphConstraintAdapter, GraphCouplingAdapter, type GraphCouplingFileData, type GraphCouplingResult, type GraphCoverageReport, type GraphDeadCodeData, type GraphDependencyData, type GraphDriftData, type GraphEdge, GraphEdgeSchema, GraphEntropyAdapter, GraphFeedbackAdapter, type GraphFilterResult, type GraphHarnessCheckData, type GraphImpactData, type GraphLayerViolation, type GraphMetadata, type GraphNode, GraphNodeSchema, type GraphSnapshotSummary, GraphStore, type HttpClient, type IngestResult, JiraConnector, KnowledgeIngestor, type LinkResult, NODE_TYPES, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type ProjectionSpec, SlackConnector, type SourceLocation, type StatisticalOutlier, SyncManager, type SyncMetadata, TopologicalLinker, VERSION, type VectorSearchResult, VectorStore, linkToCode, loadGraph, project, saveGraph };
|
|
970
|
+
export { type AnomalyDetectionOptions, type AnomalyReport, type ArticulationPoint, type AskGraphResult, type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, type ClassificationResult, CodeIngestor, type ConflictDetail, type ConflictPrediction, ConflictPredictor, type ConflictSeverity, ConfluenceConnector, type ConnectorConfig, ContextQL, type ContextQLParams, type ContextQLResult, DesignConstraintAdapter, DesignIngestor, type DesignStrictness, type DesignViolation, EDGE_TYPES, type EdgeQuery, type EdgeType, EntityExtractor, EntityResolver, FusionLayer, type FusionResult, GitIngestor, type GitRunner, GraphAnomalyAdapter, type GraphBudget, GraphComplexityAdapter, type GraphComplexityHotspot, type GraphComplexityResult, type GraphConnector, GraphConstraintAdapter, GraphCouplingAdapter, type GraphCouplingFileData, type GraphCouplingResult, type GraphCoverageReport, type GraphDeadCodeData, type GraphDependencyData, type GraphDriftData, type GraphEdge, GraphEdgeSchema, GraphEntropyAdapter, GraphFeedbackAdapter, type GraphFilterResult, type GraphHarnessCheckData, type GraphImpactData, type GraphLayerViolation, type GraphMetadata, type GraphNode, GraphNodeSchema, type GraphSnapshotSummary, GraphStore, type HttpClient, INTENTS, type ImpactGroups, type IndependenceCheckParams, type IndependenceResult, type IngestResult, type Intent, IntentClassifier, JiraConnector, KnowledgeIngestor, type LinkResult, NODE_TYPES, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type OverlapDetail, type PairResult, type ProjectionSpec, type ResolvedEntity, ResponseFormatter, SlackConnector, type SourceLocation, type StatisticalOutlier, SyncManager, type SyncMetadata, type TaskDefinition, TaskIndependenceAnalyzer, TopologicalLinker, VERSION, type VectorSearchResult, VectorStore, askGraph, groupNodesByImpact, linkToCode, loadGraph, project, saveGraph };
|