@vxnus/siduri 0.0.7 → 0.0.9
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/README.md +11 -1
- package/dist/builtin-manifests.js +12 -12
- package/dist/clean-machine-e2e.test.js +12 -12
- package/dist/configurators/behavior.d.ts +2 -0
- package/dist/configurators/behavior.js +36 -0
- package/dist/configurators/body.d.ts +2 -0
- package/dist/configurators/body.js +44 -0
- package/dist/configurators/brain.d.ts +6 -0
- package/dist/configurators/brain.js +80 -0
- package/dist/configurators/ear.d.ts +2 -0
- package/dist/configurators/ear.js +28 -0
- package/dist/configurators/hands.d.ts +2 -0
- package/dist/configurators/hands.js +27 -0
- package/dist/configurators/index.d.ts +23 -0
- package/dist/configurators/index.js +74 -0
- package/dist/configurators/knowledge.d.ts +6 -0
- package/dist/configurators/knowledge.js +100 -0
- package/dist/configurators/memory.d.ts +2 -0
- package/dist/configurators/memory.js +44 -0
- package/dist/configurators/observation.d.ts +2 -0
- package/dist/configurators/observation.js +12 -0
- package/dist/configurators/types.d.ts +12 -0
- package/dist/configurators/types.js +2 -0
- package/dist/configurators/vision.d.ts +2 -0
- package/dist/configurators/vision.js +39 -0
- package/dist/configurators/voice.d.ts +2 -0
- package/dist/configurators/voice.js +53 -0
- package/dist/configurators.test.d.ts +1 -0
- package/dist/configurators.test.js +275 -0
- package/dist/doctor-db.test.js +9 -3
- package/dist/generator.d.ts +2 -0
- package/dist/generator.js +289 -33
- package/dist/generator.test.js +20 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +165 -54
- package/dist/providers/knowledge-hub.d.ts +37 -0
- package/dist/providers/knowledge-hub.js +141 -0
- package/dist/providers/openrouter.d.ts +32 -0
- package/dist/providers/openrouter.js +201 -0
- package/dist/release-check.js +12 -12
- package/dist/web-dist/404/index.html +1 -0
- package/dist/web-dist/404.html +1 -0
- package/dist/web-dist/__next.__PAGE__.txt +34 -0
- package/dist/web-dist/__next._full.txt +27 -0
- package/dist/web-dist/__next._tree.txt +3 -0
- package/dist/web-dist/_next/static/_zOqKpMPc6RDqk04fUScI/_buildManifest.js +11 -0
- package/dist/web-dist/_next/static/_zOqKpMPc6RDqk04fUScI/_clientMiddlewareManifest.js +1 -0
- package/dist/web-dist/_next/static/_zOqKpMPc6RDqk04fUScI/_ssgManifest.js +1 -0
- package/dist/web-dist/_next/static/chunks/0cz1d0mv5g_q7.js +1 -0
- package/dist/web-dist/_next/static/chunks/0uwih7sydv413.js +1 -0
- package/dist/web-dist/_next/static/chunks/1_yae15ffa5f6.js +1 -0
- package/dist/web-dist/_next/static/chunks/1hz3jco387c-k.js +1 -0
- package/dist/web-dist/_next/static/chunks/2bu5_paf4sm3x.css +1 -0
- package/dist/web-dist/_next/static/chunks/2kcqevsmv6kh2.js +31 -0
- package/dist/web-dist/_next/static/chunks/2s3d1bfr0l4b0.js +1 -0
- package/dist/web-dist/_next/static/chunks/32z87id9k6i2z.js +22 -0
- package/dist/web-dist/_next/static/chunks/39nefv-hczfy7.js +30 -0
- package/dist/web-dist/_next/static/chunks/3bx2gs3idjmo1.js +1 -0
- package/dist/web-dist/_next/static/chunks/turbopack-3eipe4c-imn5l.js +1 -0
- package/dist/web-dist/_next/static/media/favicon.2vob68tjqpejf.ico +0 -0
- package/dist/web-dist/_not-found/__next._full.txt +17 -0
- package/dist/web-dist/_not-found/__next._not-found.__PAGE__.txt +23 -0
- package/dist/web-dist/_not-found/__next._tree.txt +3 -0
- package/dist/web-dist/_not-found/index.html +1 -0
- package/dist/web-dist/_not-found/index.txt +17 -0
- package/dist/web-dist/chat/__next._full.txt +18 -0
- package/dist/web-dist/chat/__next._tree.txt +3 -0
- package/dist/web-dist/chat/__next.chat.__PAGE__.txt +24 -0
- package/dist/web-dist/chat/index.html +1 -0
- package/dist/web-dist/chat/index.txt +18 -0
- package/dist/web-dist/favicon.ico +0 -0
- package/dist/web-dist/index.html +1 -0
- package/dist/web-dist/index.txt +27 -0
- package/dist/web-dist/live2d/akaituno/akaituno.8192/texture_00.png +0 -0
- package/dist/web-dist/live2d/akaituno/akaituno.cdi3.json +296 -0
- package/dist/web-dist/live2d/akaituno/akaituno.moc3 +0 -0
- package/dist/web-dist/live2d/akaituno/akaituno.model3.json +42 -0
- package/dist/web-dist/live2d/akaituno/akaituno.physics3.json +839 -0
- package/dist/web-dist/live2d/akaituno/eye_color.exp3.json +12 -0
- package/dist/web-dist/live2d/akaituno/eyes_zetubou.exp3.json +12 -0
- package/dist/web-dist/live2d/akaituno/face_aozame.exp3.json +12 -0
- package/dist/web-dist/live2d/akaituno/hair_open.exp3.json +12 -0
- package/dist/web-dist/live2d/live2dcubismcore.min.js +9 -0
- package/dist/web-dist/operator/__next._full.txt +18 -0
- package/dist/web-dist/operator/__next._tree.txt +3 -0
- package/dist/web-dist/operator/__next.operator.__PAGE__.txt +24 -0
- package/dist/web-dist/operator/index.html +1 -0
- package/dist/web-dist/operator/index.txt +18 -0
- package/dist/web-template.d.ts +2 -0
- package/dist/web-template.js +547 -0
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -4,10 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.colors = exports.CLI_VERSION = void 0;
|
|
8
|
+
exports.printHeader = printHeader;
|
|
9
|
+
exports.printSection = printSection;
|
|
10
|
+
exports.printSuccess = printSuccess;
|
|
11
|
+
exports.projectDirectoryName = projectDirectoryName;
|
|
12
|
+
exports.formatReviewSummary = formatReviewSummary;
|
|
13
|
+
exports.withTask = withTask;
|
|
7
14
|
exports.runCreateWizard = runCreateWizard;
|
|
8
15
|
exports.runCliDoctor = runCliDoctor;
|
|
9
16
|
exports.runCliDb = runCliDb;
|
|
10
17
|
const node_child_process_1 = require("node:child_process");
|
|
18
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
11
19
|
const promises_1 = require("node:fs/promises");
|
|
12
20
|
const node_path_1 = __importDefault(require("node:path"));
|
|
13
21
|
const node_util_1 = require("node:util");
|
|
@@ -16,24 +24,26 @@ const discovery_1 = require("./discovery");
|
|
|
16
24
|
const generator_1 = require("./generator");
|
|
17
25
|
const doctor_1 = require("./doctor");
|
|
18
26
|
const db_1 = require("./db");
|
|
27
|
+
const configurators_1 = require("./configurators");
|
|
19
28
|
const execFile = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
exports.CLI_VERSION = '0.0.9';
|
|
30
|
+
exports.colors = {
|
|
22
31
|
cyan: '\u001b[36m',
|
|
23
32
|
dim: '\u001b[2m',
|
|
24
33
|
green: '\u001b[32m',
|
|
25
34
|
yellow: '\u001b[33m',
|
|
35
|
+
bold: '\u001b[1m',
|
|
26
36
|
reset: '\u001b[0m',
|
|
27
37
|
};
|
|
28
38
|
function printHeader() {
|
|
29
|
-
console.log(`\n${colors.cyan}◈ SIDURI${colors.reset} ${colors.dim}companion setup (manifest-driven)${colors.reset}`);
|
|
30
|
-
console.log(`${colors.yellow}Version ${CLI_VERSION}${colors.reset} · composable standalone architecture\n`);
|
|
39
|
+
console.log(`\n${exports.colors.cyan}◈ SIDURI${exports.colors.reset} ${exports.colors.dim}companion setup (manifest-driven)${exports.colors.reset}`);
|
|
40
|
+
console.log(`${exports.colors.yellow}Version ${exports.CLI_VERSION}${exports.colors.reset} · composable standalone architecture\n`);
|
|
31
41
|
}
|
|
32
42
|
function printSection(title) {
|
|
33
|
-
console.log(`\n${colors.cyan}── ${title} ${'─'.repeat(Math.max(2, 42 - title.length))}${colors.reset}`);
|
|
43
|
+
console.log(`\n${exports.colors.cyan}── ${title} ${'─'.repeat(Math.max(2, 42 - title.length))}${exports.colors.reset}\n`);
|
|
34
44
|
}
|
|
35
45
|
function printSuccess(message) {
|
|
36
|
-
console.log(`${colors.green}✓${colors.reset} ${message}`);
|
|
46
|
+
console.log(`${exports.colors.green}✓${exports.colors.reset} ${message}`);
|
|
37
47
|
}
|
|
38
48
|
function projectDirectoryName(value) {
|
|
39
49
|
const slug = value
|
|
@@ -43,22 +53,47 @@ function projectDirectoryName(value) {
|
|
|
43
53
|
.replace(/^-+|-+$/g, '');
|
|
44
54
|
return slug || 'siduri';
|
|
45
55
|
}
|
|
56
|
+
function formatReviewSummary(companionName, selectedManifests, organSummaries) {
|
|
57
|
+
const lines = [];
|
|
58
|
+
lines.push(`\n${exports.colors.cyan}── Review ${companionName} ${'─'.repeat(Math.max(2, 42 - (companionName.length + 9)))}${exports.colors.reset}\n`);
|
|
59
|
+
lines.push(` ${exports.colors.bold}Companion${exports.colors.reset}`);
|
|
60
|
+
lines.push(` ${exports.colors.dim}Name:${exports.colors.reset} ${companionName}\n`);
|
|
61
|
+
for (const m of selectedManifests) {
|
|
62
|
+
const isRequired = m.organType === 'brain';
|
|
63
|
+
const tag = isRequired ? ` ${exports.colors.dim}· required${exports.colors.reset}` : '';
|
|
64
|
+
lines.push(` ${exports.colors.bold}${m.displayName.split(' ')[0] || m.organType}${exports.colors.reset}${tag}`);
|
|
65
|
+
const summary = organSummaries[m.configKey] || organSummaries[m.organType] || {};
|
|
66
|
+
const entries = Object.entries(summary);
|
|
67
|
+
if (entries.length === 0) {
|
|
68
|
+
lines.push(` ${exports.colors.dim}Provider:${exports.colors.reset} ${m.displayName}`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
for (const [key, val] of entries) {
|
|
72
|
+
const valStr = String(val);
|
|
73
|
+
lines.push(` ${exports.colors.dim}${key}:${exports.colors.reset}${' '.repeat(Math.max(1, 10 - key.length))}${valStr}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
lines.push('');
|
|
77
|
+
}
|
|
78
|
+
lines.push(`${exports.colors.cyan}${'─'.repeat(46)}${exports.colors.reset}\n`);
|
|
79
|
+
return lines.join('\n');
|
|
80
|
+
}
|
|
46
81
|
async function withTask(label, task) {
|
|
47
|
-
process.stdout.write(`${colors.dim}${label}${colors.reset}`);
|
|
82
|
+
process.stdout.write(`${exports.colors.dim}${label}${exports.colors.reset}`);
|
|
48
83
|
const frames = ['·', '•', '●', '•'];
|
|
49
84
|
let index = 0;
|
|
50
85
|
const timer = setInterval(() => {
|
|
51
|
-
process.stdout.write(`\r${colors.dim}${label} ${frames[index++ % frames.length]}${colors.reset}`);
|
|
86
|
+
process.stdout.write(`\r${exports.colors.dim}${label} ${frames[index++ % frames.length]}${exports.colors.reset}`);
|
|
52
87
|
}, 120);
|
|
53
88
|
try {
|
|
54
89
|
const result = await task();
|
|
55
90
|
clearInterval(timer);
|
|
56
|
-
process.stdout.write(`\r${colors.green}✓${colors.reset} ${label}\n`);
|
|
91
|
+
process.stdout.write(`\r${exports.colors.green}✓${exports.colors.reset} ${label}\n`);
|
|
57
92
|
return result;
|
|
58
93
|
}
|
|
59
94
|
catch (error) {
|
|
60
95
|
clearInterval(timer);
|
|
61
|
-
process.stdout.write(`\r${colors.yellow}!${colors.reset} ${label}\n`);
|
|
96
|
+
process.stdout.write(`\r${exports.colors.yellow}!${exports.colors.reset} ${label}\n`);
|
|
62
97
|
throw error;
|
|
63
98
|
}
|
|
64
99
|
}
|
|
@@ -86,7 +121,7 @@ async function runCreateWizard(targetDir) {
|
|
|
86
121
|
const companionName = basicAnswers.name;
|
|
87
122
|
const projectDir = targetDir ? node_path_1.default.resolve(process.cwd(), targetDir) : node_path_1.default.resolve(process.cwd(), projectDirectoryName(companionName));
|
|
88
123
|
printSection('Organ Selection');
|
|
89
|
-
console.log(`${colors.dim}Select any combination of organs to compose into your standalone instance.${colors.reset}\n`);
|
|
124
|
+
console.log(`${exports.colors.dim}Select any combination of organs to compose into your standalone instance.${exports.colors.reset}\n`);
|
|
90
125
|
// Brain is required by architecture contract for cognition
|
|
91
126
|
const brainManifest = registry.get('brain');
|
|
92
127
|
const nonBrainManifests = availableManifests.filter((m) => m.organType !== 'brain');
|
|
@@ -110,42 +145,110 @@ async function runCreateWizard(targetDir) {
|
|
|
110
145
|
if (m)
|
|
111
146
|
selectedManifests.push(m);
|
|
112
147
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
console.log(` ${colors.dim}Core Protocol:${colors.reset} @siduri-x/core`);
|
|
117
|
-
console.log(` ${colors.dim}Selected Organs:${colors.reset}`);
|
|
148
|
+
// 2. Interactive Organ Configuration Stage
|
|
149
|
+
const organConfigs = {};
|
|
150
|
+
const organSummaries = {};
|
|
118
151
|
for (const m of selectedManifests) {
|
|
119
|
-
|
|
152
|
+
const isRequired = m.organType === 'brain';
|
|
153
|
+
const sectionTitle = isRequired ? `${m.displayName.split(' ')[0] || m.organType} · required` : m.displayName.split(' ')[0] || m.organType;
|
|
154
|
+
printSection(sectionTitle);
|
|
155
|
+
const res = await (0, configurators_1.configureOrgan)(m, {
|
|
156
|
+
companionName,
|
|
157
|
+
existingConfig: organConfigs[m.configKey],
|
|
158
|
+
});
|
|
159
|
+
organConfigs[m.configKey] = res.config;
|
|
160
|
+
organSummaries[m.configKey] = res.summary || {};
|
|
120
161
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
162
|
+
// 3. Final Review and Edit Loop
|
|
163
|
+
while (true) {
|
|
164
|
+
console.log(formatReviewSummary(companionName, selectedManifests, organSummaries));
|
|
165
|
+
const { reviewAction } = await inquirer_1.default.prompt({
|
|
166
|
+
type: 'list',
|
|
167
|
+
name: 'reviewAction',
|
|
168
|
+
message: `Create ${companionName} with this configuration?`,
|
|
169
|
+
choices: [
|
|
170
|
+
{ name: 'Yes, create', value: 'create' },
|
|
171
|
+
{ name: 'Go back and edit', value: 'edit' },
|
|
172
|
+
{ name: 'Cancel', value: 'cancel' },
|
|
173
|
+
],
|
|
174
|
+
});
|
|
175
|
+
if (reviewAction === 'cancel') {
|
|
176
|
+
console.log('Instance creation cancelled.');
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (reviewAction === 'create') {
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
if (reviewAction === 'edit') {
|
|
183
|
+
const editChoices = selectedManifests.map((m) => ({
|
|
184
|
+
name: `Edit ${m.displayName}`,
|
|
185
|
+
value: m.configKey,
|
|
186
|
+
}));
|
|
187
|
+
editChoices.push({ name: 'Edit all organs in sequence', value: '__ALL__' });
|
|
188
|
+
editChoices.push({ name: 'Back to review', value: '__BACK__' });
|
|
189
|
+
const { organToEdit } = await inquirer_1.default.prompt({
|
|
190
|
+
type: 'list',
|
|
191
|
+
name: 'organToEdit',
|
|
192
|
+
message: 'Which organ would you like to edit?',
|
|
193
|
+
choices: editChoices,
|
|
194
|
+
});
|
|
195
|
+
if (organToEdit === '__BACK__') {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
const organsToReconfigure = organToEdit === '__ALL__'
|
|
199
|
+
? selectedManifests
|
|
200
|
+
: selectedManifests.filter((m) => m.configKey === organToEdit);
|
|
201
|
+
for (const m of organsToReconfigure) {
|
|
202
|
+
const isRequired = m.organType === 'brain';
|
|
203
|
+
const sectionTitle = isRequired ? `${m.displayName.split(' ')[0] || m.organType} · required` : m.displayName.split(' ')[0] || m.organType;
|
|
204
|
+
printSection(sectionTitle);
|
|
205
|
+
const res = await (0, configurators_1.configureOrgan)(m, {
|
|
206
|
+
companionName,
|
|
207
|
+
existingConfig: organConfigs[m.configKey],
|
|
208
|
+
});
|
|
209
|
+
organConfigs[m.configKey] = res.config;
|
|
210
|
+
organSummaries[m.configKey] = res.summary || {};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
130
213
|
}
|
|
131
|
-
//
|
|
214
|
+
// 4. Generate Instance Files
|
|
132
215
|
const files = (0, generator_1.generateInstanceFiles)({
|
|
133
216
|
name: companionName,
|
|
134
217
|
selectedManifests,
|
|
218
|
+
organConfigs,
|
|
135
219
|
});
|
|
136
220
|
await (0, promises_1.mkdir)(projectDir, { recursive: true });
|
|
137
221
|
await (0, promises_1.mkdir)(node_path_1.default.join(projectDir, 'src'), { recursive: true });
|
|
222
|
+
const publicDir = node_path_1.default.join(projectDir, 'public');
|
|
223
|
+
await (0, promises_1.mkdir)(publicDir, { recursive: true });
|
|
138
224
|
await (0, promises_1.writeFile)(node_path_1.default.join(projectDir, 'package.json'), files['package.json'], 'utf8');
|
|
139
225
|
await (0, promises_1.writeFile)(node_path_1.default.join(projectDir, 'siduri.config.json'), files['siduri.config.json'], 'utf8');
|
|
140
226
|
await (0, promises_1.writeFile)(node_path_1.default.join(projectDir, 'siduri.schema.json'), files['siduri.schema.json'], 'utf8');
|
|
141
227
|
await (0, promises_1.writeFile)(node_path_1.default.join(projectDir, '.env.example'), files['.env.example'], 'utf8');
|
|
142
228
|
await (0, promises_1.writeFile)(node_path_1.default.join(projectDir, 'README.md'), files['README.md'], 'utf8');
|
|
143
229
|
await (0, promises_1.writeFile)(node_path_1.default.join(projectDir, 'src/index.js'), files['src/index.js'], 'utf8');
|
|
230
|
+
// Copy full Next.js apps/web production build if present
|
|
231
|
+
const webDistCandidates = [
|
|
232
|
+
node_path_1.default.resolve(__dirname, 'web-dist'),
|
|
233
|
+
node_path_1.default.resolve(__dirname, '../dist/web-dist'),
|
|
234
|
+
node_path_1.default.resolve(__dirname, '../../apps/web/out'),
|
|
235
|
+
node_path_1.default.resolve(process.cwd(), 'apps/web/out'),
|
|
236
|
+
];
|
|
237
|
+
const foundWebDist = webDistCandidates.find((p) => node_fs_1.default.existsSync(p));
|
|
238
|
+
if (foundWebDist) {
|
|
239
|
+
node_fs_1.default.cpSync(foundWebDist, publicDir, { recursive: true });
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
await (0, promises_1.writeFile)(node_path_1.default.join(publicDir, 'index.html'), files['public/index.html'], 'utf8');
|
|
243
|
+
}
|
|
244
|
+
if (files['docker-compose.yml']) {
|
|
245
|
+
await (0, promises_1.writeFile)(node_path_1.default.join(projectDir, 'docker-compose.yml'), files['docker-compose.yml'], 'utf8');
|
|
246
|
+
}
|
|
144
247
|
if (files.createAssetsBodyDir) {
|
|
145
248
|
await (0, promises_1.mkdir)(node_path_1.default.join(projectDir, 'assets/body/model'), { recursive: true });
|
|
146
249
|
}
|
|
147
250
|
printSuccess(`Generated standalone files at ${projectDir}`);
|
|
148
|
-
//
|
|
251
|
+
// 5. Install packages if not in dry-run
|
|
149
252
|
try {
|
|
150
253
|
await withTask('Installing dependencies (npm install)', async () => {
|
|
151
254
|
await execFile('npm', ['install', '--no-audit', '--no-fund'], { cwd: projectDir });
|
|
@@ -153,48 +256,56 @@ async function runCreateWizard(targetDir) {
|
|
|
153
256
|
printSuccess('Dependencies installed successfully.');
|
|
154
257
|
}
|
|
155
258
|
catch (err) {
|
|
156
|
-
console.warn(`${colors.yellow}!${colors.reset} Notice: npm install had warnings or requires network: ${err.message}`);
|
|
259
|
+
console.warn(`${exports.colors.yellow}!${exports.colors.reset} Notice: npm install had warnings or requires network: ${err.message}`);
|
|
157
260
|
}
|
|
158
261
|
printSection('Instance Ready');
|
|
159
|
-
console.log(
|
|
262
|
+
console.log(`Your Siduri companion is ready! Next steps:\n`);
|
|
160
263
|
console.log(` cd ${node_path_1.default.relative(process.cwd(), projectDir) || '.'}`);
|
|
161
|
-
console.log(` cp .env.example .env
|
|
162
|
-
|
|
264
|
+
console.log(` cp .env.example .env ${exports.colors.dim}# Fill in required API keys/credentials${exports.colors.reset}`);
|
|
265
|
+
if (files['docker-compose.yml']) {
|
|
266
|
+
console.log(` npm run services:up ${exports.colors.dim}# Start local Docker services (PostgreSQL / VOICEVOX)${exports.colors.reset}`);
|
|
267
|
+
}
|
|
268
|
+
const hasMemory = selectedManifests.some((m) => m.organType === 'memory');
|
|
269
|
+
if (hasMemory) {
|
|
270
|
+
console.log(` npx @vxnus/siduri db push ${exports.colors.dim}# Push PostgreSQL memory schema${exports.colors.reset}`);
|
|
271
|
+
}
|
|
272
|
+
console.log(` npm run doctor ${exports.colors.dim}# Run diagnostic health probes${exports.colors.reset}`);
|
|
273
|
+
console.log(` npm start ${exports.colors.dim}# Start Web Companion & Memory Console at http://localhost:3000${exports.colors.reset}\n`);
|
|
163
274
|
}
|
|
164
275
|
async function runCliDoctor(targetDir) {
|
|
165
276
|
printHeader();
|
|
166
277
|
const dir = targetDir ? node_path_1.default.resolve(process.cwd(), targetDir) : process.cwd();
|
|
167
|
-
console.log(`${colors.cyan}Siduri Doctor${colors.reset}`);
|
|
168
|
-
console.log(`${colors.dim}─────────────${colors.reset}\n`);
|
|
278
|
+
console.log(`${exports.colors.cyan}Siduri Doctor${exports.colors.reset}`);
|
|
279
|
+
console.log(`${exports.colors.dim}─────────────${exports.colors.reset}\n`);
|
|
169
280
|
try {
|
|
170
281
|
const report = await (0, doctor_1.runDoctor)({ projectDir: dir });
|
|
171
|
-
console.log(`${colors.dim}Instance:${colors.reset} ${report.instanceName}`);
|
|
172
|
-
console.log(`${colors.dim}Organs:${colors.reset} ${report.configuredOrgans.join(', ')}\n`);
|
|
282
|
+
console.log(`${exports.colors.dim}Instance:${exports.colors.reset} ${report.instanceName}`);
|
|
283
|
+
console.log(`${exports.colors.dim}Organs:${exports.colors.reset} ${report.configuredOrgans.join(', ')}\n`);
|
|
173
284
|
const categories = ['Environment', 'Services', 'Database', 'Health Probe'];
|
|
174
285
|
for (const cat of categories) {
|
|
175
286
|
const items = report.results.filter((r) => r.category === cat);
|
|
176
287
|
if (items.length > 0) {
|
|
177
|
-
console.log(`${colors.cyan}${cat}${colors.reset}`);
|
|
288
|
+
console.log(`${exports.colors.cyan}${cat}${exports.colors.reset}`);
|
|
178
289
|
for (const item of items) {
|
|
179
290
|
if (item.status === 'PASS') {
|
|
180
|
-
console.log(` ${colors.green}✓${colors.reset} ${item.name} ${colors.dim}(${item.message || 'OK'})${colors.reset}`);
|
|
291
|
+
console.log(` ${exports.colors.green}✓${exports.colors.reset} ${item.name} ${exports.colors.dim}(${item.message || 'OK'})${exports.colors.reset}`);
|
|
181
292
|
}
|
|
182
293
|
else if (item.status === 'OPTIONAL_MISSING') {
|
|
183
|
-
console.log(` ${colors.dim}○${colors.reset} ${item.name} ${colors.dim}(Optional, not set)${colors.reset}`);
|
|
294
|
+
console.log(` ${exports.colors.dim}○${exports.colors.reset} ${item.name} ${exports.colors.dim}(Optional, not set)${exports.colors.reset}`);
|
|
184
295
|
}
|
|
185
296
|
else if (item.status === 'SKIPPED') {
|
|
186
|
-
console.log(` ${colors.dim}— ${item.name} (${item.message})${colors.reset}`);
|
|
297
|
+
console.log(` ${exports.colors.dim}— ${item.name} (${item.message})${exports.colors.reset}`);
|
|
187
298
|
}
|
|
188
299
|
else {
|
|
189
|
-
console.log(` ${colors.yellow}✗${colors.reset} ${item.name}`);
|
|
300
|
+
console.log(` ${exports.colors.yellow}✗${exports.colors.reset} ${item.name}`);
|
|
190
301
|
if (item.organName) {
|
|
191
|
-
console.log(` ${colors.dim}Required by:${colors.reset} ${item.organName}`);
|
|
302
|
+
console.log(` ${exports.colors.dim}Required by:${exports.colors.reset} ${item.organName}`);
|
|
192
303
|
}
|
|
193
304
|
if (item.message) {
|
|
194
|
-
console.log(` ${colors.yellow}${item.message}${colors.reset}`);
|
|
305
|
+
console.log(` ${exports.colors.yellow}${item.message}${exports.colors.reset}`);
|
|
195
306
|
}
|
|
196
307
|
if (item.remediation) {
|
|
197
|
-
console.log(` ${colors.dim}Remediation:${colors.reset} ${item.remediation}`);
|
|
308
|
+
console.log(` ${exports.colors.dim}Remediation:${exports.colors.reset} ${item.remediation}`);
|
|
198
309
|
}
|
|
199
310
|
}
|
|
200
311
|
}
|
|
@@ -202,16 +313,16 @@ async function runCliDoctor(targetDir) {
|
|
|
202
313
|
}
|
|
203
314
|
}
|
|
204
315
|
if (report.passed) {
|
|
205
|
-
console.log(`${colors.green}Result: PASS${colors.reset}\n`);
|
|
316
|
+
console.log(`${exports.colors.green}Result: PASS${exports.colors.reset}\n`);
|
|
206
317
|
process.exitCode = 0;
|
|
207
318
|
}
|
|
208
319
|
else {
|
|
209
|
-
console.log(`${colors.yellow}Result: FAIL${colors.reset}\n`);
|
|
320
|
+
console.log(`${exports.colors.yellow}Result: FAIL${exports.colors.reset}\n`);
|
|
210
321
|
process.exitCode = 1;
|
|
211
322
|
}
|
|
212
323
|
}
|
|
213
324
|
catch (err) {
|
|
214
|
-
console.error(`\n${colors.yellow}Doctor Error:${colors.reset} ${err.message}\n`);
|
|
325
|
+
console.error(`\n${exports.colors.yellow}Doctor Error:${exports.colors.reset} ${err.message}\n`);
|
|
215
326
|
process.exitCode = 2;
|
|
216
327
|
}
|
|
217
328
|
}
|
|
@@ -223,24 +334,24 @@ async function runCliDb(subcommand, targetDir) {
|
|
|
223
334
|
return;
|
|
224
335
|
}
|
|
225
336
|
const dir = targetDir ? node_path_1.default.resolve(process.cwd(), targetDir) : process.cwd();
|
|
226
|
-
console.log(`${colors.cyan}Siduri Database Migrations${colors.reset}`);
|
|
227
|
-
console.log(`${colors.dim}──────────────────────────${colors.reset}\n`);
|
|
337
|
+
console.log(`${exports.colors.cyan}Siduri Database Migrations${exports.colors.reset}`);
|
|
338
|
+
console.log(`${exports.colors.dim}──────────────────────────${exports.colors.reset}\n`);
|
|
228
339
|
try {
|
|
229
340
|
const res = await (0, db_1.runDbPush)({ projectDir: dir });
|
|
230
341
|
if (res.status === 'NOOP') {
|
|
231
|
-
console.log(`${colors.dim}— ${res.message}${colors.reset}\n`);
|
|
342
|
+
console.log(`${exports.colors.dim}— ${res.message}${exports.colors.reset}\n`);
|
|
232
343
|
}
|
|
233
344
|
else {
|
|
234
345
|
printSuccess(res.message);
|
|
235
346
|
if (res.appliedMigrations.length > 0) {
|
|
236
|
-
console.log(`${colors.dim}Applied:${colors.reset} ${res.appliedMigrations.join(', ')}`);
|
|
347
|
+
console.log(`${exports.colors.dim}Applied:${exports.colors.reset} ${res.appliedMigrations.join(', ')}`);
|
|
237
348
|
}
|
|
238
349
|
console.log();
|
|
239
350
|
}
|
|
240
351
|
process.exitCode = 0;
|
|
241
352
|
}
|
|
242
353
|
catch (err) {
|
|
243
|
-
console.error(`\n${colors.yellow}Database Migration Error:${colors.reset} ${err.message}\n`);
|
|
354
|
+
console.error(`\n${exports.colors.yellow}Database Migration Error:${exports.colors.reset} ${err.message}\n`);
|
|
244
355
|
process.exitCode = 3;
|
|
245
356
|
}
|
|
246
357
|
}
|
|
@@ -248,7 +359,7 @@ async function main() {
|
|
|
248
359
|
const args = process.argv.slice(2);
|
|
249
360
|
const command = args[0];
|
|
250
361
|
if (command === '--version' || command === '-v') {
|
|
251
|
-
console.log(CLI_VERSION);
|
|
362
|
+
console.log(exports.CLI_VERSION);
|
|
252
363
|
return;
|
|
253
364
|
}
|
|
254
365
|
if (command === 'create') {
|
|
@@ -279,7 +390,7 @@ if (require.main === module) {
|
|
|
279
390
|
console.log('\nOperation cancelled.');
|
|
280
391
|
return;
|
|
281
392
|
}
|
|
282
|
-
console.error(`\n${colors.yellow}!${colors.reset} ${error instanceof Error ? error.message : error}`);
|
|
393
|
+
console.error(`\n${exports.colors.yellow}!${exports.colors.reset} ${error instanceof Error ? error.message : error}`);
|
|
283
394
|
process.exitCode = 1;
|
|
284
395
|
});
|
|
285
396
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface KnowledgeHubCapabilities {
|
|
2
|
+
search?: boolean;
|
|
3
|
+
retrieval?: boolean;
|
|
4
|
+
contextInjection?: boolean;
|
|
5
|
+
semanticSearch?: boolean;
|
|
6
|
+
lexicalSearch?: boolean;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface KnowledgeHubManifest {
|
|
10
|
+
name: string;
|
|
11
|
+
displayName?: string;
|
|
12
|
+
publisher?: string;
|
|
13
|
+
package?: string;
|
|
14
|
+
version: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
capabilities?: KnowledgeHubCapabilities | string[];
|
|
17
|
+
distribution?: {
|
|
18
|
+
kind?: string;
|
|
19
|
+
url?: string;
|
|
20
|
+
};
|
|
21
|
+
source?: string;
|
|
22
|
+
environment?: Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
description?: string;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
export declare const KNOWN_KNOWLEDGE_PACKS: Record<string, KnowledgeHubManifest>;
|
|
29
|
+
export declare function validateKnowledgeManifest(raw: unknown, packId?: string): KnowledgeHubManifest;
|
|
30
|
+
export declare function extractCapabilitiesList(capabilities?: KnowledgeHubCapabilities | string[]): string[];
|
|
31
|
+
export declare class KnowledgeHubClient {
|
|
32
|
+
private registryUrl;
|
|
33
|
+
private timeoutMs;
|
|
34
|
+
constructor(registryUrl?: string, timeoutMs?: number);
|
|
35
|
+
resolveProvider(packId: string): Promise<KnowledgeHubManifest>;
|
|
36
|
+
}
|
|
37
|
+
export declare function displayKnowledgeProviderSummary(manifest: KnowledgeHubManifest, packId: string): void;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KnowledgeHubClient = exports.KNOWN_KNOWLEDGE_PACKS = void 0;
|
|
4
|
+
exports.validateKnowledgeManifest = validateKnowledgeManifest;
|
|
5
|
+
exports.extractCapabilitiesList = extractCapabilitiesList;
|
|
6
|
+
exports.displayKnowledgeProviderSummary = displayKnowledgeProviderSummary;
|
|
7
|
+
exports.KNOWN_KNOWLEDGE_PACKS = {
|
|
8
|
+
'@vxnus/e-teyvat': {
|
|
9
|
+
name: 'e-teyvat',
|
|
10
|
+
displayName: 'E Teyvat',
|
|
11
|
+
publisher: 'vxnus',
|
|
12
|
+
package: '@vxnus/e-teyvat',
|
|
13
|
+
version: '1.2.0',
|
|
14
|
+
description: 'Teyvat knowledge provider for Siduri.',
|
|
15
|
+
capabilities: ['Search', 'Retrieval', 'Context injection'],
|
|
16
|
+
distribution: {
|
|
17
|
+
kind: 'provider',
|
|
18
|
+
url: 'https://teyvat.e.vxnus.xyz',
|
|
19
|
+
},
|
|
20
|
+
source: 'E Knowledge Hub',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
function validateKnowledgeManifest(raw, packId) {
|
|
24
|
+
if (!raw || typeof raw !== 'object') {
|
|
25
|
+
throw new Error(`Invalid knowledge manifest: expected object.`);
|
|
26
|
+
}
|
|
27
|
+
const m = raw;
|
|
28
|
+
if (!m.name || typeof m.name !== 'string') {
|
|
29
|
+
throw new Error(`Invalid knowledge manifest: missing 'name' field.`);
|
|
30
|
+
}
|
|
31
|
+
if (!m.version || typeof m.version !== 'string') {
|
|
32
|
+
throw new Error(`Invalid knowledge manifest: missing 'version' field.`);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
name: m.name,
|
|
36
|
+
displayName: m.displayName || m.name,
|
|
37
|
+
publisher: m.publisher,
|
|
38
|
+
package: m.package || packId || m.name,
|
|
39
|
+
version: m.version,
|
|
40
|
+
description: m.description || 'Knowledge pack provider',
|
|
41
|
+
capabilities: m.capabilities || ['Search', 'Retrieval'],
|
|
42
|
+
distribution: m.distribution,
|
|
43
|
+
source: m.source || 'E Knowledge Hub',
|
|
44
|
+
environment: m.environment || [],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function extractCapabilitiesList(capabilities) {
|
|
48
|
+
if (!capabilities) {
|
|
49
|
+
return ['Search', 'Retrieval'];
|
|
50
|
+
}
|
|
51
|
+
if (Array.isArray(capabilities)) {
|
|
52
|
+
return capabilities.map((c) => String(c));
|
|
53
|
+
}
|
|
54
|
+
const result = [];
|
|
55
|
+
if (capabilities.lexicalSearch || capabilities.search)
|
|
56
|
+
result.push('Search');
|
|
57
|
+
result.push('Retrieval');
|
|
58
|
+
if (capabilities.contextInjection)
|
|
59
|
+
result.push('Context injection');
|
|
60
|
+
if (capabilities.semanticSearch)
|
|
61
|
+
result.push('Semantic search');
|
|
62
|
+
if (capabilities.structuredEntities)
|
|
63
|
+
result.push('Structured entities');
|
|
64
|
+
if (capabilities.relations)
|
|
65
|
+
result.push('Entity relations');
|
|
66
|
+
if (capabilities.revisions)
|
|
67
|
+
result.push('Content revisions');
|
|
68
|
+
for (const [key, val] of Object.entries(capabilities)) {
|
|
69
|
+
if (val === true && !['search', 'retrieval', 'contextInjection', 'semanticSearch', 'lexicalSearch', 'structuredEntities', 'relations', 'revisions'].includes(key)) {
|
|
70
|
+
result.push(key);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return result.length > 0 ? result : ['Search', 'Retrieval'];
|
|
74
|
+
}
|
|
75
|
+
class KnowledgeHubClient {
|
|
76
|
+
registryUrl;
|
|
77
|
+
timeoutMs;
|
|
78
|
+
constructor(registryUrl = 'https://e.vxnus.xyz/api/v1/knowledge', timeoutMs = 5000) {
|
|
79
|
+
this.registryUrl = registryUrl.replace(/\/+$/, '');
|
|
80
|
+
this.timeoutMs = timeoutMs;
|
|
81
|
+
}
|
|
82
|
+
async resolveProvider(packId) {
|
|
83
|
+
const trimmed = packId.trim();
|
|
84
|
+
const match = trimmed.match(/^@([^/]+)\/([^/]+)$/);
|
|
85
|
+
if (!match) {
|
|
86
|
+
throw new Error(`Invalid package ID format "${packId}". Expected format: @publisher/name (e.g. @vxnus/e-teyvat)`);
|
|
87
|
+
}
|
|
88
|
+
const publisher = match[1];
|
|
89
|
+
const name = match[2];
|
|
90
|
+
const url = `${this.registryUrl}/${encodeURIComponent(publisher)}/${encodeURIComponent(name)}`;
|
|
91
|
+
const controller = new AbortController();
|
|
92
|
+
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
93
|
+
try {
|
|
94
|
+
const response = await fetch(url, {
|
|
95
|
+
method: 'GET',
|
|
96
|
+
headers: { Accept: 'application/json' },
|
|
97
|
+
signal: controller.signal,
|
|
98
|
+
});
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
// Check offline/built-in catalog fallback for known pack IDs
|
|
101
|
+
if (exports.KNOWN_KNOWLEDGE_PACKS[trimmed]) {
|
|
102
|
+
return exports.KNOWN_KNOWLEDGE_PACKS[trimmed];
|
|
103
|
+
}
|
|
104
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText} for ${packId}`);
|
|
105
|
+
}
|
|
106
|
+
const body = await response.json();
|
|
107
|
+
return validateKnowledgeManifest(body, trimmed);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
// If network fails and known pack exists, use fallback
|
|
111
|
+
if (exports.KNOWN_KNOWLEDGE_PACKS[trimmed]) {
|
|
112
|
+
return exports.KNOWN_KNOWLEDGE_PACKS[trimmed];
|
|
113
|
+
}
|
|
114
|
+
throw new Error(`Failed to resolve package "${packId}" from E Knowledge Hub: ${err.message}`);
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
clearTimeout(timer);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.KnowledgeHubClient = KnowledgeHubClient;
|
|
122
|
+
function displayKnowledgeProviderSummary(manifest, packId) {
|
|
123
|
+
const cyan = '\u001b[36m';
|
|
124
|
+
const dim = '\u001b[2m';
|
|
125
|
+
const reset = '\u001b[0m';
|
|
126
|
+
console.log(`\n${cyan}── Knowledge Provider ────────────────────────${reset}\n`);
|
|
127
|
+
console.log(` ${dim}Name:${reset} ${manifest.displayName || manifest.name}`);
|
|
128
|
+
console.log(` ${dim}Package:${reset} ${packId}`);
|
|
129
|
+
console.log(` ${dim}Version:${reset} ${manifest.version}`);
|
|
130
|
+
if (manifest.description) {
|
|
131
|
+
console.log(`\n ${dim}Description:${reset}`);
|
|
132
|
+
console.log(` ${manifest.description}`);
|
|
133
|
+
}
|
|
134
|
+
const caps = extractCapabilitiesList(manifest.capabilities);
|
|
135
|
+
console.log(`\n ${dim}Capabilities:${reset}`);
|
|
136
|
+
for (const cap of caps) {
|
|
137
|
+
console.log(` • ${cap}`);
|
|
138
|
+
}
|
|
139
|
+
console.log(`\n ${dim}Source:${reset}`);
|
|
140
|
+
console.log(` ${manifest.source || 'E Knowledge Hub'}\n`);
|
|
141
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface ModelOption {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
contextLength?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ModelProvider {
|
|
8
|
+
listModels(): Promise<ModelOption[]>;
|
|
9
|
+
}
|
|
10
|
+
export declare const CURATED_OPENROUTER_MODELS: ModelOption[];
|
|
11
|
+
export declare class OpenRouterModelProvider implements ModelProvider {
|
|
12
|
+
private apiUrl;
|
|
13
|
+
private timeoutMs;
|
|
14
|
+
constructor(apiUrl?: string, timeoutMs?: number);
|
|
15
|
+
listModels(): Promise<ModelOption[]>;
|
|
16
|
+
}
|
|
17
|
+
export type ModelSelectionResult = {
|
|
18
|
+
type: 'selected';
|
|
19
|
+
modelId: string;
|
|
20
|
+
modelName: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'manual';
|
|
23
|
+
modelId: string;
|
|
24
|
+
} | {
|
|
25
|
+
type: 'switch_provider';
|
|
26
|
+
} | {
|
|
27
|
+
type: 'cancel';
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Interactive model selector with search, pagination, and robust error recovery.
|
|
31
|
+
*/
|
|
32
|
+
export declare function promptOpenRouterModelSelection(provider?: ModelProvider): Promise<ModelSelectionResult>;
|