@cleocode/adapters 2026.3.68 → 2026.3.70
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/LICENSE +21 -0
- package/README.md +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.d.ts.map +0 -0
- package/dist/index.js +0 -0
- package/dist/index.js.map +2 -2
- package/dist/providers/claude-code/adapter.d.ts +0 -0
- package/dist/providers/claude-code/adapter.d.ts.map +0 -0
- package/dist/providers/claude-code/adapter.js +0 -0
- package/dist/providers/claude-code/adapter.js.map +0 -0
- package/dist/providers/claude-code/context-monitor.d.ts +0 -0
- package/dist/providers/claude-code/context-monitor.d.ts.map +0 -0
- package/dist/providers/claude-code/context-monitor.js +0 -0
- package/dist/providers/claude-code/context-monitor.js.map +0 -0
- package/dist/providers/claude-code/hooks.d.ts +16 -0
- package/dist/providers/claude-code/hooks.d.ts.map +1 -1
- package/dist/providers/claude-code/hooks.js +0 -0
- package/dist/providers/claude-code/hooks.js.map +0 -0
- package/dist/providers/claude-code/index.d.ts +0 -0
- package/dist/providers/claude-code/index.d.ts.map +0 -0
- package/dist/providers/claude-code/index.js +0 -0
- package/dist/providers/claude-code/index.js.map +0 -0
- package/dist/providers/claude-code/install.d.ts +0 -0
- package/dist/providers/claude-code/install.d.ts.map +0 -0
- package/dist/providers/claude-code/install.js +0 -0
- package/dist/providers/claude-code/install.js.map +0 -0
- package/dist/providers/claude-code/paths.d.ts +0 -0
- package/dist/providers/claude-code/paths.d.ts.map +0 -0
- package/dist/providers/claude-code/paths.js +0 -0
- package/dist/providers/claude-code/paths.js.map +0 -0
- package/dist/providers/claude-code/spawn.d.ts +0 -0
- package/dist/providers/claude-code/spawn.d.ts.map +0 -0
- package/dist/providers/claude-code/spawn.js +0 -0
- package/dist/providers/claude-code/spawn.js.map +0 -0
- package/dist/providers/claude-code/statusline.d.ts +0 -0
- package/dist/providers/claude-code/statusline.d.ts.map +0 -0
- package/dist/providers/claude-code/statusline.js +0 -0
- package/dist/providers/claude-code/statusline.js.map +0 -0
- package/dist/providers/claude-code/task-sync.d.ts +0 -0
- package/dist/providers/claude-code/task-sync.d.ts.map +0 -0
- package/dist/providers/claude-code/task-sync.js +0 -0
- package/dist/providers/claude-code/task-sync.js.map +0 -0
- package/dist/providers/claude-code/transport.d.ts +0 -0
- package/dist/providers/claude-code/transport.d.ts.map +0 -0
- package/dist/providers/claude-code/transport.js +0 -0
- package/dist/providers/claude-code/transport.js.map +0 -0
- package/dist/providers/cursor/adapter.d.ts +0 -0
- package/dist/providers/cursor/adapter.d.ts.map +0 -0
- package/dist/providers/cursor/adapter.js +0 -0
- package/dist/providers/cursor/adapter.js.map +0 -0
- package/dist/providers/cursor/hooks.d.ts +0 -0
- package/dist/providers/cursor/hooks.d.ts.map +0 -0
- package/dist/providers/cursor/hooks.js +0 -0
- package/dist/providers/cursor/hooks.js.map +0 -0
- package/dist/providers/cursor/index.d.ts +0 -0
- package/dist/providers/cursor/index.d.ts.map +0 -0
- package/dist/providers/cursor/index.js +0 -0
- package/dist/providers/cursor/index.js.map +0 -0
- package/dist/providers/cursor/install.d.ts +0 -0
- package/dist/providers/cursor/install.d.ts.map +0 -0
- package/dist/providers/cursor/install.js +0 -0
- package/dist/providers/cursor/install.js.map +0 -0
- package/dist/providers/cursor/spawn.d.ts +0 -0
- package/dist/providers/cursor/spawn.d.ts.map +0 -0
- package/dist/providers/cursor/spawn.js +0 -0
- package/dist/providers/cursor/spawn.js.map +0 -0
- package/dist/providers/opencode/adapter.d.ts +0 -0
- package/dist/providers/opencode/adapter.d.ts.map +0 -0
- package/dist/providers/opencode/adapter.js +0 -0
- package/dist/providers/opencode/adapter.js.map +0 -0
- package/dist/providers/opencode/hooks.d.ts +0 -0
- package/dist/providers/opencode/hooks.d.ts.map +0 -0
- package/dist/providers/opencode/hooks.js +0 -0
- package/dist/providers/opencode/hooks.js.map +0 -0
- package/dist/providers/opencode/index.d.ts +0 -0
- package/dist/providers/opencode/index.d.ts.map +0 -0
- package/dist/providers/opencode/index.js +0 -0
- package/dist/providers/opencode/index.js.map +0 -0
- package/dist/providers/opencode/install.d.ts +0 -0
- package/dist/providers/opencode/install.d.ts.map +0 -0
- package/dist/providers/opencode/install.js +0 -0
- package/dist/providers/opencode/install.js.map +0 -0
- package/dist/providers/opencode/spawn.d.ts +0 -0
- package/dist/providers/opencode/spawn.d.ts.map +0 -0
- package/dist/providers/opencode/spawn.js +0 -0
- package/dist/providers/opencode/spawn.js.map +0 -0
- package/dist/registry.d.ts +0 -0
- package/dist/registry.d.ts.map +0 -0
- package/dist/registry.js +0 -0
- package/dist/registry.js.map +0 -0
- package/package.json +7 -7
- package/src/__tests__/claude-code-adapter.test.d.ts +0 -0
- package/src/__tests__/claude-code-adapter.test.d.ts.map +0 -0
- package/src/__tests__/claude-code-adapter.test.js +0 -0
- package/src/__tests__/claude-code-adapter.test.js.map +0 -0
- package/src/__tests__/claude-code-adapter.test.ts +0 -0
- package/src/__tests__/cursor-adapter.test.d.ts +0 -0
- package/src/__tests__/cursor-adapter.test.d.ts.map +0 -0
- package/src/__tests__/cursor-adapter.test.js +0 -0
- package/src/__tests__/cursor-adapter.test.js.map +0 -0
- package/src/__tests__/cursor-adapter.test.ts +0 -0
- package/src/__tests__/opencode-adapter.test.d.ts +0 -0
- package/src/__tests__/opencode-adapter.test.d.ts.map +0 -0
- package/src/__tests__/opencode-adapter.test.js +0 -0
- package/src/__tests__/opencode-adapter.test.js.map +0 -0
- package/src/__tests__/opencode-adapter.test.ts +0 -0
- package/src/index.d.ts +0 -0
- package/src/index.d.ts.map +0 -0
- package/src/index.js +0 -0
- package/src/index.js.map +0 -0
- package/src/index.ts +0 -0
- package/src/providers/claude-code/__tests__/adapter.test.d.ts +0 -0
- package/src/providers/claude-code/__tests__/adapter.test.d.ts.map +0 -0
- package/src/providers/claude-code/__tests__/adapter.test.js +0 -0
- package/src/providers/claude-code/__tests__/adapter.test.js.map +0 -0
- package/src/providers/claude-code/__tests__/adapter.test.ts +0 -0
- package/src/providers/claude-code/adapter.d.ts +0 -0
- package/src/providers/claude-code/adapter.d.ts.map +0 -0
- package/src/providers/claude-code/adapter.js +0 -0
- package/src/providers/claude-code/adapter.js.map +0 -0
- package/src/providers/claude-code/adapter.ts +0 -0
- package/src/providers/claude-code/context-monitor.d.ts +0 -0
- package/src/providers/claude-code/context-monitor.d.ts.map +0 -0
- package/src/providers/claude-code/context-monitor.js +0 -0
- package/src/providers/claude-code/context-monitor.js.map +0 -0
- package/src/providers/claude-code/context-monitor.ts +0 -0
- package/src/providers/claude-code/hooks.d.ts +0 -0
- package/src/providers/claude-code/hooks.d.ts.map +0 -0
- package/src/providers/claude-code/hooks.js +0 -0
- package/src/providers/claude-code/hooks.js.map +0 -0
- package/src/providers/claude-code/hooks.ts +77 -0
- package/src/providers/claude-code/index.d.ts +0 -0
- package/src/providers/claude-code/index.d.ts.map +0 -0
- package/src/providers/claude-code/index.js +0 -0
- package/src/providers/claude-code/index.js.map +0 -0
- package/src/providers/claude-code/index.ts +0 -0
- package/src/providers/claude-code/install.d.ts +0 -0
- package/src/providers/claude-code/install.d.ts.map +0 -0
- package/src/providers/claude-code/install.js +0 -0
- package/src/providers/claude-code/install.js.map +0 -0
- package/src/providers/claude-code/install.ts +0 -0
- package/src/providers/claude-code/manifest.json +0 -0
- package/src/providers/claude-code/paths.d.ts +0 -0
- package/src/providers/claude-code/paths.d.ts.map +0 -0
- package/src/providers/claude-code/paths.js +0 -0
- package/src/providers/claude-code/paths.js.map +0 -0
- package/src/providers/claude-code/paths.ts +0 -0
- package/src/providers/claude-code/spawn.d.ts +0 -0
- package/src/providers/claude-code/spawn.d.ts.map +0 -0
- package/src/providers/claude-code/spawn.js +0 -0
- package/src/providers/claude-code/spawn.js.map +0 -0
- package/src/providers/claude-code/spawn.ts +0 -0
- package/src/providers/claude-code/statusline.d.ts +0 -0
- package/src/providers/claude-code/statusline.d.ts.map +0 -0
- package/src/providers/claude-code/statusline.js +0 -0
- package/src/providers/claude-code/statusline.js.map +0 -0
- package/src/providers/claude-code/statusline.ts +0 -0
- package/src/providers/claude-code/task-sync.js +0 -0
- package/src/providers/claude-code/task-sync.js.map +0 -0
- package/src/providers/claude-code/task-sync.ts +0 -0
- package/src/providers/claude-code/transport.d.ts +0 -0
- package/src/providers/claude-code/transport.d.ts.map +0 -0
- package/src/providers/claude-code/transport.js +0 -0
- package/src/providers/claude-code/transport.js.map +0 -0
- package/src/providers/claude-code/transport.ts +0 -0
- package/src/providers/cursor/__tests__/adapter.test.d.ts +0 -0
- package/src/providers/cursor/__tests__/adapter.test.d.ts.map +0 -0
- package/src/providers/cursor/__tests__/adapter.test.js +0 -0
- package/src/providers/cursor/__tests__/adapter.test.js.map +0 -0
- package/src/providers/cursor/__tests__/adapter.test.ts +0 -0
- package/src/providers/cursor/adapter.d.ts +0 -0
- package/src/providers/cursor/adapter.d.ts.map +0 -0
- package/src/providers/cursor/adapter.js +0 -0
- package/src/providers/cursor/adapter.js.map +0 -0
- package/src/providers/cursor/adapter.ts +0 -0
- package/src/providers/cursor/hooks.d.ts +0 -0
- package/src/providers/cursor/hooks.d.ts.map +0 -0
- package/src/providers/cursor/hooks.js +0 -0
- package/src/providers/cursor/hooks.js.map +0 -0
- package/src/providers/cursor/hooks.ts +0 -0
- package/src/providers/cursor/index.d.ts +0 -0
- package/src/providers/cursor/index.d.ts.map +0 -0
- package/src/providers/cursor/index.js +0 -0
- package/src/providers/cursor/index.js.map +0 -0
- package/src/providers/cursor/index.ts +0 -0
- package/src/providers/cursor/install.d.ts +0 -0
- package/src/providers/cursor/install.d.ts.map +0 -0
- package/src/providers/cursor/install.js +0 -0
- package/src/providers/cursor/install.js.map +0 -0
- package/src/providers/cursor/install.ts +0 -0
- package/src/providers/cursor/manifest.json +0 -0
- package/src/providers/cursor/spawn.d.ts +0 -0
- package/src/providers/cursor/spawn.d.ts.map +0 -0
- package/src/providers/cursor/spawn.js +0 -0
- package/src/providers/cursor/spawn.js.map +0 -0
- package/src/providers/cursor/spawn.ts +0 -0
- package/src/providers/opencode/__tests__/adapter.test.d.ts +0 -0
- package/src/providers/opencode/__tests__/adapter.test.d.ts.map +0 -0
- package/src/providers/opencode/__tests__/adapter.test.js +0 -0
- package/src/providers/opencode/__tests__/adapter.test.js.map +0 -0
- package/src/providers/opencode/__tests__/adapter.test.ts +0 -0
- package/src/providers/opencode/adapter.d.ts +0 -0
- package/src/providers/opencode/adapter.d.ts.map +0 -0
- package/src/providers/opencode/adapter.js +0 -0
- package/src/providers/opencode/adapter.js.map +0 -0
- package/src/providers/opencode/adapter.ts +0 -0
- package/src/providers/opencode/hooks.d.ts +0 -0
- package/src/providers/opencode/hooks.d.ts.map +0 -0
- package/src/providers/opencode/hooks.js +0 -0
- package/src/providers/opencode/hooks.js.map +0 -0
- package/src/providers/opencode/hooks.ts +0 -0
- package/src/providers/opencode/index.d.ts +0 -0
- package/src/providers/opencode/index.d.ts.map +0 -0
- package/src/providers/opencode/index.js +0 -0
- package/src/providers/opencode/index.js.map +0 -0
- package/src/providers/opencode/index.ts +0 -0
- package/src/providers/opencode/install.d.ts +0 -0
- package/src/providers/opencode/install.d.ts.map +0 -0
- package/src/providers/opencode/install.js +0 -0
- package/src/providers/opencode/install.js.map +0 -0
- package/src/providers/opencode/install.ts +0 -0
- package/src/providers/opencode/manifest.json +0 -0
- package/src/providers/opencode/spawn.d.ts +0 -0
- package/src/providers/opencode/spawn.d.ts.map +0 -0
- package/src/providers/opencode/spawn.js +0 -0
- package/src/providers/opencode/spawn.js.map +0 -0
- package/src/providers/opencode/spawn.ts +0 -0
- package/src/registry.d.ts +0 -0
- package/src/registry.d.ts.map +0 -0
- package/src/registry.js +0 -0
- package/src/registry.js.map +0 -0
- package/src/registry.ts +0 -0
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* CAAMP defines: onSessionStart, onToolComplete, onPromptSubmit, onSessionEnd
|
|
7
7
|
*
|
|
8
8
|
* @task T5240
|
|
9
|
+
* @task T144
|
|
10
|
+
* @epic T134
|
|
9
11
|
*/
|
|
10
12
|
import type { AdapterHookProvider } from '@cleocode/contracts';
|
|
11
13
|
/**
|
|
@@ -55,5 +57,19 @@ export declare class ClaudeCodeHookProvider implements AdapterHookProvider {
|
|
|
55
57
|
* Get the full event mapping for introspection/debugging.
|
|
56
58
|
*/
|
|
57
59
|
getEventMap(): Readonly<Record<string, string>>;
|
|
60
|
+
/**
|
|
61
|
+
* Extract a plain-text transcript from Claude Code session JSONL files.
|
|
62
|
+
*
|
|
63
|
+
* Reads the most recent .jsonl file under ~/.claude/projects/ and
|
|
64
|
+
* extracts user/assistant turn text into a flat string for brain
|
|
65
|
+
* observation extraction.
|
|
66
|
+
*
|
|
67
|
+
* Returns null when no session data is found or on any read error.
|
|
68
|
+
*
|
|
69
|
+
* @param _sessionId - CLEO session ID (unused; reads the most recent file)
|
|
70
|
+
* @param _projectDir - Project directory (unused; Claude Code uses global paths)
|
|
71
|
+
* @task T144 @epic T134
|
|
72
|
+
*/
|
|
73
|
+
getTranscript(_sessionId: string, _projectDir: string): Promise<string | null>;
|
|
58
74
|
}
|
|
59
75
|
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/hooks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAY/D;;;;;;;;;;GAUG;AACH,qBAAa,sBAAuB,YAAW,mBAAmB;IAChE,OAAO,CAAC,UAAU,CAAS;IAE3B;;;;;OAKG;IACH,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAItD;;;;;;;;;OASG;IACG,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7D;;;;;;OAMG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5C;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,WAAW,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAI/C;;;;;;;;;;;;OAYG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CA2DrF"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/registry.d.ts
CHANGED
|
File without changes
|
package/dist/registry.d.ts.map
CHANGED
|
File without changes
|
package/dist/registry.js
CHANGED
|
File without changes
|
package/dist/registry.js.map
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/adapters",
|
|
3
|
-
"version": "2026.3.
|
|
3
|
+
"version": "2026.3.70",
|
|
4
4
|
"description": "Unified provider adapters for CLEO (Claude Code, OpenCode, Cursor)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,12 +11,8 @@
|
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc",
|
|
16
|
-
"build:check": "tsc --noEmit"
|
|
17
|
-
},
|
|
18
14
|
"dependencies": {
|
|
19
|
-
"@cleocode/contracts": "
|
|
15
|
+
"@cleocode/contracts": "2026.3.70"
|
|
20
16
|
},
|
|
21
17
|
"license": "MIT",
|
|
22
18
|
"engines": {
|
|
@@ -33,5 +29,9 @@
|
|
|
33
29
|
"type": "git",
|
|
34
30
|
"url": "https://github.com/kryptobaseddev/cleo",
|
|
35
31
|
"directory": "packages/adapters"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc",
|
|
35
|
+
"build:check": "tsc --noEmit"
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/index.d.ts
CHANGED
|
File without changes
|
package/src/index.d.ts.map
CHANGED
|
File without changes
|
package/src/index.js
CHANGED
|
File without changes
|
package/src/index.js.map
CHANGED
|
File without changes
|
package/src/index.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
* CAAMP defines: onSessionStart, onToolComplete, onPromptSubmit, onSessionEnd
|
|
7
7
|
*
|
|
8
8
|
* @task T5240
|
|
9
|
+
* @task T144
|
|
10
|
+
* @epic T134
|
|
9
11
|
*/
|
|
10
12
|
|
|
13
|
+
import { readdir, readFile } from 'node:fs/promises';
|
|
14
|
+
import { join } from 'node:path';
|
|
11
15
|
import type { AdapterHookProvider } from '@cleocode/contracts';
|
|
12
16
|
|
|
13
17
|
/**
|
|
@@ -82,4 +86,77 @@ export class ClaudeCodeHookProvider implements AdapterHookProvider {
|
|
|
82
86
|
getEventMap(): Readonly<Record<string, string>> {
|
|
83
87
|
return { ...CLAUDE_CODE_EVENT_MAP };
|
|
84
88
|
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Extract a plain-text transcript from Claude Code session JSONL files.
|
|
92
|
+
*
|
|
93
|
+
* Reads the most recent .jsonl file under ~/.claude/projects/ and
|
|
94
|
+
* extracts user/assistant turn text into a flat string for brain
|
|
95
|
+
* observation extraction.
|
|
96
|
+
*
|
|
97
|
+
* Returns null when no session data is found or on any read error.
|
|
98
|
+
*
|
|
99
|
+
* @param _sessionId - CLEO session ID (unused; reads the most recent file)
|
|
100
|
+
* @param _projectDir - Project directory (unused; Claude Code uses global paths)
|
|
101
|
+
* @task T144 @epic T134
|
|
102
|
+
*/
|
|
103
|
+
async getTranscript(_sessionId: string, _projectDir: string): Promise<string | null> {
|
|
104
|
+
try {
|
|
105
|
+
const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? '/root';
|
|
106
|
+
const projectsDir = join(homeDir, '.claude', 'projects');
|
|
107
|
+
|
|
108
|
+
// Find all JSONL files across project subdirectories
|
|
109
|
+
let allFiles: Array<{ path: string; mtime: number }> = [];
|
|
110
|
+
try {
|
|
111
|
+
const projectDirs = await readdir(projectsDir, { withFileTypes: true });
|
|
112
|
+
for (const entry of projectDirs) {
|
|
113
|
+
if (!entry.isDirectory()) continue;
|
|
114
|
+
const subDir = join(projectsDir, entry.name);
|
|
115
|
+
try {
|
|
116
|
+
const files = await readdir(subDir);
|
|
117
|
+
for (const file of files) {
|
|
118
|
+
if (!file.endsWith('.jsonl')) continue;
|
|
119
|
+
const filePath = join(subDir, file);
|
|
120
|
+
// Use file path modification heuristic (filename usually includes timestamp)
|
|
121
|
+
allFiles.push({ path: filePath, mtime: 0 });
|
|
122
|
+
}
|
|
123
|
+
} catch {
|
|
124
|
+
// Skip unreadable subdirectories
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
} catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (allFiles.length === 0) return null;
|
|
132
|
+
|
|
133
|
+
// Sort by path descending (timestamps in filenames sort naturally)
|
|
134
|
+
allFiles = allFiles.sort((a, b) => b.path.localeCompare(a.path));
|
|
135
|
+
const mostRecent = allFiles[0];
|
|
136
|
+
if (!mostRecent) return null;
|
|
137
|
+
|
|
138
|
+
const raw = await readFile(mostRecent.path, 'utf-8');
|
|
139
|
+
const lines = raw.split('\n').filter((l) => l.trim());
|
|
140
|
+
|
|
141
|
+
const turns: string[] = [];
|
|
142
|
+
for (const line of lines) {
|
|
143
|
+
try {
|
|
144
|
+
const entry = JSON.parse(line) as Record<string, unknown>;
|
|
145
|
+
const role = entry.role as string | undefined;
|
|
146
|
+
const content = entry.content;
|
|
147
|
+
if (role === 'assistant' && typeof content === 'string') {
|
|
148
|
+
turns.push(`assistant: ${content}`);
|
|
149
|
+
} else if (role === 'user' && typeof content === 'string') {
|
|
150
|
+
turns.push(`user: ${content}`);
|
|
151
|
+
}
|
|
152
|
+
} catch {
|
|
153
|
+
// Skip malformed lines
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return turns.length > 0 ? turns.join('\n') : null;
|
|
158
|
+
} catch {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
85
162
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|