@cleocode/contracts 2026.4.30 → 2026.4.35

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/brain.d.ts CHANGED
@@ -6,6 +6,39 @@
6
6
  *
7
7
  * @task T5800
8
8
  */
9
+ /**
10
+ * Memory retention tier values for the tiered cognitive memory model (T549).
11
+ *
12
+ * - `short` — Session-scoped working context. Auto-evicted after TTL if not promoted.
13
+ * - `medium` — Project-scoped verified facts. Retained for weeks.
14
+ * - `long` — Architectural bedrock. Permanent; supersession-only eviction.
15
+ */
16
+ export type BrainMemoryTier = 'short' | 'medium' | 'long';
17
+ /**
18
+ * Cognitive type taxonomy for brain entries (T549).
19
+ *
20
+ * NOTE: Named `BrainCognitiveType` (not `BrainMemoryType`) to avoid collision
21
+ * with the brain_memory_links entity type enum.
22
+ *
23
+ * - `semantic` — Declarative facts: brain_decisions, brain_learnings (default)
24
+ * - `episodic` — Event records: brain_observations, brain_learnings (transcript-derived)
25
+ * - `procedural` — Process knowledge: brain_patterns
26
+ */
27
+ export type BrainCognitiveType = 'semantic' | 'episodic' | 'procedural';
28
+ /**
29
+ * Source reliability levels for brain entries (T549 §3.1.5).
30
+ *
31
+ * Separate dimension from content `quality_score`. Each level drives a quality
32
+ * multiplier applied at scoring time:
33
+ *
34
+ * | Level | Quality multiplier |
35
+ * |---------------|--------------------|
36
+ * | `owner` | 1.0 |
37
+ * | `task-outcome`| 0.90 |
38
+ * | `agent` | 0.70 |
39
+ * | `speculative` | 0.40 |
40
+ */
41
+ export type BrainSourceConfidence = 'owner' | 'task-outcome' | 'agent' | 'speculative';
9
42
  /** Compact brain entry reference used in contradiction analysis. */
