@siduri-x/core 2.0.2 → 2.0.4
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/chat-contract.d.ts +4 -0
- package/dist/chat-contract.js +17 -2
- package/dist/context.d.ts +2 -0
- package/dist/context.js +13 -0
- package/dist/index.d.ts +13 -5
- package/dist/intent-classifier.d.ts +4 -2
- package/dist/intent-classifier.js +32 -1
- package/dist/intent-classifier.test.js +52 -0
- package/dist/memory-settler.d.ts +2 -1
- package/dist/memory-settler.js +10 -2
- package/dist/mouth-types.d.ts +7 -2
- package/dist/perception-cycle.test.js +134 -0
- package/dist/perception-pipeline.d.ts +1 -0
- package/dist/perception-pipeline.js +10 -0
- package/dist/prompt-compiler.d.ts +3 -1
- package/dist/prompt-compiler.js +11 -1
- package/dist/proposals.d.ts +6 -2
- package/dist/response-envelope.d.ts +5 -1
- package/dist/response-envelope.js +14 -3
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +2 -1
- package/dist/siduri-db.d.ts +34 -11
- package/dist/siduri-db.js +208 -134
- package/dist/siduri-db.test.js +18 -18
- package/package.json +1 -1
package/dist/siduri-db.test.js
CHANGED
|
@@ -370,7 +370,7 @@ describe('SiduriDatabase', () => {
|
|
|
370
370
|
evidence: ['lore book chapter 3'],
|
|
371
371
|
assertedAt: new Date().toISOString(),
|
|
372
372
|
});
|
|
373
|
-
expect(claim.status).toBe('
|
|
373
|
+
expect(claim.status).toBe('pending');
|
|
374
374
|
expect(claim.subject).toBe('Kur');
|
|
375
375
|
expect(claim.predicate).toBe('is');
|
|
376
376
|
expect(claim.value).toBe('a dark entity from the underworld');
|
|
@@ -401,7 +401,7 @@ describe('SiduriDatabase', () => {
|
|
|
401
401
|
const approved = db.getApprovedClaims('siduri-test');
|
|
402
402
|
expect(approved).toHaveLength(1);
|
|
403
403
|
expect(approved[0].id).toBe(claim1.id);
|
|
404
|
-
expect(approved[0].status).toBe('
|
|
404
|
+
expect(approved[0].status).toBe('approved');
|
|
405
405
|
});
|
|
406
406
|
it('searches claims using FTS5 full-text search', () => {
|
|
407
407
|
db = new siduri_db_1.SiduriDatabase({ dbPath });
|
|
@@ -617,7 +617,7 @@ describe('SiduriDatabase', () => {
|
|
|
617
617
|
expect(db2.getInventory(cId)).toHaveLength(1);
|
|
618
618
|
expect(db2.getInventory(cId)[0].entityName).toBe('Aged Wine');
|
|
619
619
|
const claims = db2.searchClaims(cId, 'wine');
|
|
620
|
-
expect(claims.some((c) => c.id === claim.id && c.status === '
|
|
620
|
+
expect(claims.some((c) => c.id === claim.id && c.status === 'approved')).toBe(true);
|
|
621
621
|
db2.close();
|
|
622
622
|
// Prevent afterEach from double-closing
|
|
623
623
|
db = null;
|
|
@@ -691,7 +691,7 @@ describe('SiduriDatabase', () => {
|
|
|
691
691
|
const active = db.getActiveDirectives(cId);
|
|
692
692
|
expect(active).toHaveLength(1);
|
|
693
693
|
expect(active[0].id).toBe(dId);
|
|
694
|
-
expect(active[0].status).toBe('
|
|
694
|
+
expect(active[0].status).toBe('active');
|
|
695
695
|
// 3. Revoke directive
|
|
696
696
|
db.revokeDirective(dId);
|
|
697
697
|
expect(db.getActiveDirectives(cId)).toHaveLength(0);
|
|
@@ -702,7 +702,7 @@ describe('SiduriDatabase', () => {
|
|
|
702
702
|
companionId: cId,
|
|
703
703
|
priority: 50,
|
|
704
704
|
directive: 'Unsafe rule',
|
|
705
|
-
status: '
|
|
705
|
+
status: 'pending',
|
|
706
706
|
category: 'behavioral',
|
|
707
707
|
});
|
|
708
708
|
db.rejectDirective(d2Id);
|
|
@@ -717,22 +717,22 @@ describe('SiduriDatabase', () => {
|
|
|
717
717
|
companionId: cId,
|
|
718
718
|
priority: 50,
|
|
719
719
|
directive: 'Rejected directive',
|
|
720
|
-
status: '
|
|
720
|
+
status: 'rejected',
|
|
721
721
|
category: 'behavioral',
|
|
722
722
|
});
|
|
723
|
-
expect(() => db.approveDirective('dir-rejected-1')).toThrow(/invalid transition from status '
|
|
723
|
+
expect(() => db.approveDirective('dir-rejected-1')).toThrow(/invalid transition from status 'rejected' to 'active'/i);
|
|
724
724
|
// 2. Commit directive in ACTIVE state
|
|
725
725
|
db.commitDirective({
|
|
726
726
|
id: 'dir-active-1',
|
|
727
727
|
companionId: cId,
|
|
728
728
|
priority: 50,
|
|
729
729
|
directive: 'Already active directive',
|
|
730
|
-
status: '
|
|
730
|
+
status: 'active',
|
|
731
731
|
category: 'behavioral',
|
|
732
732
|
});
|
|
733
|
-
expect(() => db.approveDirective('dir-active-1')).toThrow(/invalid transition from status '
|
|
733
|
+
expect(() => db.approveDirective('dir-active-1')).toThrow(/invalid transition from status 'active' to 'active'/i);
|
|
734
734
|
// 3. Rejecting an already ACTIVE directive throws
|
|
735
|
-
expect(() => db.rejectDirective('dir-active-1')).toThrow(/invalid transition from status '
|
|
735
|
+
expect(() => db.rejectDirective('dir-active-1')).toThrow(/invalid transition from status 'active' to 'rejected'/i);
|
|
736
736
|
});
|
|
737
737
|
it('automatically marks prior directive as SUPERSEDED when approving superseding directive', () => {
|
|
738
738
|
db = new siduri_db_1.SiduriDatabase({ dbPath });
|
|
@@ -766,7 +766,7 @@ describe('SiduriDatabase', () => {
|
|
|
766
766
|
expect(active).toHaveLength(1);
|
|
767
767
|
expect(active[0].id).toBe('dir-replacement-1');
|
|
768
768
|
const original = db.getDirective('dir-original-1', cId);
|
|
769
|
-
expect(original?.status).toBe('
|
|
769
|
+
expect(original?.status).toBe('superseded');
|
|
770
770
|
});
|
|
771
771
|
it('enforces companion isolation on directive approval', () => {
|
|
772
772
|
db = new siduri_db_1.SiduriDatabase({ dbPath });
|
|
@@ -777,14 +777,14 @@ describe('SiduriDatabase', () => {
|
|
|
777
777
|
companionId: cIdB,
|
|
778
778
|
priority: 50,
|
|
779
779
|
directive: 'Beta private rule',
|
|
780
|
-
status: '
|
|
780
|
+
status: 'pending',
|
|
781
781
|
category: 'behavioral',
|
|
782
782
|
});
|
|
783
783
|
// Alpha attempts to approve Beta's directive scoped to Alpha
|
|
784
784
|
db.approveDirective('dir-beta-1', cIdA);
|
|
785
|
-
// Beta's directive must remain
|
|
785
|
+
// Beta's directive must remain pending and unapproved
|
|
786
786
|
const betaDirective = db.getDirective('dir-beta-1', cIdB);
|
|
787
|
-
expect(betaDirective?.status).toBe('
|
|
787
|
+
expect(betaDirective?.status).toBe('pending');
|
|
788
788
|
expect(db.getActiveDirectives(cIdB)).toHaveLength(0);
|
|
789
789
|
// Beta approves its own directive successfully
|
|
790
790
|
db.approveDirective('dir-beta-1', cIdB);
|
|
@@ -800,7 +800,7 @@ describe('SiduriDatabase', () => {
|
|
|
800
800
|
predicate: 'likes',
|
|
801
801
|
value: 'matcha',
|
|
802
802
|
});
|
|
803
|
-
expect(claim.status).toBe('
|
|
803
|
+
expect(claim.status).toBe('pending');
|
|
804
804
|
expect(db.getApprovedClaims(cId)).toHaveLength(0);
|
|
805
805
|
// Approve
|
|
806
806
|
db.approveClaim('claim-1');
|
|
@@ -835,7 +835,7 @@ describe('SiduriDatabase', () => {
|
|
|
835
835
|
});
|
|
836
836
|
db.rejectClaim(rejectedClaim.id);
|
|
837
837
|
// Attempting to approve a REJECTED claim must throw
|
|
838
|
-
expect(() => db.approveClaim(rejectedClaim.id)).toThrow(/invalid transition from status '
|
|
838
|
+
expect(() => db.approveClaim(rejectedClaim.id)).toThrow(/invalid transition from status 'rejected' to 'approved'/i);
|
|
839
839
|
// 2. Propose and approve claim, then revoke
|
|
840
840
|
const revokedClaim = db.proposeClaim({
|
|
841
841
|
id: 'claim-revoked',
|
|
@@ -847,7 +847,7 @@ describe('SiduriDatabase', () => {
|
|
|
847
847
|
db.approveClaim(revokedClaim.id);
|
|
848
848
|
db.revokeClaim(revokedClaim.id);
|
|
849
849
|
// Attempting to approve a REVOKED claim must throw
|
|
850
|
-
expect(() => db.approveClaim(revokedClaim.id)).toThrow(/invalid transition from status '
|
|
850
|
+
expect(() => db.approveClaim(revokedClaim.id)).toThrow(/invalid transition from status 'revoked' to 'approved'/i);
|
|
851
851
|
// 3. Propose and expire claim
|
|
852
852
|
const expiredClaim = db.proposeClaim({
|
|
853
853
|
id: 'claim-expired',
|
|
@@ -858,7 +858,7 @@ describe('SiduriDatabase', () => {
|
|
|
858
858
|
});
|
|
859
859
|
db.expireClaim(expiredClaim.id);
|
|
860
860
|
// Attempting to approve an EXPIRED claim must throw
|
|
861
|
-
expect(() => db.approveClaim(expiredClaim.id)).toThrow(/invalid transition from status '
|
|
861
|
+
expect(() => db.approveClaim(expiredClaim.id)).toThrow(/invalid transition from status 'expired' to 'approved'/i);
|
|
862
862
|
});
|
|
863
863
|
});
|
|
864
864
|
});
|
package/package.json
CHANGED