@blulotus/trellis-core 0.7.0 → 0.7.2
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/mem/context.js +2 -2
- package/dist/mem/context.js.map +1 -1
- package/dist/mem/index.d.ts +1 -2
- package/dist/mem/index.d.ts.map +1 -1
- package/dist/mem/index.js +1 -2
- package/dist/mem/index.js.map +1 -1
- package/dist/mem/internal/paths.d.ts +0 -19
- package/dist/mem/internal/paths.d.ts.map +1 -1
- package/dist/mem/internal/paths.js +0 -79
- package/dist/mem/internal/paths.js.map +1 -1
- package/dist/mem/projects.d.ts.map +1 -1
- package/dist/mem/projects.js +1 -5
- package/dist/mem/projects.js.map +1 -1
- package/dist/mem/sessions.d.ts +6 -6
- package/dist/mem/sessions.d.ts.map +1 -1
- package/dist/mem/sessions.js +29 -81
- package/dist/mem/sessions.js.map +1 -1
- package/dist/mem/types.d.ts +2 -2
- package/dist/mem/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/mem/adapters/grok.d.ts +0 -41
- package/dist/mem/adapters/grok.d.ts.map +0 -1
- package/dist/mem/adapters/grok.js +0 -202
- package/dist/mem/adapters/grok.js.map +0 -1
- package/dist/mem/adapters/opencode.d.ts +0 -19
- package/dist/mem/adapters/opencode.d.ts.map +0 -1
- package/dist/mem/adapters/opencode.js +0 -25
- package/dist/mem/adapters/opencode.js.map +0 -1
- package/dist/mem/adapters/pi.d.ts +0 -24
- package/dist/mem/adapters/pi.d.ts.map +0 -1
- package/dist/mem/adapters/pi.js +0 -290
- package/dist/mem/adapters/pi.js.map +0 -1
- package/dist/mem/adapters/zcode.d.ts +0 -76
- package/dist/mem/adapters/zcode.d.ts.map +0 -1
- package/dist/mem/adapters/zcode.js +0 -434
- package/dist/mem/adapters/zcode.js.map +0 -1
- package/dist/mem/internal/sqlite-readonly.d.ts +0 -77
- package/dist/mem/internal/sqlite-readonly.d.ts.map +0 -1
- package/dist/mem/internal/sqlite-readonly.js +0 -797
- package/dist/mem/internal/sqlite-readonly.js.map +0 -1
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Persisted Grok CLI session reader.
|
|
3
|
-
*
|
|
4
|
-
* Layout: `~/.grok/sessions/<url-encoded-cwd>/<session-id>/chat_history.jsonl`,
|
|
5
|
-
* with per-session metadata in the sibling `summary.json` (`info.id`,
|
|
6
|
-
* `info.cwd`, `session_summary`, `created_at`, `updated_at`).
|
|
7
|
-
*
|
|
8
|
-
* No database. The sibling `session_search.sqlite` is Grok's own search index
|
|
9
|
-
* and is deliberately ignored — the OpenCode reader was reverted in
|
|
10
|
-
* 0.6.0-beta.4 because a native SQLite dependency broke Windows installs, and
|
|
11
|
-
* nothing here needs one.
|
|
12
|
-
*
|
|
13
|
-
* Event shape — top-level `type`:
|
|
14
|
-
* user dialogue, unless it carries `synthetic_reason` (injected
|
|
15
|
-
* reminders, project instructions, background-task notices)
|
|
16
|
-
* assistant dialogue; `content` is a plain string
|
|
17
|
-
* reasoning dropped (encrypted chain-of-thought)
|
|
18
|
-
* tool_result dropped
|
|
19
|
-
* system dropped (system prompt)
|
|
20
|
-
* backend_tool_call dropped
|
|
21
|
-
*
|
|
22
|
-
* Compaction: Grok injects a `synthetic_reason: "compaction_meta"` user event
|
|
23
|
-
* and starts the file from the compacted state. The turns before it are NOT in
|
|
24
|
-
* `chat_history.jsonl`, and the sibling `compaction_checkpoints/*.json` holds
|
|
25
|
-
* the post-compaction seed rather than the lost history — so this adapter marks
|
|
26
|
-
* the boundary and warns instead of pretending the session is whole.
|
|
27
|
-
*/
|
|
28
|
-
import type { DialogueTurn, MemFilter, MemSessionInfo, MemWarning, SearchHit, TaskPyEvent } from "../types.js";
|
|
29
|
-
export declare function grokListSessions(f: MemFilter): MemSessionInfo[];
|
|
30
|
-
export declare function grokExtractDialogue(s: MemSessionInfo, warnings?: MemWarning[]): DialogueTurn[];
|
|
31
|
-
export declare function grokSearch(s: MemSessionInfo, kw: string): SearchHit;
|
|
32
|
-
/**
|
|
33
|
-
* Single pass over `chat_history.jsonl`: cleaned dialogue turns plus the
|
|
34
|
-
* `task.py create|start` invocations found in `run_terminal_command` tool
|
|
35
|
-
* calls, which is what `--phase` slicing needs.
|
|
36
|
-
*/
|
|
37
|
-
export declare function collectGrokTurnsAndEvents(s: MemSessionInfo, warnings?: MemWarning[]): {
|
|
38
|
-
turns: DialogueTurn[];
|
|
39
|
-
events: TaskPyEvent[];
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=grok.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grok.d.ts","sourceRoot":"","sources":["../../../src/mem/adapters/grok.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAeH,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,cAAc,EACd,UAAU,EACV,SAAS,EACT,WAAW,EACZ,MAAM,aAAa,CAAC;AA0ErB,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,SAAS,GAAG,cAAc,EAAE,CAoC/D;AAuBD,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,cAAc,EACjB,QAAQ,CAAC,EAAE,UAAU,EAAE,GACtB,YAAY,EAAE,CAEhB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,CAGnE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,CAAC,EAAE,cAAc,EACjB,QAAQ,CAAC,EAAE,UAAU,EAAE,GACtB;IAAE,KAAK,EAAE,YAAY,EAAE,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE,CA6DlD"}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Persisted Grok CLI session reader.
|
|
3
|
-
*
|
|
4
|
-
* Layout: `~/.grok/sessions/<url-encoded-cwd>/<session-id>/chat_history.jsonl`,
|
|
5
|
-
* with per-session metadata in the sibling `summary.json` (`info.id`,
|
|
6
|
-
* `info.cwd`, `session_summary`, `created_at`, `updated_at`).
|
|
7
|
-
*
|
|
8
|
-
* No database. The sibling `session_search.sqlite` is Grok's own search index
|
|
9
|
-
* and is deliberately ignored — the OpenCode reader was reverted in
|
|
10
|
-
* 0.6.0-beta.4 because a native SQLite dependency broke Windows installs, and
|
|
11
|
-
* nothing here needs one.
|
|
12
|
-
*
|
|
13
|
-
* Event shape — top-level `type`:
|
|
14
|
-
* user dialogue, unless it carries `synthetic_reason` (injected
|
|
15
|
-
* reminders, project instructions, background-task notices)
|
|
16
|
-
* assistant dialogue; `content` is a plain string
|
|
17
|
-
* reasoning dropped (encrypted chain-of-thought)
|
|
18
|
-
* tool_result dropped
|
|
19
|
-
* system dropped (system prompt)
|
|
20
|
-
* backend_tool_call dropped
|
|
21
|
-
*
|
|
22
|
-
* Compaction: Grok injects a `synthetic_reason: "compaction_meta"` user event
|
|
23
|
-
* and starts the file from the compacted state. The turns before it are NOT in
|
|
24
|
-
* `chat_history.jsonl`, and the sibling `compaction_checkpoints/*.json` holds
|
|
25
|
-
* the post-compaction seed rather than the lost history — so this adapter marks
|
|
26
|
-
* the boundary and warns instead of pretending the session is whole.
|
|
27
|
-
*/
|
|
28
|
-
import * as fs from "node:fs";
|
|
29
|
-
import * as path from "node:path";
|
|
30
|
-
import { compactionBoundaryTurn, stripInjectionTags, isBootstrapTurn, } from "../dialogue.js";
|
|
31
|
-
import { inRangeOverlap, sameProject } from "../filter.js";
|
|
32
|
-
import { readJsonFile, readJsonl } from "../internal/jsonl.js";
|
|
33
|
-
import { GROK_SESSIONS, grokCwdFromProjectDir } from "../internal/paths.js";
|
|
34
|
-
import { parseTaskPyCommandsAll } from "../phase.js";
|
|
35
|
-
import { searchInDialogue } from "../search.js";
|
|
36
|
-
// Grok encodes tool-call `arguments` exactly like Codex does — a JSON string
|
|
37
|
-
// carrying `command` — so the same defensive recovery applies.
|
|
38
|
-
import { commandFromCodexArguments } from "./codex.js";
|
|
39
|
-
const CHAT_HISTORY = "chat_history.jsonl";
|
|
40
|
-
const COMPACTION_META = "compaction_meta";
|
|
41
|
-
const WARN_COMPACTION_UNRECOVERABLE = "grok-compaction-unrecoverable";
|
|
42
|
-
// ---------- list ----------
|
|
43
|
-
/** Yield `<projectDir>/<sessionDir>` pairs that contain a chat history. */
|
|
44
|
-
function* grokSessionDirs(f) {
|
|
45
|
-
if (!fs.existsSync(GROK_SESSIONS))
|
|
46
|
-
return;
|
|
47
|
-
let projects;
|
|
48
|
-
try {
|
|
49
|
-
projects = fs.readdirSync(GROK_SESSIONS, { withFileTypes: true });
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
for (const project of projects) {
|
|
55
|
-
if (!project.isDirectory())
|
|
56
|
-
continue;
|
|
57
|
-
// Fast path: the dir name is the cwd, so an out-of-scope project can be
|
|
58
|
-
// skipped without touching its sessions.
|
|
59
|
-
if (f.cwd) {
|
|
60
|
-
const cwd = grokCwdFromProjectDir(project.name);
|
|
61
|
-
if (!sameProject(cwd, f.cwd))
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
const projectDir = path.join(GROK_SESSIONS, project.name);
|
|
65
|
-
let sessions;
|
|
66
|
-
try {
|
|
67
|
-
sessions = fs.readdirSync(projectDir, { withFileTypes: true });
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
for (const session of sessions) {
|
|
73
|
-
if (!session.isDirectory())
|
|
74
|
-
continue;
|
|
75
|
-
const sessionDir = path.join(projectDir, session.name);
|
|
76
|
-
if (!fs.existsSync(path.join(sessionDir, CHAT_HISTORY)))
|
|
77
|
-
continue;
|
|
78
|
-
yield { projectDir, sessionDir };
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
export function grokListSessions(f) {
|
|
83
|
-
const out = [];
|
|
84
|
-
for (const { projectDir, sessionDir } of grokSessionDirs(f)) {
|
|
85
|
-
const filePath = path.join(sessionDir, CHAT_HISTORY);
|
|
86
|
-
const summary = readJsonFile(path.join(sessionDir, "summary.json"));
|
|
87
|
-
const id = summary?.info?.id ?? path.basename(sessionDir);
|
|
88
|
-
const cwd = summary?.info?.cwd ?? grokCwdFromProjectDir(path.basename(projectDir));
|
|
89
|
-
if (f.cwd && !sameProject(cwd, f.cwd))
|
|
90
|
-
continue;
|
|
91
|
-
const created = summary?.created_at;
|
|
92
|
-
let updated = summary?.updated_at;
|
|
93
|
-
if (!updated) {
|
|
94
|
-
try {
|
|
95
|
-
updated = fs.statSync(filePath).mtime.toISOString();
|
|
96
|
-
}
|
|
97
|
-
catch {
|
|
98
|
-
updated = undefined;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (!inRangeOverlap(created, updated, f))
|
|
102
|
-
continue;
|
|
103
|
-
const title = summary?.session_summary?.trim() ?? "";
|
|
104
|
-
out.push({
|
|
105
|
-
platform: "grok",
|
|
106
|
-
id,
|
|
107
|
-
title: title || undefined,
|
|
108
|
-
cwd,
|
|
109
|
-
created,
|
|
110
|
-
updated,
|
|
111
|
-
filePath,
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
return out;
|
|
115
|
-
}
|
|
116
|
-
// ---------- extract ----------
|
|
117
|
-
function grokText(content) {
|
|
118
|
-
if (typeof content === "string") {
|
|
119
|
-
return { text: stripInjectionTags(content), rawLength: content.length };
|
|
120
|
-
}
|
|
121
|
-
if (!Array.isArray(content))
|
|
122
|
-
return { text: "", rawLength: 0 };
|
|
123
|
-
const parts = [];
|
|
124
|
-
let rawLength = 0;
|
|
125
|
-
for (const block of content) {
|
|
126
|
-
if (block.type !== "text" || typeof block.text !== "string")
|
|
127
|
-
continue;
|
|
128
|
-
rawLength += block.text.length;
|
|
129
|
-
const cleaned = stripInjectionTags(block.text);
|
|
130
|
-
if (cleaned)
|
|
131
|
-
parts.push(cleaned);
|
|
132
|
-
}
|
|
133
|
-
return { text: parts.join("\n\n"), rawLength };
|
|
134
|
-
}
|
|
135
|
-
export function grokExtractDialogue(s, warnings) {
|
|
136
|
-
return collectGrokTurnsAndEvents(s, warnings).turns;
|
|
137
|
-
}
|
|
138
|
-
export function grokSearch(s, kw) {
|
|
139
|
-
// No warnings sink on the search path — it fans out over the whole corpus.
|
|
140
|
-
return searchInDialogue(grokExtractDialogue(s), kw);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Single pass over `chat_history.jsonl`: cleaned dialogue turns plus the
|
|
144
|
-
* `task.py create|start` invocations found in `run_terminal_command` tool
|
|
145
|
-
* calls, which is what `--phase` slicing needs.
|
|
146
|
-
*/
|
|
147
|
-
export function collectGrokTurnsAndEvents(s, warnings) {
|
|
148
|
-
const turns = [];
|
|
149
|
-
const events = [];
|
|
150
|
-
let compactions = 0;
|
|
151
|
-
readJsonl(s.filePath, (obj) => {
|
|
152
|
-
if (obj.type === "user") {
|
|
153
|
-
const reason = obj.synthetic_reason;
|
|
154
|
-
if (reason === COMPACTION_META) {
|
|
155
|
-
compactions++;
|
|
156
|
-
const { text } = grokText(obj.content);
|
|
157
|
-
turns.push(compactionBoundaryTurn("context compacted here; Grok starts this file from the compacted state, so earlier turns are not in it", text));
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
// Every other `synthetic_reason` is an injected reminder or a background
|
|
161
|
-
// task notice, not something the user said.
|
|
162
|
-
if (reason !== undefined)
|
|
163
|
-
return;
|
|
164
|
-
const { text, rawLength } = grokText(obj.content);
|
|
165
|
-
if (text && !isBootstrapTurn(text, rawLength))
|
|
166
|
-
turns.push({ role: "user", text });
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
if (obj.type !== "assistant")
|
|
170
|
-
return;
|
|
171
|
-
for (const call of obj.tool_calls ?? []) {
|
|
172
|
-
if (call.name !== "run_terminal_command")
|
|
173
|
-
continue;
|
|
174
|
-
const cmd = commandFromCodexArguments(call.arguments);
|
|
175
|
-
if (!cmd)
|
|
176
|
-
continue;
|
|
177
|
-
for (const parsed of parseTaskPyCommandsAll(cmd)) {
|
|
178
|
-
events.push({
|
|
179
|
-
action: parsed.action,
|
|
180
|
-
timestamp: "",
|
|
181
|
-
turnIndex: turns.length,
|
|
182
|
-
...(parsed.action === "create"
|
|
183
|
-
? { slug: parsed.slug }
|
|
184
|
-
: { taskDir: parsed.taskDir }),
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
const { text } = grokText(obj.content);
|
|
189
|
-
if (text)
|
|
190
|
-
turns.push({ role: "assistant", text });
|
|
191
|
-
});
|
|
192
|
-
if (compactions > 0 && warnings) {
|
|
193
|
-
const archive = path.join(path.dirname(s.filePath), "compaction");
|
|
194
|
-
warnings.push({
|
|
195
|
-
code: WARN_COMPACTION_UNRECOVERABLE,
|
|
196
|
-
message: `session ${s.id}: compacted ${compactions} time(s); the turns before each boundary are not in chat_history.jsonl and cannot be recovered as dialogue. ` +
|
|
197
|
-
`Grok keeps a rendered transcript at ${archive}/ if you need to read them.`,
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
return { turns, events };
|
|
201
|
-
}
|
|
202
|
-
//# sourceMappingURL=grok.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grok.js","sourceRoot":"","sources":["../../../src/mem/adapters/grok.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,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I,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC;QAClE,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,6BAA6B;YACnC,OAAO,EACL,WAAW,CAAC,CAAC,EAAE,eAAe,WAAW,8GAA8G;gBACvJ,uCAAuC,OAAO,6BAA6B;SAC9E,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenCode session reader — currently a degraded no-op.
|
|
3
|
-
*
|
|
4
|
-
* OpenCode 1.2+ moved to a SQLite store at
|
|
5
|
-
* `~/.local/share/opencode/opencode.db`. The previous SQLite reader required a
|
|
6
|
-
* native dependency (`better-sqlite3`) whose prebuilt-tarball + node-gyp
|
|
7
|
-
* fallback chain broke `npm install` on Windows + restricted networks, so it
|
|
8
|
-
* was reverted. These adapter functions are kept (dispatch / phase slicing
|
|
9
|
-
* rely on them) but degraded to silent no-ops.
|
|
10
|
-
*
|
|
11
|
-
* The "OpenCode reader unavailable" warning is a presentation concern owned by
|
|
12
|
-
* the CLI — core never prints. Re-enabled in a future release once a
|
|
13
|
-
* non-native backend ships.
|
|
14
|
-
*/
|
|
15
|
-
import type { DialogueTurn, MemFilter, MemSessionInfo, SearchHit } from "../types.js";
|
|
16
|
-
export declare function opencodeListSessions(_f: MemFilter): MemSessionInfo[];
|
|
17
|
-
export declare function opencodeExtractDialogue(_s: MemSessionInfo): DialogueTurn[];
|
|
18
|
-
export declare function opencodeSearch(kw: string): SearchHit;
|
|
19
|
-
//# sourceMappingURL=opencode.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../../src/mem/adapters/opencode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,cAAc,EACd,SAAS,EACV,MAAM,aAAa,CAAC;AAErB,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,SAAS,GAAG,cAAc,EAAE,CAEpE;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,cAAc,GAAG,YAAY,EAAE,CAE1E;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAEpD"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenCode session reader — currently a degraded no-op.
|
|
3
|
-
*
|
|
4
|
-
* OpenCode 1.2+ moved to a SQLite store at
|
|
5
|
-
* `~/.local/share/opencode/opencode.db`. The previous SQLite reader required a
|
|
6
|
-
* native dependency (`better-sqlite3`) whose prebuilt-tarball + node-gyp
|
|
7
|
-
* fallback chain broke `npm install` on Windows + restricted networks, so it
|
|
8
|
-
* was reverted. These adapter functions are kept (dispatch / phase slicing
|
|
9
|
-
* rely on them) but degraded to silent no-ops.
|
|
10
|
-
*
|
|
11
|
-
* The "OpenCode reader unavailable" warning is a presentation concern owned by
|
|
12
|
-
* the CLI — core never prints. Re-enabled in a future release once a
|
|
13
|
-
* non-native backend ships.
|
|
14
|
-
*/
|
|
15
|
-
import { searchInDialogue } from "../search.js";
|
|
16
|
-
export function opencodeListSessions(_f) {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
export function opencodeExtractDialogue(_s) {
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
export function opencodeSearch(kw) {
|
|
23
|
-
return searchInDialogue([], kw);
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=opencode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opencode.js","sourceRoot":"","sources":["../../../src/mem/adapters/opencode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAQhD,MAAM,UAAU,oBAAoB,CAAC,EAAa;IAChD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,EAAkB;IACxD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,OAAO,gBAAgB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Persisted Pi Agent session reader.
|
|
3
|
-
*
|
|
4
|
-
* Layout: `~/.pi/agent/sessions/--<encoded-cwd>--/<timestamp>_<id>.jsonl`
|
|
5
|
-
* for the default store, or direct `.jsonl` files under an env/settings
|
|
6
|
-
* configured custom session directory. Entries form a tree via `id` / `parentId`;
|
|
7
|
-
* extraction follows the whole active branch (last entry leaf).
|
|
8
|
-
*
|
|
9
|
-
* Compaction: Pi writes a `compaction` entry naming the first entry it kept.
|
|
10
|
-
* That is Pi's context rule, not a record of what was said — every earlier
|
|
11
|
-
* entry is still on the active path. Extraction keeps the full path and renders
|
|
12
|
-
* the compaction entry as a boundary marker in place.
|
|
13
|
-
*/
|
|
14
|
-
import type { DialogueTurn, MemFilter, MemSessionInfo, SearchHit, TaskPyEvent } from "../types.js";
|
|
15
|
-
interface PiBuilt {
|
|
16
|
-
turns: DialogueTurn[];
|
|
17
|
-
events: TaskPyEvent[];
|
|
18
|
-
}
|
|
19
|
-
export declare function piListSessions(f: MemFilter): MemSessionInfo[];
|
|
20
|
-
export declare function piExtractDialogue(s: MemSessionInfo): DialogueTurn[];
|
|
21
|
-
export declare function piSearch(s: MemSessionInfo, kw: string): SearchHit;
|
|
22
|
-
export declare function collectPiTurnsAndEvents(s: MemSessionInfo): PiBuilt;
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=pi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../../src/mem/adapters/pi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAoBH,OAAO,KAAK,EAEV,YAAY,EACZ,SAAS,EACT,cAAc,EACd,SAAS,EACT,WAAW,EACZ,MAAM,aAAa,CAAC;AAwCrB,UAAU,OAAO;IACf,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB;AAID,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,GAAG,cAAc,EAAE,CAwD7D;AA2CD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,cAAc,GAAG,YAAY,EAAE,CAEnE;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,CAEjE;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,cAAc,GAAG,OAAO,CAElE"}
|
package/dist/mem/adapters/pi.js
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Persisted Pi Agent session reader.
|
|
3
|
-
*
|
|
4
|
-
* Layout: `~/.pi/agent/sessions/--<encoded-cwd>--/<timestamp>_<id>.jsonl`
|
|
5
|
-
* for the default store, or direct `.jsonl` files under an env/settings
|
|
6
|
-
* configured custom session directory. Entries form a tree via `id` / `parentId`;
|
|
7
|
-
* extraction follows the whole active branch (last entry leaf).
|
|
8
|
-
*
|
|
9
|
-
* Compaction: Pi writes a `compaction` entry naming the first entry it kept.
|
|
10
|
-
* That is Pi's context rule, not a record of what was said — every earlier
|
|
11
|
-
* entry is still on the active path. Extraction keeps the full path and renders
|
|
12
|
-
* the compaction entry as a boundary marker in place.
|
|
13
|
-
*/
|
|
14
|
-
import * as fs from "node:fs";
|
|
15
|
-
import * as path from "node:path";
|
|
16
|
-
import { compactionBoundaryTurn, stripInjectionTags, isBootstrapTurn, } from "../dialogue.js";
|
|
17
|
-
import { inRangeOverlap, sameProject } from "../filter.js";
|
|
18
|
-
import { readJsonl, readJsonlFirst } from "../internal/jsonl.js";
|
|
19
|
-
import { PI_AGENT_DIR, piProjectDirFromCwd, piSessionRoots, walkDir, } from "../internal/paths.js";
|
|
20
|
-
import { parseTaskPyCommandsAll } from "../phase.js";
|
|
21
|
-
import { searchInDialogue } from "../search.js";
|
|
22
|
-
// ---------- list ----------
|
|
23
|
-
export function piListSessions(f) {
|
|
24
|
-
const out = [];
|
|
25
|
-
for (const filePath of candidateFiles(f)) {
|
|
26
|
-
const header = readJsonlFirst(filePath);
|
|
27
|
-
if (header?.type !== "session")
|
|
28
|
-
continue;
|
|
29
|
-
const id = typeof header.id === "string" ? header.id : idFromFile(filePath);
|
|
30
|
-
const cwd = typeof header.cwd === "string" ? header.cwd : undefined;
|
|
31
|
-
if (f.cwd && !sameProject(cwd, f.cwd))
|
|
32
|
-
continue;
|
|
33
|
-
let title;
|
|
34
|
-
let lastActivityMs;
|
|
35
|
-
readJsonl(filePath, (entry) => {
|
|
36
|
-
if (entry.type === "session_info") {
|
|
37
|
-
title =
|
|
38
|
-
typeof entry.name === "string" && entry.name.trim()
|
|
39
|
-
? entry.name.trim()
|
|
40
|
-
: undefined;
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (entry.type !== "message")
|
|
44
|
-
return;
|
|
45
|
-
const role = entry.message?.role;
|
|
46
|
-
if (role !== "user" && role !== "assistant")
|
|
47
|
-
return;
|
|
48
|
-
const activityMs = timestampMs(entry.message?.timestamp) ?? timestampMs(entry.timestamp);
|
|
49
|
-
if (activityMs !== undefined)
|
|
50
|
-
lastActivityMs = Math.max(lastActivityMs ?? 0, activityMs);
|
|
51
|
-
});
|
|
52
|
-
let updated;
|
|
53
|
-
try {
|
|
54
|
-
updated =
|
|
55
|
-
lastActivityMs !== undefined
|
|
56
|
-
? new Date(lastActivityMs).toISOString()
|
|
57
|
-
: fs.statSync(filePath).mtime.toISOString();
|
|
58
|
-
}
|
|
59
|
-
catch {
|
|
60
|
-
updated =
|
|
61
|
-
lastActivityMs !== undefined
|
|
62
|
-
? new Date(lastActivityMs).toISOString()
|
|
63
|
-
: undefined;
|
|
64
|
-
}
|
|
65
|
-
const created = typeof header.timestamp === "string" ? header.timestamp : undefined;
|
|
66
|
-
if (!inRangeOverlap(created, updated, f))
|
|
67
|
-
continue;
|
|
68
|
-
out.push({
|
|
69
|
-
platform: "pi",
|
|
70
|
-
id,
|
|
71
|
-
title,
|
|
72
|
-
cwd,
|
|
73
|
-
created,
|
|
74
|
-
updated,
|
|
75
|
-
filePath,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return out;
|
|
79
|
-
}
|
|
80
|
-
function candidateFiles(f) {
|
|
81
|
-
const defaultRoot = path.join(PI_AGENT_DIR, "sessions");
|
|
82
|
-
const seen = new Set();
|
|
83
|
-
const out = [];
|
|
84
|
-
const pushJsonlFiles = (root) => {
|
|
85
|
-
if (!fs.existsSync(root))
|
|
86
|
-
return;
|
|
87
|
-
for (const file of walkDir(root)) {
|
|
88
|
-
if (!file.endsWith(".jsonl"))
|
|
89
|
-
continue;
|
|
90
|
-
const normalized = path.resolve(file);
|
|
91
|
-
if (seen.has(normalized))
|
|
92
|
-
continue;
|
|
93
|
-
seen.add(normalized);
|
|
94
|
-
out.push(file);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
for (const root of piSessionRoots(f.cwd)) {
|
|
98
|
-
if (f.cwd && path.resolve(root) === path.resolve(defaultRoot)) {
|
|
99
|
-
pushJsonlFiles(piProjectDirFromCwd(f.cwd));
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
pushJsonlFiles(root);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return out;
|
|
106
|
-
}
|
|
107
|
-
function idFromFile(filePath) {
|
|
108
|
-
const base = path.basename(filePath, ".jsonl");
|
|
109
|
-
const underscore = base.indexOf("_");
|
|
110
|
-
return underscore === -1 ? base : base.slice(underscore + 1);
|
|
111
|
-
}
|
|
112
|
-
function timestampMs(value) {
|
|
113
|
-
if (typeof value === "number" && Number.isFinite(value))
|
|
114
|
-
return value;
|
|
115
|
-
if (typeof value !== "string")
|
|
116
|
-
return undefined;
|
|
117
|
-
const ms = new Date(value).getTime();
|
|
118
|
-
return Number.isNaN(ms) ? undefined : ms;
|
|
119
|
-
}
|
|
120
|
-
// ---------- extract/search/phase ----------
|
|
121
|
-
export function piExtractDialogue(s) {
|
|
122
|
-
return buildPiTurnsAndEvents(s).turns;
|
|
123
|
-
}
|
|
124
|
-
export function piSearch(s, kw) {
|
|
125
|
-
return searchInDialogue(piExtractDialogue(s), kw);
|
|
126
|
-
}
|
|
127
|
-
export function collectPiTurnsAndEvents(s) {
|
|
128
|
-
return buildPiTurnsAndEvents(s);
|
|
129
|
-
}
|
|
130
|
-
function buildPiTurnsAndEvents(s) {
|
|
131
|
-
const activePath = piActivePath(s.filePath);
|
|
132
|
-
const turns = [];
|
|
133
|
-
const events = [];
|
|
134
|
-
for (const entry of activePath) {
|
|
135
|
-
collectTaskEvents(entry, turns.length, events);
|
|
136
|
-
const turn = turnFromEntry(entry);
|
|
137
|
-
if (turn)
|
|
138
|
-
turns.push(turn);
|
|
139
|
-
}
|
|
140
|
-
return { turns, events };
|
|
141
|
-
}
|
|
142
|
-
/** Walk parent links back from the last entry — the branch the session ended
|
|
143
|
-
* on, in chronological order. No compaction truncation: a `compaction` entry is
|
|
144
|
-
* Pi's context rule, and the entries it excluded are still on this path. */
|
|
145
|
-
function piActivePath(filePath) {
|
|
146
|
-
const entries = [];
|
|
147
|
-
readJsonl(filePath, (entry) => {
|
|
148
|
-
if (entry.type === "session")
|
|
149
|
-
return;
|
|
150
|
-
if (typeof entry.id !== "string")
|
|
151
|
-
return;
|
|
152
|
-
entries.push(entry);
|
|
153
|
-
});
|
|
154
|
-
if (entries.length === 0)
|
|
155
|
-
return [];
|
|
156
|
-
const byId = new Map();
|
|
157
|
-
for (const entry of entries) {
|
|
158
|
-
if (typeof entry.id === "string")
|
|
159
|
-
byId.set(entry.id, entry);
|
|
160
|
-
}
|
|
161
|
-
const leaf = entries[entries.length - 1];
|
|
162
|
-
if (!leaf)
|
|
163
|
-
return [];
|
|
164
|
-
const activePath = [];
|
|
165
|
-
let current = leaf;
|
|
166
|
-
const seen = new Set();
|
|
167
|
-
while (current) {
|
|
168
|
-
if (typeof current.id !== "string" || seen.has(current.id))
|
|
169
|
-
break;
|
|
170
|
-
seen.add(current.id);
|
|
171
|
-
activePath.unshift(current);
|
|
172
|
-
current =
|
|
173
|
-
typeof current.parentId === "string"
|
|
174
|
-
? byId.get(current.parentId)
|
|
175
|
-
: undefined;
|
|
176
|
-
}
|
|
177
|
-
return activePath;
|
|
178
|
-
}
|
|
179
|
-
function turnFromEntry(entry) {
|
|
180
|
-
if (entry.type === "compaction") {
|
|
181
|
-
return compactionBoundary(entry.summary);
|
|
182
|
-
}
|
|
183
|
-
if (entry.type === "branch_summary") {
|
|
184
|
-
return syntheticTurn("[branch summary]", entry.summary);
|
|
185
|
-
}
|
|
186
|
-
if (entry.type === "custom_message") {
|
|
187
|
-
return buildTurn("user", entry.content);
|
|
188
|
-
}
|
|
189
|
-
if (entry.type !== "message")
|
|
190
|
-
return null;
|
|
191
|
-
const msg = entry.message;
|
|
192
|
-
if (!msg)
|
|
193
|
-
return null;
|
|
194
|
-
switch (msg.role) {
|
|
195
|
-
case "user":
|
|
196
|
-
return buildTurn("user", msg.content);
|
|
197
|
-
case "assistant":
|
|
198
|
-
return buildTurn("assistant", msg.content);
|
|
199
|
-
case "custom":
|
|
200
|
-
return buildTurn("user", msg.content);
|
|
201
|
-
case "branchSummary":
|
|
202
|
-
return syntheticTurn("[branch summary]", msg.summary);
|
|
203
|
-
case "compactionSummary":
|
|
204
|
-
return compactionBoundary(msg.summary);
|
|
205
|
-
default:
|
|
206
|
-
return null;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
function compactionBoundary(raw) {
|
|
210
|
-
const summary = typeof raw === "string" ? stripInjectionTags(raw) : "";
|
|
211
|
-
return compactionBoundaryTurn("context compacted here; the turns above stayed on the active branch", summary);
|
|
212
|
-
}
|
|
213
|
-
function syntheticTurn(prefix, raw) {
|
|
214
|
-
if (typeof raw !== "string")
|
|
215
|
-
return null;
|
|
216
|
-
const text = stripInjectionTags(raw);
|
|
217
|
-
if (!text)
|
|
218
|
-
return null;
|
|
219
|
-
return { role: "user", text: `${prefix}\n${text}` };
|
|
220
|
-
}
|
|
221
|
-
function buildTurn(role, content) {
|
|
222
|
-
const parts = [];
|
|
223
|
-
let totalRaw = 0;
|
|
224
|
-
if (typeof content === "string") {
|
|
225
|
-
totalRaw = content.length;
|
|
226
|
-
const cleaned = stripInjectionTags(content);
|
|
227
|
-
if (cleaned)
|
|
228
|
-
parts.push(cleaned);
|
|
229
|
-
}
|
|
230
|
-
else if (Array.isArray(content)) {
|
|
231
|
-
for (const block of content) {
|
|
232
|
-
if (block.type !== "text" || typeof block.text !== "string")
|
|
233
|
-
continue;
|
|
234
|
-
totalRaw += block.text.length;
|
|
235
|
-
const cleaned = stripInjectionTags(block.text);
|
|
236
|
-
if (cleaned)
|
|
237
|
-
parts.push(cleaned);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
if (parts.length === 0)
|
|
241
|
-
return null;
|
|
242
|
-
const merged = parts.join("\n\n");
|
|
243
|
-
if (isBootstrapTurn(merged, totalRaw))
|
|
244
|
-
return null;
|
|
245
|
-
return { role, text: merged };
|
|
246
|
-
}
|
|
247
|
-
function collectTaskEvents(entry, turnIndex, events) {
|
|
248
|
-
if (entry.type !== "message")
|
|
249
|
-
return;
|
|
250
|
-
const msg = entry.message;
|
|
251
|
-
if (!msg)
|
|
252
|
-
return;
|
|
253
|
-
if (msg.role === "bashExecution" && typeof msg.command === "string") {
|
|
254
|
-
pushTaskEvents(msg.command, entry.timestamp, turnIndex, events);
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
if (msg.role !== "assistant" || !Array.isArray(msg.content))
|
|
258
|
-
return;
|
|
259
|
-
for (const block of msg.content) {
|
|
260
|
-
if (block.type !== "toolCall")
|
|
261
|
-
continue;
|
|
262
|
-
if (typeof block.name !== "string")
|
|
263
|
-
continue;
|
|
264
|
-
const toolName = block.name.toLowerCase();
|
|
265
|
-
if (toolName !== "bash" && toolName !== "shell")
|
|
266
|
-
continue;
|
|
267
|
-
const args = block.arguments;
|
|
268
|
-
if (!args || typeof args !== "object" || Array.isArray(args))
|
|
269
|
-
continue;
|
|
270
|
-
const command = args.command;
|
|
271
|
-
if (typeof command !== "string")
|
|
272
|
-
continue;
|
|
273
|
-
pushTaskEvents(command, entry.timestamp, turnIndex, events);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
function pushTaskEvents(command, timestamp, turnIndex, events) {
|
|
277
|
-
const parsedAll = parseTaskPyCommandsAll(command);
|
|
278
|
-
for (const parsed of parsedAll) {
|
|
279
|
-
const ev = {
|
|
280
|
-
action: parsed.action,
|
|
281
|
-
timestamp: timestamp ?? "",
|
|
282
|
-
turnIndex,
|
|
283
|
-
...(parsed.action === "create"
|
|
284
|
-
? { slug: parsed.slug }
|
|
285
|
-
: { taskDir: parsed.taskDir }),
|
|
286
|
-
};
|
|
287
|
-
events.push(ev);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
//# sourceMappingURL=pi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pi.js","sourceRoot":"","sources":["../../../src/mem/adapters/pi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,sBAAsB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