musubix 1.4.4 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +48 -10
- package/README.ja.md +34 -5
- package/README.md +37 -6
- package/docs/API-REFERENCE.md +430 -2
- package/docs/INSTALL-GUIDE.ja.md +2 -2
- package/docs/INSTALL-GUIDE.md +2 -2
- package/docs/MUSUBIv1.6.1-enhancement_roadmap_20260105.md +291 -0
- package/docs/ROADMAP-v1.5.md +60 -56
- package/docs/USER-GUIDE.ja.md +717 -6
- package/docs/USER-GUIDE.md +717 -6
- package/docs/evolution-from-musubi-to-musubix.md +522 -6
- package/docs/getting-started-with-sdd.md +1 -1
- package/package.json +3 -2
package/docs/API-REFERENCE.md
CHANGED
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
- [Design](#design)
|
|
13
13
|
- [Codegen](#codegen)
|
|
14
14
|
- [Symbolic](#symbolic)
|
|
15
|
+
- [Inference](#inference) *(v1.4.5)*
|
|
16
|
+
- [REPL](#repl) *(v1.5.0)*
|
|
17
|
+
- [YATA Local](#yata-local) *(v1.6.3)*
|
|
18
|
+
- [YATA Global](#yata-global) *(v1.6.3)*
|
|
19
|
+
- [KGPR](#kgpr) *(v1.6.4)*
|
|
20
|
+
- [YATA Platform](#yata-platform) *(v1.7.0)*
|
|
15
21
|
- [Validation](#validation)
|
|
16
22
|
- [Utils](#utils)
|
|
17
23
|
- [MCP Server](#mcp-server)
|
|
@@ -291,6 +297,99 @@ const violations = checker.check(code, 'typescript');
|
|
|
291
297
|
|
|
292
298
|
---
|
|
293
299
|
|
|
300
|
+
### REPL
|
|
301
|
+
|
|
302
|
+
*(New in v1.5.0, Enhanced in v1.6.0)*
|
|
303
|
+
|
|
304
|
+
Interactive command-line interface components.
|
|
305
|
+
|
|
306
|
+
#### ReplEngine
|
|
307
|
+
|
|
308
|
+
Main REPL controller.
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
import { createReplEngine } from '@nahisaho/musubix-core';
|
|
312
|
+
|
|
313
|
+
const engine = createReplEngine({
|
|
314
|
+
history: { maxSize: 1000 },
|
|
315
|
+
prompt: { showProject: true, showPhase: true },
|
|
316
|
+
completion: { maxSuggestions: 10 },
|
|
317
|
+
output: { defaultFormat: 'auto' }
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
await engine.start();
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**Methods:**
|
|
324
|
+
|
|
325
|
+
| Method | Parameters | Returns | Description |
|
|
326
|
+
|--------|------------|---------|-------------|
|
|
327
|
+
| `start()` | - | `Promise<void>` | Starts REPL session |
|
|
328
|
+
| `stop()` | - | `Promise<void>` | Stops REPL session |
|
|
329
|
+
| `execute(command)` | `command: string` | `Promise<CommandResult>` | Executes command |
|
|
330
|
+
| `isRunning()` | - | `boolean` | Returns running state |
|
|
331
|
+
| `on(event, handler)` | `event: string, handler: Function` | `void` | Registers event handler |
|
|
332
|
+
|
|
333
|
+
#### CommandCompleter
|
|
334
|
+
|
|
335
|
+
TAB completion provider.
|
|
336
|
+
|
|
337
|
+
```typescript
|
|
338
|
+
import { createCommandCompleter } from '@nahisaho/musubix-core';
|
|
339
|
+
|
|
340
|
+
const completer = createCommandCompleter({ maxSuggestions: 10 });
|
|
341
|
+
completer.registerCommands(commandDefinitions);
|
|
342
|
+
|
|
343
|
+
const result = completer.complete('req', 3);
|
|
344
|
+
// { completions: ['requirements'], prefix: 'req' }
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
#### HistoryManager
|
|
348
|
+
|
|
349
|
+
Command history persistence.
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
import { createHistoryManager } from '@nahisaho/musubix-core';
|
|
353
|
+
|
|
354
|
+
const history = createHistoryManager({
|
|
355
|
+
maxSize: 1000,
|
|
356
|
+
filePath: '~/.musubix_history'
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
await history.load();
|
|
360
|
+
history.add('requirements analyze input.md');
|
|
361
|
+
await history.save();
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
#### SessionState
|
|
365
|
+
|
|
366
|
+
Session variable storage.
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
import { createSessionState } from '@nahisaho/musubix-core';
|
|
370
|
+
|
|
371
|
+
const session = createSessionState();
|
|
372
|
+
session.set('project', 'my-app');
|
|
373
|
+
const value = session.get('project'); // 'my-app'
|
|
374
|
+
const expanded = session.expand('design $project'); // 'design my-app'
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
#### OutputFormatter
|
|
378
|
+
|
|
379
|
+
Output formatting (JSON/YAML/Table).
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
import { createOutputFormatter } from '@nahisaho/musubix-core';
|
|
383
|
+
|
|
384
|
+
const formatter = createOutputFormatter({ defaultFormat: 'auto' });
|
|
385
|
+
console.log(formatter.format(data));
|
|
386
|
+
console.log(formatter.formatTable(arrayOfObjects));
|
|
387
|
+
console.log(formatter.formatJson(object));
|
|
388
|
+
console.log(formatter.formatYaml(object));
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
294
393
|
### Validation
|
|
295
394
|
|
|
296
395
|
#### ConstitutionalValidator
|
|
@@ -457,6 +556,335 @@ const report = validator.generateApprovalReport(result);
|
|
|
457
556
|
|
|
458
557
|
---
|
|
459
558
|
|
|
559
|
+
### Inference (v1.4.5)
|
|
560
|
+
|
|
561
|
+
The inference module provides OWL 2 RL reasoning and Datalog evaluation capabilities.
|
|
562
|
+
|
|
563
|
+
#### OWL2RLReasoner
|
|
564
|
+
|
|
565
|
+
Performs OWL 2 RL profile reasoning with 20+ built-in entailment rules.
|
|
566
|
+
|
|
567
|
+
```typescript
|
|
568
|
+
import { OWL2RLReasoner } from '@nahisaho/musubix-ontology-mcp';
|
|
569
|
+
|
|
570
|
+
const reasoner = new OWL2RLReasoner({
|
|
571
|
+
maxIterations: 100,
|
|
572
|
+
enablePropertyChains: true,
|
|
573
|
+
enableInverseProperties: true
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
const result = await reasoner.reason(store, {
|
|
577
|
+
onProgress: (progress) => console.log(`Iteration ${progress.iteration}`)
|
|
578
|
+
});
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
**Methods:**
|
|
582
|
+
|
|
583
|
+
| Method | Parameters | Returns | Description |
|
|
584
|
+
|--------|------------|---------|-------------|
|
|
585
|
+
| `reason(store, options)` | `store: N3Store, options?: ReasonerOptions` | `Promise<ReasoningResult>` | Execute reasoning |
|
|
586
|
+
| `getProvenanceLog()` | - | `ProvenanceLog` | Get inference provenance |
|
|
587
|
+
| `getRulesApplied()` | - | `string[]` | Get list of applied rules |
|
|
588
|
+
|
|
589
|
+
**Built-in Rules:**
|
|
590
|
+
|
|
591
|
+
| Rule | Description |
|
|
592
|
+
|------|-------------|
|
|
593
|
+
| `prp-dom` | Property domain inference |
|
|
594
|
+
| `prp-rng` | Property range inference |
|
|
595
|
+
| `prp-inv1/2` | Inverse property inference |
|
|
596
|
+
| `prp-trp` | Transitive property chaining |
|
|
597
|
+
| `prp-symp` | Symmetric property inference |
|
|
598
|
+
| `cax-sco` | SubClassOf propagation |
|
|
599
|
+
| `scm-spo` | SubPropertyOf inference |
|
|
600
|
+
| `eq-rep-s/p/o` | SameAs replacement |
|
|
601
|
+
|
|
602
|
+
---
|
|
603
|
+
|
|
604
|
+
#### DatalogEngine
|
|
605
|
+
|
|
606
|
+
Evaluates Datalog rules with stratified negation support.
|
|
607
|
+
|
|
608
|
+
```typescript
|
|
609
|
+
import { DatalogEngine } from '@nahisaho/musubix-ontology-mcp';
|
|
610
|
+
|
|
611
|
+
const engine = new DatalogEngine();
|
|
612
|
+
|
|
613
|
+
const rules = [
|
|
614
|
+
{
|
|
615
|
+
head: { predicate: 'ancestor', args: ['?x', '?y'] },
|
|
616
|
+
body: [{ predicate: 'parent', args: ['?x', '?y'] }]
|
|
617
|
+
}
|
|
618
|
+
];
|
|
619
|
+
|
|
620
|
+
const result = await engine.evaluate(rules, facts);
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
**Methods:**
|
|
624
|
+
|
|
625
|
+
| Method | Parameters | Returns | Description |
|
|
626
|
+
|--------|------------|---------|-------------|
|
|
627
|
+
| `evaluate(rules, facts, options)` | `rules: Rule[], facts: Fact[], options?: EvalOptions` | `Promise<EvaluationResult>` | Evaluate rules |
|
|
628
|
+
| `stratify(rules)` | `rules: Rule[]` | `Rule[][]` | Stratify rules by dependency |
|
|
629
|
+
|
|
630
|
+
---
|
|
631
|
+
|
|
632
|
+
#### InferenceExplainer
|
|
633
|
+
|
|
634
|
+
Generates human-readable explanations for inferred facts.
|
|
635
|
+
|
|
636
|
+
```typescript
|
|
637
|
+
import { InferenceExplainer, ExplanationFormat } from '@nahisaho/musubix-ontology-mcp';
|
|
638
|
+
|
|
639
|
+
const explainer = new InferenceExplainer(provenanceLog);
|
|
640
|
+
|
|
641
|
+
const explanation = explainer.explain(
|
|
642
|
+
subject, predicate, object,
|
|
643
|
+
ExplanationFormat.TEXT
|
|
644
|
+
);
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
**Methods:**
|
|
648
|
+
|
|
649
|
+
| Method | Parameters | Returns | Description |
|
|
650
|
+
|--------|------------|---------|-------------|
|
|
651
|
+
| `explain(s, p, o, format)` | `s: string, p: string, o: string, format: ExplanationFormat` | `string` | Generate explanation |
|
|
652
|
+
| `getInferenceChain(s, p, o)` | `s: string, p: string, o: string` | `InferenceStep[]` | Get inference chain |
|
|
653
|
+
|
|
654
|
+
**Explanation Formats:**
|
|
655
|
+
|
|
656
|
+
| Format | Description |
|
|
657
|
+
|--------|-------------|
|
|
658
|
+
| `TEXT` | Plain text explanation |
|
|
659
|
+
| `MARKDOWN` | Markdown formatted |
|
|
660
|
+
| `HTML` | HTML with styling |
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
#### ProgressReporter
|
|
665
|
+
|
|
666
|
+
Reports real-time inference progress.
|
|
667
|
+
|
|
668
|
+
```typescript
|
|
669
|
+
import { createProgressReporter } from '@nahisaho/musubix-ontology-mcp';
|
|
670
|
+
|
|
671
|
+
const reporter = createProgressReporter({
|
|
672
|
+
onProgress: (info) => console.log(`${info.phase}: ${info.newInferences} new`),
|
|
673
|
+
throttleMs: 500
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
await reasoner.reason(store, { progressReporter: reporter });
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
**Configuration:**
|
|
680
|
+
|
|
681
|
+
| Option | Type | Description |
|
|
682
|
+
|--------|------|-------------|
|
|
683
|
+
| `onProgress` | `(info: ProgressInfo) => void` | Progress callback |
|
|
684
|
+
| `throttleMs` | `number` | Throttle interval (default: 500ms) |
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
688
|
+
### YATA Platform (v1.7.0)
|
|
689
|
+
|
|
690
|
+
Version 1.7.0 introduces enhanced YATA platform APIs.
|
|
691
|
+
|
|
692
|
+
#### IndexOptimizer
|
|
693
|
+
|
|
694
|
+
Optimizes database indexes for improved query performance.
|
|
695
|
+
|
|
696
|
+
```typescript
|
|
697
|
+
import { IndexOptimizer } from '@nahisaho/yata-local';
|
|
698
|
+
|
|
699
|
+
const optimizer = new IndexOptimizer(database);
|
|
700
|
+
|
|
701
|
+
// Analyze query patterns
|
|
702
|
+
const analysis = await optimizer.analyzeQueryPatterns();
|
|
703
|
+
|
|
704
|
+
// Create optimal indexes
|
|
705
|
+
const created = await optimizer.createOptimalIndexes();
|
|
706
|
+
|
|
707
|
+
// Check index health
|
|
708
|
+
const health = await optimizer.checkIndexHealth();
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
**Methods:**
|
|
712
|
+
|
|
713
|
+
| Method | Parameters | Returns | Description |
|
|
714
|
+
|--------|------------|---------|-------------|
|
|
715
|
+
| `analyzeQueryPatterns()` | - | `QueryAnalysis` | Analyze query patterns |
|
|
716
|
+
| `createOptimalIndexes()` | - | `IndexCreationResult` | Create composite indexes |
|
|
717
|
+
| `checkIndexHealth()` | - | `IndexHealthReport` | Check fragmentation |
|
|
718
|
+
| `rebuildIndex(name)` | `name: string` | `void` | Rebuild specific index |
|
|
719
|
+
|
|
720
|
+
---
|
|
721
|
+
|
|
722
|
+
#### ExportPipeline
|
|
723
|
+
|
|
724
|
+
Exports knowledge graph data with transformation support.
|
|
725
|
+
|
|
726
|
+
```typescript
|
|
727
|
+
import { ExportPipeline } from '@nahisaho/yata-local';
|
|
728
|
+
|
|
729
|
+
const pipeline = new ExportPipeline(database);
|
|
730
|
+
|
|
731
|
+
// Full export
|
|
732
|
+
const data = await pipeline.exportFull({ namespace: 'myproject' });
|
|
733
|
+
|
|
734
|
+
// Incremental export
|
|
735
|
+
const changes = await pipeline.exportIncremental({
|
|
736
|
+
since: lastExportTime,
|
|
737
|
+
format: 'json'
|
|
738
|
+
});
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
**Methods:**
|
|
742
|
+
|
|
743
|
+
| Method | Parameters | Returns | Description |
|
|
744
|
+
|--------|------------|---------|-------------|
|
|
745
|
+
| `exportFull(options)` | `ExportOptions` | `ExportData` | Full data export |
|
|
746
|
+
| `exportIncremental(options)` | `IncrementalOptions` | `ExportData` | Export changes since timestamp |
|
|
747
|
+
| `exportWithTransform(options)` | `TransformOptions` | `ExportData` | Export with format transformation |
|
|
748
|
+
|
|
749
|
+
**Export Formats:**
|
|
750
|
+
|
|
751
|
+
| Format | Description |
|
|
752
|
+
|--------|-------------|
|
|
753
|
+
| `json` | JSON format (default) |
|
|
754
|
+
| `rdf` | RDF/Turtle format |
|
|
755
|
+
| `ntriples` | N-Triples format |
|
|
756
|
+
|
|
757
|
+
---
|
|
758
|
+
|
|
759
|
+
#### GlobalSyncClient
|
|
760
|
+
|
|
761
|
+
Synchronizes local knowledge graph with YATA Global.
|
|
762
|
+
|
|
763
|
+
```typescript
|
|
764
|
+
import { GlobalSyncClient } from '@nahisaho/yata-global';
|
|
765
|
+
|
|
766
|
+
const client = new GlobalSyncClient({
|
|
767
|
+
endpoint: 'https://yata-global.example.com',
|
|
768
|
+
offlineMode: true
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
await client.initialize();
|
|
772
|
+
|
|
773
|
+
const result = await client.sync({
|
|
774
|
+
namespace: 'myproject',
|
|
775
|
+
direction: 'push'
|
|
776
|
+
});
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
**Methods:**
|
|
780
|
+
|
|
781
|
+
| Method | Parameters | Returns | Description |
|
|
782
|
+
|--------|------------|---------|-------------|
|
|
783
|
+
| `initialize()` | - | `Promise<void>` | Initialize client |
|
|
784
|
+
| `sync(options)` | `SyncOptions` | `SyncResult` | Synchronize data |
|
|
785
|
+
| `getStatus()` | - | `SyncStatus` | Get sync status |
|
|
786
|
+
| `resolveConflict(id, resolution)` | `id: string, resolution: Resolution` | `void` | Resolve conflict |
|
|
787
|
+
|
|
788
|
+
---
|
|
789
|
+
|
|
790
|
+
#### SyncEngine
|
|
791
|
+
|
|
792
|
+
Core synchronization engine with conflict resolution.
|
|
793
|
+
|
|
794
|
+
```typescript
|
|
795
|
+
import { SyncEngine } from '@nahisaho/yata-global';
|
|
796
|
+
|
|
797
|
+
const engine = new SyncEngine({
|
|
798
|
+
conflictStrategy: 'server-wins',
|
|
799
|
+
batchSize: 100
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
const result = await engine.sync(localData, remoteData);
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
**Conflict Strategies:**
|
|
806
|
+
|
|
807
|
+
| Strategy | Description |
|
|
808
|
+
|----------|-------------|
|
|
809
|
+
| `server-wins` | Server data takes precedence |
|
|
810
|
+
| `client-wins` | Client data takes precedence |
|
|
811
|
+
| `merge` | Attempt automatic merge |
|
|
812
|
+
| `manual` | Require manual resolution |
|
|
813
|
+
|
|
814
|
+
---
|
|
815
|
+
|
|
816
|
+
#### CacheManager
|
|
817
|
+
|
|
818
|
+
Manages local caching for offline support.
|
|
819
|
+
|
|
820
|
+
```typescript
|
|
821
|
+
import { CacheManager } from '@nahisaho/yata-global';
|
|
822
|
+
|
|
823
|
+
const cache = new CacheManager({
|
|
824
|
+
maxSize: 100 * 1024 * 1024, // 100MB
|
|
825
|
+
ttl: 24 * 60 * 60 * 1000 // 24 hours
|
|
826
|
+
});
|
|
827
|
+
|
|
828
|
+
await cache.set('key', data);
|
|
829
|
+
const cached = await cache.get('key');
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
**Methods:**
|
|
833
|
+
|
|
834
|
+
| Method | Parameters | Returns | Description |
|
|
835
|
+
|--------|------------|---------|-------------|
|
|
836
|
+
| `get(key)` | `key: string` | `T \| undefined` | Get cached item |
|
|
837
|
+
| `set(key, value)` | `key: string, value: T` | `void` | Cache item |
|
|
838
|
+
| `has(key)` | `key: string` | `boolean` | Check if exists |
|
|
839
|
+
| `clearAll()` | - | `void` | Clear all cache |
|
|
840
|
+
| `getStats()` | - | `CacheStats` | Get cache statistics |
|
|
841
|
+
|
|
842
|
+
---
|
|
843
|
+
|
|
844
|
+
#### YataUIServer
|
|
845
|
+
|
|
846
|
+
Web-based visualization server for knowledge graphs.
|
|
847
|
+
|
|
848
|
+
```typescript
|
|
849
|
+
import { YataUIServer, createYataUIServer } from '@nahisaho/yata-ui';
|
|
850
|
+
|
|
851
|
+
const server = createYataUIServer({
|
|
852
|
+
port: 3000,
|
|
853
|
+
host: 'localhost',
|
|
854
|
+
cors: true,
|
|
855
|
+
enableRealtime: true
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
server.setDataProvider(async () => ({
|
|
859
|
+
nodes: await getEntities(),
|
|
860
|
+
edges: await getRelationships()
|
|
861
|
+
}));
|
|
862
|
+
|
|
863
|
+
await server.start();
|
|
864
|
+
```
|
|
865
|
+
|
|
866
|
+
**Methods:**
|
|
867
|
+
|
|
868
|
+
| Method | Parameters | Returns | Description |
|
|
869
|
+
|--------|------------|---------|-------------|
|
|
870
|
+
| `start()` | - | `Promise<void>` | Start server |
|
|
871
|
+
| `stop()` | - | `Promise<void>` | Stop server |
|
|
872
|
+
| `isRunning()` | - | `boolean` | Check if running |
|
|
873
|
+
| `getUrl()` | - | `string` | Get server URL |
|
|
874
|
+
| `setDataProvider(fn)` | `DataProvider` | `void` | Set data provider |
|
|
875
|
+
| `broadcastUpdate(event, data)` | `event: string, data: any` | `void` | Broadcast to clients |
|
|
876
|
+
|
|
877
|
+
**Configuration:**
|
|
878
|
+
|
|
879
|
+
| Option | Type | Default | Description |
|
|
880
|
+
|--------|------|---------|-------------|
|
|
881
|
+
| `port` | `number` | `3000` | Server port |
|
|
882
|
+
| `host` | `string` | `localhost` | Server host |
|
|
883
|
+
| `cors` | `boolean` | `true` | Enable CORS |
|
|
884
|
+
| `enableRealtime` | `boolean` | `true` | Enable WebSocket |
|
|
885
|
+
|
|
886
|
+
---
|
|
887
|
+
|
|
460
888
|
### Utils
|
|
461
889
|
|
|
462
890
|
#### I18nManager
|
|
@@ -754,6 +1182,6 @@ MIT License - see [LICENSE](./LICENSE) for details.
|
|
|
754
1182
|
|
|
755
1183
|
---
|
|
756
1184
|
|
|
757
|
-
**Version:** 1.
|
|
758
|
-
**Generated:** 2026-01-
|
|
1185
|
+
**Version:** 1.7.0
|
|
1186
|
+
**Generated:** 2026-01-06
|
|
759
1187
|
**MUSUBIX Core Package**
|
package/docs/INSTALL-GUIDE.ja.md
CHANGED