amalfa 1.0.34 → 1.0.35
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/package.json +1 -1
- package/src/cli/sonar-chat.ts +26 -6
- package/src/daemon/sonar-agent.ts +11 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amalfa",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.35",
|
|
4
4
|
"description": "Local-first knowledge graph engine for AI agents. Transforms markdown into searchable memory with MCP protocol.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/pjsvis/amalfa#readme",
|
package/src/cli/sonar-chat.ts
CHANGED
|
@@ -4,19 +4,39 @@ import { DaemonManager } from "../utils/DaemonManager";
|
|
|
4
4
|
|
|
5
5
|
export async function chatLoop() {
|
|
6
6
|
const manager = new DaemonManager();
|
|
7
|
-
|
|
7
|
+
let status = await manager.checkSonarAgent();
|
|
8
8
|
|
|
9
9
|
if (!status.running) {
|
|
10
|
-
console.log(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
console.log("🚀 Sonar Agent not running. Starting it now...");
|
|
11
|
+
await manager.startSonarAgent();
|
|
12
|
+
// Wait for it to be ready
|
|
13
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
14
|
+
status = await manager.checkSonarAgent();
|
|
15
|
+
if (!status.running) {
|
|
16
|
+
console.log(
|
|
17
|
+
"❌ Failed to start Sonar Agent. Check logs: .amalfa/logs/sonar.log",
|
|
18
|
+
);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
console.log("✅ Sonar Agent started.\n");
|
|
14
22
|
}
|
|
15
23
|
|
|
16
24
|
const BASE_URL = `http://localhost:${status.port}`;
|
|
17
25
|
let sessionId: string | undefined;
|
|
18
26
|
|
|
19
|
-
|
|
27
|
+
// Fetch health to get provider info
|
|
28
|
+
let providerInfo = "";
|
|
29
|
+
try {
|
|
30
|
+
const health = (await fetch(`${BASE_URL}/health`).then((r) =>
|
|
31
|
+
r.json(),
|
|
32
|
+
)) as { provider?: string; model?: string };
|
|
33
|
+
const providerLabel = health.provider === "cloud" ? "☁️ Cloud" : "💻 Local";
|
|
34
|
+
providerInfo = ` [${providerLabel}: ${health.model || "unknown"}]`;
|
|
35
|
+
} catch {
|
|
36
|
+
providerInfo = "";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
console.log(`💬 AMALFA Corpus Assistant${providerInfo}`);
|
|
20
40
|
console.log(" Type 'exit' or 'quit' to leave.\n");
|
|
21
41
|
|
|
22
42
|
const rl = createInterface({
|
|
@@ -149,8 +149,18 @@ function startServer(port: number) {
|
|
|
149
149
|
|
|
150
150
|
// Health check
|
|
151
151
|
if (url.pathname === "/health") {
|
|
152
|
+
const cfg = await loadConfig();
|
|
153
|
+
const provider = cfg.sonar.cloud?.enabled ? "cloud" : "local";
|
|
154
|
+
const model = cfg.sonar.cloud?.enabled
|
|
155
|
+
? cfg.sonar.cloud.model
|
|
156
|
+
: inferenceState.ollamaModel || cfg.sonar.model;
|
|
152
157
|
return Response.json(
|
|
153
|
-
{
|
|
158
|
+
{
|
|
159
|
+
status: "ok",
|
|
160
|
+
ollama: inferenceState.ollamaAvailable,
|
|
161
|
+
provider,
|
|
162
|
+
model,
|
|
163
|
+
},
|
|
154
164
|
{ headers: corsHeaders },
|
|
155
165
|
);
|
|
156
166
|
}
|