@siduri-x/api 2.0.14 → 2.0.17
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/.turbo/turbo-build.log +4 -4
- package/.turbo/turbo-test.log +22 -21
- package/dist/app.js +35 -0
- package/dist/boot.d.ts +2 -1
- package/dist/boot.js +6 -2
- package/package.json +13 -14
- package/src/app.ts +35 -0
- package/src/boot.ts +6 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
> @siduri-x/api@2.0.
|
|
3
|
-
> tsc
|
|
4
|
-
|
|
1
|
+
|
|
2
|
+
> @siduri-x/api@2.0.17 build /home/zagin/Projects/vxnus-studio/projects/siduri-x/apps/api
|
|
3
|
+
> tsc
|
|
4
|
+
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
|
|
2
|
-
> @siduri-x/api@2.0.
|
|
2
|
+
> @siduri-x/api@2.0.17 test /home/zagin/Projects/vxnus-studio/projects/siduri-x/apps/api
|
|
3
3
|
> jest --config jest.config.json
|
|
4
4
|
|
|
5
|
-
PASS src/context-mapper.test.ts (
|
|
6
|
-
PASS src/runtime.test.ts (
|
|
5
|
+
PASS src/context-mapper.test.ts (12.751 s)
|
|
6
|
+
PASS src/runtime.test.ts (12.425 s)
|
|
7
7
|
● Console
|
|
8
8
|
|
|
9
9
|
console.error
|
|
10
|
-
[SiduriRuntime] Knowledge search failed: E-Teyvat is down
|
|
10
|
+
[SiduriRuntime] Knowledge search failed for "Remember this": E-Teyvat is down
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
>
|
|
12
|
+
40 | extKnowledge && shouldQueryKnowledge && typeof extKnowledge.search === 'function'
|
|
13
|
+
41 | ? Promise.all(finalKnowledgeQueries.map((q) => extKnowledge.search(q).catch((e) => {
|
|
14
|
+
> 42 | console.error(`[SiduriRuntime] Knowledge search failed for "${q}":`, e.message);
|
|
15
15
|
| ^
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
43 | subsystemDiagnostics['knowledge'] = `UNAVAILABLE: ${e.message}`;
|
|
17
|
+
44 | return [];
|
|
18
|
+
45 | }))).then((resultsArray) => {
|
|
19
19
|
|
|
20
|
-
at ../../packages/core/dist/context-retriever.js:
|
|
20
|
+
at ../../packages/core/dist/context-retriever.js:42:25
|
|
21
21
|
at async Promise.all (index 0)
|
|
22
|
-
|
|
23
|
-
at
|
|
22
|
+
at async Promise.all (index 0)
|
|
23
|
+
at retrieveRuntimeContext (../../packages/core/dist/context-retriever.js:38:124)
|
|
24
|
+
at contextRetrievalStage (../../packages/core/dist/perception-pipeline.js:89:30)
|
|
24
25
|
at PerceptionPipeline.execute (../../packages/core/dist/perception-pipeline.js:21:34)
|
|
25
26
|
at Object.<anonymous> (src/runtime.test.ts:74:22)
|
|
26
27
|
|
|
27
|
-
PASS src/
|
|
28
|
+
PASS src/teach-mode.test.ts (13.574 s)
|
|
29
|
+
PASS src/t4-gating.test.ts (13.557 s)
|
|
30
|
+
PASS src/t5-experience.test.ts (13.299 s)
|
|
31
|
+
PASS src/auth.test.ts
|
|
32
|
+
PASS src/smoke.test.ts
|
|
33
|
+
PASS src/t6-security.test.ts (14.239 s)
|
|
28
34
|
PASS src/t7-release.test.ts
|
|
29
35
|
PASS src/boot.test.ts
|
|
30
|
-
PASS src/
|
|
36
|
+
PASS src/knowledge.test.ts (13.583 s)
|
|
31
37
|
PASS src/b0-b6.test.ts
|
|
32
|
-
PASS src/smoke.test.ts
|
|
33
38
|
PASS src/index.test.ts
|
|
34
|
-
PASS src/knowledge.test.ts (16.426 s)
|
|
35
|
-
PASS src/t4-gating.test.ts (17.057 s)
|
|
36
|
-
PASS src/teach-mode.test.ts (17.48 s)
|
|
37
|
-
PASS src/t6-security.test.ts (17.495 s)
|
|
38
39
|
[999D[K
|
|
39
40
|
Test Suites: 13 passed, 13 total
|
|
40
41
|
Tests: 94 passed, 94 total
|
|
41
42
|
Snapshots: 0 total
|
|
42
|
-
Time:
|
|
43
|
+
Time: 19.638 s
|
|
43
44
|
Ran all test suites.
|
package/dist/app.js
CHANGED
|
@@ -241,6 +241,41 @@ function createApp(runtimes = new Map()) {
|
|
|
241
241
|
res.status(500).json({ error: e.message });
|
|
242
242
|
}
|
|
243
243
|
});
|
|
244
|
+
app.get('/teach/identity', auth_1.attachIdentity, async (req, res) => {
|
|
245
|
+
try {
|
|
246
|
+
const companionId = req.query.companionId || Array.from(runtimes.keys())[0] || 'default';
|
|
247
|
+
const runtime = runtimes.get(companionId);
|
|
248
|
+
let identity = null;
|
|
249
|
+
if (runtime?.self && typeof runtime.self.getIdentity === 'function') {
|
|
250
|
+
try {
|
|
251
|
+
identity = await runtime.self.getIdentity(companionId);
|
|
252
|
+
}
|
|
253
|
+
catch { }
|
|
254
|
+
}
|
|
255
|
+
if (!identity) {
|
|
256
|
+
const repo = new self_1.SqliteSelfRepository({ dbPath: process.env.STORAGE_PATH || process.env.SQLITE_DB_PATH || 'siduri.sqlite' });
|
|
257
|
+
try {
|
|
258
|
+
identity = await repo.getIdentity(companionId);
|
|
259
|
+
}
|
|
260
|
+
catch { }
|
|
261
|
+
finally {
|
|
262
|
+
repo.close();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
const configuredName = runtime?.config?.name || 'Siduri';
|
|
266
|
+
res.json({
|
|
267
|
+
companionId,
|
|
268
|
+
name: identity?.name || configuredName,
|
|
269
|
+
archetype: identity?.archetype || identity?.role,
|
|
270
|
+
origin: identity?.origin,
|
|
271
|
+
ethos: identity?.ethos,
|
|
272
|
+
version: identity?.version,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
catch (e) {
|
|
276
|
+
res.status(500).json({ error: e.message });
|
|
277
|
+
}
|
|
278
|
+
});
|
|
244
279
|
// CHAT (API context boundary validation)
|
|
245
280
|
app.post('/chat', auth_1.attachIdentity, async (req, res) => {
|
|
246
281
|
const { id, message, history } = req.body;
|
package/dist/boot.d.ts
CHANGED
|
@@ -83,7 +83,8 @@ export declare function createMemory(config?: {
|
|
|
83
83
|
}): SqliteMemoryStore | undefined;
|
|
84
84
|
export declare function createSelf(config?: {
|
|
85
85
|
dbPath?: string;
|
|
86
|
-
|
|
86
|
+
provider?: string;
|
|
87
|
+
}): SqliteSelfRepository | undefined;
|
|
87
88
|
export declare function createObservation(vision?: any): FixtureObservationOrgan;
|
|
88
89
|
/**
|
|
89
90
|
* Canonical companion bootstrapper.
|
package/dist/boot.js
CHANGED
|
@@ -97,10 +97,14 @@ function createMouth(config, voice) {
|
|
|
97
97
|
function createMemory(config) {
|
|
98
98
|
if (isDisabled(config))
|
|
99
99
|
return undefined;
|
|
100
|
-
|
|
100
|
+
const defaultPath = process.env.NODE_ENV === 'test' ? ':memory:' : 'siduri.sqlite';
|
|
101
|
+
return new memory_1.SqliteMemoryStore({ dbPath: config?.dbPath || process.env.STORAGE_PATH || process.env.SQLITE_DB_PATH || defaultPath });
|
|
101
102
|
}
|
|
102
103
|
function createSelf(config) {
|
|
103
|
-
|
|
104
|
+
if (isDisabled(config))
|
|
105
|
+
return undefined;
|
|
106
|
+
const defaultPath = process.env.NODE_ENV === 'test' ? ':memory:' : 'siduri.sqlite';
|
|
107
|
+
return new self_1.SqliteSelfRepository({ dbPath: config?.dbPath || process.env.STORAGE_PATH || process.env.SQLITE_DB_PATH || defaultPath });
|
|
104
108
|
}
|
|
105
109
|
function createObservation(vision) {
|
|
106
110
|
return new observation_1.FixtureObservationOrgan(vision ?? { analyze: async () => JSON.stringify({ readings: [] }) });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siduri-x/api",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -12,19 +12,18 @@
|
|
|
12
12
|
"cors": "^2.8.6",
|
|
13
13
|
"dotenv": "^17.4.2",
|
|
14
14
|
"express": "^5.2.1",
|
|
15
|
-
"@siduri-x/body": "2.0.
|
|
16
|
-
"@siduri-x/
|
|
17
|
-
"@siduri-x/
|
|
18
|
-
"@siduri-x/
|
|
19
|
-
"@siduri-x/
|
|
20
|
-
"@siduri-x/
|
|
21
|
-
"@siduri-x/
|
|
22
|
-
"@siduri-x/
|
|
23
|
-
"@siduri-x/
|
|
24
|
-
"@siduri-x/
|
|
25
|
-
"@siduri-x/
|
|
26
|
-
"@siduri-x/
|
|
27
|
-
"@siduri-x/voice": "2.0.2"
|
|
15
|
+
"@siduri-x/body": "2.0.2",
|
|
16
|
+
"@siduri-x/brain": "2.0.11",
|
|
17
|
+
"@siduri-x/ear": "2.0.4",
|
|
18
|
+
"@siduri-x/core": "2.0.14",
|
|
19
|
+
"@siduri-x/hands": "2.0.3",
|
|
20
|
+
"@siduri-x/knowledge": "2.0.7",
|
|
21
|
+
"@siduri-x/memory": "2.0.6",
|
|
22
|
+
"@siduri-x/mouth": "2.0.3",
|
|
23
|
+
"@siduri-x/observation": "2.0.2",
|
|
24
|
+
"@siduri-x/self": "2.0.8",
|
|
25
|
+
"@siduri-x/vision": "2.0.2",
|
|
26
|
+
"@siduri-x/voice": "2.0.3"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
29
|
"@types/cors": "^2.8.19",
|
package/src/app.ts
CHANGED
|
@@ -273,6 +273,41 @@ export function createApp(runtimes: Map<string, SiduriRuntime> = new Map()): App
|
|
|
273
273
|
}
|
|
274
274
|
});
|
|
275
275
|
|
|
276
|
+
app.get('/teach/identity', attachIdentity, async (req, res) => {
|
|
277
|
+
try {
|
|
278
|
+
const companionId = (req.query.companionId as string) || Array.from(runtimes.keys())[0] || 'default';
|
|
279
|
+
const runtime = runtimes.get(companionId);
|
|
280
|
+
let identity: any = null;
|
|
281
|
+
|
|
282
|
+
if (runtime?.self && typeof (runtime.self as any).getIdentity === 'function') {
|
|
283
|
+
try {
|
|
284
|
+
identity = await (runtime.self as any).getIdentity(companionId);
|
|
285
|
+
} catch {}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (!identity) {
|
|
289
|
+
const repo = new SqliteSelfRepository({ dbPath: process.env.STORAGE_PATH || process.env.SQLITE_DB_PATH || 'siduri.sqlite' });
|
|
290
|
+
try {
|
|
291
|
+
identity = await repo.getIdentity(companionId);
|
|
292
|
+
} catch {} finally {
|
|
293
|
+
repo.close();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const configuredName = runtime?.config?.name || 'Siduri';
|
|
298
|
+
res.json({
|
|
299
|
+
companionId,
|
|
300
|
+
name: identity?.name || configuredName,
|
|
301
|
+
archetype: identity?.archetype || identity?.role,
|
|
302
|
+
origin: identity?.origin,
|
|
303
|
+
ethos: identity?.ethos,
|
|
304
|
+
version: identity?.version,
|
|
305
|
+
});
|
|
306
|
+
} catch (e: any) {
|
|
307
|
+
res.status(500).json({ error: e.message });
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
|
|
276
311
|
// CHAT (API context boundary validation)
|
|
277
312
|
app.post('/chat', attachIdentity, async (req, res) => {
|
|
278
313
|
const { id, message, history } = req.body;
|
package/src/boot.ts
CHANGED
|
@@ -128,11 +128,14 @@ export function createMouth(config?: DefaultMouthOrganConfig & { provider?: stri
|
|
|
128
128
|
|
|
129
129
|
export function createMemory(config?: { provider?: string; connectionString?: string; maxConnections?: number; dbPath?: string }) {
|
|
130
130
|
if (isDisabled(config)) return undefined;
|
|
131
|
-
|
|
131
|
+
const defaultPath = process.env.NODE_ENV === 'test' ? ':memory:' : 'siduri.sqlite';
|
|
132
|
+
return new SqliteMemoryStore({ dbPath: config?.dbPath || process.env.STORAGE_PATH || process.env.SQLITE_DB_PATH || defaultPath });
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
export function createSelf(config?: { dbPath?: string }) {
|
|
135
|
-
|
|
135
|
+
export function createSelf(config?: { dbPath?: string; provider?: string }) {
|
|
136
|
+
if (isDisabled(config)) return undefined;
|
|
137
|
+
const defaultPath = process.env.NODE_ENV === 'test' ? ':memory:' : 'siduri.sqlite';
|
|
138
|
+
return new SqliteSelfRepository({ dbPath: config?.dbPath || process.env.STORAGE_PATH || process.env.SQLITE_DB_PATH || defaultPath });
|
|
136
139
|
}
|
|
137
140
|
|
|
138
141
|
export function createObservation(vision?: any): FixtureObservationOrgan {
|