@nex-ai/nex 0.1.60 → 0.1.61
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/dist/index.js +0 -0
- package/dist/mcp/index.js +0 -0
- package/dist/plugin/adapters/cline-capture.d.ts +7 -0
- package/dist/plugin/adapters/cline-capture.js +25 -0
- package/dist/plugin/adapters/cline-capture.js.map +1 -0
- package/dist/plugin/adapters/cline-recall.d.ts +7 -0
- package/dist/plugin/adapters/cline-recall.js +30 -0
- package/dist/plugin/adapters/cline-recall.js.map +1 -0
- package/dist/plugin/adapters/cline-task-start.d.ts +7 -0
- package/dist/plugin/adapters/cline-task-start.js +30 -0
- package/dist/plugin/adapters/cline-task-start.js.map +1 -0
- package/dist/plugin/adapters/cursor-recall.d.ts +7 -0
- package/dist/plugin/adapters/cursor-recall.js +31 -0
- package/dist/plugin/adapters/cursor-recall.js.map +1 -0
- package/dist/plugin/adapters/cursor-session-start.d.ts +7 -0
- package/dist/plugin/adapters/cursor-session-start.js +30 -0
- package/dist/plugin/adapters/cursor-session-start.js.map +1 -0
- package/dist/plugin/adapters/cursor-stop.d.ts +7 -0
- package/dist/plugin/adapters/cursor-stop.js +25 -0
- package/dist/plugin/adapters/cursor-stop.js.map +1 -0
- package/dist/plugin/adapters/windsurf-capture.d.ts +7 -0
- package/dist/plugin/adapters/windsurf-capture.js +25 -0
- package/dist/plugin/adapters/windsurf-capture.js.map +1 -0
- package/dist/plugin/adapters/windsurf-recall.d.ts +7 -0
- package/dist/plugin/adapters/windsurf-recall.js +31 -0
- package/dist/plugin/adapters/windsurf-recall.js.map +1 -0
- package/dist/plugin/shared.d.ts +39 -0
- package/dist/plugin/shared.js +380 -0
- package/dist/plugin/shared.js.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/mcp/index.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Cline TaskComplete hook — auto-capture to Nex.
|
|
4
|
+
* Input: { taskComplete: { result: string } }
|
|
5
|
+
* Output: {}
|
|
6
|
+
*/
|
|
7
|
+
import { doCapture, readStdin } from "../shared.js";
|
|
8
|
+
async function main() {
|
|
9
|
+
try {
|
|
10
|
+
const raw = await readStdin();
|
|
11
|
+
let input = {};
|
|
12
|
+
try {
|
|
13
|
+
input = JSON.parse(raw);
|
|
14
|
+
}
|
|
15
|
+
catch { /* defaults */ }
|
|
16
|
+
await doCapture({ message: input.taskComplete?.result ?? "" });
|
|
17
|
+
process.stdout.write("{}");
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
process.stderr.write(`[nex-cline] Capture error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
21
|
+
process.stdout.write("{}");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
main().then(() => process.exit(0)).catch(() => process.exit(0));
|
|
25
|
+
//# sourceMappingURL=cline-capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cline-capture.js","sourceRoot":"","sources":["../../../src/plugin/adapters/cline-capture.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMpD,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,SAAS,EAAE,CAAC;QAC9B,IAAI,KAAK,GAAe,EAAE,CAAC;QAC3B,IAAI,CAAC;YAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;QAEzD,MAAM,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,YAAY,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC;QAC/D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Cline UserPromptSubmit hook — auto-recall from Nex.
|
|
4
|
+
* Input: { userPromptSubmit: { prompt: string } }
|
|
5
|
+
* Output: { contextModification: "..." } or {}
|
|
6
|
+
*/
|
|
7
|
+
import { doRecall, readStdin } from "../shared.js";
|
|
8
|
+
async function main() {
|
|
9
|
+
try {
|
|
10
|
+
const raw = await readStdin();
|
|
11
|
+
let input = {};
|
|
12
|
+
try {
|
|
13
|
+
input = JSON.parse(raw);
|
|
14
|
+
}
|
|
15
|
+
catch { /* defaults */ }
|
|
16
|
+
const prompt = input.userPromptSubmit?.prompt ?? "";
|
|
17
|
+
const result = await doRecall(prompt, input.session_id);
|
|
18
|
+
if (!result) {
|
|
19
|
+
process.stdout.write("{}");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
process.stdout.write(JSON.stringify({ contextModification: result.context }));
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
process.stderr.write(`[nex-cline] Recall error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
26
|
+
process.stdout.write("{}");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
main().then(() => process.exit(0)).catch(() => process.exit(0));
|
|
30
|
+
//# sourceMappingURL=cline-recall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cline-recall.js","sourceRoot":"","sources":["../../../src/plugin/adapters/cline-recall.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAOnD,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,SAAS,EAAE,CAAC;QAC9B,IAAI,KAAK,GAAe,EAAE,CAAC;QAC3B,IAAI,CAAC;YAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;QAEzD,MAAM,MAAM,GAAG,KAAK,CAAC,gBAAgB,EAAE,MAAM,IAAI,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAExD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3B,OAAO;QACT,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,mBAAmB,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAChF,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Cline TaskStart hook — load baseline context from Nex.
|
|
4
|
+
* Input: { taskStart: { task: string } }
|
|
5
|
+
* Output: { contextModification: "..." } or {}
|
|
6
|
+
*/
|
|
7
|
+
import { doSessionStart, readStdin } from "../shared.js";
|
|
8
|
+
async function main() {
|
|
9
|
+
try {
|
|
10
|
+
const raw = await readStdin();
|
|
11
|
+
let input = {};
|
|
12
|
+
try {
|
|
13
|
+
input = JSON.parse(raw);
|
|
14
|
+
}
|
|
15
|
+
catch { /* defaults */ }
|
|
16
|
+
const result = await doSessionStart("startup", input.session_id);
|
|
17
|
+
if (!result) {
|
|
18
|
+
process.stdout.write("{}");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const context = result.registrationPrompt ?? result.context;
|
|
22
|
+
process.stdout.write(JSON.stringify({ contextModification: context }));
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
process.stderr.write(`[nex-cline] Task start error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
26
|
+
process.stdout.write("{}");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
main().then(() => process.exit(0)).catch(() => process.exit(0));
|
|
30
|
+
//# sourceMappingURL=cline-task-start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cline-task-start.js","sourceRoot":"","sources":["../../../src/plugin/adapters/cline-task-start.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAOzD,KAAK,UAAU,IA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+
* Input: { prompt?: string, attachments?: unknown[], session_id?: string }
|
|
5
|
+
* Output: { continue: true, user_message: "<original + context>" } or {}
|
|
6
|
+
*/
|
|
7
|
+
import { doRecall, readStdin } from "../shared.js";
|
|
8
|
+
async function main() {
|
|
9
|
+
try {
|
|
10
|
+
const raw = await readStdin();
|
|
11
|
+
let input = {};
|
|
12
|
+
try {
|
|
13
|
+
input = JSON.parse(raw);
|
|
14
|
+
}
|
|
15
|
+
catch { /* defaults */ }
|
|
16
|
+
const prompt = input.prompt ?? "";
|
|
17
|
+
const result = await doRecall(prompt, input.session_id);
|
|
18
|
+
if (!result) {
|
|
19
|
+
process.stdout.write("{}");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Inject context as additional_context (Cursor's context injection mechanism)
|
|
23
|
+
process.stdout.write(JSON.stringify({ additional_context: result.context }));
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
process.stderr.write(`[nex-cursor] Recall error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
27
|
+
process.stdout.write("{}");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
main().then(() => process.exit(0)).catch(() => process.exit(0));
|
|
31
|
+
//# sourceMappingURL=cursor-recall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-recall.js","sourceRoot":"","sources":["../../../src/plugin/adapters/cursor-recall.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQnD,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,SAAS,EAAE,CAAC;QAC9B,IAAI,KAAK,GAAgB,EAAE,CAAC;QAC5B,IAAI,CAAC;YAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;QAEzD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAExD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3B,OAAO;QACT,CAAC;QAED,8EAA8E;QAC9E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,kBAAkB,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC/E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Cursor sessionStart hook — load baseline context from Nex.
|
|
4
|
+
* Input: { session_id?: string }
|
|
5
|
+
* Output: { additional_context: "..." } or {}
|
|
6
|
+
*/
|
|
7
|
+
import { doSessionStart, readStdin } from "../shared.js";
|
|
8
|
+
async function main() {
|
|
9
|
+
try {
|
|
10
|
+
const raw = await readStdin();
|
|
11
|
+
let input = {};
|
|
12
|
+
try {
|
|
13
|
+
input = JSON.parse(raw);
|
|
14
|
+
}
|
|
15
|
+
catch { /* defaults */ }
|
|
16
|
+
const result = await doSessionStart("startup", input.session_id);
|
|
17
|
+
if (!result) {
|
|
18
|
+
process.stdout.write("{}");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const context = result.registrationPrompt ?? result.context;
|
|
22
|
+
process.stdout.write(JSON.stringify({ additional_context: context }));
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
process.stderr.write(`[nex-cursor] Session start error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
26
|
+
process.stdout.write("{}");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
main().then(() => process.exit(0)).catch(() => process.exit(0));
|
|
30
|
+
//# sourceMappingURL=cursor-session-start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-session-start.js","sourceRoot":"","sources":["../../../src/plugin/adapters/cursor-session-start.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,SAAS,EAAE,CAAC;QAC9B,IAAI,KAAK,GAA4B,EAAE,CAAC;QACxC,IAAI,CAAC;YAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;QAEzD,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,SAAS,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QACjE,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3B,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,CAAC,kBAAkB,IAAI,MAAM,CAAC,OAAO,CAAC;QAC5D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChH,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Cursor stop hook — auto-capture conversation to Nex.
|
|
4
|
+
* Input: { last_message?: string, status?: string, session_id?: string }
|
|
5
|
+
* Output: {}
|
|
6
|
+
*/
|
|
7
|
+
import { doCapture, readStdin } from "../shared.js";
|
|
8
|
+
async function main() {
|
|
9
|
+
try {
|
|
10
|
+
const raw = await readStdin();
|
|
11
|
+
let input = {};
|
|
12
|
+
try {
|
|
13
|
+
input = JSON.parse(raw);
|
|
14
|
+
}
|
|
15
|
+
catch { /* defaults */ }
|
|
16
|
+
await doCapture({ message: input.last_message ?? "" });
|
|
17
|
+
process.stdout.write("{}");
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
process.stderr.write(`[nex-cursor] Capture error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
21
|
+
process.stdout.write("{}");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
main().then(() => process.exit(0)).catch(() => process.exit(0));
|
|
25
|
+
//# sourceMappingURL=cursor-stop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-stop.js","sourceRoot":"","sources":["../../../src/plugin/adapters/cursor-stop.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQpD,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,SAAS,EAAE,CAAC;QAC9B,IAAI,KAAK,GAAoB,EAAE,CAAC;QAChC,IAAI,CAAC;YAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;QAEzD,MAAM,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC,CAAC;QACvD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1G,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Windsurf post_cascade_response hook — auto-capture to Nex.
|
|
4
|
+
* Input: { tool_info: { response: string } }
|
|
5
|
+
* Output: {}
|
|
6
|
+
*/
|
|
7
|
+
import { doCapture, readStdin } from "../shared.js";
|
|
8
|
+
async function main() {
|
|
9
|
+
try {
|
|
10
|
+
const raw = await readStdin();
|
|
11
|
+
let input = {};
|
|
12
|
+
try {
|
|
13
|
+
input = JSON.parse(raw);
|
|
14
|
+
}
|
|
15
|
+
catch { /* defaults */ }
|
|
16
|
+
await doCapture({ message: input.tool_info?.response ?? "" });
|
|
17
|
+
process.stdout.write("{}");
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
process.stderr.write(`[nex-windsurf] Capture error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
21
|
+
process.stdout.write("{}");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
main().then(() => process.exit(0)).catch(() => process.exit(0));
|
|
25
|
+
//# sourceMappingURL=windsurf-capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windsurf-capture.js","sourceRoot":"","sources":["../../../src/plugin/adapters/windsurf-capture.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMpD,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,SAAS,EAAE,CAAC;QAC9B,IAAI,KAAK,GAAkB,EAAE,CAAC;QAC9B,IAAI,CAAC;YAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;QAEzD,MAAM,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,QAAQ,IAAI,EAAE,EAAE,CAAC,CAAC;QAC9D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5G,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Windsurf pre_user_prompt hook — auto-recall from Nex.
|
|
4
|
+
* Input: { tool_info: { user_prompt: string } }
|
|
5
|
+
* Output: context string on stdout (displayed via show_output) or {}
|
|
6
|
+
*/
|
|
7
|
+
import { doRecall, readStdin } from "../shared.js";
|
|
8
|
+
async function main() {
|
|
9
|
+
try {
|
|
10
|
+
const raw = await readStdin();
|
|
11
|
+
let input = {};
|
|
12
|
+
try {
|
|
13
|
+
input = JSON.parse(raw);
|
|
14
|
+
}
|
|
15
|
+
catch { /* defaults */ }
|
|
16
|
+
const prompt = input.tool_info?.user_prompt ?? "";
|
|
17
|
+
const result = await doRecall(prompt, input.session_id);
|
|
18
|
+
if (!result) {
|
|
19
|
+
process.stdout.write("{}");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Windsurf displays stdout content via show_output
|
|
23
|
+
process.stdout.write(JSON.stringify({ additional_context: result.context }));
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
process.stderr.write(`[nex-windsurf] Recall error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
27
|
+
process.stdout.write("{}");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
main().then(() => process.exit(0)).catch(() => process.exit(0));
|
|
31
|
+
//# sourceMappingURL=windsurf-recall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windsurf-recall.js","sourceRoot":"","sources":["../../../src/plugin/adapters/windsurf-recall.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAOnD,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,SAAS,EAAE,CAAC;QAC9B,IAAI,KAAK,GAAkB,EAAE,CAAC;QAC9B,IAAI,CAAC;YAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;QAEzD,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,WAAW,IAAI,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAExD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3B,OAAO;QACT,CAAC;QAED,mDAAmD;QACnD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,kBAAkB,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC/E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3G,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared hook logic — platform-agnostic recall, capture, and session-start.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from auto-recall.ts, auto-capture.ts, auto-session-start.ts
|
|
5
|
+
* so adapters for Cursor, Windsurf, Cline, etc. can reuse the same logic
|
|
6
|
+
* without duplicating filter/client/format code.
|
|
7
|
+
*/
|
|
8
|
+
export interface RecallResult {
|
|
9
|
+
context: string;
|
|
10
|
+
nexSessionId?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface CaptureInput {
|
|
13
|
+
message: string;
|
|
14
|
+
sessionId?: string;
|
|
15
|
+
planDir?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SessionStartResult {
|
|
18
|
+
context: string;
|
|
19
|
+
nexSessionId?: string;
|
|
20
|
+
registrationPrompt?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Run recall logic: filter prompt → query Nex /ask → return formatted context.
|
|
24
|
+
* Returns null if recall is skipped or fails.
|
|
25
|
+
*/
|
|
26
|
+
export declare function doRecall(prompt: string, sessionKey?: string): Promise<RecallResult | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Run capture logic: filter message → ingest to Nex + scan plan files.
|
|
29
|
+
*/
|
|
30
|
+
export declare function doCapture(input: CaptureInput): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Run session-start logic: scan files → query Nex baseline → return context.
|
|
33
|
+
* Returns null if disabled. Returns registrationPrompt if no API key.
|
|
34
|
+
*/
|
|
35
|
+
export declare function doSessionStart(source: string, sessionKey?: string): Promise<SessionStartResult | null>;
|
|
36
|
+
/** Read stdin as a string (shared across all hook scripts). */
|
|
37
|
+
export declare function readStdin(): Promise<string>;
|
|
38
|
+
/** Wrap output in Claude Code hookSpecificOutput format. */
|
|
39
|
+
export declare function claudeCodeOutput(hookEventName: string, additionalContext: string): string;
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared hook logic — platform-agnostic recall, capture, and session-start.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from auto-recall.ts, auto-capture.ts, auto-session-start.ts
|
|
5
|
+
* so adapters for Cursor, Windsurf, Cline, etc. can reuse the same logic
|
|
6
|
+
* without duplicating filter/client/format code.
|
|
7
|
+
*/
|
|
8
|
+
import { loadConfig, loadScanConfig, ConfigError, isHookEnabled } from "./config.js";
|
|
9
|
+
import { NexClient, NexAuthError } from "./nex-client.js";
|
|
10
|
+
import { formatNexContext } from "./context-format.js";
|
|
11
|
+
import { captureFilter } from "./capture-filter.js";
|
|
12
|
+
import { SessionStore } from "./session-store.js";
|
|
13
|
+
import { shouldRecall, recordRecall } from "./recall-filter.js";
|
|
14
|
+
import { RateLimiter } from "./rate-limiter.js";
|
|
15
|
+
import { scanAndIngest } from "./file-scanner.js";
|
|
16
|
+
import { ingestContextFiles } from "./context-files.js";
|
|
17
|
+
import { readManifest, writeManifest, isChanged, markIngested, isScanFresh, markScanned } from "./file-manifest.js";
|
|
18
|
+
import { readdirSync, statSync, readFileSync } from "node:fs";
|
|
19
|
+
import { join, extname } from "node:path";
|
|
20
|
+
import { homedir } from "node:os";
|
|
21
|
+
const sessions = new SessionStore();
|
|
22
|
+
// ── Recall ──────────────────────────────────────────────────────────────
|
|
23
|
+
/**
|
|
24
|
+
* Run recall logic: filter prompt → query Nex /ask → return formatted context.
|
|
25
|
+
* Returns null if recall is skipped or fails.
|
|
26
|
+
*/
|
|
27
|
+
export async function doRecall(prompt, sessionKey) {
|
|
28
|
+
if (!isHookEnabled("recall"))
|
|
29
|
+
return null;
|
|
30
|
+
const trimmed = prompt?.trim();
|
|
31
|
+
if (!trimmed || trimmed.length < 5)
|
|
32
|
+
return null;
|
|
33
|
+
if (trimmed.startsWith("/"))
|
|
34
|
+
return null;
|
|
35
|
+
const isFirst = sessionKey ? !sessions.get(sessionKey) : true;
|
|
36
|
+
const decision = shouldRecall(trimmed, isFirst);
|
|
37
|
+
if (!decision.shouldRecall)
|
|
38
|
+
return null;
|
|
39
|
+
const cfg = loadConfig();
|
|
40
|
+
const client = new NexClient(cfg.apiKey, cfg.baseUrl);
|
|
41
|
+
let result;
|
|
42
|
+
try {
|
|
43
|
+
const nexSessionId = sessionKey ? sessions.get(sessionKey) : undefined;
|
|
44
|
+
result = await client.ask(trimmed, nexSessionId, 30_000);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
if (err instanceof NexAuthError) {
|
|
48
|
+
return {
|
|
49
|
+
context: "[Nex] API key expired or invalid. Run: nex register --email <email>",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
if (!result.answer)
|
|
55
|
+
return null;
|
|
56
|
+
if (result.session_id && sessionKey) {
|
|
57
|
+
sessions.set(sessionKey, result.session_id);
|
|
58
|
+
}
|
|
59
|
+
recordRecall(result.session_id);
|
|
60
|
+
const entityCount = result.entity_references?.length ?? 0;
|
|
61
|
+
const context = formatNexContext({
|
|
62
|
+
answer: result.answer,
|
|
63
|
+
entityCount,
|
|
64
|
+
sessionId: result.session_id,
|
|
65
|
+
});
|
|
66
|
+
return { context, nexSessionId: result.session_id };
|
|
67
|
+
}
|
|
68
|
+
// ── Capture ─────────────────────────────────────────────────────────────
|
|
69
|
+
const INGEST_TIMEOUT_MS = 3_000;
|
|
70
|
+
const MAX_PLAN_FILES = 2;
|
|
71
|
+
/**
|
|
72
|
+
* Run capture logic: filter message → ingest to Nex + scan plan files.
|
|
73
|
+
*/
|
|
74
|
+
export async function doCapture(input) {
|
|
75
|
+
if (!isHookEnabled("capture"))
|
|
76
|
+
return;
|
|
77
|
+
let cfg;
|
|
78
|
+
try {
|
|
79
|
+
cfg = loadConfig();
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const client = new NexClient(cfg.apiKey, cfg.baseUrl);
|
|
85
|
+
const rateLimiter = new RateLimiter();
|
|
86
|
+
// Conversation capture
|
|
87
|
+
const message = input.message?.trim();
|
|
88
|
+
if (message) {
|
|
89
|
+
const filterResult = captureFilter(message);
|
|
90
|
+
if (!filterResult.skipped) {
|
|
91
|
+
if (rateLimiter.canProceed()) {
|
|
92
|
+
try {
|
|
93
|
+
await client.ingest(filterResult.text, "claude-code-conversation", INGEST_TIMEOUT_MS);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
if (err instanceof NexAuthError) {
|
|
97
|
+
process.stderr.write(`[nex-capture] API key expired or invalid. Run 'nex register --email <email>' to get a new key.\n`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
process.stderr.write(`[nex-capture] Ingest failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Plan file ingestion
|
|
106
|
+
const plansDir = input.planDir ?? join(process.cwd(), ".claude", "plans");
|
|
107
|
+
try {
|
|
108
|
+
await ingestPlanFiles(client, rateLimiter, plansDir);
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
process.stderr.write(`[nex-capture] Plan file scan error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
112
|
+
}
|
|
113
|
+
// Transcript ingestion — ingest the full session conversation
|
|
114
|
+
if (input.sessionId) {
|
|
115
|
+
try {
|
|
116
|
+
await ingestTranscript(client, input.sessionId);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
// non-fatal
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async function ingestPlanFiles(client, rateLimiter, plansDir) {
|
|
124
|
+
const scanConfig = loadScanConfig();
|
|
125
|
+
if (!scanConfig.enabled)
|
|
126
|
+
return;
|
|
127
|
+
let entries;
|
|
128
|
+
try {
|
|
129
|
+
entries = readdirSync(plansDir, { withFileTypes: true });
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const manifest = readManifest();
|
|
135
|
+
let ingested = 0;
|
|
136
|
+
for (const entry of entries) {
|
|
137
|
+
if (ingested >= MAX_PLAN_FILES)
|
|
138
|
+
break;
|
|
139
|
+
if (!entry.isFile())
|
|
140
|
+
continue;
|
|
141
|
+
if (extname(entry.name).toLowerCase() !== ".md")
|
|
142
|
+
continue;
|
|
143
|
+
const fullPath = join(plansDir, entry.name);
|
|
144
|
+
try {
|
|
145
|
+
const stat = statSync(fullPath);
|
|
146
|
+
if (!isChanged(fullPath, stat, manifest))
|
|
147
|
+
continue;
|
|
148
|
+
if (!rateLimiter.canProceed())
|
|
149
|
+
break;
|
|
150
|
+
let content = readFileSync(fullPath, "utf-8");
|
|
151
|
+
if (content.length > 100_000) {
|
|
152
|
+
content = content.slice(0, 100_000) + "\n[...truncated]";
|
|
153
|
+
}
|
|
154
|
+
const context = `claude-code-plan:${entry.name}`;
|
|
155
|
+
await client.ingest(content, context, INGEST_TIMEOUT_MS);
|
|
156
|
+
markIngested(fullPath, stat, context, manifest);
|
|
157
|
+
ingested++;
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
// skip individual file errors
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (ingested > 0)
|
|
164
|
+
writeManifest(manifest);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Read a Claude Code session transcript and ingest the full conversation.
|
|
168
|
+
*
|
|
169
|
+
* Extracts user and assistant messages from the JSONL transcript file,
|
|
170
|
+
* builds a condensed conversation text, and sends it to Nex in one shot.
|
|
171
|
+
* This captures the full context instead of just the last assistant message.
|
|
172
|
+
*/
|
|
173
|
+
const MAX_TRANSCRIPT_LENGTH = 100_000;
|
|
174
|
+
async function ingestTranscript(client, sessionId) {
|
|
175
|
+
const cwd = process.cwd();
|
|
176
|
+
// Claude Code stores transcripts at ~/.claude/projects/<project-hash>/<session-id>.jsonl
|
|
177
|
+
// Project hash is the CWD path with / replaced by -
|
|
178
|
+
const projectHash = "-" + cwd.replace(/\//g, "-");
|
|
179
|
+
const transcriptPath = join(homedir(), ".claude", "projects", projectHash, `${sessionId}.jsonl`);
|
|
180
|
+
let raw;
|
|
181
|
+
try {
|
|
182
|
+
raw = readFileSync(transcriptPath, "utf-8");
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return; // transcript doesn't exist yet or path is wrong
|
|
186
|
+
}
|
|
187
|
+
// Extract user/assistant messages
|
|
188
|
+
const lines = [];
|
|
189
|
+
for (const line of raw.split("\n")) {
|
|
190
|
+
if (!line.trim())
|
|
191
|
+
continue;
|
|
192
|
+
try {
|
|
193
|
+
const entry = JSON.parse(line);
|
|
194
|
+
const role = entry.message?.role;
|
|
195
|
+
if (role !== "user" && role !== "assistant")
|
|
196
|
+
continue;
|
|
197
|
+
let text = "";
|
|
198
|
+
const content = entry.message?.content;
|
|
199
|
+
if (typeof content === "string") {
|
|
200
|
+
text = content;
|
|
201
|
+
}
|
|
202
|
+
else if (Array.isArray(content)) {
|
|
203
|
+
text = content
|
|
204
|
+
.filter((c) => c.type === "text")
|
|
205
|
+
.map((c) => c.text)
|
|
206
|
+
.join("\n");
|
|
207
|
+
}
|
|
208
|
+
if (!text.trim())
|
|
209
|
+
continue;
|
|
210
|
+
// Strip nex-context blocks to avoid feedback loops
|
|
211
|
+
text = text.replace(/<nex-context>[\s\S]*?<\/nex-context>/g, "").trim();
|
|
212
|
+
if (!text)
|
|
213
|
+
continue;
|
|
214
|
+
lines.push(`[${role}]: ${text}`);
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (lines.length < 2)
|
|
221
|
+
return; // need at least one exchange
|
|
222
|
+
let transcript = lines.join("\n\n");
|
|
223
|
+
if (transcript.length > MAX_TRANSCRIPT_LENGTH) {
|
|
224
|
+
// Keep the most recent messages (end of conversation is most valuable)
|
|
225
|
+
transcript = transcript.slice(-MAX_TRANSCRIPT_LENGTH);
|
|
226
|
+
transcript = "[...earlier messages truncated]\n\n" + transcript;
|
|
227
|
+
}
|
|
228
|
+
await client.ingest(transcript, `claude-code-transcript:${sessionId}`, 30_000);
|
|
229
|
+
}
|
|
230
|
+
// ── Session Start ───────────────────────────────────────────────────────
|
|
231
|
+
const SESSION_START_QUERY = "Summarize the key active context, recent interactions, and important updates for this user.";
|
|
232
|
+
/**
|
|
233
|
+
* Run session-start logic: scan files → query Nex baseline → return context.
|
|
234
|
+
* Returns null if disabled. Returns registrationPrompt if no API key.
|
|
235
|
+
*/
|
|
236
|
+
export async function doSessionStart(source, sessionKey) {
|
|
237
|
+
if (!isHookEnabled("session_start"))
|
|
238
|
+
return null;
|
|
239
|
+
let cfg;
|
|
240
|
+
try {
|
|
241
|
+
cfg = loadConfig();
|
|
242
|
+
}
|
|
243
|
+
catch (err) {
|
|
244
|
+
if (err instanceof ConfigError) {
|
|
245
|
+
// No API key — return registration instructions
|
|
246
|
+
return {
|
|
247
|
+
context: "",
|
|
248
|
+
registrationPrompt: buildRegistrationPrompt(),
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
const client = new NexClient(cfg.apiKey, cfg.baseUrl);
|
|
254
|
+
const contextParts = [];
|
|
255
|
+
// File scan on startup or clear
|
|
256
|
+
const shouldScan = source === "startup" || source === "clear";
|
|
257
|
+
if (shouldScan) {
|
|
258
|
+
// Skip expensive file scanning if a scan completed recently (within 1 hour).
|
|
259
|
+
// The context query below still runs — only the file walk + ingest is skipped.
|
|
260
|
+
const scanManifest = readManifest();
|
|
261
|
+
const scanFresh = isScanFresh(scanManifest);
|
|
262
|
+
if (!scanFresh) {
|
|
263
|
+
const rateLimiter = new RateLimiter();
|
|
264
|
+
const cwd = process.cwd();
|
|
265
|
+
try {
|
|
266
|
+
const ctxResult = await ingestContextFiles(client, rateLimiter, cwd);
|
|
267
|
+
if (ctxResult.ingested > 0) {
|
|
268
|
+
contextParts.push(`[Context files: ${ctxResult.ingested} ingested (${ctxResult.files.join(", ")})]`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
// non-fatal
|
|
273
|
+
}
|
|
274
|
+
try {
|
|
275
|
+
const scanConfig = loadScanConfig();
|
|
276
|
+
if (scanConfig.enabled) {
|
|
277
|
+
const scanResult = await scanAndIngest(client, rateLimiter, cwd, scanConfig);
|
|
278
|
+
if (scanResult.ingested > 0) {
|
|
279
|
+
contextParts.push(`[File scan: ${scanResult.ingested} file${scanResult.ingested === 1 ? "" : "s"} ingested, ${scanResult.scanned} scanned]`);
|
|
280
|
+
// Trigger compounding intelligence after ingestion (non-blocking, best-effort)
|
|
281
|
+
triggerCompounding(cfg).catch(() => { });
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
// non-fatal
|
|
287
|
+
}
|
|
288
|
+
// Mark scan as complete so subsequent sessions skip it
|
|
289
|
+
markScanned(scanManifest);
|
|
290
|
+
writeManifest(scanManifest);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
let result;
|
|
294
|
+
try {
|
|
295
|
+
result = await client.ask(SESSION_START_QUERY, undefined, 30_000);
|
|
296
|
+
}
|
|
297
|
+
catch (err) {
|
|
298
|
+
if (err instanceof NexAuthError) {
|
|
299
|
+
return {
|
|
300
|
+
context: "",
|
|
301
|
+
registrationPrompt: buildAuthExpiredPrompt(),
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
throw err;
|
|
305
|
+
}
|
|
306
|
+
if (!result.answer && contextParts.length === 0)
|
|
307
|
+
return null;
|
|
308
|
+
if (result.session_id && sessionKey) {
|
|
309
|
+
sessions.set(sessionKey, result.session_id);
|
|
310
|
+
}
|
|
311
|
+
recordRecall(result.session_id);
|
|
312
|
+
const entityCount = result.entity_references?.length ?? 0;
|
|
313
|
+
const context = formatNexContext({
|
|
314
|
+
answer: result.answer,
|
|
315
|
+
entityCount,
|
|
316
|
+
sessionId: result.session_id,
|
|
317
|
+
});
|
|
318
|
+
const fullContext = contextParts.length > 0
|
|
319
|
+
? `${context}\n${contextParts.join("\n")}`
|
|
320
|
+
: context;
|
|
321
|
+
return { context: fullContext, nexSessionId: result.session_id };
|
|
322
|
+
}
|
|
323
|
+
function buildRegistrationPrompt() {
|
|
324
|
+
return [
|
|
325
|
+
"[Nex Memory Plugin] No API key configured. Registration is required to enable persistent memory.",
|
|
326
|
+
"",
|
|
327
|
+
"IMPORTANT: Before proceeding with the user's request, you must set up Nex memory:",
|
|
328
|
+
"1. Ask the user for their email address to register for a Nex account",
|
|
329
|
+
"2. Run: nex register --email <email>",
|
|
330
|
+
"3. Then run: nex setup",
|
|
331
|
+
"",
|
|
332
|
+
"Keep it brief — just ask for the email and register. No restart needed after registration.",
|
|
333
|
+
].join("\n");
|
|
334
|
+
}
|
|
335
|
+
function buildAuthExpiredPrompt() {
|
|
336
|
+
return [
|
|
337
|
+
"[Nex Memory Plugin] API key expired or invalid. Re-registration is required to restore persistent memory.",
|
|
338
|
+
"",
|
|
339
|
+
"IMPORTANT: Before proceeding with the user's request, you must renew the Nex API key:",
|
|
340
|
+
"1. Ask the user for their email address",
|
|
341
|
+
"2. Run: nex register --email <email>",
|
|
342
|
+
"3. Then run: nex setup",
|
|
343
|
+
"",
|
|
344
|
+
"Keep it brief — just ask for the email and register. No restart needed after registration.",
|
|
345
|
+
].join("\n");
|
|
346
|
+
}
|
|
347
|
+
// ── Helpers ─────────────────────────────────────────────────────────────
|
|
348
|
+
/** Read stdin as a string (shared across all hook scripts). */
|
|
349
|
+
export async function readStdin() {
|
|
350
|
+
const chunks = [];
|
|
351
|
+
for await (const chunk of process.stdin) {
|
|
352
|
+
chunks.push(chunk);
|
|
353
|
+
}
|
|
354
|
+
return Buffer.concat(chunks).toString("utf-8");
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Trigger compounding intelligence jobs after content ingestion.
|
|
358
|
+
* Runs consolidation, pattern detection, and playbook synthesis.
|
|
359
|
+
* Best-effort — errors are silently ignored.
|
|
360
|
+
*/
|
|
361
|
+
async function triggerCompounding(cfg) {
|
|
362
|
+
const jobs = ["consolidation", "pattern_detection", "playbook_synthesis"];
|
|
363
|
+
const url = `${cfg.baseUrl}/api/developers/v1/compounding/trigger`;
|
|
364
|
+
await Promise.allSettled(jobs.map((job) => fetch(url, {
|
|
365
|
+
method: "POST",
|
|
366
|
+
headers: { Authorization: `Bearer ${cfg.apiKey}`, "Content-Type": "application/json" },
|
|
367
|
+
body: JSON.stringify({ job_type: job, dry_run: false }),
|
|
368
|
+
signal: AbortSignal.timeout(30_000),
|
|
369
|
+
})));
|
|
370
|
+
}
|
|
371
|
+
/** Wrap output in Claude Code hookSpecificOutput format. */
|
|
372
|
+
export function claudeCodeOutput(hookEventName, additionalContext) {
|
|
373
|
+
return JSON.stringify({
|
|
374
|
+
hookSpecificOutput: {
|
|
375
|
+
hookEventName,
|
|
376
|
+
additionalContext,
|
|
377
|
+
},
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/plugin/shared.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAkB,MAAM,aAAa,CAAC;AACrG,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC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KAAK,CAAC,GAAG,EAAE;QACT,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,GAAG,CAAC,MAAM,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QACtF,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACvD,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC;KACpC,CAAC,CACH,CACF,CAAC;AACJ,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,gBAAgB,CAC9B,aAAqB,EACrB,iBAAyB;IAEzB,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,kBAAkB,EAAE;YAClB,aAAa;YACb,iBAAiB;SAClB;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nex-ai/nex",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.61",
|
|
4
4
|
"description": "Nex CLI provides organizational context & memory to AI agents. Connect email, CRM, Slack, meetings, and 100+ tools into one knowledge graph.",
|
|
5
5
|
"mcpName": "io.github.nex-crm/nex",
|
|
6
6
|
"type": "module",
|