t3code-session-manager 0.0.0-stage → 0.4.0

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.
Files changed (172) hide show
  1. package/.claude-plugin/marketplace.json +21 -0
  2. package/.claude-plugin/plugin.json +19 -0
  3. package/CHANGELOG.md +138 -0
  4. package/LICENSE +21 -0
  5. package/README.md +660 -2
  6. package/README.pt.md +616 -0
  7. package/bin/entry.d.mts +2 -0
  8. package/bin/entry.mjs +19 -0
  9. package/bin/t3sm.mjs +44 -0
  10. package/commands/import.md +30 -0
  11. package/commands/organize.md +36 -0
  12. package/commands/status.md +24 -0
  13. package/commands/sync.md +26 -0
  14. package/dist/apply/apply.js +993 -0
  15. package/dist/apply/claudeWriter.js +168 -0
  16. package/dist/apply/copyTranscript.js +116 -0
  17. package/dist/apply/importer.js +697 -0
  18. package/dist/apply/materialize.js +335 -0
  19. package/dist/apply/waves.js +108 -0
  20. package/dist/assistant/core.js +295 -0
  21. package/dist/assistant/deps.js +256 -0
  22. package/dist/assistant/i18n.js +38 -0
  23. package/dist/assistant/messages.en.js +494 -0
  24. package/dist/assistant/messages.pt.js +495 -0
  25. package/dist/assistant/runner.js +64 -0
  26. package/dist/assistant/steps.js +1362 -0
  27. package/dist/build.json +1 -0
  28. package/dist/cli/applyScreen.js +158 -0
  29. package/dist/cli/commands/accounts.js +254 -0
  30. package/dist/cli/commands/apply.js +199 -0
  31. package/dist/cli/commands/changelog.js +61 -0
  32. package/dist/cli/commands/doctor.js +105 -0
  33. package/dist/cli/commands/help.js +158 -0
  34. package/dist/cli/commands/merge.js +224 -0
  35. package/dist/cli/commands/organize.js +872 -0
  36. package/dist/cli/commands/plan.js +161 -0
  37. package/dist/cli/commands/projects.js +430 -0
  38. package/dist/cli/commands/quarantine.js +203 -0
  39. package/dist/cli/commands/recover.js +230 -0
  40. package/dist/cli/commands/rollback.js +281 -0
  41. package/dist/cli/commands/scan.js +117 -0
  42. package/dist/cli/commands/schedule.js +288 -0
  43. package/dist/cli/commands/start.js +45 -0
  44. package/dist/cli/commands/status.js +615 -0
  45. package/dist/cli/commands/sync.js +336 -0
  46. package/dist/cli/commands/update.js +398 -0
  47. package/dist/cli/errors.js +53 -0
  48. package/dist/cli/failures.js +91 -0
  49. package/dist/cli/flags.js +53 -0
  50. package/dist/cli/help.en.js +549 -0
  51. package/dist/cli/help.pt.js +566 -0
  52. package/dist/cli/helpText.js +211 -0
  53. package/dist/cli/helpTopics.js +58 -0
  54. package/dist/cli/locked.js +12 -0
  55. package/dist/cli/main.js +155 -0
  56. package/dist/cli/screen.js +3 -0
  57. package/dist/cli/ui.js +111 -0
  58. package/dist/cli/words.js +2 -0
  59. package/dist/core/activity.js +16 -0
  60. package/dist/core/changelog.js +47 -0
  61. package/dist/core/config.js +530 -0
  62. package/dist/core/fsutil.js +171 -0
  63. package/dist/core/glob.js +34 -0
  64. package/dist/core/history.js +32 -0
  65. package/dist/core/journal.js +274 -0
  66. package/dist/core/lock.js +337 -0
  67. package/dist/core/mask.js +31 -0
  68. package/dist/core/paths.js +68 -0
  69. package/dist/core/pid.js +101 -0
  70. package/dist/core/run.js +4 -0
  71. package/dist/core/semver.js +18 -0
  72. package/dist/core/sysroot.js +29 -0
  73. package/dist/core/types.js +229 -0
  74. package/dist/core/uuid.js +29 -0
  75. package/dist/core/version.js +72 -0
  76. package/dist/help/convert.md +20 -0
  77. package/dist/help/convert.pt.md +21 -0
  78. package/dist/help/cwd-unreadable.md +22 -0
  79. package/dist/help/cwd-unreadable.pt.md +22 -0
  80. package/dist/help/decisions.md +20 -0
  81. package/dist/help/decisions.pt.md +20 -0
  82. package/dist/help/errors.md +20 -0
  83. package/dist/help/errors.pt.md +22 -0
  84. package/dist/help/held.md +20 -0
  85. package/dist/help/held.pt.md +20 -0
  86. package/dist/help/history.md +27 -0
  87. package/dist/help/history.pt.md +29 -0
  88. package/dist/help/instance-unavailable.md +18 -0
  89. package/dist/help/instance-unavailable.pt.md +19 -0
  90. package/dist/help/not-imported.md +19 -0
  91. package/dist/help/not-imported.pt.md +19 -0
  92. package/dist/help/orphaned.md +19 -0
  93. package/dist/help/orphaned.pt.md +19 -0
  94. package/dist/help/project-mismatch.md +15 -0
  95. package/dist/help/project-mismatch.pt.md +15 -0
  96. package/dist/help/t3-native.md +22 -0
  97. package/dist/help/t3-native.pt.md +22 -0
  98. package/dist/help/updates.md +26 -0
  99. package/dist/help/updates.pt.md +28 -0
  100. package/dist/help/watcher.md +24 -0
  101. package/dist/help/watcher.pt.md +25 -0
  102. package/dist/i18n/cli.js +41 -0
  103. package/dist/i18n/lang.js +55 -0
  104. package/dist/i18n/messages.en.js +1140 -0
  105. package/dist/i18n/messages.pt.js +1149 -0
  106. package/dist/i18n/words.js +12 -0
  107. package/dist/ops/accounts.js +170 -0
  108. package/dist/ops/autoUpdate.js +223 -0
  109. package/dist/ops/discoverAccounts.js +343 -0
  110. package/dist/ops/doctor.js +811 -0
  111. package/dist/ops/elevated.js +47 -0
  112. package/dist/ops/errorCodes.js +39 -0
  113. package/dist/ops/follow.js +558 -0
  114. package/dist/ops/merge.js +830 -0
  115. package/dist/ops/notify.js +249 -0
  116. package/dist/ops/plugin.js +92 -0
  117. package/dist/ops/projects.js +113 -0
  118. package/dist/ops/quarantine.js +415 -0
  119. package/dist/ops/rollback.js +868 -0
  120. package/dist/ops/schedule.js +464 -0
  121. package/dist/ops/successor.js +51 -0
  122. package/dist/ops/sync.js +859 -0
  123. package/dist/ops/syncStatus.js +290 -0
  124. package/dist/ops/update.js +273 -0
  125. package/dist/ops/updater.js +641 -0
  126. package/dist/ops/watch.js +676 -0
  127. package/dist/ops/watcherControl.js +212 -0
  128. package/dist/ops/watcherHealth.js +75 -0
  129. package/dist/organize/apply.js +495 -0
  130. package/dist/organize/history.js +192 -0
  131. package/dist/organize/plan.js +283 -0
  132. package/dist/organize/rename.js +58 -0
  133. package/dist/organize/sessions.js +100 -0
  134. package/dist/organize/titles.js +70 -0
  135. package/dist/organize/types.js +73 -0
  136. package/dist/plan/categories.js +104 -0
  137. package/dist/plan/dedupe.js +137 -0
  138. package/dist/plan/folders.js +82 -0
  139. package/dist/plan/names.js +93 -0
  140. package/dist/plan/ownership.js +316 -0
  141. package/dist/plan/planner.js +669 -0
  142. package/dist/plan/rehome.js +101 -0
  143. package/dist/plan/report.js +407 -0
  144. package/dist/sources/cache.js +89 -0
  145. package/dist/sources/claude.js +297 -0
  146. package/dist/sources/codex.js +496 -0
  147. package/dist/sources/flatten.js +23 -0
  148. package/dist/sources/jsonl.js +169 -0
  149. package/dist/sources/native.js +233 -0
  150. package/dist/sources/opencode.js +483 -0
  151. package/dist/sources/pi.js +133 -0
  152. package/dist/sources/registry.js +67 -0
  153. package/dist/sources/types.js +80 -0
  154. package/dist/t3/api.js +492 -0
  155. package/dist/t3/auth.js +248 -0
  156. package/dist/t3/compat.js +62 -0
  157. package/dist/t3/decode.js +408 -0
  158. package/dist/t3/errors.js +185 -0
  159. package/dist/t3/rpc.js +185 -0
  160. package/dist/t3/runtime.js +80 -0
  161. package/dist/ui/caps.js +56 -0
  162. package/dist/ui/components.js +202 -0
  163. package/dist/ui/layout.js +205 -0
  164. package/dist/ui/list.js +423 -0
  165. package/dist/ui/locale.js +73 -0
  166. package/dist/ui/organizePreview.js +72 -0
  167. package/dist/ui/progress.js +237 -0
  168. package/dist/ui/style.js +32 -0
  169. package/dist/ui/terminal.js +126 -0
  170. package/dist/ui/text.js +186 -0
  171. package/package.json +58 -4
  172. package/skills/t3code-sessions/SKILL.md +183 -0
