@@ -51,11 +51,26 @@ function homePath(...parts) {
|
51 | 51 | return path.join(os.homedir(), ...parts); |
52 | 52 | } |
53 | 53 | |
| 54 | +function openClawSessionRoots() { |
| 55 | +const stateDir = process.env.OPENCLAW_STATE_DIR || homePath(".openclaw"); |
| 56 | +const agentsDir = path.join(stateDir, "agents"); |
| 57 | +if (!fs.existsSync(agentsDir)) return []; |
| 58 | +try { |
| 59 | +return fs |
| 60 | +.readdirSync(agentsDir, { withFileTypes: true }) |
| 61 | +.filter((entry) => entry.isDirectory()) |
| 62 | +.map((entry) => path.join(agentsDir, entry.name, "sessions")); |
| 63 | +} catch { |
| 64 | +return []; |
| 65 | +} |
| 66 | +} |
| 67 | + |
54 | 68 | function defaultRoots() { |
55 | 69 | return [ |
56 | 70 | homePath(".codex", "sessions"), |
57 | 71 | homePath(".claude", "projects"), |
58 | 72 | homePath(".pi", "agent", "sessions"), |
| 73 | + ...openClawSessionRoots(), |
59 | 74 | ]; |
60 | 75 | } |
61 | 76 | |
@@ -110,6 +125,12 @@ function detectAgent(file, rows) {
|
110 | 125 | if (file.includes(`${path.sep}.codex${path.sep}`)) return "codex"; |
111 | 126 | if (file.includes(`${path.sep}.claude${path.sep}`)) return "claude"; |
112 | 127 | if (file.includes(`${path.sep}.pi${path.sep}`)) return "pi"; |
| 128 | +if ( |
| 129 | +file.includes(`${path.sep}.openclaw${path.sep}`) || |
| 130 | +(file.includes(`${path.sep}agents${path.sep}`) && file.includes(`${path.sep}sessions${path.sep}`)) |
| 131 | +) { |
| 132 | +return "openclaw"; |
| 133 | +} |
113 | 134 | if (rows.some((row) => row?.type === "session_meta" || row?.type === "response_item")) return "codex"; |
114 | 135 | if (rows.some((row) => row?.sessionId && row?.userType)) return "claude"; |
115 | 136 | return "agent"; |
|