@nex-ai/nex 0.2.8 → 0.2.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nex-ai/nex",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Nex CLI provides organizational context & memory to AI agents. Connect email, CRM, Slack, meetings, and 100+ tools into one knowledge graph. Delegates to the nex-cli binary.",
|
|
5
5
|
"mcpName": "io.github.nex-crm/nex",
|
|
6
6
|
"type": "module",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { readFileSync } from "node:fs";
|
|
13
|
-
import { join } from "node:path";
|
|
14
13
|
import { homedir } from "node:os";
|
|
14
|
+
import { join } from "node:path";
|
|
15
15
|
|
|
16
16
|
// Read API key from shared Nex config
|
|
17
17
|
function loadApiKey(): string | null {
|
|
@@ -36,7 +36,7 @@ async function nexAsk(query: string, apiKey: string): Promise<string> {
|
|
|
36
36
|
signal: AbortSignal.timeout(10_000),
|
|
37
37
|
});
|
|
38
38
|
if (!res.ok) return "";
|
|
39
|
-
const data = await res.json() as { answer?: string };
|
|
39
|
+
const data = (await res.json()) as { answer?: string };
|
|
40
40
|
return data.answer ?? "";
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -87,8 +87,9 @@ export default {
|
|
|
87
87
|
const apiKey = loadApiKey();
|
|
88
88
|
if (!apiKey) return;
|
|
89
89
|
|
|
90
|
-
// Capture last assistant message
|
|
91
|
-
|
|
90
|
+
// Capture last assistant message. Use optional chaining in case the
|
|
91
|
+
// host passes a nullish payload — we prefer silent no-op over a throw.
|
|
92
|
+
const messages = _input?.messages;
|
|
92
93
|
if (!Array.isArray(messages)) return;
|
|
93
94
|
|
|
94
95
|
const lastAssistant = [...messages].reverse().find((m) => m.role === "assistant");
|