osborn 0.1.6 → 0.5.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/.env.example +8 -1
- package/dist/bridge-llm.d.ts +22 -0
- package/dist/bridge-llm.js +39 -0
- package/dist/claude-handler.d.ts +6 -0
- package/dist/claude-handler.js +43 -1
- package/dist/claude-llm.d.ts +128 -0
- package/dist/claude-llm.js +623 -0
- package/dist/codex-llm.d.ts +40 -0
- package/dist/codex-llm.js +144 -0
- package/dist/config.d.ts +227 -1
- package/dist/config.js +775 -8
- package/dist/conversation-brain.d.ts +92 -0
- package/dist/conversation-brain.js +360 -0
- package/dist/fast-brain.d.ts +122 -0
- package/dist/fast-brain.js +1404 -0
- package/dist/index.js +1997 -322
- package/dist/prompts.d.ts +19 -0
- package/dist/prompts.js +610 -0
- package/dist/session-access.d.ts +399 -0
- package/dist/session-access.js +775 -0
- package/dist/smithery-proxy.d.ts +57 -0
- package/dist/smithery-proxy.js +195 -0
- package/dist/status-manager.d.ts +90 -0
- package/dist/status-manager.js +187 -0
- package/dist/voice-io.d.ts +70 -0
- package/dist/voice-io.js +152 -0
- package/package.json +17 -6
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session-access.ts — Programmatic access to Claude Agent SDK session artifacts
|
|
3
|
+
*
|
|
4
|
+
* Given a session ID and project directory, resolves all related files:
|
|
5
|
+
* conversations, sub-agents, tool results, plans, todos, tasks, file history.
|
|
6
|
+
*
|
|
7
|
+
* The JSONL files contain FULL, untruncated content — no caps on tool results,
|
|
8
|
+
* file reads, or assistant reasoning.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
12
|
+
* CLAUDE SESSION STORAGE — DIRECTORY MAP & RELATIONSHIP RULES
|
|
13
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
14
|
+
*
|
|
15
|
+
* All session data lives under a single root directory:
|
|
16
|
+
* claudeDir = CLAUDE_CONFIG_DIR env var || ~/.claude
|
|
17
|
+
*
|
|
18
|
+
* The "project slug" is the project's absolute path with "/" replaced by "-":
|
|
19
|
+
* /Users/foo/my-project → -Users-foo-my-project
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
* ── DIRECTORY STRUCTURE ─────────────────────────────────────────────────────
|
|
23
|
+
*
|
|
24
|
+
* {claudeDir}/
|
|
25
|
+
* ├── settings.json Global settings (MCP servers, etc.)
|
|
26
|
+
* ├── history.jsonl Top-level conversation index
|
|
27
|
+
* │
|
|
28
|
+
* ├── projects/{projectSlug}/ ALL SESSION DATA lives here
|
|
29
|
+
* │ ├── {sessionId}.jsonl Main conversation (1 file per session)
|
|
30
|
+
* │ ├── {sessionId}/
|
|
31
|
+
* │ │ ├── subagents/
|
|
32
|
+
* │ │ │ └── agent-{hash}.jsonl Sub-agent conversations (one per Task tool call)
|
|
33
|
+
* │ │ └── tool-results/
|
|
34
|
+
* │ │ └── {hash}.txt Large tool outputs (exceeding inline threshold)
|
|
35
|
+
* │ ├── .session-meta.json Maps sessionId → {agentMode, lastUpdated, projectPath}
|
|
36
|
+
* │ └── memory/MEMORY.md Persistent project memory
|
|
37
|
+
* │
|
|
38
|
+
* ├── plans/ GLOBAL — not per-session
|
|
39
|
+
* │ └── {slug}.md Plan files (linked to sessions via slug field)
|
|
40
|
+
* │
|
|
41
|
+
* ├── todos/
|
|
42
|
+
* │ └── {sessionId}-agent-{sessionId}.json Todo items per session
|
|
43
|
+
* │
|
|
44
|
+
* ├── tasks/{sessionId}/ Only exists if TaskCreate was used
|
|
45
|
+
* │ ├── .lock
|
|
46
|
+
* │ └── .highwatermark Task ID counter
|
|
47
|
+
* │
|
|
48
|
+
* ├── file-history/{sessionId}/ Versioned backups of edited files
|
|
49
|
+
* │ └── {hash}@v{N} e.g., 65c16cbbfa80f250@v3
|
|
50
|
+
* │
|
|
51
|
+
* ├── debug/ Debug logs
|
|
52
|
+
* ├── shell-snapshots/ Terminal snapshots
|
|
53
|
+
* ├── paste-cache/ Paste history
|
|
54
|
+
* └── statsig/ Analytics
|
|
55
|
+
*
|
|
56
|
+
*
|
|
57
|
+
* ── GIVEN A SESSION ID, HOW TO FIND EVERYTHING ─────────────────────────────
|
|
58
|
+
*
|
|
59
|
+
* You need TWO inputs: sessionId + projectDir (the working directory).
|
|
60
|
+
* From those, everything is deterministic:
|
|
61
|
+
*
|
|
62
|
+
* projectSlug = projectDir.replace(/\//g, '-')
|
|
63
|
+
* base = {claudeDir}/projects/{projectSlug}
|
|
64
|
+
*
|
|
65
|
+
* RELIABLE (deterministic paths):
|
|
66
|
+
* ┌──────────────────┬────────────────────────────────────────────────────────┐
|
|
67
|
+
* │ Artifact │ Path │
|
|
68
|
+
* ├──────────────────┼────────────────────────────────────────────────────────┤
|
|
69
|
+
* │ Conversation │ {base}/{sessionId}.jsonl (always) │
|
|
70
|
+
* │ Sub-agents │ {base}/{sessionId}/subagents/agent-*.jsonl (glob) │
|
|
71
|
+
* │ Tool result cache│ {base}/{sessionId}/tool-results/*.txt (glob) │
|
|
72
|
+
* │ Todos │ {claudeDir}/todos/{sessionId}-agent-{sessionId}.json │
|
|
73
|
+
* │ Tasks │ {claudeDir}/tasks/{sessionId}/ (may not exist) │
|
|
74
|
+
* │ File history │ {claudeDir}/file-history/{sessionId}/ (may not exist) │
|
|
75
|
+
* └──────────────────┴────────────────────────────────────────────────────────┘
|
|
76
|
+
*
|
|
77
|
+
* UNRELIABLE (requires JSONL parsing):
|
|
78
|
+
* ┌──────────────────┬────────────────────────────────────────────────────────┐
|
|
79
|
+
* │ Plan file │ Read JSONL → extract `slug` field → │
|
|
80
|
+
* │ │ {claudeDir}/plans/{slug}.md │
|
|
81
|
+
* │ │ ⚠ Slug is NOT unique per session (10+ sessions can │
|
|
82
|
+
* │ │ share the same slug). Slug is sometimes null. │
|
|
83
|
+
* │ │ Fallback: search JSONL for Write tool calls targeting │
|
|
84
|
+
* │ │ ~/.claude/plans/*.md to find the actual plan file. │
|
|
85
|
+
* ├──────────────────┼────────────────────────────────────────────────────────┤
|
|
86
|
+
* │ Session metadata │ {base}/.session-meta.json │
|
|
87
|
+
* │ │ ⚠ May be in a DIFFERENT project slug if the agent's │
|
|
88
|
+
* │ │ cwd differs from the project root (e.g., running │
|
|
89
|
+
* │ │ from /project/agent/ puts metadata in │
|
|
90
|
+
* │ │ -project-agent/ not -project/). │
|
|
91
|
+
* └──────────────────┴────────────────────────────────────────────────────────┘
|
|
92
|
+
*
|
|
93
|
+
*
|
|
94
|
+
* ── JSONL LINE SHAPES (each line is one JSON object) ───────────────────────
|
|
95
|
+
*
|
|
96
|
+
* type: "file-history-snapshot" (usually line 1)
|
|
97
|
+
* { type, messageId, snapshot: { trackedFileBackups: { [path]: { backupFileName, version } }, timestamp } }
|
|
98
|
+
*
|
|
99
|
+
* type: "user" (user message)
|
|
100
|
+
* { type: "user", sessionId, slug, cwd, version, gitBranch, uuid, parentUuid, timestamp,
|
|
101
|
+
* message: { role: "user", content: [{ type: "text", text: "..." }] } }
|
|
102
|
+
*
|
|
103
|
+
* type: "user" (tool_result — SDK wraps results in a user message)
|
|
104
|
+
* { type: "user", uuid, parentUuid, timestamp,
|
|
105
|
+
* message: { role: "user", content: [{ type: "tool_result", tool_use_id, content: "FULL output" }] },
|
|
106
|
+
* toolUseResult: { type: "text", file?: { filePath, content: "FULL FILE CONTENT" } } }
|
|
107
|
+
*
|
|
108
|
+
* type: "assistant" (with thinking + tool_use)
|
|
109
|
+
* { type: "assistant", sessionId, uuid, parentUuid, timestamp, requestId,
|
|
110
|
+
* message: { model, id, role: "assistant",
|
|
111
|
+
* content: [
|
|
112
|
+
* { type: "thinking", thinking: "full reasoning..." },
|
|
113
|
+
* { type: "text", text: "visible response" },
|
|
114
|
+
* { type: "tool_use", id, name, input: {...} }
|
|
115
|
+
* ],
|
|
116
|
+
* usage: { input_tokens, cache_creation_input_tokens, cache_read_input_tokens, output_tokens }
|
|
117
|
+
* } }
|
|
118
|
+
*
|
|
119
|
+
* type: "progress" (hook events)
|
|
120
|
+
* { type: "progress", parentUuid, parentToolUseID, toolUseID, timestamp,
|
|
121
|
+
* data: { type: "hook_progress", hookEvent, hookName, command } }
|
|
122
|
+
*
|
|
123
|
+
*
|
|
124
|
+
* ── HOW ARTIFACTS RELATE TO EACH OTHER ─────────────────────────────────────
|
|
125
|
+
*
|
|
126
|
+
* Messages link via parentUuid chain (forms a linked list of the conversation).
|
|
127
|
+
*
|
|
128
|
+
* Sub-agents: Parent session sees Task tool_use + tool_result.
|
|
129
|
+
* The sub-agent's FULL work is in its own JSONL file under subagents/.
|
|
130
|
+
* The "queue-operation" events in the main JSONL map task_id to sub-agent filenames.
|
|
131
|
+
*
|
|
132
|
+
* Tool result cache: When a tool result exceeds the inline threshold, the SDK
|
|
133
|
+
* stores the full output in {sessionId}/tool-results/{hash}.txt and references
|
|
134
|
+
* it from the JSONL. The JSONL tool_result content may be truncated while the
|
|
135
|
+
* .txt file has the full content.
|
|
136
|
+
*
|
|
137
|
+
* Plans: Stored GLOBALLY in {claudeDir}/plans/{slug}.md — NOT per-session.
|
|
138
|
+
* The "slug" field in JSONL events is the link. Multiple sessions can share
|
|
139
|
+
* the same slug. A session's plan is found by: read JSONL → find slug → open
|
|
140
|
+
* plans/{slug}.md. If slug is null, search for Write calls to plans/*.md.
|
|
141
|
+
*
|
|
142
|
+
* Todos: One file per session-agent pair. May be empty [].
|
|
143
|
+
* Path is deterministic from sessionId alone.
|
|
144
|
+
*
|
|
145
|
+
* File history: Versioned backups of files the agent edited during the session.
|
|
146
|
+
* Only exists if Write/Edit tools were used.
|
|
147
|
+
*
|
|
148
|
+
* Session metadata (.session-meta.json): A SINGLE file per project slug that
|
|
149
|
+
* maps ALL session IDs → { agentMode, editMode, lastUpdated, projectPath }.
|
|
150
|
+
* Careful: the cwd when the agent ran determines which project slug folder
|
|
151
|
+
* the metadata ends up in.
|
|
152
|
+
*
|
|
153
|
+
*
|
|
154
|
+
* ── KEY FACTS FOR BUILDING NEW FUNCTIONS ───────────────────────────────────
|
|
155
|
+
*
|
|
156
|
+
* 1. JSONL content is FULL and UNTRUNCATED — complete file reads, bash outputs,
|
|
157
|
+
* web search results, thinking blocks, assistant reasoning. No caps.
|
|
158
|
+
*
|
|
159
|
+
* 2. The SDK and CLI share the SAME storage. Sessions created by the SDK can
|
|
160
|
+
* be resumed via CLI and vice versa.
|
|
161
|
+
*
|
|
162
|
+
* 3. Storage location is controlled ONLY by CLAUDE_CONFIG_DIR env var + the
|
|
163
|
+
* project path slug derived from cwd. There is no sessionDir or outputPath
|
|
164
|
+
* option in the SDK.
|
|
165
|
+
*
|
|
166
|
+
* 4. JSONL files are written INCREMENTALLY by the SDK — new lines are appended.
|
|
167
|
+
* This enables the watchSessionFile() pattern for real-time tailing.
|
|
168
|
+
*
|
|
169
|
+
* 5. All functions accept SessionAccessOptions with optional claudeDir to
|
|
170
|
+
* override the default path resolution.
|
|
171
|
+
*
|
|
172
|
+
* 6. The projectSlug encoding is simple: replace all "/" with "-".
|
|
173
|
+
* /Users/newupgrade/Desktop/Developer/osborn → -Users-newupgrade-Desktop-Developer-osborn
|
|
174
|
+
*
|
|
175
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
176
|
+
*/
|
|
177
|
+
import { watch } from 'fs';
|
|
178
|
+
export interface SessionPaths {
|
|
179
|
+
/** Main conversation JSONL file */
|
|
180
|
+
conversation: string;
|
|
181
|
+
/** Directory containing subagents/ and tool-results/ */
|
|
182
|
+
sessionDir: string;
|
|
183
|
+
/** Sub-agent JSONL files (may be empty) */
|
|
184
|
+
subagents: string[];
|
|
185
|
+
/** Large tool result cache files (may be empty) */
|
|
186
|
+
toolResults: string[];
|
|
187
|
+
/** Todos JSON file */
|
|
188
|
+
todos: string;
|
|
189
|
+
/** Tasks directory (may not exist) */
|
|
190
|
+
tasks: string;
|
|
191
|
+
/** File history directory (may not exist) */
|
|
192
|
+
fileHistory: string;
|
|
193
|
+
/** Debug log file (may not exist) */
|
|
194
|
+
debugLog: string;
|
|
195
|
+
/** Whether the main conversation file exists */
|
|
196
|
+
exists: boolean;
|
|
197
|
+
}
|
|
198
|
+
export interface SessionMessage {
|
|
199
|
+
type: 'user' | 'assistant' | 'tool_use' | 'tool_result' | 'progress' | 'file-history-snapshot' | 'other';
|
|
200
|
+
timestamp?: string;
|
|
201
|
+
uuid?: string;
|
|
202
|
+
parentUuid?: string | null;
|
|
203
|
+
sessionId?: string;
|
|
204
|
+
slug?: string;
|
|
205
|
+
role?: string;
|
|
206
|
+
text?: string;
|
|
207
|
+
toolName?: string;
|
|
208
|
+
toolId?: string;
|
|
209
|
+
toolInput?: Record<string, any>;
|
|
210
|
+
toolUseId?: string;
|
|
211
|
+
toolResultContent?: string;
|
|
212
|
+
toolUseResult?: any;
|
|
213
|
+
raw: any;
|
|
214
|
+
}
|
|
215
|
+
export interface SubagentInfo {
|
|
216
|
+
taskId: string;
|
|
217
|
+
filePath: string;
|
|
218
|
+
fileSize: number;
|
|
219
|
+
messages: SessionMessage[];
|
|
220
|
+
}
|
|
221
|
+
export interface SessionPlanInfo {
|
|
222
|
+
slug: string;
|
|
223
|
+
planPath: string;
|
|
224
|
+
content: string;
|
|
225
|
+
exists: boolean;
|
|
226
|
+
}
|
|
227
|
+
export interface ToolResultEntry {
|
|
228
|
+
toolName: string;
|
|
229
|
+
toolId: string;
|
|
230
|
+
toolInput: Record<string, any>;
|
|
231
|
+
resultContent: string;
|
|
232
|
+
toolUseResult?: any;
|
|
233
|
+
timestamp?: string;
|
|
234
|
+
}
|
|
235
|
+
/** Options passed to most functions — allows custom claude dir */
|
|
236
|
+
export interface SessionAccessOptions {
|
|
237
|
+
/** Override the claude directory (default: CLAUDE_CONFIG_DIR env or ~/.claude) */
|
|
238
|
+
claudeDir?: string;
|
|
239
|
+
}
|
|
240
|
+
/** Main agent transcript + all sub-agent transcripts in one object */
|
|
241
|
+
export interface SessionTranscripts {
|
|
242
|
+
/** The main session conversation (the agent itself) */
|
|
243
|
+
agent: {
|
|
244
|
+
sessionId: string;
|
|
245
|
+
filePath: string;
|
|
246
|
+
fileSize: number;
|
|
247
|
+
messages: SessionMessage[];
|
|
248
|
+
rawLines: any[];
|
|
249
|
+
};
|
|
250
|
+
/** All sub-agent conversations spawned via Task tool */
|
|
251
|
+
subagents: SubagentInfo[];
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Resolve all artifact paths for a session.
|
|
255
|
+
* Does NOT read any files — just computes paths and checks existence.
|
|
256
|
+
*
|
|
257
|
+
* @param sessionId - The session UUID
|
|
258
|
+
* @param projectDir - The project working directory (e.g., /Users/.../osborn)
|
|
259
|
+
* @param opts.claudeDir - Override the claude directory path
|
|
260
|
+
*/
|
|
261
|
+
export declare function getSessionPaths(sessionId: string, projectDir: string, opts?: SessionAccessOptions): SessionPaths;
|
|
262
|
+
/**
|
|
263
|
+
* Read raw JSON objects from a JSONL file — no parsing into SessionMessage.
|
|
264
|
+
* Returns the actual JSON as-is so you can inspect the full object shapes.
|
|
265
|
+
*/
|
|
266
|
+
export declare function readRawJsonl(filePath: string): any[];
|
|
267
|
+
/**
|
|
268
|
+
* Read the full conversation history from a session.
|
|
269
|
+
* Returns structured messages in chronological order.
|
|
270
|
+
*
|
|
271
|
+
* @param sessionId - The session UUID
|
|
272
|
+
* @param projectDir - The project working directory (e.g., /Users/.../osborn)
|
|
273
|
+
* @param opts.lastN - Only return the last N messages (default: all)
|
|
274
|
+
* @param opts.types - Filter by message type (default: all types)
|
|
275
|
+
* @param opts.claudeDir - Override the claude directory path
|
|
276
|
+
*/
|
|
277
|
+
export declare function readSessionHistory(sessionId: string, projectDir: string, opts?: {
|
|
278
|
+
lastN?: number;
|
|
279
|
+
types?: SessionMessage['type'][];
|
|
280
|
+
claudeDir?: string;
|
|
281
|
+
}): SessionMessage[];
|
|
282
|
+
/**
|
|
283
|
+
* Get sub-agent transcripts for a session.
|
|
284
|
+
* Each sub-agent has its own JSONL file with a full conversation.
|
|
285
|
+
*/
|
|
286
|
+
export declare function getSubagentTranscripts(sessionId: string, projectDir: string, opts?: SessionAccessOptions): SubagentInfo[];
|
|
287
|
+
/**
|
|
288
|
+
* Get the raw JSON objects from the main session JSONL file.
|
|
289
|
+
* Returns the actual JSON as written by the SDK — no transformation.
|
|
290
|
+
* Use this when you need the full object shapes for inspection.
|
|
291
|
+
*
|
|
292
|
+
* @param lastN - Only return the last N lines (default: all)
|
|
293
|
+
*/
|
|
294
|
+
export declare function getRawSessionJsonl(sessionId: string, projectDir: string, opts?: SessionAccessOptions & {
|
|
295
|
+
lastN?: number;
|
|
296
|
+
}): any[];
|
|
297
|
+
/**
|
|
298
|
+
* Get the main agent transcript AND all sub-agent transcripts together.
|
|
299
|
+
* This is the primary function for accessing what Claude is doing —
|
|
300
|
+
* the agent's own conversation plus every sub-agent it spawned.
|
|
301
|
+
*
|
|
302
|
+
* The agent transcript contains: user messages, assistant reasoning,
|
|
303
|
+
* tool_use calls, tool_result responses, thinking blocks, progress events.
|
|
304
|
+
*
|
|
305
|
+
* Sub-agent transcripts contain the same structure but for each Task
|
|
306
|
+
* tool invocation (Explore agents, Plan agents, etc.).
|
|
307
|
+
*/
|
|
308
|
+
export declare function getSessionTranscripts(sessionId: string, projectDir: string, opts?: SessionAccessOptions): SessionTranscripts;
|
|
309
|
+
/**
|
|
310
|
+
* Find the plan file associated with a session.
|
|
311
|
+
* Plans are linked via the `slug` field in JSONL events.
|
|
312
|
+
*
|
|
313
|
+
* Falls back to searching for Write tool calls targeting ~/.claude/plans/
|
|
314
|
+
* if slug is not found.
|
|
315
|
+
*/
|
|
316
|
+
export declare function getSessionPlan(sessionId: string, projectDir: string, opts?: SessionAccessOptions): SessionPlanInfo | null;
|
|
317
|
+
/**
|
|
318
|
+
* Get recent tool use/result pairs from a session.
|
|
319
|
+
* Returns matched pairs of (tool_use → tool_result) in chronological order.
|
|
320
|
+
*
|
|
321
|
+
* @param lastN - Number of recent pairs to return (default: 10, 0 = all)
|
|
322
|
+
* @param opts.toolNameFilter - Optional: only return results from these tool names (e.g., ['Read', 'WebSearch'])
|
|
323
|
+
*/
|
|
324
|
+
export declare function getRecentToolResults(sessionId: string, projectDir: string, lastN?: number, opts?: SessionAccessOptions & {
|
|
325
|
+
toolNameFilter?: string[];
|
|
326
|
+
}): ToolResultEntry[];
|
|
327
|
+
/**
|
|
328
|
+
* Watch a session JSONL file for new entries.
|
|
329
|
+
* Calls back with each new parsed entry as it's appended.
|
|
330
|
+
*
|
|
331
|
+
* Returns the fs.FSWatcher (call .close() to stop watching).
|
|
332
|
+
*/
|
|
333
|
+
export declare function watchSessionFile(sessionId: string, projectDir: string, callback: (entry: SessionMessage) => void, opts?: SessionAccessOptions): ReturnType<typeof watch> | null;
|
|
334
|
+
/**
|
|
335
|
+
* Get the session slug (human-readable name) from a session.
|
|
336
|
+
*/
|
|
337
|
+
export declare function getSessionSlug(sessionId: string, projectDir: string, opts?: SessionAccessOptions): string | null;
|
|
338
|
+
/**
|
|
339
|
+
* Get todos for a session.
|
|
340
|
+
*/
|
|
341
|
+
export declare function getSessionTodos(sessionId: string, opts?: SessionAccessOptions): any[];
|
|
342
|
+
/**
|
|
343
|
+
* Get the text-only conversation (user messages + assistant text responses).
|
|
344
|
+
* Useful for building context for the fast brain.
|
|
345
|
+
*
|
|
346
|
+
* @param lastN - Number of exchanges to return
|
|
347
|
+
* @param maxCharsPerMessage - Max chars per message (0 = no limit)
|
|
348
|
+
*/
|
|
349
|
+
export declare function getConversationText(sessionId: string, projectDir: string, lastN?: number, maxCharsPerMessage?: number, opts?: SessionAccessOptions): {
|
|
350
|
+
role: string;
|
|
351
|
+
text: string;
|
|
352
|
+
}[];
|
|
353
|
+
/**
|
|
354
|
+
* Search the session JSONL for entries matching a keyword (case-insensitive).
|
|
355
|
+
* Searches across text, toolResultContent, toolName, and toolInput.
|
|
356
|
+
* Returns matching entries with 500-char excerpts around the match.
|
|
357
|
+
*
|
|
358
|
+
* @param keyword - The search keyword (case-insensitive)
|
|
359
|
+
* @param opts.maxResults - Maximum number of results to return (default: 20)
|
|
360
|
+
*/
|
|
361
|
+
export declare function searchSessionJsonl(sessionId: string, projectDir: string, keyword: string, opts?: SessionAccessOptions & {
|
|
362
|
+
maxResults?: number;
|
|
363
|
+
}): {
|
|
364
|
+
type: string;
|
|
365
|
+
text: string;
|
|
366
|
+
timestamp?: string;
|
|
367
|
+
}[];
|
|
368
|
+
/**
|
|
369
|
+
* Get session stats: message counts, tool usage breakdown, data sizes.
|
|
370
|
+
* Helps the fast brain decide how much data to read and which tools to query.
|
|
371
|
+
*/
|
|
372
|
+
export declare function getSessionStats(sessionId: string, projectDir: string, opts?: SessionAccessOptions): {
|
|
373
|
+
totalMessages: number;
|
|
374
|
+
userMessages: number;
|
|
375
|
+
assistantMessages: number;
|
|
376
|
+
toolUseCount: number;
|
|
377
|
+
toolResultCount: number;
|
|
378
|
+
toolBreakdown: Record<string, number>;
|
|
379
|
+
subagentCount: number;
|
|
380
|
+
fileSizeBytes: number;
|
|
381
|
+
firstTimestamp?: string;
|
|
382
|
+
lastTimestamp?: string;
|
|
383
|
+
} | null;
|
|
384
|
+
/**
|
|
385
|
+
* Get a quick summary of a session: slug, message count, timestamps, tools used.
|
|
386
|
+
*/
|
|
387
|
+
export declare function getSessionSummary(sessionId: string, projectDir: string, opts?: SessionAccessOptions): {
|
|
388
|
+
sessionId: string;
|
|
389
|
+
slug: string;
|
|
390
|
+
messageCount: number;
|
|
391
|
+
userMessages: number;
|
|
392
|
+
assistantMessages: number;
|
|
393
|
+
toolUseCount: number;
|
|
394
|
+
uniqueTools: string[];
|
|
395
|
+
subagentCount: number;
|
|
396
|
+
firstTimestamp: string;
|
|
397
|
+
lastTimestamp: string;
|
|
398
|
+
fileSize: number;
|
|
399
|
+
};
|