@geravant/sinain 1.18.3 → 1.19.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/cli.js +10 -0
- package/onboard.js +32 -6
- package/package.json +1 -1
- package/sinain-core/src/server.ts +2 -2
package/cli.js
CHANGED
|
@@ -81,6 +81,13 @@ switch (cmd) {
|
|
|
81
81
|
await import("./install.js");
|
|
82
82
|
break;
|
|
83
83
|
|
|
84
|
+
case "mcp": {
|
|
85
|
+
const sub = process.argv[3]; // install | list | remove
|
|
86
|
+
const { runMcpCli } = await import("./mcp-register.js");
|
|
87
|
+
await runMcpCli(sub, process.argv.slice(4));
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
|
|
84
91
|
case "export-knowledge":
|
|
85
92
|
await exportKnowledge();
|
|
86
93
|
break;
|
|
@@ -396,6 +403,9 @@ Usage:
|
|
|
396
403
|
sinain export-knowledge Export knowledge for transfer to another machine
|
|
397
404
|
sinain import-knowledge <file> Import knowledge from export file
|
|
398
405
|
sinain install Install OpenClaw plugin (server-side)
|
|
406
|
+
sinain mcp install Register sinain MCP for your agents (Claude, Cursor, Codex, Goose, Junie)
|
|
407
|
+
sinain mcp list Show MCP registration status across agents
|
|
408
|
+
sinain mcp remove <agent> Unregister sinain MCP from one agent
|
|
399
409
|
|
|
400
410
|
Start options:
|
|
401
411
|
--no-sense Skip screen capture (sense_client)
|
package/onboard.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
stepApiKey, stepTranscription, stepGateway, stepPrivacy, stepModel,
|
|
13
13
|
HOME, SINAIN_DIR, ENV_PATH, PKG_DIR, IS_WINDOWS, IS_MAC,
|
|
14
14
|
} from "./config-shared.js";
|
|
15
|
+
import { stepMcpInstall, detectMcpAgents } from "./mcp-register.js";
|
|
15
16
|
|
|
16
17
|
// ── Header ──────────────────────────────────────────────────────────────────
|
|
17
18
|
|
|
@@ -138,7 +139,7 @@ export async function runOnboard(args = {}) {
|
|
|
138
139
|
initialValue: "quickstart",
|
|
139
140
|
}));
|
|
140
141
|
|
|
141
|
-
const totalSteps = flow === "quickstart" ? 2 :
|
|
142
|
+
const totalSteps = flow === "quickstart" ? 2 : 6;
|
|
142
143
|
|
|
143
144
|
// ── Collect vars ────────────────────────────────────────────────────────
|
|
144
145
|
|
|
@@ -211,9 +212,28 @@ export async function runOnboard(args = {}) {
|
|
|
211
212
|
].join("\n"),
|
|
212
213
|
"QuickStart defaults",
|
|
213
214
|
);
|
|
215
|
+
|
|
216
|
+
// QuickStart MCP install: a single confirm gated on at least one
|
|
217
|
+
// detected agent. Avoids interrupting users who don't have any
|
|
218
|
+
// MCP-aware agent installed. Re-runnable later via `sinain mcp install`.
|
|
219
|
+
try {
|
|
220
|
+
const detected = (await detectMcpAgents()).filter((a) => a.present);
|
|
221
|
+
if (detected.length > 0) {
|
|
222
|
+
const labels = detected.map((a) => a.label).join(", ");
|
|
223
|
+
const wantMcp = guard(await p.confirm({
|
|
224
|
+
message: `Detected ${labels} — register sinain MCP for them?`,
|
|
225
|
+
initialValue: true,
|
|
226
|
+
}));
|
|
227
|
+
if (wantMcp) {
|
|
228
|
+
await stepMcpInstall(base, "Connect MCP agents");
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
} catch (err) {
|
|
232
|
+
p.log.info(`Skipping MCP setup: ${err.message}`);
|
|
233
|
+
}
|
|
214
234
|
} else {
|
|
215
|
-
// Advanced flow: steps 2-
|
|
216
|
-
const transcription = await stepTranscription(base, "[2/
|
|
235
|
+
// Advanced flow: steps 2-6 (MCP install is step 6)
|
|
236
|
+
const transcription = await stepTranscription(base, "[2/6] Audio transcription");
|
|
217
237
|
vars.TRANSCRIPTION_BACKEND = transcription;
|
|
218
238
|
p.log.success(`Using ${transcription === "openrouter" ? "cloud" : "local"} transcription.`);
|
|
219
239
|
|
|
@@ -249,7 +269,7 @@ export async function runOnboard(args = {}) {
|
|
|
249
269
|
|
|
250
270
|
// stepGateway returns { envVars, agentsPatch }: tokens go to .env,
|
|
251
271
|
// URLs + session + escalation mode go to agents.json's openclaw profile.
|
|
252
|
-
const gatewayResult = await stepGateway(base, "[3/
|
|
272
|
+
const gatewayResult = await stepGateway(base, "[3/6] OpenClaw gateway");
|
|
253
273
|
Object.assign(vars, gatewayResult.envVars);
|
|
254
274
|
Object.assign(agentsPatch, gatewayResult.agentsPatch);
|
|
255
275
|
if (gatewayResult.agentsPatch.escalationMode === "off") {
|
|
@@ -258,17 +278,23 @@ export async function runOnboard(args = {}) {
|
|
|
258
278
|
p.log.success("Gateway configured.");
|
|
259
279
|
}
|
|
260
280
|
|
|
261
|
-
const privacy = await stepPrivacy(base, "[4/
|
|
281
|
+
const privacy = await stepPrivacy(base, "[4/6] Privacy mode");
|
|
262
282
|
vars.PRIVACY_MODE = privacy;
|
|
263
283
|
p.log.success(`Privacy: ${privacy}.`);
|
|
264
284
|
|
|
265
|
-
const model = await stepModel(base, "[5/
|
|
285
|
+
const model = await stepModel(base, "[5/6] AI model for HUD analysis");
|
|
266
286
|
vars.AGENT_MODEL = model;
|
|
267
287
|
p.log.success(`Model: ${model}.`);
|
|
268
288
|
|
|
269
289
|
// Default agent goes into agents.json `default` field (was SINAIN_AGENT
|
|
270
290
|
// env var). Overlay's chip selector lets the user switch at runtime.
|
|
271
291
|
agentsPatch.default = base.SINAIN_AGENT || "claude";
|
|
292
|
+
|
|
293
|
+
// Step 6: register sinain MCP with locally-installed MCP-aware agents
|
|
294
|
+
// (Claude Code, Cursor, Codex, Goose, Junie, Claude Desktop). Detection
|
|
295
|
+
// is non-destructive — if no agents are installed, the step prints a
|
|
296
|
+
// skip note and returns. Idempotent across re-runs.
|
|
297
|
+
await stepMcpInstall(base, "[6/6] Connect MCP agents");
|
|
272
298
|
}
|
|
273
299
|
|
|
274
300
|
// ── Common defaults ───────────────────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -60,7 +60,7 @@ let allFacts = [];
|
|
|
60
60
|
async function loadFacts() {
|
|
61
61
|
document.getElementById('status').textContent = 'Loading...';
|
|
62
62
|
try {
|
|
63
|
-
const res = await fetch('/knowledge/entities?max=
|
|
63
|
+
const res = await fetch('/knowledge/entities?max=1000');
|
|
64
64
|
const data = await res.json();
|
|
65
65
|
allFacts = typeof data.entities === 'string' ? JSON.parse(data.entities) : data.entities;
|
|
66
66
|
const domains = [...new Set(allFacts.map(f => f.domain).filter(Boolean))].sort();
|
|
@@ -440,7 +440,7 @@ export function createAppServer(deps: ServerDeps) {
|
|
|
440
440
|
|
|
441
441
|
if (req.method === "GET" && url.pathname === "/knowledge/entities") {
|
|
442
442
|
// List all entities in the knowledge graph
|
|
443
|
-
const max = Math.min(parseInt(url.searchParams.get("max") || "50"),
|
|
443
|
+
const max = Math.min(parseInt(url.searchParams.get("max") || "50"), 1000);
|
|
444
444
|
if (deps.listKnowledgeEntities) {
|
|
445
445
|
try {
|
|
446
446
|
const entities = await deps.listKnowledgeEntities(max);
|