musubix 1.6.0 → 1.8.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 +46 -9
- package/README.ja.md +8 -3
- package/README.md +11 -4
- package/docs/API-REFERENCE.md +444 -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/USER-GUIDE.ja.md +598 -6
- package/docs/USER-GUIDE.md +598 -6
- package/docs/evolution-from-musubi-to-musubix.md +418 -4
- package/docs/getting-started-with-sdd.md +1 -1
- package/docs/overview/MUSUBIX-Core.md +671 -0
- package/docs/overview/MUSUBIX-FormalVerify.md +566 -0
- package/docs/overview/MUSUBIX-Learning.md +837 -0
- package/docs/overview/MUSUBIX-MCP-Server.md +535 -0
- package/docs/overview/MUSUBIX-Overview.md +264 -0
- package/docs/overview/MUSUBIX-Roadmap-v2.md +399 -0
- package/docs/overview/MUSUBIX-Security-Plan.md +939 -0
- package/docs/overview/MUSUBIX-YATA.md +666 -0
- package/docs/overview/Neuro-SymbolicAI.md +159 -0
- package/package.json +5 -3
package/docs/USER-GUIDE.md
CHANGED
|
@@ -17,10 +17,15 @@
|
|
|
17
17
|
9. [Consistency Validation](#consistency-validation) *(v1.4.1)*
|
|
18
18
|
10. [Advanced Inference](#advanced-inference) *(v1.4.5)*
|
|
19
19
|
11. [Interactive REPL Mode](#interactive-repl-mode) *(v1.5.0)*
|
|
20
|
-
12. [
|
|
21
|
-
13. [YATA
|
|
22
|
-
14. [
|
|
23
|
-
15. [
|
|
20
|
+
12. [YATA Local](#yata-local) *(v1.6.3)*
|
|
21
|
+
13. [YATA Global](#yata-global) *(v1.6.3)*
|
|
22
|
+
14. [KGPR - Knowledge Graph Pull Request](#kgpr---knowledge-graph-pull-request) *(v1.6.4)*
|
|
23
|
+
15. [YATA Platform Enhancements](#yata-platform-enhancements) *(v1.7.0)*
|
|
24
|
+
16. [Formal Verification](#formal-verification) *(v1.7.5)*
|
|
25
|
+
17. [MCP Server Integration](#mcp-server-integration)
|
|
26
|
+
17. [YATA Integration](#yata-integration)
|
|
27
|
+
18. [Best Practices](#best-practices)
|
|
28
|
+
19. [Troubleshooting](#troubleshooting)
|
|
24
29
|
|
|
25
30
|
---
|
|
26
31
|
|
|
@@ -615,6 +620,593 @@ musubix> history clear
|
|
|
615
620
|
|
|
616
621
|
---
|
|
617
622
|
|
|
623
|
+
## YATA Local
|
|
624
|
+
|
|
625
|
+
*(New in v1.6.3)*
|
|
626
|
+
|
|
627
|
+
YATA Local provides a high-performance, SQLite-based local knowledge graph with built-in inference capabilities. Designed for single-user, offline scenarios where data sovereignty and speed are critical.
|
|
628
|
+
|
|
629
|
+
### Features
|
|
630
|
+
|
|
631
|
+
| Feature | Description |
|
|
632
|
+
|---------|-------------|
|
|
633
|
+
| **SQLite Storage** | WAL mode for concurrent reads, single-writer |
|
|
634
|
+
| **Full-Text Search** | FTS5-based triple search |
|
|
635
|
+
| **Graph Traversal** | BFS/DFS with depth control |
|
|
636
|
+
| **Inference Engine** | 4 OWL-lite rules (transitivity, symmetry, inverse, domain/range) |
|
|
637
|
+
| **Constraints** | 4 validation rules (cardinality, disjoint, unique, required) |
|
|
638
|
+
| **ACID Transactions** | Full transaction support |
|
|
639
|
+
|
|
640
|
+
### Installation
|
|
641
|
+
|
|
642
|
+
```bash
|
|
643
|
+
npm install @nahisaho/yata-local
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
### Quick Start
|
|
647
|
+
|
|
648
|
+
```typescript
|
|
649
|
+
import { YataLocal } from '@nahisaho/yata-local';
|
|
650
|
+
|
|
651
|
+
// Initialize with default config
|
|
652
|
+
const yata = new YataLocal('./knowledge.db');
|
|
653
|
+
await yata.initialize();
|
|
654
|
+
|
|
655
|
+
// Add triples
|
|
656
|
+
await yata.addTriple({
|
|
657
|
+
subject: 'Person:john',
|
|
658
|
+
predicate: 'hasParent',
|
|
659
|
+
object: 'Person:mary'
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
// Query triples
|
|
663
|
+
const results = await yata.query({
|
|
664
|
+
subject: 'Person:john',
|
|
665
|
+
predicate: 'hasParent'
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
// Full-text search
|
|
669
|
+
const searchResults = await yata.search('john parent');
|
|
670
|
+
|
|
671
|
+
// Graph traversal (BFS)
|
|
672
|
+
const ancestors = await yata.traverse('Person:john', 'hasParent', {
|
|
673
|
+
direction: 'outgoing',
|
|
674
|
+
maxDepth: 5,
|
|
675
|
+
algorithm: 'bfs'
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
// Clean up
|
|
679
|
+
await yata.close();
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
### Inference Engine
|
|
683
|
+
|
|
684
|
+
YATA Local supports four OWL-lite inference rules:
|
|
685
|
+
|
|
686
|
+
| Rule | Description | Example |
|
|
687
|
+
|------|-------------|---------|
|
|
688
|
+
| **Transitivity** | If A→B and B→C then A→C | hasAncestor is transitive |
|
|
689
|
+
| **Symmetry** | If A→B then B→A | friendOf is symmetric |
|
|
690
|
+
| **Inverse** | If A→B via P then B→A via P⁻¹ | hasChild ↔ hasParent |
|
|
691
|
+
| **Domain/Range** | Type inference from predicate | hasAge implies Person |
|
|
692
|
+
|
|
693
|
+
```typescript
|
|
694
|
+
// Run inference
|
|
695
|
+
const inferred = await yata.infer();
|
|
696
|
+
console.log(`Inferred ${inferred.length} new triples`);
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
### Constraints
|
|
700
|
+
|
|
701
|
+
```typescript
|
|
702
|
+
// Define constraints
|
|
703
|
+
await yata.addConstraint({
|
|
704
|
+
type: 'cardinality',
|
|
705
|
+
predicate: 'hasSpouse',
|
|
706
|
+
max: 1
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
// Validate
|
|
710
|
+
const violations = await yata.validate();
|
|
711
|
+
if (violations.length > 0) {
|
|
712
|
+
console.error('Constraint violations:', violations);
|
|
713
|
+
}
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
### Configuration Options
|
|
717
|
+
|
|
718
|
+
```typescript
|
|
719
|
+
const yata = new YataLocal('./knowledge.db', {
|
|
720
|
+
// WAL mode for better concurrency (default: true)
|
|
721
|
+
walMode: true,
|
|
722
|
+
|
|
723
|
+
// Enable FTS5 search (default: true)
|
|
724
|
+
enableSearch: true,
|
|
725
|
+
|
|
726
|
+
// Auto-run inference on writes (default: false)
|
|
727
|
+
autoInfer: false,
|
|
728
|
+
|
|
729
|
+
// Journal mode (default: 'wal')
|
|
730
|
+
journalMode: 'wal'
|
|
731
|
+
});
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
---
|
|
735
|
+
|
|
736
|
+
## YATA Global
|
|
737
|
+
|
|
738
|
+
*(New in v1.6.3)*
|
|
739
|
+
|
|
740
|
+
YATA Global is a distributed knowledge graph platform for team collaboration. It provides REST API access to shared knowledge graphs with offline support and intelligent synchronization.
|
|
741
|
+
|
|
742
|
+
### Features
|
|
743
|
+
|
|
744
|
+
| Feature | Description |
|
|
745
|
+
|---------|-------------|
|
|
746
|
+
| **REST API** | Full CRUD operations via HTTP |
|
|
747
|
+
| **Offline Cache** | SQLite-based local cache |
|
|
748
|
+
| **Sync Engine** | Push/Pull with conflict resolution |
|
|
749
|
+
| **Conflict Resolution** | Last-write-wins or custom strategies |
|
|
750
|
+
| **Authentication** | API key-based auth |
|
|
751
|
+
| **Batch Operations** | Bulk triple operations |
|
|
752
|
+
|
|
753
|
+
### Installation
|
|
754
|
+
|
|
755
|
+
```bash
|
|
756
|
+
npm install @nahisaho/yata-global
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
### Quick Start
|
|
760
|
+
|
|
761
|
+
```typescript
|
|
762
|
+
import { YataGlobal } from '@nahisaho/yata-global';
|
|
763
|
+
|
|
764
|
+
// Initialize client
|
|
765
|
+
const yata = new YataGlobal({
|
|
766
|
+
endpoint: 'https://yata.example.com/api',
|
|
767
|
+
apiKey: 'your-api-key',
|
|
768
|
+
graphId: 'project-knowledge'
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
await yata.initialize();
|
|
772
|
+
|
|
773
|
+
// Add triples (batched)
|
|
774
|
+
await yata.addTriples([
|
|
775
|
+
{ subject: 'Task:001', predicate: 'assignedTo', object: 'User:alice' },
|
|
776
|
+
{ subject: 'Task:001', predicate: 'status', object: 'in-progress' }
|
|
777
|
+
]);
|
|
778
|
+
|
|
779
|
+
// Query with filters
|
|
780
|
+
const tasks = await yata.query({
|
|
781
|
+
predicate: 'assignedTo',
|
|
782
|
+
object: 'User:alice'
|
|
783
|
+
});
|
|
784
|
+
|
|
785
|
+
// Clean up
|
|
786
|
+
await yata.close();
|
|
787
|
+
```
|
|
788
|
+
|
|
789
|
+
### Offline Support
|
|
790
|
+
|
|
791
|
+
YATA Global supports offline-first operation with automatic synchronization:
|
|
792
|
+
|
|
793
|
+
```typescript
|
|
794
|
+
const yata = new YataGlobal({
|
|
795
|
+
endpoint: 'https://yata.example.com/api',
|
|
796
|
+
apiKey: 'your-api-key',
|
|
797
|
+
graphId: 'project-knowledge',
|
|
798
|
+
|
|
799
|
+
// Offline configuration
|
|
800
|
+
offlineMode: true,
|
|
801
|
+
cachePath: './yata-cache.db',
|
|
802
|
+
syncInterval: 60000 // Auto-sync every 60 seconds
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
// Works offline - cached locally
|
|
806
|
+
await yata.addTriple({
|
|
807
|
+
subject: 'Note:001',
|
|
808
|
+
predicate: 'content',
|
|
809
|
+
object: 'Important meeting notes'
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
// Manual sync when online
|
|
813
|
+
await yata.sync();
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
### Conflict Resolution
|
|
817
|
+
|
|
818
|
+
```typescript
|
|
819
|
+
const yata = new YataGlobal({
|
|
820
|
+
// ... other options
|
|
821
|
+
|
|
822
|
+
conflictStrategy: 'last-write-wins', // Default
|
|
823
|
+
// or: 'server-wins', 'client-wins', 'manual'
|
|
824
|
+
|
|
825
|
+
onConflict: async (local, remote) => {
|
|
826
|
+
// Custom resolution logic
|
|
827
|
+
console.log('Conflict detected:', local, remote);
|
|
828
|
+
return remote; // Prefer remote version
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
### Sync Status
|
|
834
|
+
|
|
835
|
+
```typescript
|
|
836
|
+
// Check sync status
|
|
837
|
+
const status = await yata.getSyncStatus();
|
|
838
|
+
console.log(`Pending changes: ${status.pendingPush}`);
|
|
839
|
+
console.log(`Last sync: ${status.lastSyncAt}`);
|
|
840
|
+
|
|
841
|
+
// Force full sync
|
|
842
|
+
await yata.sync({ force: true });
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
### When to Use YATA Local vs YATA Global
|
|
846
|
+
|
|
847
|
+
| Use Case | Recommended |
|
|
848
|
+
|----------|-------------|
|
|
849
|
+
| Personal knowledge base | YATA Local |
|
|
850
|
+
| Single-user application | YATA Local |
|
|
851
|
+
| Privacy-sensitive data | YATA Local |
|
|
852
|
+
| Team collaboration | YATA Global |
|
|
853
|
+
| Cross-device access | YATA Global |
|
|
854
|
+
| Shared project knowledge | YATA Global |
|
|
855
|
+
| Offline-first with sync | YATA Global |
|
|
856
|
+
|
|
857
|
+
---
|
|
858
|
+
|
|
859
|
+
## KGPR - Knowledge Graph Pull Request
|
|
860
|
+
|
|
861
|
+
*(v1.6.4)*
|
|
862
|
+
|
|
863
|
+
KGPR (Knowledge Graph Pull Request) enables safe sharing of knowledge graphs from YATA Local to YATA Global using a GitHub PR-like workflow.
|
|
864
|
+
|
|
865
|
+
### Workflow
|
|
866
|
+
|
|
867
|
+
```
|
|
868
|
+
┌─────────────┐ ┌──────────────┐ ┌───────────────┐
|
|
869
|
+
│ YATA Local │ ──► │ KGPR (Draft) │ ──► │ YATA Global │
|
|
870
|
+
│ (Local KG) │ │ (Extract) │ │ (Review/Merge)│
|
|
871
|
+
└─────────────┘ └──────────────┘ └───────────────┘
|
|
872
|
+
|
|
873
|
+
Status Flow:
|
|
874
|
+
draft → open → reviewing → approved/changes_requested → merged/closed
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
### Privacy Levels
|
|
878
|
+
|
|
879
|
+
| Level | Filtered Content |
|
|
880
|
+
|-------|------------------|
|
|
881
|
+
| `strict` | File paths, URLs, credentials, all metadata |
|
|
882
|
+
| `moderate` | File paths, URLs, credentials |
|
|
883
|
+
| `none` | No filtering |
|
|
884
|
+
|
|
885
|
+
### CLI Commands
|
|
886
|
+
|
|
887
|
+
```bash
|
|
888
|
+
# Create a KGPR
|
|
889
|
+
musubix kgpr create -t "Add authentication patterns"
|
|
890
|
+
|
|
891
|
+
# Preview diff before creating
|
|
892
|
+
musubix kgpr diff --namespace myproject --privacy moderate
|
|
893
|
+
|
|
894
|
+
# List KGPRs
|
|
895
|
+
musubix kgpr list
|
|
896
|
+
|
|
897
|
+
# Submit KGPR for review
|
|
898
|
+
musubix kgpr submit <id>
|
|
899
|
+
|
|
900
|
+
# Show KGPR details
|
|
901
|
+
musubix kgpr show <id>
|
|
902
|
+
|
|
903
|
+
# Close without merging
|
|
904
|
+
musubix kgpr close <id>
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
### MCP Tools
|
|
908
|
+
|
|
909
|
+
| Tool | Description |
|
|
910
|
+
|------|-------------|
|
|
911
|
+
| `kgpr_create` | Create KGPR from local knowledge graph |
|
|
912
|
+
| `kgpr_diff` | Preview diff before creating KGPR |
|
|
913
|
+
| `kgpr_list` | List all KGPRs |
|
|
914
|
+
| `kgpr_submit` | Submit KGPR for review |
|
|
915
|
+
| `kgpr_review` | Review KGPR (approve/changes_requested/commented) |
|
|
916
|
+
|
|
917
|
+
### Example Usage
|
|
918
|
+
|
|
919
|
+
```bash
|
|
920
|
+
# 1. Preview what will be shared
|
|
921
|
+
musubix kgpr diff --privacy strict
|
|
922
|
+
|
|
923
|
+
# 2. Create KGPR with description
|
|
924
|
+
musubix kgpr create -t "Share React patterns" -d "Learned patterns from project-x"
|
|
925
|
+
|
|
926
|
+
# 3. Review the KGPR
|
|
927
|
+
musubix kgpr show KGPR-001
|
|
928
|
+
|
|
929
|
+
# 4. Submit for review
|
|
930
|
+
musubix kgpr submit KGPR-001
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
---
|
|
934
|
+
|
|
935
|
+
## YATA Platform Enhancements
|
|
936
|
+
|
|
937
|
+
*(v1.7.0)*
|
|
938
|
+
|
|
939
|
+
Version 1.7.0 introduces significant enhancements to the YATA platform with 5 major features.
|
|
940
|
+
|
|
941
|
+
### Phase 1: Index Optimization
|
|
942
|
+
|
|
943
|
+
Optimized query performance for YATA Local with composite indexes.
|
|
944
|
+
|
|
945
|
+
```typescript
|
|
946
|
+
import { IndexOptimizer } from '@nahisaho/yata-local';
|
|
947
|
+
|
|
948
|
+
const optimizer = new IndexOptimizer(database);
|
|
949
|
+
|
|
950
|
+
// Analyze and create optimal indexes
|
|
951
|
+
const analysis = await optimizer.analyzeQueryPatterns();
|
|
952
|
+
const created = await optimizer.createOptimalIndexes();
|
|
953
|
+
|
|
954
|
+
// Check index health
|
|
955
|
+
const health = await optimizer.checkIndexHealth();
|
|
956
|
+
```
|
|
957
|
+
|
|
958
|
+
**Key Features:**
|
|
959
|
+
- Composite index creation for common query patterns
|
|
960
|
+
- Index health monitoring with fragmentation detection
|
|
961
|
+
- Automatic optimization recommendations
|
|
962
|
+
|
|
963
|
+
### Phase 2: Enhanced Export Pipeline
|
|
964
|
+
|
|
965
|
+
Powerful export capabilities with incremental export and multiple formats.
|
|
966
|
+
|
|
967
|
+
```typescript
|
|
968
|
+
import { ExportPipeline } from '@nahisaho/yata-local';
|
|
969
|
+
|
|
970
|
+
const pipeline = new ExportPipeline(database);
|
|
971
|
+
|
|
972
|
+
// Full export
|
|
973
|
+
const fullData = await pipeline.exportFull({ namespace: 'myproject' });
|
|
974
|
+
|
|
975
|
+
// Incremental export (changes since last export)
|
|
976
|
+
const changes = await pipeline.exportIncremental({
|
|
977
|
+
since: lastExportTimestamp,
|
|
978
|
+
format: 'json'
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
// Export with transformation
|
|
982
|
+
const transformed = await pipeline.exportWithTransform({
|
|
983
|
+
format: 'rdf',
|
|
984
|
+
includeMetadata: true
|
|
985
|
+
});
|
|
986
|
+
```
|
|
987
|
+
|
|
988
|
+
**Supported Formats:**
|
|
989
|
+
- JSON (default)
|
|
990
|
+
- RDF/Turtle
|
|
991
|
+
- N-Triples
|
|
992
|
+
- Custom transformers
|
|
993
|
+
|
|
994
|
+
### Phase 3: Global Sync Integration
|
|
995
|
+
|
|
996
|
+
Seamless synchronization between YATA Local and YATA Global.
|
|
997
|
+
|
|
998
|
+
```typescript
|
|
999
|
+
import { GlobalSyncClient, SyncEngine } from '@nahisaho/yata-global';
|
|
1000
|
+
|
|
1001
|
+
const client = new GlobalSyncClient({
|
|
1002
|
+
endpoint: 'https://yata-global.example.com',
|
|
1003
|
+
offlineMode: true
|
|
1004
|
+
});
|
|
1005
|
+
|
|
1006
|
+
// Initialize sync
|
|
1007
|
+
await client.initialize();
|
|
1008
|
+
|
|
1009
|
+
// Push local changes
|
|
1010
|
+
const syncResult = await client.sync({
|
|
1011
|
+
namespace: 'myproject',
|
|
1012
|
+
direction: 'push'
|
|
1013
|
+
});
|
|
1014
|
+
|
|
1015
|
+
// Pull updates from global
|
|
1016
|
+
await client.sync({
|
|
1017
|
+
namespace: 'shared-patterns',
|
|
1018
|
+
direction: 'pull'
|
|
1019
|
+
});
|
|
1020
|
+
```
|
|
1021
|
+
|
|
1022
|
+
**Features:**
|
|
1023
|
+
- Offline-first with automatic sync
|
|
1024
|
+
- Conflict resolution strategies
|
|
1025
|
+
- Selective namespace sync
|
|
1026
|
+
- Framework pattern repository
|
|
1027
|
+
|
|
1028
|
+
### Phase 4: Code Generator Enhancement
|
|
1029
|
+
|
|
1030
|
+
Advanced code generation from design documents.
|
|
1031
|
+
|
|
1032
|
+
```typescript
|
|
1033
|
+
import { CodeGenerator } from '@nahisaho/yata-local';
|
|
1034
|
+
|
|
1035
|
+
const generator = new CodeGenerator({
|
|
1036
|
+
language: 'typescript',
|
|
1037
|
+
outputDir: './src/generated'
|
|
1038
|
+
});
|
|
1039
|
+
|
|
1040
|
+
// Generate from C4 design
|
|
1041
|
+
const result = await generator.generateFromC4(designDocument);
|
|
1042
|
+
|
|
1043
|
+
// Generate with custom templates
|
|
1044
|
+
await generator.generate({
|
|
1045
|
+
template: 'repository-pattern',
|
|
1046
|
+
context: { entityName: 'User' }
|
|
1047
|
+
});
|
|
1048
|
+
```
|
|
1049
|
+
|
|
1050
|
+
**Supported Patterns:**
|
|
1051
|
+
- Repository Pattern
|
|
1052
|
+
- Service Layer
|
|
1053
|
+
- Factory Pattern
|
|
1054
|
+
- Domain Events
|
|
1055
|
+
- Value Objects
|
|
1056
|
+
|
|
1057
|
+
### Phase 5: YATA UI (Web Visualization)
|
|
1058
|
+
|
|
1059
|
+
Web-based visualization and management interface for knowledge graphs.
|
|
1060
|
+
|
|
1061
|
+
```typescript
|
|
1062
|
+
import { YataUIServer, createYataUIServer } from '@nahisaho/yata-ui';
|
|
1063
|
+
|
|
1064
|
+
// Create and start server
|
|
1065
|
+
const server = createYataUIServer({
|
|
1066
|
+
port: 3000,
|
|
1067
|
+
enableRealtime: true
|
|
1068
|
+
});
|
|
1069
|
+
|
|
1070
|
+
// Set data provider
|
|
1071
|
+
server.setDataProvider(async () => ({
|
|
1072
|
+
nodes: await getEntities(),
|
|
1073
|
+
edges: await getRelationships()
|
|
1074
|
+
}));
|
|
1075
|
+
|
|
1076
|
+
await server.start();
|
|
1077
|
+
console.log(`UI available at ${server.getUrl()}`);
|
|
1078
|
+
```
|
|
1079
|
+
|
|
1080
|
+
**UI Features:**
|
|
1081
|
+
- Interactive graph visualization
|
|
1082
|
+
- Real-time updates via WebSocket
|
|
1083
|
+
- Namespace filtering
|
|
1084
|
+
- Entity/Relationship editing
|
|
1085
|
+
- Export/Import functionality
|
|
1086
|
+
|
|
1087
|
+
### v1.7.0 Package Summary
|
|
1088
|
+
|
|
1089
|
+
| Package | Description |
|
|
1090
|
+
|---------|-------------|
|
|
1091
|
+
| `@nahisaho/yata-local` | IndexOptimizer, ExportPipeline, CodeGenerator |
|
|
1092
|
+
| `@nahisaho/yata-global` | GlobalSyncClient, SyncEngine, CacheManager |
|
|
1093
|
+
| `@nahisaho/yata-ui` | YataUIServer, Graph visualization |
|
|
1094
|
+
|
|
1095
|
+
---
|
|
1096
|
+
|
|
1097
|
+
## Formal Verification
|
|
1098
|
+
|
|
1099
|
+
*(v1.7.5)*
|
|
1100
|
+
|
|
1101
|
+
The `@nahisaho/musubix-formal-verify` package provides formal verification capabilities using the Z3 SMT solver.
|
|
1102
|
+
|
|
1103
|
+
### Installation
|
|
1104
|
+
|
|
1105
|
+
```bash
|
|
1106
|
+
npm install @nahisaho/musubix-formal-verify
|
|
1107
|
+
# Optional: Install z3-solver for WebAssembly support
|
|
1108
|
+
npm install z3-solver
|
|
1109
|
+
```
|
|
1110
|
+
|
|
1111
|
+
### Z3 SMT Solver Integration
|
|
1112
|
+
|
|
1113
|
+
```typescript
|
|
1114
|
+
import { Z3Adapter, PreconditionVerifier, PostconditionVerifier } from '@nahisaho/musubix-formal-verify';
|
|
1115
|
+
|
|
1116
|
+
// Create Z3 adapter (auto-selects backend)
|
|
1117
|
+
const z3 = await Z3Adapter.create();
|
|
1118
|
+
|
|
1119
|
+
// Precondition verification
|
|
1120
|
+
const preVerifier = new PreconditionVerifier(z3);
|
|
1121
|
+
const result = await preVerifier.verify({
|
|
1122
|
+
condition: { expression: 'amount > 0 && balance >= amount', format: 'javascript' },
|
|
1123
|
+
variables: [
|
|
1124
|
+
{ name: 'amount', type: 'Int' },
|
|
1125
|
+
{ name: 'balance', type: 'Int' },
|
|
1126
|
+
],
|
|
1127
|
+
});
|
|
1128
|
+
|
|
1129
|
+
console.log(result.status); // 'valid' | 'invalid' | 'unknown' | 'error'
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
### Hoare Triple Verification
|
|
1133
|
+
|
|
1134
|
+
```typescript
|
|
1135
|
+
// Verify {P} C {Q}
|
|
1136
|
+
const postVerifier = new PostconditionVerifier(z3);
|
|
1137
|
+
const hoareResult = await postVerifier.verify({
|
|
1138
|
+
precondition: { expression: 'balance >= amount', format: 'javascript' },
|
|
1139
|
+
postcondition: { expression: 'balance_new == balance - amount', format: 'javascript' },
|
|
1140
|
+
preVariables: [{ name: 'balance', type: 'Int' }, { name: 'amount', type: 'Int' }],
|
|
1141
|
+
postVariables: [{ name: 'balance_new', type: 'Int' }],
|
|
1142
|
+
transition: 'balance_new == balance - amount',
|
|
1143
|
+
});
|
|
1144
|
+
```
|
|
1145
|
+
|
|
1146
|
+
### EARS to SMT Conversion
|
|
1147
|
+
|
|
1148
|
+
```typescript
|
|
1149
|
+
import { EarsToSmtConverter } from '@nahisaho/musubix-formal-verify';
|
|
1150
|
+
|
|
1151
|
+
const converter = new EarsToSmtConverter();
|
|
1152
|
+
|
|
1153
|
+
// Convert EARS requirements to SMT-LIB2
|
|
1154
|
+
const results = converter.convertMultiple([
|
|
1155
|
+
'THE system SHALL validate inputs', // ubiquitous
|
|
1156
|
+
'WHEN error, THE system SHALL notify user', // event-driven
|
|
1157
|
+
'WHILE busy, THE system SHALL queue requests', // state-driven
|
|
1158
|
+
'THE system SHALL NOT expose secrets', // unwanted
|
|
1159
|
+
'IF admin, THEN THE system SHALL allow edit', // optional
|
|
1160
|
+
]);
|
|
1161
|
+
|
|
1162
|
+
results.forEach(r => {
|
|
1163
|
+
console.log(`Pattern: ${r.formula?.metadata.earsPattern.type}`);
|
|
1164
|
+
console.log(`SMT: ${r.formula?.smtLib2}`);
|
|
1165
|
+
});
|
|
1166
|
+
```
|
|
1167
|
+
|
|
1168
|
+
### Traceability Database
|
|
1169
|
+
|
|
1170
|
+
```typescript
|
|
1171
|
+
import { TraceabilityDB, ImpactAnalyzer } from '@nahisaho/musubix-formal-verify';
|
|
1172
|
+
|
|
1173
|
+
// Create SQLite-based traceability database
|
|
1174
|
+
const db = new TraceabilityDB('./trace.db');
|
|
1175
|
+
|
|
1176
|
+
// Add nodes
|
|
1177
|
+
await db.addNode({ id: 'REQ-001', type: 'requirement', title: 'User Auth' });
|
|
1178
|
+
await db.addNode({ id: 'DES-001', type: 'design', title: 'AuthService' });
|
|
1179
|
+
await db.addNode({ id: 'CODE-001', type: 'code', title: 'auth.ts' });
|
|
1180
|
+
|
|
1181
|
+
// Add traceability links
|
|
1182
|
+
await db.addLink({ source: 'DES-001', target: 'REQ-001', type: 'satisfies' });
|
|
1183
|
+
await db.addLink({ source: 'CODE-001', target: 'DES-001', type: 'implements' });
|
|
1184
|
+
|
|
1185
|
+
// Impact analysis
|
|
1186
|
+
const analyzer = new ImpactAnalyzer(db);
|
|
1187
|
+
const impact = await analyzer.analyze('REQ-001');
|
|
1188
|
+
console.log(`Impacted nodes: ${impact.totalImpacted}`);
|
|
1189
|
+
```
|
|
1190
|
+
|
|
1191
|
+
### v1.7.5 Package Summary
|
|
1192
|
+
|
|
1193
|
+
| Package | Description |
|
|
1194
|
+
|---------|-------------|
|
|
1195
|
+
| `@nahisaho/musubix-formal-verify` | Z3 integration, Hoare verification, EARS→SMT, TraceabilityDB |
|
|
1196
|
+
|
|
1197
|
+
### Supported Variable Types
|
|
1198
|
+
|
|
1199
|
+
| Type | Description |
|
|
1200
|
+
|------|-------------|
|
|
1201
|
+
| `Int` | Integer values |
|
|
1202
|
+
| `Real` | Real numbers |
|
|
1203
|
+
| `Bool` | Boolean values |
|
|
1204
|
+
| `String` | String values |
|
|
1205
|
+
| `Array` | Array types |
|
|
1206
|
+
| `BitVec` | Bit vectors |
|
|
1207
|
+
|
|
1208
|
+
---
|
|
1209
|
+
|
|
618
1210
|
## MCP Server Integration
|
|
619
1211
|
|
|
620
1212
|
### CLI Startup
|
|
@@ -1225,6 +1817,6 @@ const client = createYATAClient({
|
|
|
1225
1817
|
|
|
1226
1818
|
---
|
|
1227
1819
|
|
|
1228
|
-
**Version**: 1.
|
|
1229
|
-
**Last Updated**: 2026-01-
|
|
1820
|
+
**Version**: 1.6.0
|
|
1821
|
+
**Last Updated**: 2026-01-06
|
|
1230
1822
|
**MUSUBIX Project**
|