@agentex/agent 0.0.10 → 0.0.11

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/index.d.ts CHANGED
@@ -17,8 +17,12 @@ export type { TempConfigResult, TempConfigOptions } from "./utils/runtime-config
17
17
  export { executeAll } from "./utils/execute-all.js";
18
18
  export type { ExecuteAllOptions, ExecuteAllTask } from "./utils/execute-all.js";
19
19
  export { getClaudeUnknownDetails, classifyClaudeAuthFromResult, CLAUDE_LOGIN_COMMAND, } from "./providers/claude/parse.js";
20
+ export { getClaudeTranscriptPath, findClaudeTranscriptBySessionId, readClaudeTranscript, peekClaudeTranscript, claudeTranscriptOps, sanitizeProjectPath, resolveClaudeHome, canonicalizeCwd, MAX_SANITIZED_LENGTH, } from "./providers/claude/transcript.js";
21
+ export type { GetClaudeTranscriptPathOptions, ClaudeTranscriptLocation, FindClaudeTranscriptOptions, FoundClaudeTranscript, ReadClaudeTranscriptOptions, ClaudeTranscriptYield, ClaudePeekResult, } from "./providers/claude/transcript.js";
22
+ export { getCodexTranscriptPath, readCodexTranscript, peekCodexTranscript, readCodexCwd, codexTranscriptOps, parseCodexLine, resolveCodexHome, } from "./providers/codex/transcript.js";
23
+ export type { GetCodexTranscriptPathOptions, CodexTranscriptLocation, ReadCodexTranscriptOptions, CodexTranscriptYield, CodexTranscriptLine, CodexPeekResult, } from "./providers/codex/transcript.js";
20
24
  export { installSkills, removeSkills, listInstalledSkills, resolveSkillsHome, resolveSkillsWorkspace, resolveNativeSkillsHome, resolveNativeSkillsWorkspace, ensureSkillSymlink, } from "./utils/skills.js";
21
- export type { ProviderModule, ProviderCapabilities, ExecutionContext, ExecutionResult, ExecutionStatus, ProviderConfig, McpServerConfig, StreamEvent, SessionCodec, SessionState, TokenUsage, ModelUsage, RateLimitInfo, BaseStreamEventFields, LifecycleEvent, QuotaStatus, QuotaContext, AuthMethod, AuthSource, AuthOption, AuthReport, AuthResolveContext, AuthIdentity, AuthRequiredReason, BinaryStatus, ProviderModel, SessionContext, AgentSession, TurnResult, UserInputRequest, UserInputResponse, ElicitationRequest, ElicitationResponse, HookCallbackRequest, HookCallbackResponse, } from "./types.js";
25
+ export type { ProviderModule, ProviderCapabilities, ExecutionContext, ExecutionResult, ExecutionStatus, ProviderConfig, McpServerConfig, StreamEvent, SessionCodec, SessionState, TokenUsage, ModelUsage, RateLimitInfo, BaseStreamEventFields, LifecycleEvent, QuotaStatus, QuotaContext, AuthMethod, AuthSource, AuthOption, AuthReport, AuthResolveContext, AuthIdentity, AuthRequiredReason, BinaryStatus, ProviderModel, SessionContext, AgentSession, TurnResult, UserInputRequest, UserInputResponse, ElicitationRequest, ElicitationResponse, HookCallbackRequest, HookCallbackResponse, TranscriptOps, TranscriptYield, TranscriptPeek, FoundTranscript, } from "./types.js";
22
26
  export type { AskUserQuestion, QuestionOption, } from "./utils/ask-user-question.js";
23
27
  export type { ExitPlanModeRequest } from "./utils/exit-plan-mode.js";
