@mindfoldhq/trellis 0.6.0-beta.1 → 0.6.0-beta.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/commands/mem.d.ts +117 -1
- package/dist/commands/mem.d.ts.map +1 -1
- package/dist/commands/mem.js +945 -137
- package/dist/commands/mem.js.map +1 -1
- package/dist/migrations/manifests/0.6.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.3.json +9 -0
- package/package.json +3 -1
package/dist/commands/mem.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ declare const SessionInfoSchema: z.ZodObject<{
|
|
|
23
23
|
created: z.ZodOptional<z.ZodString>;
|
|
24
24
|
updated: z.ZodOptional<z.ZodString>;
|
|
25
25
|
filePath: z.ZodString;
|
|
26
|
-
messageDir: z.ZodOptional<z.ZodString>;
|
|
27
26
|
parent_id: z.ZodOptional<z.ZodString>;
|
|
28
27
|
}, z.core.$strip>;
|
|
29
28
|
type SessionInfo = z.infer<typeof SessionInfoSchema>;
|
|
@@ -78,6 +77,22 @@ type Argv = z.infer<typeof ArgvSchema>;
|
|
|
78
77
|
export declare function parseArgv(argv: readonly string[]): Argv;
|
|
79
78
|
export declare function buildFilter(flags: Argv["flags"]): Filter;
|
|
80
79
|
export declare function inRange(iso: string | undefined, f: Filter): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Interval-overlap version of `inRange` for sessions with both start and end
|
|
82
|
+
* timestamps. A session is kept iff its lifetime `[start, end]` overlaps the
|
|
83
|
+
* query window `[f.since, f.until]`.
|
|
84
|
+
*
|
|
85
|
+
* Why this exists: long / cross-day sessions (created on day N, still updated
|
|
86
|
+
* on day N+M) were being dropped by `inRange(created, f)` when `--since` fell
|
|
87
|
+
* after `created`. Switching to interval overlap keeps sessions that were
|
|
88
|
+
* active inside the window even when they started before it.
|
|
89
|
+
*
|
|
90
|
+
* Degenerate inputs:
|
|
91
|
+
* - both undefined → pass through (no timestamp = don't filter)
|
|
92
|
+
* - one undefined → fall back to single-point semantics on the other end
|
|
93
|
+
* - unparseable iso → defer to the parsable end (or pass through if both bad)
|
|
94
|
+
*/
|
|
95
|
+
export declare function inRangeOverlap(start: string | undefined, end: string | undefined, f: Filter): boolean;
|
|
81
96
|
export declare function sameProject(sessionCwd: string | undefined, target: string | undefined): boolean;
|
|
82
97
|
/** True if this turn is a platform bootstrap injection (AGENTS.md, pure
|
|
83
98
|
* INSTRUCTIONS preamble, etc.) and should be dropped wholesale rather than
|
|
@@ -106,9 +121,110 @@ export declare function searchInDialogue(turns: readonly DialogueTurn[], kw: str
|
|
|
106
121
|
export declare function claudeListSessions(f: Filter): SessionInfo[];
|
|
107
122
|
export declare function claudeExtractDialogue(s: SessionInfo): DialogueTurn[];
|
|
108
123
|
export declare function claudeSearch(s: SessionInfo, kw: string): SearchHit;
|
|
124
|
+
/**
|
|
125
|
+
* Parse a Bash command string and extract `task.py create|start` invocations.
|
|
126
|
+
*
|
|
127
|
+
* Returns null if the command does not invoke `task.py`. The detection is
|
|
128
|
+
* intentionally lenient on invoker prefix — covers `python` / `python3` /
|
|
129
|
+
* `py -3` / no-prefix (PATH + chmod +x) — and on path separator (`/`, `\`,
|
|
130
|
+
* `\\` from JSONL re-escape). False-positive guard: `task.py` MUST be at the
|
|
131
|
+
* start of the command, after a path separator, or preceded by whitespace —
|
|
132
|
+
* never embedded inside a flag value like `--slug task.py-create-foo`.
|
|
133
|
+
*
|
|
134
|
+
* For `create`, the slug / title arg is captured as the first positional
|
|
135
|
+
* argument after the verb (best-effort; not used to gate the match).
|
|
136
|
+
*
|
|
137
|
+
* For `start`, the task-dir path is captured as the first positional argument.
|
|
138
|
+
*/
|
|
139
|
+
export type ParsedTaskPyCommand = {
|
|
140
|
+
action: "create";
|
|
141
|
+
slug?: string;
|
|
142
|
+
titleArg?: string;
|
|
143
|
+
} | {
|
|
144
|
+
action: "start";
|
|
145
|
+
taskDir?: string;
|
|
146
|
+
};
|
|
147
|
+
/** Find ALL `task.py create|start` invocations in a single Bash command
|
|
148
|
+
* string. A real Bash invocation can contain several (e.g.
|
|
149
|
+
* `SMOKE=$(task.py create …); task.py start "$SMOKE"; …`); the original
|
|
150
|
+
* single-match `parseTaskPyCommand` only saw the first one and silently
|
|
151
|
+
* dropped the rest, breaking pairing in any session that used such patterns.
|
|
152
|
+
*
|
|
153
|
+
* Returned in source order. Each entry's `restRaw` is bounded to the next
|
|
154
|
+
* `task.py` invocation or end-of-line, whichever comes first, so multi-action
|
|
155
|
+
* one-liners are split safely without leaking later args into earlier ones. */
|
|
156
|
+
export declare function parseTaskPyCommandsAll(cmd: string): ParsedTaskPyCommand[];
|
|
157
|
+
/** Single-result wrapper for backwards compatibility (returns the first
|
|
158
|
+
* occurrence, or null if none). Existing tests that assume single-match
|
|
159
|
+
* semantics still pass via this helper; new code should call
|
|
160
|
+
* `parseTaskPyCommandsAll`. */
|
|
161
|
+
export declare function parseTaskPyCommand(cmd: string): ParsedTaskPyCommand | null;
|
|
162
|
+
export interface TaskPyEvent {
|
|
163
|
+
action: "create" | "start";
|
|
164
|
+
timestamp: string;
|
|
165
|
+
/** Index into the cleaned DialogueTurn[] array — points to the next turn
|
|
166
|
+
* that would be appended after this Bash tool_use event was emitted. */
|
|
167
|
+
turnIndex: number;
|
|
168
|
+
slug?: string;
|
|
169
|
+
taskDir?: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Single-pass scan of a Claude JSONL file that produces both:
|
|
173
|
+
* 1. the cleaned dialogue turns (semantically identical to
|
|
174
|
+
* `claudeExtractDialogue`)
|
|
175
|
+
* 2. the list of `task.py create|start` Bash tool_use events with their
|
|
176
|
+
* `turnIndex` (= turns.length AT THE TIME the tool_use was seen).
|
|
177
|
+
*
|
|
178
|
+
* Why one pass: we need the turnIndex to align with `claudeExtractDialogue`'s
|
|
179
|
+
* output exactly, including compaction-reset behavior. A second pass would
|
|
180
|
+
* have to re-derive turn indices from timestamps, which is fragile when
|
|
181
|
+
* timestamps repeat or are missing.
|
|
182
|
+
*
|
|
183
|
+
* For non-Claude platforms this returns turns + an empty event list; callers
|
|
184
|
+
* are expected to handle Codex/OpenCode boundary detection separately (or
|
|
185
|
+
* gracefully degrade — see PRD MVP scope).
|
|
186
|
+
*/
|
|
187
|
+
export declare function collectClaudeTurnsAndEvents(s: SessionInfo): {
|
|
188
|
+
turns: DialogueTurn[];
|
|
189
|
+
events: TaskPyEvent[];
|
|
190
|
+
};
|
|
191
|
+
export interface BrainstormWindow {
|
|
192
|
+
label: string;
|
|
193
|
+
/** inclusive */
|
|
194
|
+
startTurn: number;
|
|
195
|
+
/** exclusive */
|
|
196
|
+
endTurn: number;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Pair `create` → `start` events into brainstorm windows.
|
|
200
|
+
*
|
|
201
|
+
* Pairing strategy:
|
|
202
|
+
* 1. Walk events in order.
|
|
203
|
+
* 2. For each `create`, find the next unmatched `start` whose slug matches
|
|
204
|
+
* (slug derived from `start` taskDir's last path segment) — slug match
|
|
205
|
+
* wins regardless of position.
|
|
206
|
+
* 3. If no slug match: pair with the next unmatched `start` by position
|
|
207
|
+
* (FIFO).
|
|
208
|
+
* 4. Unmatched `create` (no following `start`): window = [create, totalTurns).
|
|
209
|
+
* 5. Unmatched `start` (no preceding `create`): window = [0, start).
|
|
210
|
+
*
|
|
211
|
+
* Window labels: `<slug>` if known, else `window-N`.
|
|
212
|
+
*/
|
|
213
|
+
export declare function buildBrainstormWindows(events: readonly TaskPyEvent[], totalTurns: number): BrainstormWindow[];
|
|
109
214
|
export declare function codexListSessions(f: Filter): SessionInfo[];
|
|
110
215
|
export declare function codexExtractDialogue(s: SessionInfo): DialogueTurn[];
|
|
111
216
|
export declare function codexSearch(s: SessionInfo, kw: string): SearchHit;
|
|
217
|
+
/** Codex twin of `collectClaudeTurnsAndEvents`. Single pass over the rollout
|
|
218
|
+
* file; emits both the cleaned dialogue turns (semantically identical to
|
|
219
|
+
* `codexExtractDialogue`) AND the list of `task.py create|start` invocations
|
|
220
|
+
* found inside `function_call` events whose `name === "exec_command"` (Codex's
|
|
221
|
+
* stable shell tool). Compaction resets both turns AND events for the same
|
|
222
|
+
* reason as the Claude collector — pre-compact event indices stop pointing at
|
|
223
|
+
* real turns once history is replaced. */
|
|
224
|
+
export declare function collectCodexTurnsAndEvents(s: SessionInfo): {
|
|
225
|
+
turns: DialogueTurn[];
|
|
226
|
+
events: TaskPyEvent[];
|
|
227
|
+
};
|
|
112
228
|
export declare function opencodeListSessions(f: Filter): SessionInfo[];
|
|
113
229
|
export declare function opencodeExtractDialogue(s: SessionInfo): DialogueTurn[];
|
|
114
230
|
export declare function shortDate(iso?: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mem.d.ts","sourceRoot":"","sources":["../../src/commands/mem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"mem.d.ts","sourceRoot":"","sources":["../../src/commands/mem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;iBASrB,CAAC;AACH,KAAK,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAErD,QAAA,MAAM,kBAAkB;;;EAAgC,CAAC;AACzD,KAAK,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEvD,UAAU,YAAY;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAMD,QAAA,MAAM,eAAe;;;;;;;;;;;;iBAMnB,CAAC;AACH,KAAK,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAEjD;;;;;2BAK2B;AAC3B,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,GAAG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