agent-knowledge 1.3.1 → 1.3.3
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/dashboard.d.ts.map +1 -1
- package/dist/dashboard.js +74 -0
- package/dist/dashboard.js.map +1 -1
- package/dist/knowledge/consolidate.d.ts +4 -2
- package/dist/knowledge/consolidate.d.ts.map +1 -1
- package/dist/knowledge/consolidate.js +21 -9
- package/dist/knowledge/consolidate.js.map +1 -1
- package/dist/knowledge/distill.d.ts.map +1 -1
- package/dist/knowledge/distill.js +9 -2
- package/dist/knowledge/distill.js.map +1 -1
- package/dist/knowledge/search.d.ts +5 -3
- package/dist/knowledge/search.d.ts.map +1 -1
- package/dist/knowledge/search.js +29 -13
- package/dist/knowledge/search.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +16 -8
- package/dist/server.js.map +1 -1
- package/dist/sessions/adapters/index.d.ts +1 -1
- package/dist/sessions/adapters/index.d.ts.map +1 -1
- package/dist/sessions/adapters/index.js +0 -1
- package/dist/sessions/adapters/index.js.map +1 -1
- package/dist/sessions/parser.d.ts.map +1 -1
- package/dist/sessions/parser.js +12 -10
- package/dist/sessions/parser.js.map +1 -1
- package/dist/sessions/summary.d.ts.map +1 -1
- package/dist/sessions/summary.js +20 -13
- package/dist/sessions/summary.js.map +1 -1
- package/dist/tool-handlers.d.ts +1 -1
- package/dist/tool-handlers.d.ts.map +1 -1
- package/dist/tool-handlers.js +79 -63
- package/dist/tool-handlers.js.map +1 -1
- package/docs/SETUP.md +61 -24
- package/package.json +1 -1
- package/dist/sessions/adapters/aider.d.ts +0 -3
- package/dist/sessions/adapters/aider.d.ts.map +0 -1
- package/dist/sessions/adapters/aider.js +0 -140
- package/dist/sessions/adapters/aider.js.map +0 -1
- package/dist/sessions/adapters/cline.d.ts +0 -3
- package/dist/sessions/adapters/cline.d.ts.map +0 -1
- package/dist/sessions/adapters/cline.js +0 -74
- package/dist/sessions/adapters/cline.js.map +0 -1
- package/dist/sessions/adapters/continue.d.ts +0 -3
- package/dist/sessions/adapters/continue.d.ts.map +0 -1
- package/dist/sessions/adapters/continue.js +0 -74
- package/dist/sessions/adapters/continue.js.map +0 -1
package/docs/SETUP.md
CHANGED
|
@@ -234,32 +234,69 @@ Combine with `AGENTS.md` instructions (see below).
|
|
|
234
234
|
|
|
235
235
|
### Cursor and Windsurf
|
|
236
236
|
|
|
237
|
-
Cursor and Windsurf don't support lifecycle hooks. Use
|
|
237
|
+
Cursor and Windsurf don't support lifecycle hooks. Use rules files instead:
|
|
238
238
|
|
|
239
|
-
| Client |
|
|
240
|
-
| -------- |
|
|
241
|
-
| Cursor | `.
|
|
242
|
-
| Windsurf | `.windsurfrules`
|
|
239
|
+
| Client | Rules location |
|
|
240
|
+
| -------- | --------------------- |
|
|
241
|
+
| Cursor | `.cursor/rules/*.mdc` |
|
|
242
|
+
| Windsurf | `.windsurfrules` |
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
#### Cursor Rules Setup
|
|
245
245
|
|
|
246
|
+
Create `.cursor/rules/agent-mcp-stack.mdc` with "Always Apply" mode:
|
|
247
|
+
|
|
248
|
+
```yaml
|
|
249
|
+
---
|
|
250
|
+
description: Agent MCP stack integration
|
|
251
|
+
globs: *
|
|
252
|
+
alwaysApply: true
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
# Agent MCP Stack
|
|
256
|
+
|
|
257
|
+
## Default behavior in every chat
|
|
258
|
+
|
|
259
|
+
Treat `agent-comm`, `agent-knowledge`, and `agent-tasks` as default infrastructure
|
|
260
|
+
for this repository. Do not wait for the user to restate this.
|
|
261
|
+
|
|
262
|
+
At the start of each new chat/session:
|
|
263
|
+
|
|
264
|
+
1. Bootstrap `agent-comm` (`comm_register`, join `general`, send one-line intent, then `comm_inbox`).
|
|
265
|
+
2. Use `agent-knowledge` first for recall/session context when it can help
|
|
266
|
+
(especially prior decisions, errors, tool usage, and related sessions).
|
|
267
|
+
3. Check `agent-tasks` before creating work (`task_list`), and keep task
|
|
268
|
+
state/artifacts/comments current when work spans more than one step.
|
|
269
|
+
|
|
270
|
+
If an MCP server is unavailable, report it briefly and continue with local tools;
|
|
271
|
+
retry MCP usage after restoring connectivity.
|
|
246
272
|
```
|
|
247
|
-
You have access to agent-knowledge MCP tools — a shared knowledge base synced via git.
|
|
248
273
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
274
|
+
Optionally create `.cursor/rules/session-wrapup-knowledge.mdc` for session wrap-up:
|
|
275
|
+
|
|
276
|
+
```yaml
|
|
277
|
+
---
|
|
278
|
+
description: Save session learnings to knowledge base
|
|
279
|
+
globs: *
|
|
280
|
+
alwaysApply: false
|
|
281
|
+
---
|
|
252
282
|
|
|
253
|
-
|
|
283
|
+
# Session Wrap-up
|
|
254
284
|
|
|
255
|
-
|
|
256
|
-
Use knowledge_recall for scoped search (errors, plans, configs, tools, files, decisions).
|
|
257
|
-
Use knowledge_link/knowledge_unlink to manage relationships between entries.
|
|
258
|
-
Use knowledge_graph to explore connections from any entry via BFS traversal.
|
|
285
|
+
Before ending a session, save non-obvious learnings to agent-knowledge:
|
|
259
286
|
|
|
260
|
-
|
|
287
|
+
1. `knowledge_search` for existing entries that overlap with this session's work.
|
|
288
|
+
2. `knowledge_write` new entries for decisions, architecture changes, or error patterns
|
|
289
|
+
that aren't already captured.
|
|
290
|
+
3. `knowledge_link` related entries together.
|
|
291
|
+
|
|
292
|
+
Categories: projects (project context), decisions (trade-offs made), workflows (processes),
|
|
293
|
+
notes (everything else).
|
|
261
294
|
```
|
|
262
295
|
|
|
296
|
+
#### Windsurf
|
|
297
|
+
|
|
298
|
+
Add equivalent instructions to `.windsurfrules` in your project root.
|
|
299
|
+
|
|
263
300
|
---
|
|
264
301
|
|
|
265
302
|
## Knowledge Base Setup
|
|
@@ -457,11 +494,11 @@ If your session data is in a non-standard location, use `EXTRA_SESSION_ROOTS` to
|
|
|
457
494
|
|
|
458
495
|
## Client Comparison
|
|
459
496
|
|
|
460
|
-
| Feature | Claude Code | Cursor
|
|
461
|
-
| -------------------- | ----------- |
|
|
462
|
-
| MCP stdio transport | Yes | Yes
|
|
463
|
-
| Session reading | Yes (JSONL) | Yes (JSONL)
|
|
464
|
-
| Lifecycle hooks | Yes (JSON) | No
|
|
465
|
-
| Session auto-distill | Yes | Yes
|
|
466
|
-
| System prompt file | CLAUDE.md | .
|
|
467
|
-
| REST API fallback | Yes | Yes
|
|
497
|
+
| Feature | Claude Code | Cursor | OpenCode | Cline | Continue.dev | Aider | Windsurf |
|
|
498
|
+
| -------------------- | ----------- | -------------------- | ------------- | ---------- | ------------ | -------------- | -------------- |
|
|
499
|
+
| MCP stdio transport | Yes | Yes | Yes | Yes | Yes | -- | Yes |
|
|
500
|
+
| Session reading | Yes (JSONL) | Yes (JSONL) | Yes (SQLite) | Yes (JSON) | Yes (JSON) | Yes (MD/JSONL) | -- |
|
|
501
|
+
| Lifecycle hooks | Yes (JSON) | No | Yes (plugins) | No | No | -- | No |
|
|
502
|
+
| Session auto-distill | Yes | Yes | Yes | Yes | Yes | Yes | -- |
|
|
503
|
+
| System prompt file | CLAUDE.md | .cursor/rules/\*.mdc | AGENTS.md | -- | -- | -- | .windsurfrules |
|
|
504
|
+
| REST API fallback | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-knowledge",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Cross-session memory and recall for AI agents — git-synced knowledge base, knowledge graph, confidence scoring, hybrid semantic+TF-IDF search, auto-distillation with secrets scrubbing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aider.d.ts","sourceRoot":"","sources":["../../../src/sessions/adapters/aider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAuCjD,eAAO,MAAM,YAAY,EAAE,cAyC1B,CAAC"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { existsSync, readdirSync, readFileSync } from 'fs';
|
|
2
|
-
import { homedir } from 'os';
|
|
3
|
-
import { join, basename } from 'path';
|
|
4
|
-
const PREFIX = 'aider://';
|
|
5
|
-
const HISTORY_FILE = '.aider.chat.history.md';
|
|
6
|
-
const LLM_HISTORY_FILE = '.aider.llm.history';
|
|
7
|
-
function findAiderProjects() {
|
|
8
|
-
// Scan common development directories for aider history files
|
|
9
|
-
const home = homedir();
|
|
10
|
-
const candidates = [
|
|
11
|
-
join(home, 'projects'),
|
|
12
|
-
join(home, 'code'),
|
|
13
|
-
join(home, 'dev'),
|
|
14
|
-
join(home, 'src'),
|
|
15
|
-
join(home, 'repos'),
|
|
16
|
-
join(home, 'workspace'),
|
|
17
|
-
];
|
|
18
|
-
const found = [];
|
|
19
|
-
for (const dir of candidates) {
|
|
20
|
-
if (!existsSync(dir))
|
|
21
|
-
continue;
|
|
22
|
-
try {
|
|
23
|
-
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
24
|
-
if (!entry.isDirectory())
|
|
25
|
-
continue;
|
|
26
|
-
const projectDir = join(dir, entry.name);
|
|
27
|
-
if (existsSync(join(projectDir, HISTORY_FILE)) ||
|
|
28
|
-
existsSync(join(projectDir, LLM_HISTORY_FILE))) {
|
|
29
|
-
found.push(projectDir);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
// skip
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return found;
|
|
38
|
-
}
|
|
39
|
-
export const aiderAdapter = {
|
|
40
|
-
prefix: 'aider',
|
|
41
|
-
name: 'Aider',
|
|
42
|
-
isAvailable() {
|
|
43
|
-
return findAiderProjects().length > 0;
|
|
44
|
-
},
|
|
45
|
-
discoverProjects() {
|
|
46
|
-
return findAiderProjects().map((dir) => ({
|
|
47
|
-
name: `aider-${basename(dir)}`,
|
|
48
|
-
path: `${PREFIX}project:${dir}`,
|
|
49
|
-
}));
|
|
50
|
-
},
|
|
51
|
-
listSessions(projectDescriptor) {
|
|
52
|
-
const dir = projectDescriptor.replace(`${PREFIX}project:`, '');
|
|
53
|
-
const sessions = [];
|
|
54
|
-
const mdPath = join(dir, HISTORY_FILE);
|
|
55
|
-
if (existsSync(mdPath)) {
|
|
56
|
-
sessions.push({ id: 'chat-history', file: `${PREFIX}md:${mdPath}` });
|
|
57
|
-
}
|
|
58
|
-
const jsonlPath = join(dir, LLM_HISTORY_FILE);
|
|
59
|
-
if (existsSync(jsonlPath)) {
|
|
60
|
-
sessions.push({ id: 'llm-history', file: `${PREFIX}jsonl:${jsonlPath}` });
|
|
61
|
-
}
|
|
62
|
-
return sessions;
|
|
63
|
-
},
|
|
64
|
-
parseSession(descriptor) {
|
|
65
|
-
if (descriptor.startsWith(`${PREFIX}md:`)) {
|
|
66
|
-
return parseAiderMarkdown(descriptor.replace(`${PREFIX}md:`, ''));
|
|
67
|
-
}
|
|
68
|
-
if (descriptor.startsWith(`${PREFIX}jsonl:`)) {
|
|
69
|
-
return parseAiderJsonl(descriptor.replace(`${PREFIX}jsonl:`, ''));
|
|
70
|
-
}
|
|
71
|
-
return [];
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
function parseAiderMarkdown(filePath) {
|
|
75
|
-
if (!existsSync(filePath))
|
|
76
|
-
return [];
|
|
77
|
-
try {
|
|
78
|
-
const raw = readFileSync(filePath, 'utf-8');
|
|
79
|
-
const entries = [];
|
|
80
|
-
// Aider markdown uses #### headings for user messages, rest is assistant
|
|
81
|
-
const sections = raw.split(/^####\s+/m);
|
|
82
|
-
for (const section of sections) {
|
|
83
|
-
if (!section.trim())
|
|
84
|
-
continue;
|
|
85
|
-
const lines = section.split('\n');
|
|
86
|
-
const firstLine = lines[0]?.trim();
|
|
87
|
-
if (!firstLine)
|
|
88
|
-
continue;
|
|
89
|
-
// First line after #### is the user message
|
|
90
|
-
entries.push({
|
|
91
|
-
type: 'user',
|
|
92
|
-
message: { role: 'user', content: firstLine },
|
|
93
|
-
});
|
|
94
|
-
// Rest is assistant response
|
|
95
|
-
const response = lines.slice(1).join('\n').trim();
|
|
96
|
-
if (response) {
|
|
97
|
-
entries.push({
|
|
98
|
-
type: 'assistant',
|
|
99
|
-
message: { role: 'assistant', content: response },
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return entries;
|
|
104
|
-
}
|
|
105
|
-
catch {
|
|
106
|
-
return [];
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function parseAiderJsonl(filePath) {
|
|
110
|
-
if (!existsSync(filePath))
|
|
111
|
-
return [];
|
|
112
|
-
try {
|
|
113
|
-
const raw = readFileSync(filePath, 'utf-8');
|
|
114
|
-
const entries = [];
|
|
115
|
-
for (const line of raw.split('\n')) {
|
|
116
|
-
if (!line.trim())
|
|
117
|
-
continue;
|
|
118
|
-
try {
|
|
119
|
-
const msg = JSON.parse(line);
|
|
120
|
-
if (msg.role === 'user' || msg.role === 'assistant') {
|
|
121
|
-
entries.push({
|
|
122
|
-
type: msg.role,
|
|
123
|
-
message: {
|
|
124
|
-
role: msg.role,
|
|
125
|
-
content: typeof msg.content === 'string' ? msg.content : JSON.stringify(msg.content),
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
catch {
|
|
131
|
-
// skip malformed lines
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return entries;
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
return [];
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
//# sourceMappingURL=aider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aider.js","sourceRoot":"","sources":["../../../src/sessions/adapters/aider.ts"],"names":[],"mappings":"AAAA,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,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,uBAAuB;YACzB,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cline.d.ts","sourceRoot":"","sources":["../../../src/sessions/adapters/cline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAgCjD,eAAO,MAAM,YAAY,EAAE,cAwD1B,CAAC"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { existsSync, readdirSync, readFileSync } from 'fs';
|
|
2
|
-
import { homedir } from 'os';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
const PREFIX = 'cline://';
|
|
5
|
-
function getTasksDir() {
|
|
6
|
-
const platform = process.platform;
|
|
7
|
-
const home = homedir();
|
|
8
|
-
const ext = 'saoudrizwan.claude-dev';
|
|
9
|
-
if (platform === 'win32') {
|
|
10
|
-
return join(process.env.APPDATA || join(home, 'AppData', 'Roaming'), 'Code', 'User', 'globalStorage', ext, 'tasks');
|
|
11
|
-
}
|
|
12
|
-
else if (platform === 'darwin') {
|
|
13
|
-
return join(home, 'Library', 'Application Support', 'Code', 'User', 'globalStorage', ext, 'tasks');
|
|
14
|
-
}
|
|
15
|
-
return join(home, '.config', 'Code', 'User', 'globalStorage', ext, 'tasks');
|
|
16
|
-
}
|
|
17
|
-
export const clineAdapter = {
|
|
18
|
-
prefix: 'cline',
|
|
19
|
-
name: 'Cline',
|
|
20
|
-
isAvailable() {
|
|
21
|
-
return existsSync(getTasksDir());
|
|
22
|
-
},
|
|
23
|
-
discoverProjects() {
|
|
24
|
-
return [{ name: 'cline', path: `${PREFIX}tasks` }];
|
|
25
|
-
},
|
|
26
|
-
listSessions(_projectDescriptor) {
|
|
27
|
-
const tasksDir = getTasksDir();
|
|
28
|
-
if (!existsSync(tasksDir))
|
|
29
|
-
return [];
|
|
30
|
-
try {
|
|
31
|
-
return readdirSync(tasksDir, { withFileTypes: true })
|
|
32
|
-
.filter((d) => d.isDirectory())
|
|
33
|
-
.filter((d) => existsSync(join(tasksDir, d.name, 'api_conversation_history.json')))
|
|
34
|
-
.map((d) => ({ id: d.name, file: `${PREFIX}task:${d.name}` }));
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
parseSession(descriptor) {
|
|
41
|
-
const taskId = descriptor.replace(`${PREFIX}task:`, '');
|
|
42
|
-
const filePath = join(getTasksDir(), taskId, 'api_conversation_history.json');
|
|
43
|
-
if (!existsSync(filePath))
|
|
44
|
-
return [];
|
|
45
|
-
try {
|
|
46
|
-
const messages = JSON.parse(readFileSync(filePath, 'utf-8'));
|
|
47
|
-
if (!Array.isArray(messages))
|
|
48
|
-
return [];
|
|
49
|
-
return messages
|
|
50
|
-
.filter((m) => m.role === 'user' || m.role === 'assistant')
|
|
51
|
-
.map((m) => {
|
|
52
|
-
let content = '';
|
|
53
|
-
if (typeof m.content === 'string') {
|
|
54
|
-
content = m.content;
|
|
55
|
-
}
|
|
56
|
-
else if (Array.isArray(m.content)) {
|
|
57
|
-
content = m.content
|
|
58
|
-
.filter((p) => p.type === 'text')
|
|
59
|
-
.map((p) => p.text || '')
|
|
60
|
-
.join('\n');
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
type: m.role,
|
|
64
|
-
message: { role: m.role, content },
|
|
65
|
-
};
|
|
66
|
-
})
|
|
67
|
-
.filter((e) => e.message?.content);
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
return [];
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
//# sourceMappingURL=cline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cline.js","sourceRoot":"","sources":["../../../src/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IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC;iBACnF,GAAG,CAAC,CAAC,CAA0B,EAAE,EAAE;gBAClC,IAAI,OAAO,GAAG,EAAE,CAAC;gBACjB,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;oBAClC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;gBACtB,CAAC;qBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;oBACpC,OAAO,GAAI,CAAC,CAAC,OAA0C;yBACpD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;yBAChC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAE,CAAC,CAAC,IAAe,IAAI,EAAE,CAAC;yBACpC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAChB,CAAC;gBACD,OAAO;oBACL,IAAI,EAAE,CAAC,CAAC,IAAc;oBACtB,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAc,EAAE,OAAO,EAAE;iBAC7B,CAAC;YACpB,CAAC,CAAC;iBACD,MAAM,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"continue.d.ts","sourceRoot":"","sources":["../../../src/sessions/adapters/continue.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQjD,eAAO,MAAM,eAAe,EAAE,cAyE7B,CAAC"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { existsSync, readdirSync, readFileSync } from 'fs';
|
|
2
|
-
import { homedir } from 'os';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
const PREFIX = 'continue://';
|
|
5
|
-
function getSessionsDir() {
|
|
6
|
-
return join(homedir(), '.continue', 'sessions');
|
|
7
|
-
}
|
|
8
|
-
export const continueAdapter = {
|
|
9
|
-
prefix: 'continue',
|
|
10
|
-
name: 'Continue.dev',
|
|
11
|
-
isAvailable() {
|
|
12
|
-
return existsSync(getSessionsDir());
|
|
13
|
-
},
|
|
14
|
-
discoverProjects() {
|
|
15
|
-
// Group sessions by workspaceDirectory, or return single project
|
|
16
|
-
return [{ name: 'continue', path: `${PREFIX}sessions` }];
|
|
17
|
-
},
|
|
18
|
-
listSessions() {
|
|
19
|
-
const dir = getSessionsDir();
|
|
20
|
-
if (!existsSync(dir))
|
|
21
|
-
return [];
|
|
22
|
-
try {
|
|
23
|
-
return readdirSync(dir)
|
|
24
|
-
.filter((f) => f.endsWith('.json'))
|
|
25
|
-
.map((f) => ({
|
|
26
|
-
id: f.replace('.json', ''),
|
|
27
|
-
file: `${PREFIX}session:${join(dir, f)}`,
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
parseSession(descriptor) {
|
|
35
|
-
const filePath = descriptor.replace(`${PREFIX}session:`, '');
|
|
36
|
-
if (!existsSync(filePath))
|
|
37
|
-
return [];
|
|
38
|
-
try {
|
|
39
|
-
const session = JSON.parse(readFileSync(filePath, 'utf-8'));
|
|
40
|
-
if (!session.history || !Array.isArray(session.history))
|
|
41
|
-
return [];
|
|
42
|
-
return session.history
|
|
43
|
-
.filter((h) => h.message &&
|
|
44
|
-
(h.message.role === 'user' ||
|
|
45
|
-
h.message.role === 'assistant'))
|
|
46
|
-
.map((h) => {
|
|
47
|
-
let content = '';
|
|
48
|
-
const msg = h.message;
|
|
49
|
-
if (typeof msg.content === 'string') {
|
|
50
|
-
content = msg.content;
|
|
51
|
-
}
|
|
52
|
-
else if (Array.isArray(msg.content)) {
|
|
53
|
-
content = msg.content
|
|
54
|
-
.filter((p) => typeof p === 'string' ||
|
|
55
|
-
(typeof p === 'object' &&
|
|
56
|
-
p !== null &&
|
|
57
|
-
p.type === 'text'))
|
|
58
|
-
.map((p) => typeof p === 'string' ? p : p.text || '')
|
|
59
|
-
.join('\n');
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
type: msg.role,
|
|
63
|
-
sessionId: session.sessionId,
|
|
64
|
-
message: { role: msg.role, content },
|
|
65
|
-
};
|
|
66
|
-
})
|
|
67
|
-
.filter((e) => e.message?.content);
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
return [];
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
//# sourceMappingURL=continue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"continue.js","sourceRoot":"","sources":["../../../src/sessions/adapters/continue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,MAAM,MAAM,GAAG,aAAa,CAAC;AAE7B,SAAS,cAAc;IACrB,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC7C,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,cAAc;IAEpB,WAAW;QACT,OAAO,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,gBAAgB;QACd,iEAAiE;QACjE,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,UAAU,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,YAAY;QACV,MAAM,GAAG,GAAG,cAAc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