@@ -0,0 +1,169 @@
1
+ import { createReadStream, } from "node:fs";
2
+ import { readdir, stat } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+
5
+ /** Options forwarded to createReadStream (tests shrink highWaterMark to force chunk boundaries). */
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+ /**
18
+ * Stream a JSONL file once without loading it whole. Lines are split on raw bytes (LF; a trailing
19
+ * CR is stripped before parsing). Unparseable and non-object lines are counted as corrupt.
20
+ */
21
+ export function scanJsonl(
22
+ path ,
23
+ readOpts ,
24
+ onRecord ,
25
+ ) {
26
+ return scanJsonlChunks(createReadStream(path, readOpts) , onRecord);
27
+ }
28
+
29
+ /** A line longer than the scan's `maxLineBytes`: the scan stops before buffering more of it. */
30
+ export class LineTooLongError extends Error {
31
+ name = "LineTooLongError";
32
+ }
33
+
34
+ /**
35
+ * scanJsonl over any byte stream (a decompressed one, for instance). `onRecord` returning "stop" ends the scan there
36
+ * (the source is released; totals cover what was read). `maxLineBytes`: a longer line throws LineTooLongError as soon
37
+ * as that much of it is buffered (one giant line never sits whole in memory).
38
+ */
39
+ export async function scanJsonlChunks(
40
+ chunks ,
41
+ onRecord ,
42
+ opts = {},
43
+ ) {
44
+ const maxLine = opts.maxLineBytes ?? Infinity;
45
+ const tooLong = (n ) => {
46
+ if (n > maxLine) throw new LineTooLongError(`a line longer than ${maxLine} bytes`);
47
+ };
48
+ const totals = { corruptLines: 0, totalBytes: 0 };
49
+ let offset = 0;
50
+ let recordIndex = 0;
51
+ let firstLine = true;
52
+ let stopped = false;
53
+
54
+ const handle = (line ) => {
55
+ let text = line.toString("utf8");
56
+ if (firstLine) {
57
+ firstLine = false;
58
+ if (text.charCodeAt(0) === 0xfeff) text = text.slice(1);
59
+ }
60
+ if (text.endsWith("\r")) text = text.slice(0, -1);
61
+ // T3 reserves one record per line split on LF, blank ones included (AgentSessionScanner.ts:947-957,
62
+ // 988-991), so blank lines count toward the 1000-record window.
63
+ recordIndex++;
64
+ if (text.trim() === "") return;
65
+ let rec ;
66
+ try {
67
+ rec = JSON.parse(text);
68
+ } catch {
69
+ totals.corruptLines++;
70
+ return;
71
+ }
72
+ if (rec === null || typeof rec !== "object" || Array.isArray(rec)) {
73
+ totals.corruptLines++;
74
+ return;
75
+ }
76
+ if (onRecord(rec , { offset, recordIndex }) === "stop") stopped = true;
77
+ };
78
+
79
+ let pending = [];
80
+ let pendingLen = 0;
81
+ for await (const chunk of chunks) {
82
+ let start = 0;
83
+ for (;;) {
84
+ const nl = chunk.indexOf(0x0a, start);
85
+ if (nl < 0) break;
86
+ const piece = chunk.subarray(start, nl);
87
+ tooLong(pendingLen + piece.length);
88
+ const line = pending.length ? Buffer.concat([...pending, piece], pendingLen + piece.length) : piece;
89
+ offset += line.length + 1;
90
+ handle(line);
91
+ pending = [];
92
+ pendingLen = 0;
93
+ start = nl + 1;
94
+ if (stopped) break;
95
+ }
96
+ if (stopped) {
97
+ totals.totalBytes = offset;
98
+ return totals; // leaving the loop releases (destroys) the source
99
+ }
100
+ if (start < chunk.length) {
101
+ const rest = chunk.subarray(start);
102
+ tooLong(pendingLen + rest.length);
103
+ pending.push(rest);
104
+ pendingLen += rest.length;
105
+ }
106
+ }
107
+ if (pendingLen > 0) {
108
+ const line = Buffer.concat(pending, pendingLen);
109
+ offset += line.length;
110
+ handle(line);
111
+ }
112
+ totals.totalBytes = offset;
113
+ return totals;
114
+ }
115
+
116
+ export async function listDir(dir ) {
117
+ try {
118
+ return await readdir(dir, { withFileTypes: true });
119
+ } catch {
120
+ return [];
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Entry type following symlinks, as T3 does (it stats every entry). A link that cannot be resolved
126
+ * is reported through `onError` and skipped.
127
+ */
128
+ export async function entryKind(
129
+ dir ,
130
+ d ,
131
+ onError ,
132
+ ) {
133
+ if (d.isDirectory()) return "dir";
134
+ if (d.isFile()) return "file";
135
+ if (!d.isSymbolicLink()) return null;
136
+ const full = join(dir, d.name);
137
+ try {
138
+ const s = await stat(full);
139
+ return s.isDirectory() ? "dir" : s.isFile() ? "file" : null;
140
+ } catch (e) {
141
+ onError(full, `broken symlink: ${(e ).code ?? String(e)}`);
142
+ return null;
143
+ }
144
+ }
145
+
146
+ export const isNum = (v ) => typeof v === "number" && Number.isFinite(v);
147
+ export const isStrOrNull = (v ) => v === null || typeof v === "string";
148
+
149
+ export function isoOrNull(v ) {
150
+ if (typeof v !== "string") return null;
151
+ const t = Date.parse(v);
152
+ return Number.isNaN(t) ? null : new Date(t).toISOString();
153
+ }
154
+
155
+ /** T3 `extractText`: string content trimmed, or the non-empty text of text/input_text/output_text blocks joined by newline. */
156
+ export function extractText(content ) {
157
+ if (typeof content === "string") return content.trim();
158
+ if (!Array.isArray(content)) return "";
159
+ return content
160
+ .filter((b) =>
161
+ b !== null && typeof b === "object" && ["text", "input_text", "output_text"].includes((b ).type ))
162
+ .map((b) => (typeof b.text === "string" ? b.text.trim() : ""))
163
+ .filter((t) => t.length > 0)
164
+ .join("\n");
165
+ }
166
+
167
+ export const str = (v ) => (typeof v === "string" ? v.trim() : "");
168
+ export const obj = (v ) =>
169
+ v !== null && typeof v === "object" && !Array.isArray(v) ? (v ) : null;
@@ -0,0 +1,233 @@
1
+ import { basename, join } from "node:path";
2
+
3
+ import { statSafe } from "../core/fsutil.js";
4
+ import { createDiscoveryCache, readCachedMtimes } from "./cache.js";
5
+ import { isNum, isStrOrNull, } from "./jsonl.js";
6
+ import { } from "./types.js";
7
+ import { isActive } from "../core/activity.js";
8
+
9
+ const MIB = 1024 * 1024;
10
+ const OVER_32MIB = 32 * MIB;
11
+ const OVER_4GIB = 4 * 1024 * MIB;
12
+ const CACHE_VERSION = 3;
13
+
14
+ /** What a scan of one Codex/Pi transcript yields; independent of `now`, so it is cacheable. */
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+ export function isValidScan(r ) {
34
+ if (r === null || typeof r !== "object") return false;
35
+ const o = r ;
36
+ return isStrOrNull(o.id) && isStrOrNull(o.cwd) && isStrOrNull(o.startedAt) && isStrOrNull(o.updatedAt) &&
37
+ isNum(o.messageCount) && isNum(o.visibleUserCount) && isNum(o.corruptLines) &&
38
+ isNum(o.cwdOffsetBytes) && typeof o.cwdReadable === "boolean" && typeof o.subagent === "boolean" &&
39
+ (o.tooLarge === undefined || typeof o.tooLarge === "boolean");
40
+ }
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ export function createNativeAdapter(spec , opts = {}) {
78
+ const adapter = {
79
+ id: spec.id,
80
+ mode: "native",
81
+ lastErrors: [],
82
+ async isAvailable(env ) {
83
+ return (await statSafe(spec.root(env))) !== null;
84
+ },
85
+ async watchRoots(env ) {
86
+ const root = spec.root(env);
87
+ return (await statSafe(root)) !== null ? [root] : [];
88
+ },
89
+ async *fileTimes(env ) {
90
+ const seen = new Set ();
91
+ for await (const path of spec.files(env, () => {})) {
92
+ if (seen.has(path)) continue;
93
+ seen.add(path);
94
+ const file = await statSafe(path).catch(() => null);
95
+ if (file) yield { path, mtimeMs: file.mtimeMs };
96
+ }
97
+ },
98
+ cachedFileTimes: (env ) => readCachedMtimes(join(env.stateDir, "cache", spec.cacheFile)),
99
+ async *discover(env ) {
100
+ adapter.lastErrors = [];
101
+ const cachePath = join(env.stateDir, "cache", spec.cacheFile);
102
+ const cache = createDiscoveryCache (cachePath, spec.cacheVersion ?? CACHE_VERSION, isValidScan);
103
+ await cache.load();
104
+ const seen = new Set ();
105
+ /** The cached or fresh scan of a file; null (error recorded) when it cannot be read. */
106
+ const scanned = async (path , file ) => {
107
+ let result = cache.get(path, file.size, file.mtimeMs);
108
+ if (!result) {
109
+ try {
110
+ opts.onScan?.(path);
111
+ result = await spec.scan(path, opts.readOptions ?? {});
112
+ } catch (e) {
113
+ adapter.lastErrors.push({ path, error: (e ).code ?? String(e) });
114
+ return null;
115
+ }
116
+ }
117
+ cache.set(path, file.size, file.mtimeMs, result);
118
+ return result;
119
+ };
120
+ // Compressed transcripts to convert: scanned after the plain ones, so a plain copy of the same session wins.
121
+ const compressed = [];
122
+ const plainIds = new Set ();
123
+ for await (const path of spec.files(env, (p, error) => adapter.lastErrors.push({ path: p, error }))) {
124
+ if (seen.has(path)) continue;
125
+ seen.add(path);
126
+ let file;
127
+ try {
128
+ file = await statSafe(path);
129
+ } catch (e) {
130
+ adapter.lastErrors.push({ path, error: (e ).code ?? String(e) });
131
+ continue;
132
+ }
133
+ if (!file) {
134
+ adapter.lastErrors.push({ path, error: "stat failed" });
135
+ continue;
136
+ }
137
+ const compressedId = spec.compressed?.id(path) ?? null;
138
+ if (compressedId !== null) {
139
+ if (spec.compressed .convert(env)) {
140
+ compressed.push({ path, file });
141
+ continue;
142
+ }
143
+ const mtimeIso = new Date(file.mtimeMs).toISOString();
144
+ yield {
145
+ harness: spec.id, accountId: null, nativeId: compressedId, cwd: null, startedAt: null, updatedAt: mtimeIso,
146
+ messageCount: 0, corruptLines: 0, file, flags: ["compressed"], cwdOffsetBytes: 0,
147
+ };
148
+ continue;
149
+ }
150
+ const result = await scanned(path, file);
151
+ if (!result) continue;
152
+ if (result.id !== null) plainIds.add(result.id);
153
+ const flags = [];
154
+ if (result.corruptLines > 0) flags.push("corrupt-lines");
155
+ if (result.subagent) flags.push("subagent");
156
+ else {
157
+ if (result.cwd === null) flags.push("no-cwd");
158
+ if (!result.cwdReadable) flags.push("cwd-unreadable");
159
+ }
160
+ if (result.id === null && !spec.stemFallback) flags.push("no-session-id");
161
+ if (result.visibleUserCount === 0) flags.push("only-hidden");
162
+ if (file.size > OVER_32MIB) flags.push("over-32mib");
163
+ if (file.size > OVER_4GIB) flags.push("over-4gib");
164
+ if (isActive(file.mtimeMs, env.now())) flags.push("active");
165
+ const mtimeIso = new Date(file.mtimeMs).toISOString();
166
+ yield {
167
+ harness: spec.id,
168
+ accountId: null,
169
+ nativeId: result.id ?? basename(path, ".jsonl"),
170
+ cwd: result.cwd,
171
+ startedAt: result.startedAt ?? mtimeIso,
172
+ updatedAt: result.updatedAt ?? mtimeIso,
173
+ messageCount: result.messageCount,
174
+ corruptLines: result.corruptLines,
175
+ file,
176
+ flags,
177
+ cwdOffsetBytes: result.cwdOffsetBytes,
178
+ };
179
+ }
180
+ // Compressed transcripts, converted (convert mode): T3 never reads them, so its cwd window and 32 MiB read do not
181
+ // apply (the converted transcript carries cwd on its first record and is sized by the writer).
182
+ const scans = [];
183
+ for (const { path, file } of compressed) {
184
+ const result = await scanned(path, file);
185
+ if (result) scans.push({ path, file, result });
186
+ }
187
+ // One planned file per session id; every other copy is listed, flagged `duplicate-file`. A plain copy wins. Among
188
+ // compressed copies (Codex writes `<id>_<child>` rollouts carrying the parent's id): a usable one (not a
189
+ // sub-agent, not too large, with a cwd and a visible user message) first, then the parent rollout (its file name carries the id inside),
190
+ // then the path. Stable: activity never decides, so the choice does not flip between runs.
191
+ const rank = (x ) => [
192
+ !x.result.subagent && !x.result.tooLarge && x.result.cwd !== null && x.result.visibleUserCount > 0 ? 0 : 1,
193
+ spec.compressed .id(x.path) === x.result.id ? 0 : 1,
194
+ x.path,
195
+ ];
196
+ const before = (a , b ) => {
197
+ const [ra, rb] = [rank(a), rank(b)];
198
+ return ra[0] !== rb[0] ? ra[0] < rb[0] : ra[1] !== rb[1] ? ra[1] < rb[1] : ra[2] < rb[2];
199
+ };
200
+ const best = new Map ();
201
+ for (const x of scans) {
202
+ const id = x.result.id;
203
+ if (id === null) continue;
204
+ const cur = best.get(id);
205
+ if (!cur || before(x, cur)) best.set(id, x);
206
+ }
207
+ for (const x of scans) {
208
+ const { path, file, result } = x;
209
+ const flags = ["compressed"];
210
+ if (result.id !== null && (plainIds.has(result.id) || best.get(result.id) !== x)) flags.push("duplicate-file");
211
+ if (result.corruptLines > 0) flags.push("corrupt-lines");
212
+ if (result.subagent) flags.push("subagent");
213
+ else if (result.cwd === null) flags.push("no-cwd");
214
+ if (result.id === null && !spec.stemFallback) flags.push("no-session-id");
215
+ if (!result.subagent && result.visibleUserCount === 0) flags.push("only-hidden"); // a subagent scan stops at its meta
216
+ if (result.tooLarge) flags.push("too-large");
217
+ if (isActive(file.mtimeMs, env.now())) flags.push("active");
218
+ const mtimeIso = new Date(file.mtimeMs).toISOString();
219
+ yield {
220
+ harness: spec.id, accountId: null, nativeId: result.id ?? basename(basename(path, ".zst"), ".jsonl"),
221
+ cwd: result.cwd, startedAt: result.startedAt ?? mtimeIso, updatedAt: result.updatedAt ?? mtimeIso,
222
+ messageCount: result.messageCount, corruptLines: result.corruptLines, file, flags, cwdOffsetBytes: 0, mode: "convert",
223
+ };
224
+ }
225
+ try {
226
+ if (!env.readOnly) await cache.save();
227
+ } catch (e) {
228
+ adapter.lastErrors.push({ path: cachePath, error: `cache write failed: ${(e ).message}` });
229
+ }
230
+ },
231
+ };
232
+ return adapter;
233
+ }