24
28
  export type { SkillRuntime, SkillLocation, SkillChannel, InstallSkillsOptions, SkillInstallEntry, SkillInstallResult, RemoveSkillsOptions, SkillRemoveEntry, SkillRemoveResult, InstalledSkill, } from "./utils/skills.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oB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AAC;AAG3B,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACd,eAAe,EACf,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,eAAe,EACf,cAAc,GACf,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,YAAY,EACV,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -13,6 +13,8 @@ export { prepareWorkspace } from "./utils/workspace.js";
13
13
  export { withTempConfig } from "./utils/runtime-config.js";
14
14
  export { executeAll } from "./utils/execute-all.js";
15
15
  export { getClaudeUnknownDetails, classifyClaudeAuthFromResult, CLAUDE_LOGIN_COMMAND, } from "./providers/claude/parse.js";
16
+ export { getClaudeTranscriptPath, findClaudeTranscriptBySessionId, readClaudeTranscript, peekClaudeTranscript, claudeTranscriptOps, sanitizeProjectPath, resolveClaudeHome, canonicalizeCwd, MAX_SANITIZED_LENGTH, } from "./providers/claude/transcript.js";
17
+ export { getCodexTranscriptPath, readCodexTranscript, peekCodexTranscript, readCodexCwd, codexTranscriptOps, parseCodexLine, resolveCodexHome, } from "./providers/codex/transcript.js";
16
18
  // Skills
17
19
  export { installSkills, removeSkills, listInstalledSkills, resolveSkillsHome, resolveSkillsWorkspace, resolveNativeSkillsHome, resolveNativeSkillsWorkspace, ensureSkillSymlink, } from "./utils/skills.js";
18
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY;AACZ,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1F,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,cAAc,EACd,eAAe,EACf,SAAS,EACT,UAAU,EACV,UAAU,EACV,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AAErC,SAAS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B,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,kCAAkC,CAAC;AAU1C,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,gBAAgB,GACjB,MAAM,iCAAiC,CAAC;AAUzC,SAAS;AACT,OAAO,EACL,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,mBAAmB,CAAC"}
@@ -1,3 +1,5 @@
1
1
  import type { ProviderModule } from "../../types.js";
2
2
  export declare const claudeProvider: ProviderModule;
3
+ export { getClaudeTranscriptPath, findClaudeTranscriptBySessionId, readClaudeTranscript, peekClaudeTranscript, claudeTranscriptOps, sanitizeProjectPath, resolveClaudeHome, canonicalizeCwd, MAX_SANITIZED_LENGTH, } from "./transcript.js";
4
+ export type { GetClaudeTranscriptPathOptions, ClaudeTranscriptLocation, FindClaudeTranscriptOptions, FoundClaudeTranscript, ReadClaudeTranscriptOptions, ClaudeTranscriptYield, ClaudePeekResult, } from "./transcript.js";
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/claude/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAA2D,MAAM,gBAAgB,CAAC;AAkB9G,eAAO,MAAM,cAAc,EAAE,cAiB5B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/claude/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAA2D,MAAM,gBAAgB,CAAC;AAmB9G,eAAO,MAAM,cAAc,EAAE,cAkB5B,CAAC;AAEF,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,8BAA8B,EAC9B,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC"}
@@ -3,6 +3,7 @@ import { executeClaudeProvider } from "./execute.js";
3
3
  import { createClaudeSession } from "./session.js";
4
4
  import { claudeSessionCodec } from "./codec.js";
5
5
  import { buildEnv, ensurePathInEnv } from "../../utils/env.js";
