@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
|
@@ -29,7 +29,14 @@ function createGateRejectionEnvelope(stagedPlan, gateEval) {
|
|
|
29
29
|
* Assembles the standardized response structure for approved companion responses.
|
|
30
30
|
*/
|
|
31
31
|
function assembleResponseEnvelope(params) {
|
|
32
|
-
const { stagedPlan, speech, language, speechId, createdMemoryProposals, memoryProposalReceipts, actionResults, filteredEvidenceIds, filteredCitations, subsystemDiagnostics, experienceEvents, mouthDelivery, } = params;
|
|
32
|
+
const { stagedPlan, speech, language, subtitle, subtitles, subtitleLanguage, speechId, createdMemoryProposals, memoryProposalReceipts, actionResults, filteredEvidenceIds, filteredCitations, subsystemDiagnostics, experienceEvents, mouthDelivery, effectiveMode, } = params;
|
|
33
|
+
const resolvedSubtitles = {
|
|
34
|
+
...(mouthDelivery?.subtitles || {}),
|
|
35
|
+
...(subtitles || {}),
|
|
36
|
+
};
|
|
37
|
+
if (subtitle && subtitleLanguage) {
|
|
38
|
+
resolvedSubtitles[subtitleLanguage] = subtitle;
|
|
39
|
+
}
|
|
33
40
|
return {
|
|
34
41
|
status: 'APPROVED',
|
|
35
42
|
response_id: stagedPlan.responseId,
|
|
@@ -37,11 +44,15 @@ function assembleResponseEnvelope(params) {
|
|
|
37
44
|
response: {
|
|
38
45
|
speech_id: speechId,
|
|
39
46
|
audio_url: mouthDelivery?.audioUrl ?? (speechId ? `/voice/stream?id=${speechId}` : undefined),
|
|
40
|
-
subtitle_ja: mouthDelivery?.subtitles?.ja ?? speech,
|
|
41
|
-
subtitle_en: mouthDelivery?.subtitles?.en ?? speech,
|
|
47
|
+
subtitle_ja: mouthDelivery?.subtitles?.ja ?? resolvedSubtitles['ja'] ?? speech,
|
|
48
|
+
subtitle_en: mouthDelivery?.subtitles?.en ?? resolvedSubtitles['en'] ?? speech,
|
|
49
|
+
subtitle: subtitle ?? (subtitleLanguage ? resolvedSubtitles[subtitleLanguage] : undefined),
|
|
50
|
+
subtitle_language: subtitleLanguage,
|
|
51
|
+
subtitles: resolvedSubtitles,
|
|
42
52
|
},
|
|
43
53
|
delivery: mouthDelivery,
|
|
44
54
|
metadata: {
|
|
55
|
+
mode: effectiveMode ?? 'hybrid',
|
|
45
56
|
language,
|
|
46
57
|
proposals: createdMemoryProposals,
|
|
47
58
|
memory_proposals: memoryProposalReceipts,
|
package/dist/runtime.d.ts
CHANGED
|
@@ -46,5 +46,5 @@ export declare class SiduriRuntime {
|
|
|
46
46
|
/**
|
|
47
47
|
* Primary entrypoint for text chat messages.
|
|
48
48
|
*/
|
|
49
|
-
handleUserMessage(message: string, roleOrContext?: 'OWNER' | 'VIEWER' | 'OPERATOR' | RequestContext | string, history?: Message[], medium?: MouthMedium, signal?: AbortSignal): Promise<any>;
|
|
49
|
+
handleUserMessage(message: string, roleOrContext?: 'OWNER' | 'VIEWER' | 'OPERATOR' | RequestContext | string, history?: Message[], medium?: MouthMedium, signal?: AbortSignal, subtitleLanguage?: string): Promise<any>;
|
|
50
50
|
}
|
package/dist/runtime.js
CHANGED
|
@@ -81,7 +81,7 @@ class SiduriRuntime {
|
|
|
81
81
|
/**
|
|
82
82
|
* Primary entrypoint for text chat messages.
|
|
83
83
|
*/
|
|
84
|
-
async handleUserMessage(message, roleOrContext = 'OWNER', history = [], medium, signal) {
|
|
84
|
+
async handleUserMessage(message, roleOrContext = 'OWNER', history = [], medium, signal, subtitleLanguage) {
|
|
85
85
|
return this.processPerception({
|
|
86
86
|
source: 'text_chat',
|
|
87
87
|
text: message,
|
|
@@ -89,6 +89,7 @@ class SiduriRuntime {
|
|
|
89
89
|
history,
|
|
90
90
|
medium,
|
|
91
91
|
signal,
|
|
92
|
+
subtitleLanguage,
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
95
|
}
|
package/dist/siduri-db.d.ts
CHANGED
|
@@ -1,34 +1,48 @@
|
|
|
1
|
+
import { ClaimStatus, DirectiveStatus } from './proposals';
|
|
1
2
|
export interface SelfIdentity {
|
|
2
3
|
companionId: string;
|
|
3
4
|
name: string;
|
|
4
5
|
archetype?: string;
|
|
6
|
+
origin?: string;
|
|
7
|
+
ethos?: string;
|
|
5
8
|
version: string;
|
|
6
9
|
updatedAt: string;
|
|
7
10
|
}
|
|
8
11
|
export interface PersonalityTraits {
|
|
9
|
-
warmth
|
|
10
|
-
formality
|
|
11
|
-
sarcasm
|
|
12
|
-
verbosity
|
|
13
|
-
curiosity
|
|
12
|
+
warmth?: number;
|
|
13
|
+
formality?: number;
|
|
14
|
+
sarcasm?: number;
|
|
15
|
+
verbosity?: number;
|
|
16
|
+
curiosity?: number;
|
|
14
17
|
}
|
|
15
18
|
export interface SelfDirective {
|
|
16
19
|
id: string;
|
|
17
20
|
companionId: string;
|
|
18
|
-
priority
|
|
21
|
+
priority?: number;
|
|
19
22
|
directive: string;
|
|
20
|
-
status:
|
|
23
|
+
status: DirectiveStatus;
|
|
21
24
|
category: 'behavioral' | 'guardrail' | 'relational' | string;
|
|
25
|
+
scopeActor?: string;
|
|
22
26
|
supersedesId?: string;
|
|
23
27
|
createdAt?: string;
|
|
24
28
|
}
|
|
25
29
|
export interface SelfRelationship {
|
|
26
30
|
companionId: string;
|
|
27
31
|
entityId: string;
|
|
28
|
-
entityType
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
entityType?: 'human' | 'companion' | 'system';
|
|
33
|
+
role?: string;
|
|
34
|
+
stance?: string;
|
|
35
|
+
trustScore?: number;
|
|
36
|
+
familiarity?: number;
|
|
31
37
|
interactionConventions: string[];
|
|
38
|
+
updatedAt?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface SelfDialogueExample {
|
|
41
|
+
id?: string;
|
|
42
|
+
companionId?: string;
|
|
43
|
+
user: string;
|
|
44
|
+
assistant: string;
|
|
45
|
+
createdAt?: string;
|
|
32
46
|
}
|
|
33
47
|
export interface LifeInventoryItem {
|
|
34
48
|
id: string;
|
|
@@ -77,7 +91,7 @@ export interface MemoryClaim {
|
|
|
77
91
|
subject: string;
|
|
78
92
|
predicate: string;
|
|
79
93
|
value: string;
|
|
80
|
-
status:
|
|
94
|
+
status: ClaimStatus;
|
|
81
95
|
confidence: number;
|
|
82
96
|
validFrom?: string;
|
|
83
97
|
validUntil?: string;
|
|
@@ -86,6 +100,7 @@ export interface MemoryClaim {
|
|
|
86
100
|
supersedes?: string;
|
|
87
101
|
sourceEventId?: string;
|
|
88
102
|
}
|
|
103
|
+
export declare function normalizeStatus(status?: string, defaultStatus?: string): string;
|
|
89
104
|
export interface SiduriDatabaseOptions {
|
|
90
105
|
dbPath?: string;
|
|
91
106
|
}
|
|
@@ -98,7 +113,9 @@ export declare class SiduriDatabase {
|
|
|
98
113
|
setIdentity(identity: SelfIdentity): void;
|
|
99
114
|
getPersonality(companionId: string): PersonalityTraits | undefined;
|
|
100
115
|
setPersonality(companionId: string, traits: PersonalityTraits): void;
|
|
116
|
+
private rowToSelfDirective;
|
|
101
117
|
getActiveDirectives(companionId: string): SelfDirective[];
|
|
118
|
+
getAllDirectives(companionId: string): SelfDirective[];
|
|
102
119
|
commitDirective(directive: SelfDirective): void;
|
|
103
120
|
getDirective(id: string, companionId?: string): SelfDirective | undefined;
|
|
104
121
|
approveDirective(id: string, companionId?: string): void;
|
|
@@ -107,7 +124,10 @@ export declare class SiduriDatabase {
|
|
|
107
124
|
expireDirective(id: string, companionId?: string): void;
|
|
108
125
|
disableDirective(id: string, companionId?: string): void;
|
|
109
126
|
getRelationship(companionId: string, entityId: string): SelfRelationship | undefined;
|
|
127
|
+
getRelationships(companionId: string): SelfRelationship[];
|
|
110
128
|
upsertRelationship(rel: SelfRelationship): void;
|
|
129
|
+
getExemplars(companionId: string): SelfDialogueExample[];
|
|
130
|
+
setExemplars(companionId: string, exemplars: SelfDialogueExample[]): void;
|
|
111
131
|
getInventory(companionId: string, domain?: string): LifeInventoryItem[];
|
|
112
132
|
upsertInventoryItem(item: LifeInventoryItem): void;
|
|
113
133
|
getFinanceEntries(companionId: string, limit?: number): LifeFinanceEntry[];
|
|
@@ -119,11 +139,13 @@ export declare class SiduriDatabase {
|
|
|
119
139
|
recordEvent(event: EpisodicEvent): void;
|
|
120
140
|
getRecentEvents(companionId: string, limit?: number): EpisodicEvent[];
|
|
121
141
|
getEvent(id: string): EpisodicEvent | undefined;
|
|
142
|
+
private rowToMemoryClaim;
|
|
122
143
|
proposeClaim(claim: Omit<MemoryClaim, 'status' | 'confidence' | 'assertedAt'> & {
|
|
123
144
|
confidence?: number;
|
|
124
145
|
assertedAt?: string;
|
|
125
146
|
supersedes?: string;
|
|
126
147
|
sourceEventId?: string;
|
|
148
|
+
status?: string;
|
|
127
149
|
}): MemoryClaim;
|
|
128
150
|
approveClaim(id: string, companionId?: string): void;
|
|
129
151
|
rejectClaim(id: string, companionId?: string): void;
|
|
@@ -133,6 +155,7 @@ export declare class SiduriDatabase {
|
|
|
133
155
|
searchClaims(companionId: string, query: string, limit?: number): MemoryClaim[];
|
|
134
156
|
getPendingClaims(companionId: string, limit?: number): MemoryClaim[];
|
|
135
157
|
getApprovedClaims(companionId: string, limit?: number): MemoryClaim[];
|
|
158
|
+
getAllClaims(companionId?: string, limit?: number): MemoryClaim[];
|
|
136
159
|
getClaim(id: string): MemoryClaim | undefined;
|
|
137
160
|
resetMemory(companionId: string): void;
|
|
138
161
|
}
|