10
43
  export interface BrainEntryRef {
11
44
  /** Brain.db entry identifier. */
@@ -1 +1 @@
1
- {"version":3,"file":"brain.d.ts","sourceRoot":"","sources":["../src/brain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oEAAoE;AACpE,MAAM,WAAW,aAA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Aa;IAC5B,iCAAiC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,uEAAuE;AACvE,MAAM,WAAW,iBAAiB;IAChC,iCAAiC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,sDAAsD;AACtD,MAAM,WAAW,mBAAmB;IAClC,6CAA6C;IAC7C,MAAM,EAAE,aAAa,CAAC;IACtB,8CAA8C;IAC9C,MAAM,EAAE,aAAa,CAAC;IACtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,iEAAiE;AACjE,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,iDAAiD;IACjD,WAAW,EAAE,iBAAiB,CAAC;IAC/B,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;CAClB"}
package/dist/config.d.ts CHANGED
@@ -164,6 +164,43 @@ export interface BrainSummarizationConfig {
164
164
  /** Whether session summarization is enabled (default: false). */
165
165
  enabled: boolean;
166
166
  }
167
+ /**
168
+ * Brain tiered + typed memory configuration (T549).
169
+ *
170
+ * Controls the tiered cognitive memory model: tier promotion, eviction TTLs,
171
+ * and the sleep-time consolidator. All fields default to disabled/conservative
172
+ * values — the system requires explicit opt-in.
173
+ *
174
+ * @epic T549
175
+ */
176
+ export interface BrainTieringConfig {
177
+ /**
178
+ * Enable write-time tier/type/source_confidence assignment and updated quality scoring.
179
+ * When false (default), new entries receive column defaults without routing logic overhead.
180
+ */
181
+ enabled: boolean;
182
+ /**
183
+ * Enable the sleep-time consolidator: runs tier promotion, eviction, and contradiction
184
+ * detection at session end (after VACUUM INTO backup). Fires as setImmediate — non-blocking.
185
+ * Requires `enabled: true` to take effect.
186
+ */
187
+ autoPromote: boolean;
188
+ /**
189
+ * Hours before unverified short-term entries are soft-evicted (default: 48).
190
+ * Set invalidAt on entries older than this threshold that were not promoted.
191
+ */
192
+ shortTermTtlHours: number;
193
+ /**
194
+ * Days before unverified medium-term entries are soft-evicted (default: 30).
195
+ * Medium-term entries with quality_score below the medium decay threshold are evicted.
196
+ */
197
+ mediumTermTtlDays: number;
198
+ /**
199
+ * Minimum citations for medium→long promotion via citation gate (default: 5).
200
+ * An entry at medium tier with citationCount >= promotionThreshold qualifies for long-term.
201
+ */
202
+ promotionThreshold: number;
203
+ }
167
204
  /**
168
205
  * Brain (BRAIN memory system) configuration.
169
206
  * Controls automated memory capture, embedding generation, memory bridge
@@ -185,6 +222,14 @@ export interface BrainConfig {
185
222
  memoryBridge: BrainMemoryBridgeConfig;
186
223
  /** Session summarization settings. */
187
224
  summarization: BrainSummarizationConfig;
225
+ /**
226
+ * Tiered + typed memory settings (T549).
227
+ * Controls tier routing, sleep-time consolidation, and TTL-based eviction.
228
+ * All fields default to disabled. Opt-in required.
229
+ *
230
+ * @defaultValue { enabled: false, autoPromote: false, shortTermTtlHours: 48, mediumTermTtlDays: 30, promotionThreshold: 5 }
231
+ */
232
+ tiering?: BrainTieringConfig;
188
233
  }
189
234
  /**
190
235
  * Structured session summary input for ingestStructuredSummary().
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,6BAA6B;AAC7B,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;AAE5E,2BAA2B;AAC3B,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,K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,CAAC;IACvB,yDAAyD;IACzD,WAAW,EAAE,iBAAiB,CAAC;IAC/B,2CAA2C;IAC3C,YAAY,EAAE,kBAAkB,CAAC;IACjC,uCAAuC;IACvC,SAAS,EAAE,eAAe,CAAC;IAC3B,yDAAyD;IACzD,OAAO,EAAE,aAAa,CAAC;IACvB,yDAAyD;IACzD,OAAO,EAAE,aAAa,CAAC;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B;;;;OAIG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,yCAAyC;AACzC,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE5E,+CAA+C;AAC/C,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,wCAAwC;IACxC,KAAK,EAAE,CAAC,CAAC;IACT,yDAAyD;IACzD,MAAM,EAAE,YAAY,CAAC;CACtB"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Dependency registry contracts for CLEO runtime dependency verification.
3
+ *
4
+ * This is the single source of truth (SSoT) for all CLEO dependency types.
5
+ * All health check systems that inspect external dependencies MUST use these
6
+ * contracts rather than defining inline or ad-hoc types.
7
+ *
8
+ * @task T507
9
+ */
10
+ /**
11
+ * Classification of a CLEO dependency by necessity.
12
+ *
13
+ * - `required` — CLEO cannot function without this dependency.
14
+ * - `optional` — CLEO works without this but specific features are disabled.
15
+ * - `feature` — A bundled or internally-managed dependency (e.g. native addons).
16
+ */
17
+ export type DependencyCategory = 'required' | 'optional' | 'feature';
18
+ /**
19
+ * Static specification describing a single CLEO dependency.
20
+ *
21
+ * This is the registry entry — it does NOT carry check results.
22
+ * Use {@link DependencyCheckResult} for runtime check outcomes.
23
+ */
24
+ export interface DependencySpec {
25
+ /** Canonical identifier used as a lookup key (e.g. `"git"`, `"gh"`). */
26
+ name: string;
27
+ /** Classification of the dependency by necessity. */
28
+ category: DependencyCategory;
29
+ /** Human-readable description of what the dependency is used for. */
30
+ description: string;
31
+ /** Semver-style constraint string (e.g. `">=24.0.0"`). Optional. */
32
+ versionConstraint?: string;
33
+ /** URL pointing to installation or documentation for this dependency. */
34
+ documentationUrl?: string;
35
+ /** Shell command to install the dependency (informational only). */
36
+ installCommand?: string;
37
+ /**
38
+ * Platforms on which this dependency applies.
39
+ * When absent the dependency is considered applicable on all platforms.
40
+ */
41
+ platforms?: ('linux' | 'darwin' | 'win32')[];
42
+ }
43
+ /**
44
+ * Runtime check result for a single CLEO dependency.
45
+ *
46
+ * Produced by `checkDependency()` and collected into a {@link DependencyReport}.
47
+ */
48
+ export interface DependencyCheckResult {
49
+ /** Canonical identifier matching the corresponding {@link DependencySpec}. */
50
+ name: string;
51
+ /** Classification of the dependency (copied from its spec). */
52
+ category: DependencyCategory;
53
+ /** Whether the dependency is present on the system. */
54
+ installed: boolean;
55
+ /** Detected version string, if available (e.g. `"2.43.0"`). */
56
+ version?: string;
57
+ /** Filesystem path where the dependency was found (e.g. `/usr/bin/git`). */
58
+ location?: string;
59
+ /**
60
+ * Whether the dependency passes all health criteria.
61
+ *
62
+ * For `required` dependencies this means installed AND the version satisfies
63
+ * `versionConstraint`. For `optional` and `feature` dependencies a missing
64
+ * dependency is still considered healthy (the feature is simply disabled).
65
+ */
66
+ healthy: boolean;
67
+ /** Human-readable error or diagnostic message when `healthy` is `false`. */
68
+ error?: string;
69
+ /** Actionable fix suggestion to show the user when `healthy` is `false`. */
70
+ suggestedFix?: string;
71
+ }
72
+ /**
73
+ * Full dependency report produced by `checkAllDependencies()`.
74
+ *
75
+ * Intended for consumption by `coreDoctorReport()` and any CLI output layer.
76
+ */
77
+ export interface DependencyReport {
78
+ /** ISO 8601 timestamp of when the report was generated. */
79
+ timestamp: string;
80
+ /** `process.platform` value at check time (e.g. `"linux"`, `"darwin"`). */
81
+ platform: string;
82
+ /** Node.js version string without the `v` prefix (e.g. `"24.0.0"`). */
83
+ nodeVersion: string;
84
+ /** Per-dependency check results. */
85
+ results: DependencyCheckResult[];
86
+ /**
87
+ * `true` when every `required` dependency is healthy.
88
+ * Optional and feature dependencies do not affect this flag.
89
+ */
90
+ allRequiredMet: boolean;
91
+ /** Non-fatal advisory messages (e.g. optional dep missing, feature unavailable). */
92
+ warnings: string[];
93
+ }
94
+ //# sourceMappingURL=dependency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency.d.ts","sourceRoot":"","sources":["../src/dependency.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AAErE;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,EAAE,CAAC;CAC9C;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB,oFAAoF;IACpF,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Dependency registry contracts for CLEO runtime dependency verification.
3
+ *
4
+ * This is the single source of truth (SSoT) for all CLEO dependency types.
5
+ * All health check systems that inspect external dependencies MUST use these
6
+ * contracts rather than defining inline or ad-hoc types.
7
+ *
8
+ * @task T507
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=dependency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency.js","sourceRoot":"","sources":["../src/dependency.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,192 @@
1
+ /**
2
+ * Graph type contracts for CLEO code intelligence.
3
+ *
4
+ * Defines the node types, relationship types, and structures that form the
5
+ * foundation of the code intelligence graph. Ported from GitNexus graph
6
+ * primitives and adapted for CLEO's lightweight, in-process use case.
7
+ *
8
+ * @task T512
9
+ * @module contracts/graph
10
+ */
11
+ /**
12
+ * All supported symbol node kinds in the code intelligence graph.
13
+ *
14
+ * Covers file/folder structural nodes plus every symbol-level construct
15
+ * that tree-sitter can identify across TypeScript, JavaScript, and future
16
+ * language providers. Includes synthetic graph-level nodes produced by
17
+ * analysis phases (community detection, process detection, route extraction).
18
+ *
19
+ * @since T529 — expanded from T512 baseline with 17 new kinds
20
+ */
21
+ export type GraphNodeKind = 'file' | 'folder' | 'module' | 'namespace' | 'function' | 'method' | 'constructor' | 'class' | 'interface' | 'struct' | 'trait' | 'impl' | 'type_alias' | 'enum' | 'property' | 'constant' | 'variable' | 'static' | 'record' | 'delegate' | 'macro' | 'union' | 'typedef' | 'annotation' | 'template' | 'community' | 'process' | 'route' | 'tool' | 'section' | 'import' | 'export' | 'type';
22
+ /**
23
+ * All supported directed relationship types between graph nodes.
24
+ *
25
+ * Types are intentionally lowercase to match CLEO convention.
26
+ * Each type carries semantic meaning about the nature of the dependency.
27
+ *
28
+ * @since T529 — expanded from T512 baseline with 10 new relation types
29
+ */
30
+ export type GraphRelationType = 'contains' | 'defines' | 'imports' | 'accesses' | 'calls' | 'extends' | 'implements' | 'method_overrides' | 'method_implements' | 'has_method' | 'has_property' | 'member_of' | 'step_in_process' | 'handles_route' | 'fetches' | 'handles_tool' | 'entry_point_of' | 'wraps' | 'queries' | 'documents' | 'applies_to';
31
+ /**
32
+ * A node in the code intelligence graph representing a symbol or structural
33
+ * element extracted from source code.
34
+ *
35
+ * The `id` field is a stable identifier for the node, typically derived from
36
+ * the file path and symbol name (e.g., `src/foo.ts::parseFile`).
37
+ */
38
+ export interface GraphNode {
39
+ /** Unique, stable node identifier. Typically `<filePath>::<name>`. */
40
+ id: string;
41
+ /** Kind of code element this node represents. */
42
+ kind: GraphNodeKind;
43
+ /** Symbol name as it appears in source code. */
44
+ name: string;
45
+ /** File path relative to the project root. */
46
+ filePath: string;
47
+ /** Start line in the source file (1-based). */
48
+ startLine: number;
49
+ /** End line in the source file (1-based). */
50
+ endLine: number;
51
+ /** Language of the source file (e.g., "typescript", "javascript"). */
52
+ language: string;
53
+ /** Whether the symbol is publicly exported from its module. */
54
+ exported: boolean;
55
+ /** Parent node ID, if this symbol is nested (e.g., method inside class). */
56
+ parent?: string;
57
+ /** Parameter names or signatures for functions and methods. */
58
+ parameters?: string[];
59
+ /** Return type annotation text, if available. */
60
+ returnType?: string;
61
+ /** First line of the TSDoc/JSDoc comment for this symbol, if present. */
62
+ docSummary?: string;
63
+ /** Community ID this node belongs to (set after Phase 5 community detection). */
64
+ communityId?: string;
65
+ /** Execution flow process IDs this node participates in (set after Phase 6). */
66
+ processIds?: string[];
67
+ /** Kind-specific metadata blob (matches nexus_nodes.meta_json). */
68
+ meta?: Record<string, unknown>;
69
+ }
70
+ /**
71
+ * A directed relationship between two nodes in the code intelligence graph.
72
+ *
73
+ * The `source` and `target` fields reference node IDs (see {@link GraphNode.id}).
74
+ * Confidence reflects how certain the extractor is about this relationship,
75
+ * from 0.0 (speculative) to 1.0 (statically verified).
76
+ */
77
+ export interface GraphRelation {
78
+ /** ID of the originating node. */
79
+ source: string;
80
+ /** ID of the target node. */
81
+ target: string;
82
+ /** Semantic type of the relationship. */
83
+ type: GraphRelationType;
84
+ /**
85
+ * Extractor confidence for this relationship (0.0 to 1.0).
86
+ *
87
+ * Common values by type:
88
+ * - `calls` / `imports`: 0.9 (direct, strongly typed)
89
+ * - `extends` / `implements`: 0.85 (statically verifiable)
90
+ * - `has_method` / `has_property`: 0.95 (structural containment)
91
+ * - `accesses`: 0.8 (field read/write, may be indirect)
92
+ */
93
+ confidence: number;
94
+ /** Human-readable note explaining why this relation was emitted. */
95
+ reason?: string;
96
+ }
97
+ /**
98
+ * Result of a BFS-based impact analysis starting from a named symbol.
99
+ *
100
+ * Affected nodes are grouped into three depth tiers that reflect the
101
+ * likelihood and urgency of breakage:
102
+ *
103
+ * - **depth1_willBreak** (d=1): Direct callers/importers — WILL break.
104
+ * Must be updated whenever the target changes.
105
+ * - **depth2_likelyAffected** (d=2): Indirect dependants — LIKELY affected.
106
+ * Should be tested.
107
+ * - **depth3_mayNeedTesting** (d=3): Transitive dependants — MAY need testing.
108
+ * Test if the symbol is on a critical path.
109
+ */
110
+ export interface ImpactResult {
111
+ /** Name or ID of the symbol that was analyzed. */
112
+ target: string;
113
+ /**
114
+ * Overall risk classification based on the number and type of affected nodes.
115
+ *
116
+ * - `low`: 0–3 direct dependants, no cross-module spread
117
+ * - `medium`: 4–9 direct dependants, or limited cross-module spread
118
+ * - `high`: 10+ direct dependants, or significant cross-module spread
119
+ * - `critical`: Exported symbol with high cross-module usage
120
+ */
121
+ riskLevel: 'low' | 'medium' | 'high' | 'critical';
122
+ /** Human-readable summary of the impact analysis outcome. */
123
+ summary: string;
124
+ /** Nodes affected at each traversal depth. */
125
+ affectedByDepth: {
126
+ /** d=1: Direct dependants — WILL BREAK. */
127
+ depth1_willBreak: GraphNode[];
128
+ /** d=2: Indirect dependants — LIKELY AFFECTED. */
129
+ depth2_likelyAffected: GraphNode[];
130
+ /** d=3: Transitive dependants — MAY NEED TESTING. */
131
+ depth3_mayNeedTesting: GraphNode[];
132
+ };
133
+ /** Total number of affected nodes across all depths. */
134
+ totalAffected: number;
135
+ }
136
+ /**
137
+ * An in-memory symbol table entry tracking all files where a name appears.
138
+ * Used during ingestion to resolve cross-file call targets.
139
+ */
140
+ export interface SymbolIndex {
141
+ /** Symbol name as it appears in source (e.g., "parseFile"). */
142
+ name: string;
143
+ /** All node IDs that define this name across the project. */
144
+ nodeIds: string[];
145
+ /** All file paths that export this name. */
146
+ exportingFiles: string[];
147
+ }
148
+ /**
149
+ * The in-memory KnowledgeGraph assembled during a single ingestion run.
150
+ * Flushed to nexus_nodes + nexus_relations after all phases complete.
151
+ */
152
+ export interface KnowledgeGraph {
153
+ /** Primary node store: nodeId → GraphNode. */
154
+ nodes: Map<string, GraphNode>;
155
+ /** All directed edges (appended during ingestion, deduplicated at flush). */
156
+ relations: GraphRelation[];
157
+ /** Indexes for fast lookup during resolution phases. */
158
+ symbolTable: SymbolIndex[];
159
+ /** Files that changed since last index (incremental mode only). */
160
+ changedFiles?: Set<string>;
161
+ }
162
+ /**
163
+ * A community (module cluster) identified by Louvain community detection
164
+ * during Phase 5. Represents a group of cohesive symbols within the graph.
165
+ */
166
+ export interface CommunityNode {
167
+ /** Node ID format: `community:<n>` */
168
+ id: string;
169
+ /** Inferred label from the top folder name. */
170
+ label: string;
171
+ /** Number of member symbols in this community. */
172
+ memberCount: number;
173
+ /** Top-level folders contributing most members. */
174
+ topFolders: string[];
175
+ }
176
+ /**
177
+ * A detected execution flow (process) from BFS entry point analysis
178
+ * during Phase 6. Represents a named sequence of function calls.
179
+ */
180
+ export interface ProcessNode {
181
+ /** Node ID format: `process:<slug>` */
182
+ id: string;
183
+ /** Entry point function name used as the process label. */
184
+ label: string;
185
+ /** Node ID of the entry point function. */
186
+ entryPointId: string;
187
+ /** Ordered node IDs representing each step in the flow. */
188
+ stepIds: string[];
189
+ /** Total number of steps in this execution flow. */
190
+ stepCount: number;
191
+ }
192
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAErB,MAAM,GACN,QAAQ,GAER,QAAQ,GACR,WAAW,GAEX,UAAU,GACV,QAAQ,GACR,aAAa,GAEb,OAAO,GACP,WAAW,GACX,QAAQ,GACR,OAAO,GACP,MAAM,GACN,YAAY,GACZ,MAAM,GAEN,UAAU,GACV,UAAU,GACV,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,UAAU,GAEV,OAAO,GACP,OAAO,GACP,SAAS,GACT,YAAY,GACZ,UAAU,GAEV,WAAW,GACX,SAAS,GACT,OAAO,GACP,MAAM,GACN,SAAS,GAET,QAAQ,GACR,QAAQ,GACR,MAAM,CAAC;AAMX;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAEzB,UAAU,GAEV,SAAS,GACT,SAAS,GACT,UAAU,GAEV,OAAO,GAEP,SAAS,GACT,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GAEnB,YAAY,GACZ,cAAc,GAEd,WAAW,GACX,iBAAiB,GAEjB,eAAe,GACf,SAAS,GAET,cAAc,GACd,gBAAgB,GAEhB,OAAO,GAEP,SAAS,GAET,WAAW,GACX,YAAY,CAAC;AAMjB;;;;;;GAMG;AACH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E,MAAM,EAAE,CAAC;IAClB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;CACnB"}
package/dist/graph.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Graph type contracts for CLEO code intelligence.
3
+ *
4
+ * Defines the node types, relationship types, and structures that form the
5
+ * foundation of the code intelligence graph. Ported from GitNexus graph
6
+ * primitives and adapted for CLEO's lightweight, in-process use case.
7
+ *
8
+ * @task T512
9
+ * @module contracts/graph
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
package/dist/index.d.ts CHANGED
@@ -9,18 +9,20 @@ export type { AdapterHealthStatus, CLEOProviderAdapter } from './adapter.js';
9
9
  export type { AgentCredential, AgentListFilter, AgentRegistryAPI, AgentWithProjectOverride, ProjectAgentRef, TransportConfig, } from './agent-registry.js';
10
10
  export type { ArchiveCycleTimesReport, ArchiveDailyTrend, ArchivedTask, ArchiveLabelEntry, ArchiveMetadata, ArchiveMonthlyTrend, ArchivePhaseEntry, ArchivePriorityEntry, ArchiveReportType, ArchiveStatsEnvelope, ArchiveSummaryReport, ArchiveTrendsReport, CycleTimeDistribution, CycleTimePercentiles, } from './archive.js';
11
11
  export type { BackupDatabaseEntry, BackupGlobalFileEntry, BackupIntegrity, BackupJsonEntry, BackupManifest, BackupMetadata, BackupScope, } from './backup-manifest.js';
12
- export type { BrainEntryRef, BrainEntrySummary, ContradictionDetail, SupersededEntry, } from './brain.js';
12
+ export type { BrainCognitiveType, BrainEntryRef, BrainEntrySummary, BrainMemoryTier, BrainSourceConfidence, ContradictionDetail, SupersededEntry, } from './brain.js';
13
13
  export type { AdapterCapabilities } from './capabilities.js';
14
14
  export type { BatchParseResult, CodeSymbol, CodeSymbolKind, ParseResult, } from './code-symbol.js';
15
15
  export type { Conduit, ConduitConfig, ConduitMessage, ConduitSendOptions, ConduitSendResult, ConduitState, ConduitStateChange, ConduitUnsubscribe, } from './conduit.js';
16
- export type { BackupConfig, BrainConfig, BrainEmbeddingConfig, BrainMemoryBridgeConfig, BrainSummarizationConfig, CleoConfig, ConfigSource, DateFormat, EnforcementProfile, HierarchyConfig, LifecycleConfig, LifecycleEnforcementMode, LoggingConfig, LogLevel, OutputConfig, OutputFormat, ResolvedValue, SessionConfig, SessionSummaryInput, SharingConfig, SharingMode, SignalDockConfig, SignalDockMode, } from './config.js';
16
+ export type { BackupConfig, BrainConfig, BrainEmbeddingConfig, BrainMemoryBridgeConfig, BrainSummarizationConfig, BrainTieringConfig, CleoConfig, ConfigSource, DateFormat, EnforcementProfile, HierarchyConfig, LifecycleConfig, LifecycleEnforcementMode, LoggingConfig, LogLevel, OutputConfig, OutputFormat, ResolvedValue, SessionConfig, SessionSummaryInput, SharingConfig, SharingMode, SignalDockConfig, SignalDockMode, } from './config.js';
17
17
  export type { AdapterContextMonitorProvider } from './context-monitor.js';
18
18
  export type { ArchiveFields, ArchiveFile, DataAccessor, DataAccessorAgentInstance, QueryTasksResult, TaskFieldUpdates, TaskQueryFilters, TransactionAccessor, } from './data-accessor.js';
19
+ export type { DependencyCategory, DependencyCheckResult, DependencyReport, DependencySpec, } from './dependency.js';
19
20
  export type { AdapterManifest, DetectionPattern } from './discovery.js';
20
21
  export { createErrorResult, createSuccessResult, formatError, getErrorMessage, isErrorResult, isErrorType, normalizeError, } from './errors.js';
21
22
  export { ExitCode, getExitCodeName, isErrorCode, isNoChangeCode, isRecoverableCode, isSuccessCode, } from './exit-codes.js';
22
23
  export type { AdminAPI, AgentCapacity, AgentHealthStatus, AgentInstanceRow, AgentInstanceStatus, AgentsAPI, AgentType, BlastRadius, BlastRadiusSeverity, BrainObservationType, CleoInitOptions, DuplicateStrategy, HybridSearchOptions, ImpactedTask, ImpactReport, ImportParams, IntelligenceAPI, LifecycleAPI, MemoryAPI, NexusAPI, OrchestrationAPI, RegisterAgentOptions, ReleaseAPI, SessionsAPI, StickyAPI, SyncAPI, TaskStartResult, TasksAPI, } from './facade.js';
23
24
  export { AGENT_INSTANCE_STATUSES, AGENT_TYPES, BRAIN_OBSERVATION_TYPES, } from './facade.js';
25
+ export type { CommunityNode, GraphNode, GraphNodeKind, GraphRelation, GraphRelationType, ImpactResult, KnowledgeGraph, ProcessNode, SymbolIndex, } from './graph.js';
24
26
  export type { AdapterHookProvider } from './hooks.js';
25
27
  export type { AdapterInstallProvider, InstallOptions, InstallResult } from './install.js';
26
28
  export type { CleoResponse, ConformanceReport, FlagInput, GatewayEnvelope, GatewayError, GatewayMeta, GatewaySuccess, LAFSEnvelope, LAFSError, LAFSErrorCategory, LAFSMeta, LAFSPage, LAFSPageNone, LAFSPageOffset, LAFSTransport, LafsAlternative, LafsEnvelope, LafsError, LafsErrorDetail, LafsSuccess, MVILevel, Warning, } from './lafs.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE7E,YAAY,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,EACf,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,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,EACR,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,yBAAyB,EACzB,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,wBAAwB,EACxB,SAAS,EACT,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,UAAU,EACV,eAAe,EACf,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,SAAS,GACV,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE7E,YAAY,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,EACf,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,mBAAmB,EACn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B,KAAK,cAAc,EACnB,gBAAgB,EAChB,KAAK,aAAa,EAClB,kBAAkB,EAClB,eAAe,EACf,KAAK,WAAW,EAChB,yBAAyB,EACzB,2BAA2B,EAE3B,aAAa,EAEb,KAAK,UAAU,EACf,0BAA0B,EAC1B,uBAAuB,EAEvB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,aAAa,EACb,aAAa,EACb,aAAa,EACb,QAAQ,EACR,KAAK,EACL,WAAW,EACX,eAAe,EACf,WAAW,EACX,OAAO,EACP,aAAa,EACb,WAAW,EACX,IAAI,EACJ,UAAU,EACV,UAAU,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,yBAAyB,EACzB,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,wBAAwB,EACxB,SAAS,EACT,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,UAAU,EACV,eAAe,EACf,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,SAAS,GACV,MAAM,iBAAiB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyGH,0BAA0B;AAC1B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,aAAa,EACb,WAAW,EACX,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,qBAAqB;AACrB,OAAO,EACL,QAAQ,EACR,eAAe,EACf,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,iBAAiB,CAAC;AA+BzB,gCAAgC;AAChC,OAAO,EACL,uBAAuB,EACvB,WAAW,EACX,uBAAuB,GACxB,MAAM,aAAa,CAAC;AA2BrB,8BAA8B;AAC9B,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,aAAa,GACd,MAAM,WAAW,CAAC;AAUnB,8FAA8F;AAC9F,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAG7C,kCAAkC;AAClC,OAAO,EAKL,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AAgCtC,wBAAwB;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAa3C,uEAAuE;AACvE,OAAO,EACL,YAAY,EAIZ,aAAa,EAEb,aAAa,EACb,2BAA2B,EAC3B,wBAAwB,EACxB,iBAAiB;AAEjB,gBAAgB;AAChB,qBAAqB,EAErB,gBAAgB,EAEhB,kBAAkB,EAClB,eAAe,EAEf,yBAAyB,EACzB,2BAA2B;AAC3B,YAAY;AACZ,aAAa,EAGb,0BAA0B,EAC1B,uBAAuB;AACvB,sBAAsB;AACtB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AA6E9B,yCAAyC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoHH,0BAA0B;AAC1B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,aAAa,EACb,WAAW,EACX,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,qBAAqB;AACrB,OAAO,EACL,QAAQ,EACR,eAAe,EACf,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,iBAAiB,CAAC;AA+BzB,gCAAgC;AAChC,OAAO,EACL,uBAAuB,EACvB,WAAW,EACX,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAuCrB,8BAA8B;AAC9B,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,aAAa,GACd,MAAM,WAAW,CAAC;AAUnB,8FAA8F;AAC9F,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAG7C,kCAAkC;AAClC,OAAO,EAKL,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AAgCtC,wBAAwB;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAa3C,uEAAuE;AACvE,OAAO,EACL,YAAY,EAIZ,aAAa,EAEb,aAAa,EACb,2BAA2B,EAC3B,wBAAwB,EACxB,iBAAiB;AAEjB,gBAAgB;AAChB,qBAAqB,EAErB,gBAAgB,EAEhB,kBAAkB,EAClB,eAAe,EAEf,yBAAyB,EACzB,2BAA2B;AAC3B,YAAY;AACZ,aAAa,EAGb,0BAA0B,EAC1B,uBAAuB;AACvB,sBAAsB;AACtB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AA6E9B,yCAAyC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/contracts",
3
- "version": "2026.4.30",
3
+ "version": "2026.4.35",
4
4
  "description": "Domain types, interfaces, and contracts for the CLEO ecosystem",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/brain.ts CHANGED
@@ -7,6 +7,46 @@
7
7
  * @task T5800
8
8
  */
9
9
 
10
+ // ============================================================
11
+ // T549: Tiered + Typed Memory Architecture types
12
+ // ============================================================
13
+
14
+ /**
15
+ * Memory retention tier values for the tiered cognitive memory model (T549).
16
+ *
17
+ * - `short` — Session-scoped working context. Auto-evicted after TTL if not promoted.
18
+ * - `medium` — Project-scoped verified facts. Retained for weeks.
19
+ * - `long` — Architectural bedrock. Permanent; supersession-only eviction.
20
+ */
21
+ export type BrainMemoryTier = 'short' | 'medium' | 'long';
22
+
23
+ /**
24
+ * Cognitive type taxonomy for brain entries (T549).
25
+ *
26
+ * NOTE: Named `BrainCognitiveType` (not `BrainMemoryType`) to avoid collision
27
+ * with the brain_memory_links entity type enum.
28
+ *
29
+ * - `semantic` — Declarative facts: brain_decisions, brain_learnings (default)
30
+ * - `episodic` — Event records: brain_observations, brain_learnings (transcript-derived)
31
+ * - `procedural` — Process knowledge: brain_patterns
32
+ */
33
+ export type BrainCognitiveType = 'semantic' | 'episodic' | 'procedural';
34
+
35
+ /**
36
+ * Source reliability levels for brain entries (T549 §3.1.5).
37
+ *
38
+ * Separate dimension from content `quality_score`. Each level drives a quality
39
+ * multiplier applied at scoring time:
40
+ *
41
+ * | Level | Quality multiplier |
42
+ * |---------------|--------------------|
43
+ * | `owner` | 1.0 |
44
+ * | `task-outcome`| 0.90 |
45
+ * | `agent` | 0.70 |
46
+ * | `speculative` | 0.40 |
47
+ */
48
+ export type BrainSourceConfidence = 'owner' | 'task-outcome' | 'agent' | 'speculative';
49
+
10
50
  /** Compact brain entry reference used in contradiction analysis. */
11
51
  export interface BrainEntryRef {
12
52
  /** Brain.db entry identifier. */
package/src/config.ts CHANGED
@@ -186,6 +186,44 @@ export interface BrainSummarizationConfig {
186
186
  enabled: boolean;
187
187
  }
188
188
 
189
+ /**
190
+ * Brain tiered + typed memory configuration (T549).
191
+ *
192
+ * Controls the tiered cognitive memory model: tier promotion, eviction TTLs,
193
+ * and the sleep-time consolidator. All fields default to disabled/conservative
194
+ * values — the system requires explicit opt-in.
195
+ *
196
+ * @epic T549
197
+ */
198
+ export interface BrainTieringConfig {
199
+ /**
200
+ * Enable write-time tier/type/source_confidence assignment and updated quality scoring.
201
+ * When false (default), new entries receive column defaults without routing logic overhead.
202
+ */
203
+ enabled: boolean;
204
+ /**
205
+ * Enable the sleep-time consolidator: runs tier promotion, eviction, and contradiction
206
+ * detection at session end (after VACUUM INTO backup). Fires as setImmediate — non-blocking.
207
+ * Requires `enabled: true` to take effect.
208
+ */
209
+ autoPromote: boolean;
210
+ /**
211
+ * Hours before unverified short-term entries are soft-evicted (default: 48).
212
+ * Set invalidAt on entries older than this threshold that were not promoted.
213
+ */
214
+ shortTermTtlHours: number;
215
+ /**
216
+ * Days before unverified medium-term entries are soft-evicted (default: 30).
217
+ * Medium-term entries with quality_score below the medium decay threshold are evicted.
218
+ */
219
+ mediumTermTtlDays: number;
220
+ /**
221
+ * Minimum citations for medium→long promotion via citation gate (default: 5).
222
+ * An entry at medium tier with citationCount >= promotionThreshold qualifies for long-term.
223
+ */
224
+ promotionThreshold: number;
225
+ }
226
+
189
227
  /**
190
228
  * Brain (BRAIN memory system) configuration.
191
229
  * Controls automated memory capture, embedding generation, memory bridge
@@ -207,6 +245,14 @@ export interface BrainConfig {
207
245
  memoryBridge: BrainMemoryBridgeConfig;
208
246
  /** Session summarization settings. */
209
247
  summarization: BrainSummarizationConfig;
248
+ /**
249
+ * Tiered + typed memory settings (T549).
250
+ * Controls tier routing, sleep-time consolidation, and TTL-based eviction.
251
+ * All fields default to disabled. Opt-in required.
252
+ *
253
+ * @defaultValue { enabled: false, autoPromote: false, shortTermTtlHours: 48, mediumTermTtlDays: 30, promotionThreshold: 5 }
254
+ */
255
+ tiering?: BrainTieringConfig;
210
256
  }
211
257
 
212
258
  /**
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Dependency registry contracts for CLEO runtime dependency verification.
3
+ *
4
+ * This is the single source of truth (SSoT) for all CLEO dependency types.
5
+ * All health check systems that inspect external dependencies MUST use these
6
+ * contracts rather than defining inline or ad-hoc types.
7
+ *
8
+ * @task T507
9
+ */
10
+
11
+ /**
12
+ * Classification of a CLEO dependency by necessity.
13
+ *
14
+ * - `required` — CLEO cannot function without this dependency.
15
+ * - `optional` — CLEO works without this but specific features are disabled.
16
+ * - `feature` — A bundled or internally-managed dependency (e.g. native addons).
17
+ */
18
+ export type DependencyCategory = 'required' | 'optional' | 'feature';
19
+
20
+ /**
21
+ * Static specification describing a single CLEO dependency.
22
+ *
23
+ * This is the registry entry — it does NOT carry check results.
24
+ * Use {@link DependencyCheckResult} for runtime check outcomes.
25
+ */
26
+ export interface DependencySpec {
27
+ /** Canonical identifier used as a lookup key (e.g. `"git"`, `"gh"`). */
28
+ name: string;
29
+ /** Classification of the dependency by necessity. */
30
+ category: DependencyCategory;
31
+ /** Human-readable description of what the dependency is used for. */
32
+ description: string;
33
+ /** Semver-style constraint string (e.g. `">=24.0.0"`). Optional. */
34
+ versionConstraint?: string;
35
+ /** URL pointing to installation or documentation for this dependency. */
36
+ documentationUrl?: string;
37
+ /** Shell command to install the dependency (informational only). */
38
+ installCommand?: string;
39
+ /**
40
+ * Platforms on which this dependency applies.
41
+ * When absent the dependency is considered applicable on all platforms.
42
+ */
43
+ platforms?: ('linux' | 'darwin' | 'win32')[];
44
+ }
45
+
46
+ /**
47
+ * Runtime check result for a single CLEO dependency.
48
+ *
49
+ * Produced by `checkDependency()` and collected into a {@link DependencyReport}.
50
+ */
51
+ export interface DependencyCheckResult {
52
+ /** Canonical identifier matching the corresponding {@link DependencySpec}. */
53
+ name: string;
54
+ /** Classification of the dependency (copied from its spec). */
55
+ category: DependencyCategory;
56
+ /** Whether the dependency is present on the system. */
57
+ installed: boolean;
58
+ /** Detected version string, if available (e.g. `"2.43.0"`). */
59
+ version?: string;
60
+ /** Filesystem path where the dependency was found (e.g. `/usr/bin/git`). */
61
+ location?: string;
62
+ /**
63
+ * Whether the dependency passes all health criteria.
64
+ *
65
+ * For `required` dependencies this means installed AND the version satisfies
66
+ * `versionConstraint`. For `optional` and `feature` dependencies a missing
67
+ * dependency is still considered healthy (the feature is simply disabled).
68
+ */
69
+ healthy: boolean;
70
+ /** Human-readable error or diagnostic message when `healthy` is `false`. */
71
+ error?: string;
72
+ /** Actionable fix suggestion to show the user when `healthy` is `false`. */
73
+ suggestedFix?: string;
74
+ }
75
+
76
+ /**
77
+ * Full dependency report produced by `checkAllDependencies()`.
78
+ *
79
+ * Intended for consumption by `coreDoctorReport()` and any CLI output layer.
80
+ */
81
+ export interface DependencyReport {
82
+ /** ISO 8601 timestamp of when the report was generated. */
83
+ timestamp: string;
84
+ /** `process.platform` value at check time (e.g. `"linux"`, `"darwin"`). */
85
+ platform: string;
86
+ /** Node.js version string without the `v` prefix (e.g. `"24.0.0"`). */
87
+ nodeVersion: string;
88
+ /** Per-dependency check results. */
89
+ results: DependencyCheckResult[];
90
+ /**
91
+ * `true` when every `required` dependency is healthy.
92
+ * Optional and feature dependencies do not affect this flag.
93
+ */
94
+ allRequiredMet: boolean;
95
+ /** Non-fatal advisory messages (e.g. optional dep missing, feature unavailable). */
96
+ warnings: string[];
97
+ }
package/src/graph.ts ADDED
@@ -0,0 +1,297 @@
1
+ /**
2
+ * Graph type contracts for CLEO code intelligence.
3
+ *
4
+ * Defines the node types, relationship types, and structures that form the
5
+ * foundation of the code intelligence graph. Ported from GitNexus graph
6
+ * primitives and adapted for CLEO's lightweight, in-process use case.
7
+ *
8
+ * @task T512
9
+ * @module contracts/graph
10
+ */
11
+
12
+ // ---------------------------------------------------------------------------
13
+ // Node kinds
14
+ // ---------------------------------------------------------------------------
15
+
16
+ /**
17
+ * All supported symbol node kinds in the code intelligence graph.
18
+ *
19
+ * Covers file/folder structural nodes plus every symbol-level construct
20
+ * that tree-sitter can identify across TypeScript, JavaScript, and future
21
+ * language providers. Includes synthetic graph-level nodes produced by
22
+ * analysis phases (community detection, process detection, route extraction).
23
+ *
24
+ * @since T529 — expanded from T512 baseline with 17 new kinds
25
+ */
26
+ export type GraphNodeKind =
27
+ // Structural
28
+ | 'file'
29
+ | 'folder'
30
+ // Module-level
31
+ | 'module'
32
+ | 'namespace'
33
+ // Callable
34
+ | 'function'
35
+ | 'method'
36
+ | 'constructor'
37
+ // Type hierarchy
38
+ | 'class'
39
+ | 'interface'
40
+ | 'struct'
41
+ | 'trait'
42
+ | 'impl'
43
+ | 'type_alias'
44
+ | 'enum'
45
+ // Value-level
46
+ | 'property'
47
+ | 'constant'
48
+ | 'variable'
49
+ | 'static'
50
+ | 'record'
51
+ | 'delegate'
52
+ // Language-specific constructs
53
+ | 'macro'
54
+ | 'union'
55
+ | 'typedef'
56
+ | 'annotation'
57
+ | 'template'
58
+ // Graph-level (synthetic, from analysis phases)
59
+ | 'community'
60
+ | 'process'
61
+ | 'route'
62
+ | 'tool'
63
+ | 'section'
64
+ // Legacy (kept for T506 compatibility)
65
+ | 'import'
66
+ | 'export'
67
+ | 'type';
68
+
69
+ // ---------------------------------------------------------------------------
70
+ // Relationship types
71
+ // ---------------------------------------------------------------------------
72
+
73
+ /**
74
+ * All supported directed relationship types between graph nodes.
75
+ *
76
+ * Types are intentionally lowercase to match CLEO convention.
77
+ * Each type carries semantic meaning about the nature of the dependency.
78
+ *
79
+ * @since T529 — expanded from T512 baseline with 10 new relation types
80
+ */
81
+ export type GraphRelationType =
82
+ // Structural
83
+ | 'contains'
84
+ // Definition / usage
85
+ | 'defines'
86
+ | 'imports'
87
+ | 'accesses'
88
+ // Callable
89
+ | 'calls'
90
+ // Type hierarchy
91
+ | 'extends'
92
+ | 'implements'
93
+ | 'method_overrides'
94
+ | 'method_implements'
95
+ // Class structure
96
+ | 'has_method'
97
+ | 'has_property'
98
+ // Graph-level (synthetic, from analysis phases)
99
+ | 'member_of' // symbol → community node
100
+ | 'step_in_process' // symbol → process node
101
+ // Web / API
102
+ | 'handles_route' // function → route node
103
+ | 'fetches' // function → external URL
104
+ // Tool / agent
105
+ | 'handles_tool'
106
+ | 'entry_point_of' // function → process node
107
+ // Wrapping / delegation
108
+ | 'wraps'
109
+ // Data access
110
+ | 'queries'
111
+ // Cross-graph (brain integration)
112
+ | 'documents' // brain node → nexus node
113
+ | 'applies_to'; // brain decision/learning → nexus node
114
+
115
+ // ---------------------------------------------------------------------------
116
+ // Node interface
117
+ // ---------------------------------------------------------------------------
118
+
119
+ /**
120
+ * A node in the code intelligence graph representing a symbol or structural
121
+ * element extracted from source code.
122
+ *
123
+ * The `id` field is a stable identifier for the node, typically derived from
124
+ * the file path and symbol name (e.g., `src/foo.ts::parseFile`).
125
+ */
126
+ export interface GraphNode {
127
+ /** Unique, stable node identifier. Typically `<filePath>::<name>`. */
128
+ id: string;
129
+ /** Kind of code element this node represents. */
130
+ kind: GraphNodeKind;
131
+ /** Symbol name as it appears in source code. */
132
+ name: string;
133
+ /** File path relative to the project root. */
134
+ filePath: string;
135
+ /** Start line in the source file (1-based). */
136
+ startLine: number;
137
+ /** End line in the source file (1-based). */
138
+ endLine: number;
139
+ /** Language of the source file (e.g., "typescript", "javascript"). */
140
+ language: string;
141
+ /** Whether the symbol is publicly exported from its module. */
142
+ exported: boolean;
143
+ /** Parent node ID, if this symbol is nested (e.g., method inside class). */
144
+ parent?: string;
145
+ /** Parameter names or signatures for functions and methods. */
146
+ parameters?: string[];
147
+ /** Return type annotation text, if available. */
148
+ returnType?: string;
149
+ /** First line of the TSDoc/JSDoc comment for this symbol, if present. */
150
+ docSummary?: string;
151
+ /** Community ID this node belongs to (set after Phase 5 community detection). */
152
+ communityId?: string;
153
+ /** Execution flow process IDs this node participates in (set after Phase 6). */
154
+ processIds?: string[];
155
+ /** Kind-specific metadata blob (matches nexus_nodes.meta_json). */
156
+ meta?: Record<string, unknown>;
157
+ }
158
+
159
+ // ---------------------------------------------------------------------------
160
+ // Relation interface
161
+ // ---------------------------------------------------------------------------
162
+
163
+ /**
164
+ * A directed relationship between two nodes in the code intelligence graph.
165
+ *
166
+ * The `source` and `target` fields reference node IDs (see {@link GraphNode.id}).
167
+ * Confidence reflects how certain the extractor is about this relationship,
168
+ * from 0.0 (speculative) to 1.0 (statically verified).
169
+ */
170
+ export interface GraphRelation {
171
+ /** ID of the originating node. */
172
+ source: string;
173
+ /** ID of the target node. */
174
+ target: string;
175
+ /** Semantic type of the relationship. */
176
+ type: GraphRelationType;
177
+ /**
178
+ * Extractor confidence for this relationship (0.0 to 1.0).
179
+ *
180
+ * Common values by type:
181
+ * - `calls` / `imports`: 0.9 (direct, strongly typed)
182
+ * - `extends` / `implements`: 0.85 (statically verifiable)
183
+ * - `has_method` / `has_property`: 0.95 (structural containment)
184
+ * - `accesses`: 0.8 (field read/write, may be indirect)
185
+ */
186
+ confidence: number;
187
+ /** Human-readable note explaining why this relation was emitted. */
188
+ reason?: string;
189
+ }
190
+
191
+ // ---------------------------------------------------------------------------
192
+ // Impact analysis result
193
+ // ---------------------------------------------------------------------------
194
+
195
+ /**
196
+ * Result of a BFS-based impact analysis starting from a named symbol.
197
+ *
198
+ * Affected nodes are grouped into three depth tiers that reflect the
199
+ * likelihood and urgency of breakage:
200
+ *
201
+ * - **depth1_willBreak** (d=1): Direct callers/importers — WILL break.
202
+ * Must be updated whenever the target changes.
203
+ * - **depth2_likelyAffected** (d=2): Indirect dependants — LIKELY affected.
204
+ * Should be tested.
205
+ * - **depth3_mayNeedTesting** (d=3): Transitive dependants — MAY need testing.
206
+ * Test if the symbol is on a critical path.
207
+ */
208
+ export interface ImpactResult {
209
+ /** Name or ID of the symbol that was analyzed. */
210
+ target: string;
211
+ /**
212
+ * Overall risk classification based on the number and type of affected nodes.
213
+ *
214
+ * - `low`: 0–3 direct dependants, no cross-module spread
215
+ * - `medium`: 4–9 direct dependants, or limited cross-module spread
216
+ * - `high`: 10+ direct dependants, or significant cross-module spread
217
+ * - `critical`: Exported symbol with high cross-module usage
218
+ */
219
+ riskLevel: 'low' | 'medium' | 'high' | 'critical';
220
+ /** Human-readable summary of the impact analysis outcome. */
221
+ summary: string;
222
+ /** Nodes affected at each traversal depth. */
223
+ affectedByDepth: {
224
+ /** d=1: Direct dependants — WILL BREAK. */
225
+ depth1_willBreak: GraphNode[];
226
+ /** d=2: Indirect dependants — LIKELY AFFECTED. */
227
+ depth2_likelyAffected: GraphNode[];
228
+ /** d=3: Transitive dependants — MAY NEED TESTING. */
229
+ depth3_mayNeedTesting: GraphNode[];
230
+ };
231
+ /** Total number of affected nodes across all depths. */
232
+ totalAffected: number;
233
+ }
234
+
235
+ // ---------------------------------------------------------------------------
236
+ // Pipeline interfaces (T529)
237
+ // ---------------------------------------------------------------------------
238
+
239
+ /**
240
+ * An in-memory symbol table entry tracking all files where a name appears.
241
+ * Used during ingestion to resolve cross-file call targets.
242
+ */
243
+ export interface SymbolIndex {
244
+ /** Symbol name as it appears in source (e.g., "parseFile"). */
245
+ name: string;
246
+ /** All node IDs that define this name across the project. */
247
+ nodeIds: string[];
248
+ /** All file paths that export this name. */
249
+ exportingFiles: string[];
250
+ }
251
+
252
+ /**
253
+ * The in-memory KnowledgeGraph assembled during a single ingestion run.
254
+ * Flushed to nexus_nodes + nexus_relations after all phases complete.
255
+ */
256
+ export interface KnowledgeGraph {
257
+ /** Primary node store: nodeId → GraphNode. */
258
+ nodes: Map<string, GraphNode>;
259
+ /** All directed edges (appended during ingestion, deduplicated at flush). */
260
+ relations: GraphRelation[];
261
+ /** Indexes for fast lookup during resolution phases. */
262
+ symbolTable: SymbolIndex[];
263
+ /** Files that changed since last index (incremental mode only). */
264
+ changedFiles?: Set<string>;
265
+ }
266
+
267
+ /**
268
+ * A community (module cluster) identified by Louvain community detection
269
+ * during Phase 5. Represents a group of cohesive symbols within the graph.
270
+ */
271
+ export interface CommunityNode {
272
+ /** Node ID format: `community:<n>` */
273
+ id: string;
274
+ /** Inferred label from the top folder name. */
275
+ label: string;
276
+ /** Number of member symbols in this community. */
277
+ memberCount: number;
278
+ /** Top-level folders contributing most members. */
279
+ topFolders: string[];
280
+ }
281
+
282
+ /**
283
+ * A detected execution flow (process) from BFS entry point analysis
284
+ * during Phase 6. Represents a named sequence of function calls.
285
+ */
286
+ export interface ProcessNode {
287
+ /** Node ID format: `process:<slug>` */
288
+ id: string;
289
+ /** Entry point function name used as the process label. */
290
+ label: string;
291
+ /** Node ID of the entry point function. */
292
+ entryPointId: string;
293
+ /** Ordered node IDs representing each step in the flow. */
294
+ stepIds: string[];
295
+ /** Total number of steps in this execution flow. */
296
+ stepCount: number;
297
+ }
package/src/index.ts CHANGED
@@ -46,8 +46,11 @@ export type {
46
46
  } from './backup-manifest.js';
47
47
  // === Brain/Memory Types ===
48
48
  export type {
49
+ BrainCognitiveType,
49
50
  BrainEntryRef,
50
51
  BrainEntrySummary,
52
+ BrainMemoryTier,
53
+ BrainSourceConfidence,
51
54
  ContradictionDetail,
52
55
  SupersededEntry,
53
56
  } from './brain.js';
@@ -77,6 +80,7 @@ export type {
77
80
  BrainEmbeddingConfig,
78
81
  BrainMemoryBridgeConfig,
79
82
  BrainSummarizationConfig,
83
+ BrainTieringConfig,
80
84
  CleoConfig,
81
85
  ConfigSource,
82
86
  DateFormat,
@@ -108,6 +112,13 @@ export type {
108
112
  TaskQueryFilters,
109
113
  TransactionAccessor,
110
114
  } from './data-accessor.js';
115
+ // === Dependency Registry Contracts ===
116
+ export type {
117
+ DependencyCategory,
118
+ DependencyCheckResult,
119
+ DependencyReport,
120
+ DependencySpec,
121
+ } from './dependency.js';
111
122
  export type { AdapterManifest, DetectionPattern } from './discovery.js';
112
123
  // === Error Utilities ===
113
124
  export {
@@ -164,6 +175,18 @@ export {
164
175
  AGENT_TYPES,
165
176
  BRAIN_OBSERVATION_TYPES,
166
177
  } from './facade.js';
178
+ // === Graph Intelligence Types (T512, T529) ===
179
+ export type {
180
+ CommunityNode,
181
+ GraphNode,
182
+ GraphNodeKind,
183
+ GraphRelation,
184
+ GraphRelationType,
185
+ ImpactResult,
186
+ KnowledgeGraph,
187
+ ProcessNode,
188
+ SymbolIndex,
189
+ } from './graph.js';
167
190
  export type { AdapterHookProvider } from './hooks.js';
168
191
  export type { AdapterInstallProvider, InstallOptions, InstallResult } from './install.js';
169
192
  export type {