@mindfoldhq/trellis 0.6.0-beta.14 → 0.6.0-beta.16
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/channel/adapters/codex.d.ts +4 -0
- package/dist/commands/channel/adapters/codex.d.ts.map +1 -1
- package/dist/commands/channel/adapters/codex.js +27 -10
- package/dist/commands/channel/adapters/codex.js.map +1 -1
- package/dist/commands/channel/index.d.ts.map +1 -1
- package/dist/commands/channel/index.js +12 -7
- package/dist/commands/channel/index.js.map +1 -1
- package/dist/commands/channel/messages.js +3 -3
- package/dist/commands/channel/messages.js.map +1 -1
- package/dist/commands/channel/send.d.ts +1 -0
- package/dist/commands/channel/send.d.ts.map +1 -1
- package/dist/commands/channel/send.js +3 -1
- package/dist/commands/channel/send.js.map +1 -1
- package/dist/commands/channel/spawn.d.ts +3 -0
- package/dist/commands/channel/spawn.d.ts.map +1 -1
- package/dist/commands/channel/spawn.js +1 -0
- package/dist/commands/channel/spawn.js.map +1 -1
- package/dist/commands/channel/store/events.d.ts +1 -1
- package/dist/commands/channel/store/events.js +1 -1
- package/dist/commands/channel/store/watch.d.ts.map +1 -1
- package/dist/commands/channel/store/watch.js +17 -1
- package/dist/commands/channel/store/watch.js.map +1 -1
- package/dist/commands/channel/supervisor/inbox.d.ts +5 -0
- package/dist/commands/channel/supervisor/inbox.d.ts.map +1 -1
- package/dist/commands/channel/supervisor/inbox.js +69 -8
- package/dist/commands/channel/supervisor/inbox.js.map +1 -1
- package/dist/commands/channel/supervisor/stdout.d.ts +3 -1
- package/dist/commands/channel/supervisor/stdout.d.ts.map +1 -1
- package/dist/commands/channel/supervisor/stdout.js +17 -3
- package/dist/commands/channel/supervisor/stdout.js.map +1 -1
- package/dist/commands/channel/supervisor/turns.d.ts +20 -0
- package/dist/commands/channel/supervisor/turns.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/turns.js +28 -0
- package/dist/commands/channel/supervisor/turns.js.map +1 -0
- package/dist/commands/channel/supervisor.d.ts +4 -0
- package/dist/commands/channel/supervisor.d.ts.map +1 -1
- package/dist/commands/channel/supervisor.js +7 -0
- package/dist/commands/channel/supervisor.js.map +1 -1
- package/dist/commands/channel/threads.d.ts +2 -2
- package/dist/commands/channel/threads.d.ts.map +1 -1
- package/dist/commands/channel/threads.js +3 -3
- package/dist/commands/channel/threads.js.map +1 -1
- package/dist/commands/mem.d.ts +13 -217
- package/dist/commands/mem.d.ts.map +1 -1
- package/dist/commands/mem.js +142 -1587
- package/dist/commands/mem.js.map +1 -1
- package/dist/migrations/manifests/0.6.0-beta.15.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.16.json +9 -0
- package/dist/templates/claude/agents/trellis-check.md +11 -5
- package/dist/templates/codebuddy/agents/trellis-check.md +11 -5
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +27 -0
- package/dist/templates/cursor/agents/trellis-check.md +11 -5
- package/dist/templates/droid/droids/trellis-check.md +11 -5
- package/dist/templates/gemini/agents/trellis-check.md +11 -5
- package/dist/templates/kiro/agents/trellis-check.json +1 -1
- package/dist/templates/opencode/agents/trellis-check.md +11 -5
- package/dist/templates/pi/agents/trellis-check.md +5 -4
- package/dist/templates/pi/agents/trellis-implement.md +5 -4
- package/dist/templates/qoder/agents/trellis-check.md +11 -5
- package/dist/templates/trellis/workflow.md +20 -0
- package/package.json +2 -2
package/dist/commands/mem.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* mem.ts —
|
|
2
|
+
* mem.ts — CLI wrapper over `@mindfoldhq/trellis-core/mem`.
|
|
3
|
+
*
|
|
4
|
+
* The reusable retrieval / context-extraction logic lives in core; this file
|
|
5
|
+
* owns only CLI concerns: argument parsing, terminal rendering, the OpenCode
|
|
6
|
+
* "reader unavailable" notice, and process exit behavior.
|
|
3
7
|
*
|
|
4
8
|
* Commands:
|
|
5
9
|
* list list sessions (default if no command)
|
|
@@ -10,225 +14,17 @@
|
|
|
10
14
|
*
|
|
11
15
|
* Run `trellis mem help` for the full flag reference.
|
|
12
16
|
*/
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
claude: "claude";
|
|
19
|
-
}>;
|
|
20
|
-
id: z.ZodString;
|
|
21
|
-
title: z.ZodOptional<z.ZodString>;
|
|
22
|
-
cwd: z.ZodOptional<z.ZodString>;
|
|
23
|
-
created: z.ZodOptional<z.ZodString>;
|
|
24
|
-
updated: z.ZodOptional<z.ZodString>;
|
|
25
|
-
filePath: z.ZodString;
|
|
26
|
-
parent_id: z.ZodOptional<z.ZodString>;
|
|
27
|
-
}, z.core.$strip>;
|
|
28
|
-
type SessionInfo = z.infer<typeof SessionInfoSchema>;
|
|
29
|
-
declare const DialogueRoleSchema: z.ZodEnum<{
|
|
30
|
-
user: "user";
|
|
31
|
-
assistant: "assistant";
|
|
32
|
-
}>;
|
|
33
|
-
type DialogueRole = z.infer<typeof DialogueRoleSchema>;
|
|
34
|
-
interface DialogueTurn {
|
|
35
|
-
role: DialogueRole;
|
|
36
|
-
text: string;
|
|
17
|
+
import type { MemFilter } from "@mindfoldhq/trellis-core/mem";
|
|
18
|
+
export interface Argv {
|
|
19
|
+
cmd: string;
|
|
20
|
+
positional: string[];
|
|
21
|
+
flags: Record<string, string | boolean>;
|
|
37
22
|
}
|
|
38
|
-
declare const SearchHitSchema: z.ZodObject<{
|
|
39
|
-
count: z.ZodNumber;
|
|
40
|
-
user_count: z.ZodNumber;
|
|
41
|
-
asst_count: z.ZodNumber;
|
|
42
|
-
total_turns: z.ZodNumber;
|
|
43
|
-
excerpts: z.ZodArray<z.ZodObject<{
|
|
44
|
-
role: z.ZodEnum<{
|
|
45
|
-
user: "user";
|
|
46
|
-
assistant: "assistant";
|
|
47
|
-
}>;
|
|
48
|
-
snippet: z.ZodString;
|
|
49
|
-
}, z.core.$strip>>;
|
|
50
|
-
}, z.core.$strip>;
|
|
51
|
-
type SearchHit = z.infer<typeof SearchHitSchema>;
|
|
52
|
-
/** Weighted-density relevance score:
|
|
53
|
-
* (3 * user_hits + asst_hits) / total_turns
|
|
54
|
-
* Higher = the session is more topically concentrated on the query AND the
|
|
55
|
-
* user themselves brought it up (user hits weighted ×3 because the user's own
|
|
56
|
-
* words anchor "what they actually cared about", while assistant elaboration
|
|
57
|
-
* is downstream noise). */
|
|
58
|
-
export declare function relevanceScore(h: SearchHit): number;
|
|
59
|
-
declare const FilterSchema: z.ZodObject<{
|
|
60
|
-
platform: z.ZodUnion<readonly [z.ZodEnum<{
|
|
61
|
-
opencode: "opencode";
|
|
62
|
-
codex: "codex";
|
|
63
|
-
claude: "claude";
|
|
64
|
-
}>, z.ZodLiteral<"all">]>;
|
|
65
|
-
since: z.ZodOptional<z.ZodDate>;
|
|
66
|
-
until: z.ZodOptional<z.ZodDate>;
|
|
67
|
-
cwd: z.ZodOptional<z.ZodString>;
|
|
68
|
-
limit: z.ZodNumber;
|
|
69
|
-
}, z.core.$strip>;
|
|
70
|
-
type Filter = z.infer<typeof FilterSchema>;
|
|
71
|
-
declare const ArgvSchema: z.ZodObject<{
|
|
72
|
-
cmd: z.ZodString;
|
|
73
|
-
positional: z.ZodArray<z.ZodString>;
|
|
74
|
-
flags: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
75
|
-
}, z.core.$strip>;
|
|
76
|
-
type Argv = z.infer<typeof ArgvSchema>;
|
|
77
23
|
export declare function parseArgv(argv: readonly string[]): Argv;
|
|
78
|
-
|
|
79
|
-
|
|
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;
|
|
96
|
-
export declare function sameProject(sessionCwd: string | undefined, target: string | undefined): boolean;
|
|
97
|
-
/** True if this turn is a platform bootstrap injection (AGENTS.md, pure
|
|
98
|
-
* INSTRUCTIONS preamble, etc.) and should be dropped wholesale rather than
|
|
99
|
-
* partially cleaned. Detected after stripInjectionTags, so we look at what's
|
|
100
|
-
* left after tag-stripping. */
|
|
101
|
-
export declare function isBootstrapTurn(cleaned: string, originalLength: number): boolean;
|
|
102
|
-
export declare function stripInjectionTags(text: string): string;
|
|
103
|
-
/** Find the paragraph-aligned chunk surrounding a hit position. A "chunk" is
|
|
104
|
-
* the contiguous text bounded by the nearest blank-line breaks (`\n\n`) on
|
|
105
|
-
* either side. If the natural paragraph exceeds `maxChars`, fall back to a
|
|
106
|
-
* centered char window — and report the truncation so callers can mark it. */
|
|
107
|
-
export declare function chunkAround(text: string, hitIdx: number, maxChars: number): {
|
|
108
|
-
start: number;
|
|
109
|
-
end: number;
|
|
110
|
-
truncated: boolean;
|
|
111
|
-
};
|
|
112
|
-
/** Multi-token AND grep over cleaned dialogue. Whitespace-split tokens; a
|
|
113
|
-
* turn matches if every token (case-insensitive) appears anywhere in it.
|
|
114
|
-
* `count` is the total occurrence count across all tokens within matching
|
|
115
|
-
* turns. Excerpts are paragraph-aligned chunks (drawer-style): for each
|
|
116
|
-
* matching turn we collect chunks around every hit position, dedupe by
|
|
117
|
-
* chunk start so adjacent hits inside the same paragraph collapse to one
|
|
118
|
-
* chunk. User-role chunks are listed first (the user's own words anchor
|
|
119
|
-
* topic intent more reliably than AI elaboration). */
|
|
120
|
-
export declare function searchInDialogue(turns: readonly DialogueTurn[], kw: string, maxExcerpts?: number, chunkChars?: number): SearchHit;
|
|
121
|
-
export declare function claudeListSessions(f: Filter): SessionInfo[];
|
|
122
|
-
export declare function claudeExtractDialogue(s: SessionInfo): DialogueTurn[];
|
|
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[];
|
|
214
|
-
export declare function codexListSessions(f: Filter): SessionInfo[];
|
|
215
|
-
export declare function codexExtractDialogue(s: SessionInfo): DialogueTurn[];
|
|
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
|
-
};
|
|
228
|
-
export declare function opencodeListSessions(_f: Filter): SessionInfo[];
|
|
229
|
-
export declare function opencodeExtractDialogue(_s: SessionInfo): DialogueTurn[];
|
|
24
|
+
/** Translate parsed CLI flags into a core `MemFilter`. Validation failures
|
|
25
|
+
* exit the process — core never sees raw CLI flags. */
|
|
26
|
+
export declare function buildFilter(flags: Argv["flags"]): MemFilter;
|
|
230
27
|
export declare function shortDate(iso?: string): string;
|
|
231
28
|
export declare function shortPath(p?: string): string;
|
|
232
29
|
export declare function runMem(args: readonly string[]): void;
|
|
233
|
-
export {};
|
|
234
30
|
//# sourceMappingURL=mem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mem.d.ts","sourceRoot":"","sources":["../../src/commands/mem.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mem.d.ts","sourceRoot":"","sources":["../../src/commands/mem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAaH,OAAO,KAAK,EACV,SAAS,EAKV,MAAM,8BAA8B,CAAC;AAItC,MAAM,WAAW,IAAI;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;CACzC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAqBvD;AASD;uDACuD;AACvD,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,SAAS,CAyB3D;AA8CD,wBAAgB,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED,wBAAgB,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAG5C;AAqVD,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAwBpD"}
|