@musubix/knowledge 3.6.0 → 3.7.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 nahisaho
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @fileoverview Integration layer exports for knowledge
3
+ * @traceability TSK-INT-003
4
+ */
5
+ export * from './types.js';
6
+ export * from './skill-knowledge-bridge.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integration/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @fileoverview Integration layer exports for knowledge
3
+ * @traceability TSK-INT-003
4
+ */
5
+ export * from './types.js';
6
+ export * from './skill-knowledge-bridge.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/integration/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @fileoverview Skill-Knowledge Bridge Implementation
3
+ * Integrates skills with Knowledge Graph
4
+ *
5
+ * @traceability TSK-INT-003, DES-v3.7.0 Section 9.4
6
+ */
7
+ import type { SkillKnowledgeBridge, SkillKnowledgeBridgeConfig, SkillEntity, ContextQueryResult } from './types.js';
8
+ /**
9
+ * Create a Skill-Knowledge Bridge instance
10
+ */
11
+ export declare function createSkillKnowledgeBridge(config?: Partial<SkillKnowledgeBridgeConfig>): SkillKnowledgeBridge;
12
+ /**
13
+ * Format session as markdown for display
14
+ */
15
+ export declare function formatSessionAsMarkdown(session: SkillEntity): string;
16
+ /**
17
+ * Format context query result as markdown
18
+ */
19
+ export declare function formatContextAsMarkdown(result: ContextQueryResult): string;
20
+ //# sourceMappingURL=skill-knowledge-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-knowledge-bridge.d.ts","sourceRoot":"","sources":["../../src/integration/skill-knowledge-bridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,WAAW,EAIX,kBAAkB,EAMnB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,GAAE,OAAO,CAAC,0BAA0B,CAAM,GAC/C,oBAAoB,CA2YtB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAgCpE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAwB1E"}
@@ -0,0 +1,388 @@
1
+ /**
2
+ * @fileoverview Skill-Knowledge Bridge Implementation
3
+ * Integrates skills with Knowledge Graph
4
+ *
5
+ * @traceability TSK-INT-003, DES-v3.7.0 Section 9.4
6
+ */
7
+ import { createKnowledgeStore } from '../index.js';
8
+ import { DEFAULT_SKILL_KNOWLEDGE_BRIDGE_CONFIG, } from './types.js';
9
+ /**
10
+ * Create a Skill-Knowledge Bridge instance
11
+ */
12
+ export function createSkillKnowledgeBridge(config = {}) {
13
+ const fullConfig = {
14
+ ...DEFAULT_SKILL_KNOWLEDGE_BRIDGE_CONFIG,
15
+ ...config,
16
+ };
17
+ // Resolve home directory
18
+ const basePath = fullConfig.basePath.replace(/^~/, process.env.HOME ?? '');
19
+ const store = createKnowledgeStore(basePath);
20
+ /**
21
+ * Generate unique ID with prefix
22
+ */
23
+ function generateId(prefix) {
24
+ const timestamp = Date.now().toString(36);
25
+ const random = Math.random().toString(36).substring(2, 8);
26
+ return `${prefix}-${timestamp}-${random}`;
27
+ }
28
+ /**
29
+ * Convert SkillEntity to base Entity
30
+ */
31
+ function toBaseEntity(skill) {
32
+ // Map SkillEntityType to EntityType (use 'code' as fallback for skill-specific types)
33
+ const baseType = ['requirement', 'design', 'task', 'code', 'decision', 'pattern', 'constraint'].includes(skill.type)
34
+ ? skill.type
35
+ : 'code'; // Use 'code' as generic fallback
36
+ return {
37
+ id: skill.id,
38
+ type: baseType,
39
+ name: skill.name,
40
+ description: skill.description,
41
+ properties: {
42
+ ...skill.properties,
43
+ skillEntityType: skill.type, // Preserve original type
44
+ },
45
+ tags: skill.tags,
46
+ createdAt: '',
47
+ updatedAt: '',
48
+ };
49
+ }
50
+ /**
51
+ * Convert base Entity to SkillEntity
52
+ */
53
+ function fromBaseEntity(entity) {
54
+ const skillType = entity.properties.skillEntityType ?? entity.type;
55
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
56
+ const { skillEntityType, ...properties } = entity.properties;
57
+ return {
58
+ id: entity.id,
59
+ type: skillType,
60
+ name: entity.name,
61
+ description: entity.description,
62
+ properties: properties,
63
+ tags: entity.tags,
64
+ };
65
+ }
66
+ /**
67
+ * Calculate relevance score for context query
68
+ */
69
+ function calculateRelevance(entity, context) {
70
+ let score = 0;
71
+ // Session match
72
+ if (context.sessionId && entity.properties.kind === 'session') {
73
+ if (entity.id === context.sessionId) {
74
+ score += 0.5;
75
+ }
76
+ }
77
+ // Skill match
78
+ if (context.currentSkill && entity.properties.kind === 'skill') {
79
+ if (entity.name.toLowerCase().includes(context.currentSkill.toLowerCase())) {
80
+ score += 0.4;
81
+ }
82
+ }
83
+ // Keyword match
84
+ if (context.taskKeywords && context.taskKeywords.length > 0) {
85
+ const entityText = `${entity.name} ${entity.description ?? ''} ${JSON.stringify(entity.properties)}`.toLowerCase();
86
+ const matchedKeywords = context.taskKeywords.filter(k => entityText.includes(k.toLowerCase()));
87
+ score += 0.1 * matchedKeywords.length;
88
+ }
89
+ // Error context match for patterns
90
+ if (context.errorContext && entity.properties.kind === 'learned_pattern') {
91
+ const patternProps = entity.properties;
92
+ if (patternProps.problem.toLowerCase().includes(context.errorContext.toLowerCase())) {
93
+ score += 0.6;
94
+ }
95
+ }
96
+ // Recency boost for sessions
97
+ if (entity.properties.kind === 'session') {
98
+ const props = entity.properties;
99
+ const age = Date.now() - new Date(props.startedAt).getTime();
100
+ const dayMs = 24 * 60 * 60 * 1000;
101
+ if (age < dayMs) {
102
+ score += 0.2;
103
+ }
104
+ else if (age < 7 * dayMs) {
105
+ score += 0.1;
106
+ }
107
+ }
108
+ return Math.min(1, score);
109
+ }
110
+ return {
111
+ async storeSkillEntity(entity) {
112
+ await store.putEntity(toBaseEntity(entity));
113
+ if (fullConfig.autoSave) {
114
+ await store.save();
115
+ }
116
+ },
117
+ async getSkillEntity(id) {
118
+ const entity = await store.getEntity(id);
119
+ return entity ? fromBaseEntity(entity) : undefined;
120
+ },
121
+ async deleteSkillEntity(id) {
122
+ const result = await store.deleteEntity(id);
123
+ if (result && fullConfig.autoSave) {
124
+ await store.save();
125
+ }
126
+ return result;
127
+ },
128
+ async addSkillRelation(sourceId, targetId, type, properties) {
129
+ // Map to base relation type
130
+ const baseType = ['implements', 'depends_on', 'traces_to', 'related_to', 'derives_from', 'conflicts_with'].includes(type)
131
+ ? type
132
+ : 'related_to';
133
+ const relationId = `rel-${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 8)}`;
134
+ const relation = {
135
+ id: relationId,
136
+ source: sourceId,
137
+ target: targetId,
138
+ type: baseType,
139
+ properties: {
140
+ ...properties,
141
+ skillRelationType: type, // Preserve original type
142
+ },
143
+ };
144
+ await store.addRelation(relation);
145
+ if (fullConfig.autoSave) {
146
+ await store.save();
147
+ }
148
+ },
149
+ async querySkillContext(context) {
150
+ const maxResults = context.maxResults ?? fullConfig.maxContextEntities;
151
+ const allEntities = await store.query({});
152
+ const scored = [];
153
+ for (const entity of allEntities) {
154
+ const skillEntity = fromBaseEntity(entity);
155
+ const score = calculateRelevance(skillEntity, context);
156
+ if (score > 0) {
157
+ scored.push({ entity: skillEntity, score });
158
+ }
159
+ }
160
+ // Sort by score and limit
161
+ scored.sort((a, b) => b.score - a.score);
162
+ const limited = scored.slice(0, maxResults);
163
+ // Determine query source
164
+ let querySource = 'related';
165
+ if (context.sessionId) {
166
+ querySource = 'session';
167
+ }
168
+ else if (context.errorContext) {
169
+ querySource = 'pattern';
170
+ }
171
+ return {
172
+ entities: limited.map(s => s.entity),
173
+ scores: new Map(limited.map(s => [s.entity.id, s.score])),
174
+ querySource,
175
+ };
176
+ },
177
+ async startSession(taskDescription) {
178
+ const sessionId = generateId('session');
179
+ const now = new Date().toISOString();
180
+ const session = {
181
+ id: sessionId,
182
+ type: 'session',
183
+ name: `Session ${sessionId}`,
184
+ description: taskDescription,
185
+ properties: {
186
+ kind: 'session',
187
+ startedAt: now,
188
+ status: 'active',
189
+ taskDescription,
190
+ skillsUsed: [],
191
+ checkpointCount: 0,
192
+ },
193
+ tags: ['session', 'active'],
194
+ };
195
+ await this.storeSkillEntity(session);
196
+ return sessionId;
197
+ },
198
+ async endSession(sessionId, status, skillsUsed) {
199
+ const session = await this.getSkillEntity(sessionId);
200
+ if (!session) {
201
+ throw new Error(`Session not found: ${sessionId}`);
202
+ }
203
+ const now = new Date().toISOString();
204
+ const props = session.properties;
205
+ const updated = {
206
+ ...session,
207
+ properties: {
208
+ ...props,
209
+ endedAt: now,
210
+ status,
211
+ skillsUsed,
212
+ },
213
+ tags: session.tags.filter(t => t !== 'active').concat(status),
214
+ };
215
+ await this.storeSkillEntity(updated);
216
+ },
217
+ async recordCheckpoint(sessionId, phase, snapshotPath) {
218
+ const checkpointId = generateId('checkpoint');
219
+ const checkpoint = {
220
+ id: checkpointId,
221
+ type: 'checkpoint',
222
+ name: `Checkpoint: ${phase}`,
223
+ description: `Checkpoint at phase ${phase} for session ${sessionId}`,
224
+ properties: {
225
+ kind: 'checkpoint',
226
+ sessionId,
227
+ phase,
228
+ snapshotPath,
229
+ verified: false,
230
+ },
231
+ tags: ['checkpoint', phase],
232
+ };
233
+ await this.storeSkillEntity(checkpoint);
234
+ await this.addSkillRelation(checkpointId, sessionId, 'checkpoint_of');
235
+ // Update session checkpoint count
236
+ const session = await this.getSkillEntity(sessionId);
237
+ if (session) {
238
+ const props = session.properties;
239
+ props.checkpointCount += 1;
240
+ await this.storeSkillEntity(session);
241
+ }
242
+ return checkpointId;
243
+ },
244
+ async recordEvalResult(sessionId, evalType, results) {
245
+ const evalId = generateId('eval');
246
+ const evalResult = {
247
+ id: evalId,
248
+ type: 'eval_result',
249
+ name: `${evalType} Evaluation`,
250
+ description: `${evalType} evaluation result for session ${sessionId}`,
251
+ properties: {
252
+ kind: 'eval_result',
253
+ evalType,
254
+ ...results,
255
+ },
256
+ tags: ['eval', evalType],
257
+ };
258
+ await this.storeSkillEntity(evalResult);
259
+ await this.addSkillRelation(evalId, sessionId, 'evaluated_by');
260
+ return evalId;
261
+ },
262
+ async getSessionHistory(limit = 10) {
263
+ const allEntities = await store.query({});
264
+ const sessions = allEntities
265
+ .map(fromBaseEntity)
266
+ .filter(e => e.type === 'session')
267
+ .sort((a, b) => {
268
+ const aTime = a.properties.startedAt;
269
+ const bTime = b.properties.startedAt;
270
+ return new Date(bTime).getTime() - new Date(aTime).getTime();
271
+ })
272
+ .slice(0, limit);
273
+ return sessions;
274
+ },
275
+ async getRelatedEntities(entityId, relationTypes, depth = 1) {
276
+ const related = await store.traverse(entityId, {
277
+ direction: 'both',
278
+ depth: depth,
279
+ });
280
+ const entities = related.map(fromBaseEntity);
281
+ if (relationTypes && relationTypes.length > 0) {
282
+ // Filter would need relation data - for now return all
283
+ return entities;
284
+ }
285
+ return entities;
286
+ },
287
+ async getStatistics() {
288
+ const allEntities = await store.query({});
289
+ const skillEntities = allEntities.map(fromBaseEntity);
290
+ const byType = {};
291
+ let completedSessions = 0;
292
+ let failedSessions = 0;
293
+ let totalCheckpoints = 0;
294
+ let totalLearnedPatterns = 0;
295
+ let totalSessionDuration = 0;
296
+ let sessionCount = 0;
297
+ for (const entity of skillEntities) {
298
+ byType[entity.type] = (byType[entity.type] ?? 0) + 1;
299
+ if (entity.type === 'session') {
300
+ const props = entity.properties;
301
+ sessionCount++;
302
+ if (props.status === 'completed')
303
+ completedSessions++;
304
+ if (props.status === 'failed')
305
+ failedSessions++;
306
+ if (props.endedAt) {
307
+ totalSessionDuration +=
308
+ new Date(props.endedAt).getTime() - new Date(props.startedAt).getTime();
309
+ }
310
+ }
311
+ else if (entity.type === 'checkpoint') {
312
+ totalCheckpoints++;
313
+ }
314
+ else if (entity.type === 'learned_pattern') {
315
+ totalLearnedPatterns++;
316
+ }
317
+ }
318
+ return {
319
+ totalEntities: skillEntities.length,
320
+ byType: byType,
321
+ totalSessions: sessionCount,
322
+ completedSessions,
323
+ failedSessions,
324
+ totalCheckpoints,
325
+ totalLearnedPatterns,
326
+ averageSessionDuration: sessionCount > 0
327
+ ? totalSessionDuration / sessionCount
328
+ : undefined,
329
+ };
330
+ },
331
+ };
332
+ }
333
+ /**
334
+ * Format session as markdown for display
335
+ */
336
+ export function formatSessionAsMarkdown(session) {
337
+ if (session.type !== 'session') {
338
+ throw new Error('Entity is not a session');
339
+ }
340
+ const props = session.properties;
341
+ const lines = [
342
+ `# 📋 Session: ${session.id}`,
343
+ '',
344
+ `**Status**: ${props.status}`,
345
+ `**Started**: ${props.startedAt}`,
346
+ ];
347
+ if (props.endedAt) {
348
+ lines.push(`**Ended**: ${props.endedAt}`);
349
+ const duration = new Date(props.endedAt).getTime() - new Date(props.startedAt).getTime();
350
+ const minutes = Math.round(duration / 60000);
351
+ lines.push(`**Duration**: ${minutes} minutes`);
352
+ }
353
+ if (props.taskDescription) {
354
+ lines.push('', '## Task', props.taskDescription);
355
+ }
356
+ if (props.skillsUsed.length > 0) {
357
+ lines.push('', '## Skills Used');
358
+ props.skillsUsed.forEach(s => lines.push(`- ${s}`));
359
+ }
360
+ lines.push('', `**Checkpoints**: ${props.checkpointCount}`);
361
+ return lines.join('\n');
362
+ }
363
+ /**
364
+ * Format context query result as markdown
365
+ */
366
+ export function formatContextAsMarkdown(result) {
367
+ if (result.entities.length === 0) {
368
+ return '📝 No relevant context found.\n';
369
+ }
370
+ const lines = [
371
+ `# 🔍 Context Query Result (${result.querySource})`,
372
+ '',
373
+ `Found ${result.entities.length} relevant entities:`,
374
+ '',
375
+ ];
376
+ for (const entity of result.entities) {
377
+ const score = result.scores.get(entity.id) ?? 0;
378
+ lines.push(`## ${entity.name}`);
379
+ lines.push(`- **Type**: ${entity.type}`);
380
+ lines.push(`- **Relevance**: ${(score * 100).toFixed(1)}%`);
381
+ if (entity.description) {
382
+ lines.push(`- **Description**: ${entity.description}`);
383
+ }
384
+ lines.push('');
385
+ }
386
+ return lines.join('\n');
387
+ }
388
+ //# sourceMappingURL=skill-knowledge-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-knowledge-bridge.js","sourceRoot":"","sources":["../../src/integ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/**
2
+ * @fileoverview Skill-Knowledge Bridge Types
3
+ * Integrates skills with Knowledge Graph
4
+ *
5
+ * @traceability TSK-INT-003, DES-v3.7.0 Section 9.4
6
+ */
7
+ import type { EntityType, RelationType } from '../index.js';
8
+ /**
9
+ * Skill entity types (extends base EntityType)
10
+ */
11
+ export type SkillEntityType = EntityType | 'skill' | 'session' | 'checkpoint' | 'eval_result' | 'learned_pattern';
12
+ /**
13
+ * Skill relation types (extends base RelationType)
14
+ */
15
+ export type SkillRelationType = RelationType | 'executed_by' | 'checkpoint_of' | 'evaluated_by' | 'learned_from' | 'triggered_by';
16
+ /**
17
+ * Skill entity for storing in knowledge graph
18
+ */
19
+ export interface SkillEntity {
20
+ /** Unique identifier */
21
+ id: string;
22
+ /** Entity type */
23
+ type: SkillEntityType;
24
+ /** Display name */
25
+ name: string;
26
+ /** Description */
27
+ description?: string;
28
+ /** Properties specific to skill type */
29
+ properties: SkillEntityProperties;
30
+ /** Tags for categorization */
31
+ tags: string[];
32
+ }
33
+ /**
34
+ * Properties for different skill entity types
35
+ */
36
+ export type SkillEntityProperties = SkillProperties | SessionProperties | CheckpointProperties | EvalResultProperties | LearnedPatternProperties;
37
+ /**
38
+ * Skill definition properties
39
+ */
40
+ export interface SkillProperties {
41
+ kind: 'skill';
42
+ version: string;
43
+ author?: string;
44
+ triggers: string[];
45
+ commands: string[];
46
+ successMetric?: string;
47
+ failureMetric?: string;
48
+ }
49
+ /**
50
+ * Session properties
51
+ */
52
+ export interface SessionProperties {
53
+ kind: 'session';
54
+ startedAt: string;
55
+ endedAt?: string;
56
+ status: 'active' | 'completed' | 'failed' | 'abandoned';
57
+ taskDescription?: string;
58
+ skillsUsed: string[];
59
+ checkpointCount: number;
60
+ }
61
+ /**
62
+ * Checkpoint properties
63
+ */
64
+ export interface CheckpointProperties {
65
+ kind: 'checkpoint';
66
+ sessionId: string;
67
+ phase: string;
68
+ snapshotPath: string;
69
+ verified: boolean;
70
+ verificationTime?: string;
71
+ }
72
+ /**
73
+ * Evaluation result properties
74
+ */
75
+ export interface EvalResultProperties {
76
+ kind: 'eval_result';
77
+ evalType: 'capability' | 'regression' | 'human';
78
+ passAt1?: number;
79
+ passAt3?: number;
80
+ consecutiveAt3?: number;
81
+ testsPassed: number;
82
+ testsFailed: number;
83
+ notes?: string;
84
+ }
85
+ /**
86
+ * Learned pattern properties
87
+ */
88
+ export interface LearnedPatternProperties {
89
+ kind: 'learned_pattern';
90
+ category: string;
91
+ problem: string;
92
+ solution: string;
93
+ confidence: number;
94
+ usageCount: number;
95
+ sourceSession?: string;
96
+ }
97
+ /**
98
+ * Skill context for queries
99
+ */
100
+ export interface SkillQueryContext {
101
+ /** Current skill being executed */
102
+ currentSkill?: string;
103
+ /** Current session ID */
104
+ sessionId?: string;
105
+ /** Task keywords */
106
+ taskKeywords?: string[];
107
+ /** File paths being worked on */
108
+ filePaths?: string[];
109
+ /** Error context if any */
110
+ errorContext?: string;
111
+ /** Max results to return */
112
+ maxResults?: number;
113
+ }
114
+ /**
115
+ * Context query result
116
+ */
117
+ export interface ContextQueryResult {
118
+ /** Relevant entities */
119
+ entities: SkillEntity[];
120
+ /** Relevance scores */
121
+ scores: Map<string, number>;
122
+ /** Query source (where the context came from) */
123
+ querySource: 'session' | 'pattern' | 'eval' | 'related';
124
+ }
125
+ /**
126
+ * Configuration for Skill-Knowledge Bridge
127
+ */
128
+ export interface SkillKnowledgeBridgeConfig {
129
+ /** Base path for knowledge store */
130
+ basePath: string;
131
+ /** Auto-save on store operations */
132
+ autoSave: boolean;
133
+ /** Maximum context entities to return */
134
+ maxContextEntities: number;
135
+ /** Enable semantic search (if embedding service available) */
136
+ enableSemanticSearch: boolean;
137
+ }
138
+ /**
139
+ * Default configuration
140
+ */
141
+ export declare const DEFAULT_SKILL_KNOWLEDGE_BRIDGE_CONFIG: SkillKnowledgeBridgeConfig;
142
+ /**
143
+ * Interface for Skill-Knowledge Bridge
144
+ */
145
+ export interface SkillKnowledgeBridge {
146
+ /**
147
+ * Store a skill entity in the knowledge graph
148
+ */
149
+ storeSkillEntity(entity: SkillEntity): Promise<void>;
150
+ /**
151
+ * Get a skill entity by ID
152
+ */
153
+ getSkillEntity(id: string): Promise<SkillEntity | undefined>;
154
+ /**
155
+ * Delete a skill entity
156
+ */
157
+ deleteSkillEntity(id: string): Promise<boolean>;
158
+ /**
159
+ * Add relation between skill entities
160
+ */
161
+ addSkillRelation(sourceId: string, targetId: string, type: SkillRelationType, properties?: Record<string, unknown>): Promise<void>;
162
+ /**
163
+ * Query context relevant to current skill execution
164
+ */
165
+ querySkillContext(context: SkillQueryContext): Promise<ContextQueryResult>;
166
+ /**
167
+ * Record session start
168
+ */
169
+ startSession(taskDescription?: string): Promise<string>;
170
+ /**
171
+ * Record session end
172
+ */
173
+ endSession(sessionId: string, status: SessionProperties['status'], skillsUsed: string[]): Promise<void>;
174
+ /**
175
+ * Record checkpoint
176
+ */
177
+ recordCheckpoint(sessionId: string, phase: string, snapshotPath: string): Promise<string>;
178
+ /**
179
+ * Record evaluation result
180
+ */
181
+ recordEvalResult(sessionId: string, evalType: EvalResultProperties['evalType'], results: Omit<EvalResultProperties, 'kind' | 'evalType'>): Promise<string>;
182
+ /**
183
+ * Get session history
184
+ */
185
+ getSessionHistory(limit?: number): Promise<SkillEntity[]>;
186
+ /**
187
+ * Get related entities
188
+ */
189
+ getRelatedEntities(entityId: string, relationTypes?: SkillRelationType[], depth?: number): Promise<SkillEntity[]>;
190
+ /**
191
+ * Get statistics
192
+ */
193
+ getStatistics(): Promise<SkillKnowledgeStatistics>;
194
+ }
195
+ /**
196
+ * Statistics for skill knowledge
197
+ */
198
+ export interface SkillKnowledgeStatistics {
199
+ /** Total entities */
200
+ totalEntities: number;
201
+ /** Entities by type */
202
+ byType: Record<SkillEntityType, number>;
203
+ /** Total sessions */
204
+ totalSessions: number;
205
+ /** Completed sessions */
206
+ completedSessions: number;
207
+ /** Failed sessions */
208
+ failedSessions: number;
209
+ /** Total checkpoints */
210
+ totalCheckpoints: number;
211
+ /** Total learned patterns */
212
+ totalLearnedPatterns: number;
213
+ /** Average session duration (ms) */
214
+ averageSessionDuration?: number;
215
+ }
216
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/integration/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,OAAO,GACP,SAAS,GACT,YAAY,GACZ,aAAa,GACb,iBAAiB,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ,aAAa,GACb,eAAe,GACf,cAAc,GACd,cAAc,GACd,cAAc,CAAC;AAEnB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB;IAClB,IAAI,EAAE,eAAe,CAAC;IACtB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,UAAU,EAAE,qBAAqB,CAAC;IAClC,8BAA8B;IAC9B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,eAAe,GACf,iBAAiB,GACjB,oBAAoB,GACpB,oBAAoB,GACpB,wBAAwB,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,C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AAC,eAAe,EAAE,MAAM,CAAC,CAAC;IACxC,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,wBAAwB;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,6BAA6B;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oCAAoC;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @fileoverview Skill-Knowledge Bridge Types
3
+ * Integrates skills with Knowledge Graph
4
+ *
5
+ * @traceability TSK-INT-003, DES-v3.7.0 Section 9.4
6
+ */
7
+ /**
8
+ * Default configuration
9
+ */
10
+ export const DEFAULT_SKILL_KNOWLEDGE_BRIDGE_CONFIG = {
11
+ basePath: '~/.musubix/knowledge',
12
+ autoSave: true,
13
+ maxContextEntities: 20,
14
+ enableSemanticSearch: false,
15
+ };
16
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/integration/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmKH;;GAEG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAA+B;IAC/E,QAAQ,EAAE,sBAAsB;IAChC,QAAQ,EAAE,IAAI;IACd,kBAAkB,EAAE,EAAE;IACtB,oBAAoB,EAAE,KAAK;CAC5B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@musubix/knowledge",
3
- "version": "3.6.0",
3
+ "version": "3.7.3",
4
4
  "description": "Git-Native Knowledge Store for MUSUBIX - File-based knowledge graph management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -14,13 +14,6 @@
14
14
  "files": [
15
15
  "dist"
16
16
  ],
17
- "scripts": {
18
- "build": "tsc",
19
- "test": "vitest run",
20
- "test:watch": "vitest",
21
- "clean": "rm -rf dist",
22
- "typecheck": "tsc --noEmit"
23
- },
24
17
  "keywords": [
25
18
  "musubix",
26
19
  "knowledge-graph",
@@ -40,5 +33,12 @@
40
33
  "devDependencies": {
41
34
  "typescript": "^5.3.0",
42
35
  "vitest": "^4.0.16"
36
+ },
37
+ "scripts": {
38
+ "build": "tsc",
39
+ "test": "vitest run",
40
+ "test:watch": "vitest",
41
+ "clean": "rm -rf dist",
42
+ "typecheck": "tsc --noEmit"
43
43
  }
44
- }
44
+ }