6
+ import { claudeTranscriptOps } from "./transcript.js";
6
7
  async function checkQuota(ctx) {
7
8
  const env = buildEnv(ctx.env);
8
9
  ensurePathInEnv(env);
@@ -30,5 +31,7 @@ export const claudeProvider = {
30
31
  resolveAuth: (ctx) => resolveAuthForProvider("claude", ctx),
31
32
  sessionCodec: claudeSessionCodec,
32
33
  checkQuota,
34
+ transcript: claudeTranscriptOps,
33
35
  };
36
+ export { getClaudeTranscriptPath, findClaudeTranscriptBySessionId, readClaudeTranscript, peekClaudeTranscript, claudeTranscriptOps, sanitizeProjectPath, resolveClaudeHome, canonicalizeCwd, MAX_SANITIZED_LENGTH, } from "./transcript.js";
34
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/claude/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE/D,KAAK,UAAU,UAAU,CAAC,GAAiB;IACzC,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CA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,GACrB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,202 @@
1
+ /**
2
+ * Claude Code writes a durable JSONL transcript for every session under
3
+ * `<claudeHome>/projects/<sanitized-cwd>/<sessionId>.jsonl`. The on-disk lines
4
+ * use the same JSON shape Claude streams over stdout, so {@link parseStreamLine}
5
+ * handles them unchanged. These helpers cover the two parts the consuming
6
+ * host can't easily derive itself: where the file lives, and how to stream
7
+ * it back as `StreamEvent`s.
8
+ *
9
+ * Encoding rules are verified against Claude Code's open-source source
10
+ * (`sessionStoragePortable.ts:sanitizePath`):
11
+ * 1. Replace EVERY non-alphanumeric character with `-`
12
+ * (not just `/` and `.` — also `_`, space, `:`, etc.)
13
+ * 2. If the sanitized name exceeds {@link MAX_SANITIZED_LENGTH} (200),
14
+ * truncate and append a hash suffix
15
+ * 3. Canonicalize the cwd via `realpath` + NFC first so symlinks
16
+ * (e.g. macOS `/tmp` → `/private/tmp`) resolve to the same project dir
17
+ *
18
+ * The CLI does not expose a flag for the transcript path; the only source of
19
+ * truth is the open-source `sessionStoragePortable.ts`.
20
+ */
21
+ import type { StreamEvent, TranscriptOps } from "../../types.js";
22
+ /**
23
+ * Maximum length of a sanitized project-directory name before truncation +
24
+ * hash suffix kicks in. Mirrors Claude Code's `MAX_SANITIZED_LENGTH`. Most
25
+ * filesystems cap individual filename segments at 255 bytes; the gap leaves
26
+ * room for the hash suffix.
27
+ */
28
+ export declare const MAX_SANITIZED_LENGTH = 200;
29
+ /**
30
+ * Encode an absolute path into Claude's project-directory name. Mirrors
31
+ * `sanitizePath` in Claude Code's open-source `sessionStoragePortable.ts`.
32
+ *
33
+ * @example
34
+ * sanitizeProjectPath("/Users/foo/bar") // → "-Users-foo-bar"
35
+ * sanitizeProjectPath("/Users/foo/.config") // → "-Users-foo--config"
36
+ * sanitizeProjectPath("/Users/foo/my_app") // → "-Users-foo-my-app"
37
+ * // (underscore is non-alphanumeric)
38
+ */
39
+ export declare function sanitizeProjectPath(name: string): string;
40
+ /**
41
+ * Resolve Claude's config home directory. Mirrors `getClaudeConfigHomeDir` in
42
+ * Claude Code, including the NFC normalization needed to keep paths consistent
43
+ * with macOS HFS+/APFS Unicode handling.
44
+ */
45
+ export declare function resolveClaudeHome(override?: string): string;
46
+ /**
47
+ * Canonicalize a cwd path to match what Claude Code stores. `realpath`
48
+ * resolves symlinks (`/tmp` → `/private/tmp` on macOS) and NFC unifies the
49
+ * two Unicode normalizations macOS accepts for filenames with accents.
50
+ *
51
+ * Returns the NFC-normalized input on `realpath` failure (e.g., directory
52
+ * was deleted after the session ran), since the directory name on disk was
53
+ * computed against whatever the cwd was at session start.
54
+ */
55
+ export declare function canonicalizeCwd(cwd: string): Promise<string>;
56
+ export interface GetClaudeTranscriptPathOptions {
57
+ /** Claude's session id (UUID). Same value as the `session_id` field on stream events. */
58
+ sessionId: string;
59
+ /**
60
+ * The working directory Claude was launched in. Canonicalized via `realpath`
61
+ * + NFC before encoding, matching Claude's own behavior.
62
+ */
63
+ cwd: string;
64
+ /**
65
+ * Override the Claude config home. Defaults to `$CLAUDE_CONFIG_DIR` or
66
+ * `~/.claude`. Useful in tests and for hosts pointing Claude at a
67
+ * non-standard home.
68
+ */
69
+ claudeHome?: string;
70
+ }
71
+ export interface ClaudeTranscriptLocation {
72
+ /** Absolute path to the JSONL file. May not exist on disk yet. */
73
+ filePath: string;
74
+ /** The project-directory name (sanitized cwd) under `<claudeHome>/projects/`. */
75
+ projectDir: string;
76
+ /** The canonicalized cwd that was used to compute {@link projectDir}. */
77
+ canonicalCwd: string;
78
+ /** The Claude config home that was used. */
79
+ claudeHome: string;
80
+ }
81
+ /**
82
+ * Compute the on-disk JSONL path for a Claude session. Performs `realpath`
83
+ * canonicalization on the cwd and applies the same encoding rules Claude
84
+ * Code uses internally.
85
+ *
86
+ * For cwd paths sanitized longer than {@link MAX_SANITIZED_LENGTH}, the
87
+ * deterministic djb2 hash suffix may not match what Claude wrote (Claude Code
88
+ * uses `Bun.hash` under Bun). If the exact path doesn't exist and the
89
+ * sanitized name was truncated, this function falls back to a prefix scan
90
+ * under `<claudeHome>/projects/` and returns the first matching directory.
91
+ */
92
+ export declare function getClaudeTranscriptPath(opts: GetClaudeTranscriptPathOptions): Promise<ClaudeTranscriptLocation>;
93
+ export interface FindClaudeTranscriptOptions {
94
+ /** Claude's session id (UUID). */
95
+ sessionId: string;
96
+ /** Override the Claude config home. */
97
+ claudeHome?: string;
98
+ }
99
+ export interface FoundClaudeTranscript {
100
+ /** Absolute path to the JSONL file. */
101
+ filePath: string;
102
+ /** The project-directory name (sanitized cwd) under `<claudeHome>/projects/`. */
103
+ projectDir: string;
104
+ /**
105
+ * The literal cwd Claude was launched with, recovered from the first
106
+ * `system.init` event in the transcript. `null` if the file has no init
107
+ * event (e.g., truncated transcript) or it never recorded a cwd.
108
+ *
109
+ * This is the only way to recover the original cwd — `projectDir` is the
110
+ * sanitized form, which is one-way (multiple cwds can collide on the same
111
+ * sanitized name, though it's rare).
112
+ */
113
+ cwd: string | null;
114
+ }
115
+ /**
116
+ * Scan `<claudeHome>/projects/*` looking for `<sessionId>.jsonl`. Use this
117
+ * when you have a session ID but don't know which cwd Claude was launched
118
+ * in — typical for resume-by-id flows.
119
+ *
120
+ * Session IDs are unique across project directories, so the first match is
121
+ * authoritative. The original cwd is recovered from the transcript's first
122
+ * `system.init` event (Claude writes one at session start carrying `cwd`).
123
+ *
124
+ * Returns `null` if no project directory contains the session file.
125
+ */
126
+ export declare function findClaudeTranscriptBySessionId(opts: FindClaudeTranscriptOptions): Promise<FoundClaudeTranscript | null>;
127
+ export interface ReadClaudeTranscriptOptions {
128
+ /** Absolute path to the JSONL file. */
129
+ filePath: string;
130
+ /**
131
+ * Byte offset to resume from. Must be line-aligned (the position immediately
132
+ * after a `\n`). Use an offset previously yielded by this function.
133
+ * Defaults to 0 (read from the start).
134
+ */
135
+ fromOffset?: number;
136
+ /**
137
+ * Defensive dedup: if set, skip events whose {@link StreamEvent.eventId}
138
+ * matches and any events from the same line. Useful when `fromOffset` is
139
+ * missing or stale; the consumer's unique-index on `eventId` makes
140
+ * duplicates safe anyway, but this saves a round trip.
141
+ *
142
+ * Behavior: drop events up to and including the first one whose eventId
143
+ * matches; resume yielding from the next line.
144
+ */
145
+ sinceEventId?: string;
146
+ }
147
+ export interface ClaudeTranscriptYield {
148
+ /** A parsed `StreamEvent` from the transcript. */
149
+ event: StreamEvent;
150
+ /**
151
+ * Byte offset immediately AFTER the trailing `\n` of the line this event
152
+ * came from. Pass this back as {@link ReadClaudeTranscriptOptions.fromOffset}
153
+ * to resume on the next line. Events sharing a line share an offset.
154
+ */
155
+ offset: number;
156
+ }
157
+ /**
158
+ * Stream-read a Claude transcript JSONL, yielding parsed `StreamEvent`s.
159
+ *
160
+ * Behavior:
161
+ * - Returns an empty async iterable if the file doesn't exist (no throw).
162
+ * - Skips wrapper types in {@link SKIP_ON_DISK_TYPES} (currently `queue-operation`).
163
+ * - Skips lines that fail to parse as JSON (`parseStreamLine` returns []).
164
+ * - Seeks into the file with `createReadStream` so multi-megabyte transcripts
165
+ * don't load fully into memory.
166
+ *
167
+ * The yielded `offset` lets the caller checkpoint after each event and
168
+ * resume from that offset on the next call.
169
+ */
170
+ export declare function readClaudeTranscript(opts: ReadClaudeTranscriptOptions): AsyncIterable<ClaudeTranscriptYield>;
171
+ export interface ClaudePeekResult {
172
+ /** Last successfully parsed event, or null if the file is empty/missing/unparseable. */
173
+ lastEvent: StreamEvent | null;
174
+ /** Total size of the file in bytes, or null if the file is missing. */
175
+ size: number | null;
176
+ }
177
+ /**
178
+ * Drift-check primitive. Reads up to {@link PEEK_TAIL_BYTES} from the end of
179
+ * the file, parses the last complete line, and returns the last event plus
180
+ * total file size.
181
+ *
182
+ * Does NOT stream the whole file — designed to be called frequently as a
183
+ * cheap "has this changed since I last checked?" probe. Walks back through
184
+ * the buffer if the last line is a skipped wrapper type or fails to parse.
185
+ *
186
+ * Returns `{ lastEvent: null, size }` if the tail buffer holds no parseable
187
+ * line — caller should fall back to a full read if it needs guaranteed data.
188
+ */
189
+ export declare function peekClaudeTranscript(filePath: string): Promise<ClaudePeekResult>;
190
+ /**
191
+ * Polymorphic transcript ops for Claude. Delegates to the named functions
192
+ * above; mounted as `claudeProvider.transcript` so apps doing runtime-
193
+ * dispatched recovery can call `getProvider(name).transcript.find(...)`
194
+ * without a switch statement.
195
+ *
196
+ * Apps that know they're on Claude at compile time should prefer the named
197
+ * helpers (`getClaudeTranscriptPath`, `findClaudeTranscriptBySessionId`) —
198
+ * they return richer types (`canonicalCwd`, `projectDir`, `claudeHome`) that
199
+ * the polymorphic interface flattens away.
200
+ */
201
+ export declare const claudeTranscriptOps: TranscriptOps<StreamEvent>;
202
+ //# sourceMappingURL=transcript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../../../src/providers/claude/transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AASH,OAAO,KAAK,EAAmB,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGlF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC;AA4BxC;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIxD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAM3D;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMlE;AAMD,MAAM,WAAW,8BAA8B;IAC7C,yFAAyF;IACzF,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB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