t3code-session-manager 0.0.0-stage → 0.4.1
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/.claude-plugin/marketplace.json +21 -0
- package/.claude-plugin/plugin.json +19 -0
- package/CHANGELOG.md +149 -0
- package/LICENSE +21 -0
- package/README.md +661 -2
- package/README.pt.md +617 -0
- package/bin/entry.d.mts +2 -0
- package/bin/entry.mjs +19 -0
- package/bin/t3sm.mjs +44 -0
- package/commands/import.md +30 -0
- package/commands/organize.md +36 -0
- package/commands/status.md +24 -0
- package/commands/sync.md +26 -0
- package/dist/apply/apply.js +993 -0
- package/dist/apply/claudeWriter.js +168 -0
- package/dist/apply/copyTranscript.js +116 -0
- package/dist/apply/importer.js +697 -0
- package/dist/apply/materialize.js +335 -0
- package/dist/apply/waves.js +108 -0
- package/dist/assistant/core.js +295 -0
- package/dist/assistant/deps.js +256 -0
- package/dist/assistant/i18n.js +38 -0
- package/dist/assistant/messages.en.js +494 -0
- package/dist/assistant/messages.pt.js +495 -0
- package/dist/assistant/runner.js +64 -0
- package/dist/assistant/steps.js +1362 -0
- package/dist/build.json +1 -0
- package/dist/cli/applyScreen.js +158 -0
- package/dist/cli/commands/accounts.js +254 -0
- package/dist/cli/commands/apply.js +199 -0
- package/dist/cli/commands/changelog.js +61 -0
- package/dist/cli/commands/doctor.js +105 -0
- package/dist/cli/commands/help.js +158 -0
- package/dist/cli/commands/merge.js +224 -0
- package/dist/cli/commands/organize.js +872 -0
- package/dist/cli/commands/plan.js +161 -0
- package/dist/cli/commands/projects.js +430 -0
- package/dist/cli/commands/quarantine.js +203 -0
- package/dist/cli/commands/recover.js +230 -0
- package/dist/cli/commands/rollback.js +281 -0
- package/dist/cli/commands/scan.js +117 -0
- package/dist/cli/commands/schedule.js +288 -0
- package/dist/cli/commands/start.js +45 -0
- package/dist/cli/commands/status.js +615 -0
- package/dist/cli/commands/sync.js +336 -0
- package/dist/cli/commands/update.js +398 -0
- package/dist/cli/errors.js +53 -0
- package/dist/cli/failures.js +91 -0
- package/dist/cli/flags.js +53 -0
- package/dist/cli/help.en.js +549 -0
- package/dist/cli/help.pt.js +566 -0
- package/dist/cli/helpText.js +211 -0
- package/dist/cli/helpTopics.js +58 -0
- package/dist/cli/locked.js +12 -0
- package/dist/cli/main.js +155 -0
- package/dist/cli/screen.js +3 -0
- package/dist/cli/ui.js +111 -0
- package/dist/cli/words.js +2 -0
- package/dist/core/activity.js +16 -0
- package/dist/core/changelog.js +47 -0
- package/dist/core/config.js +530 -0
- package/dist/core/fsutil.js +171 -0
- package/dist/core/glob.js +34 -0
- package/dist/core/history.js +32 -0
- package/dist/core/journal.js +274 -0
- package/dist/core/lock.js +337 -0
- package/dist/core/mask.js +31 -0
- package/dist/core/paths.js +68 -0
- package/dist/core/pid.js +101 -0
- package/dist/core/run.js +4 -0
- package/dist/core/semver.js +18 -0
- package/dist/core/sysroot.js +29 -0
- package/dist/core/types.js +229 -0
- package/dist/core/uuid.js +29 -0
- package/dist/core/version.js +72 -0
- package/dist/help/convert.md +20 -0
- package/dist/help/convert.pt.md +21 -0
- package/dist/help/cwd-unreadable.md +22 -0
- package/dist/help/cwd-unreadable.pt.md +22 -0
- package/dist/help/decisions.md +20 -0
- package/dist/help/decisions.pt.md +20 -0
- package/dist/help/errors.md +20 -0
- package/dist/help/errors.pt.md +22 -0
- package/dist/help/held.md +20 -0
- package/dist/help/held.pt.md +20 -0
- package/dist/help/history.md +27 -0
- package/dist/help/history.pt.md +29 -0
- package/dist/help/instance-unavailable.md +18 -0
- package/dist/help/instance-unavailable.pt.md +19 -0
- package/dist/help/not-imported.md +19 -0
- package/dist/help/not-imported.pt.md +19 -0
- package/dist/help/orphaned.md +19 -0
- package/dist/help/orphaned.pt.md +19 -0
- package/dist/help/project-mismatch.md +15 -0
- package/dist/help/project-mismatch.pt.md +15 -0
- package/dist/help/t3-native.md +22 -0
- package/dist/help/t3-native.pt.md +22 -0
- package/dist/help/updates.md +26 -0
- package/dist/help/updates.pt.md +28 -0
- package/dist/help/watcher.md +24 -0
- package/dist/help/watcher.pt.md +25 -0
- package/dist/i18n/cli.js +41 -0
- package/dist/i18n/lang.js +55 -0
- package/dist/i18n/messages.en.js +1140 -0
- package/dist/i18n/messages.pt.js +1149 -0
- package/dist/i18n/words.js +12 -0
- package/dist/ops/accounts.js +170 -0
- package/dist/ops/autoUpdate.js +223 -0
- package/dist/ops/discoverAccounts.js +343 -0
- package/dist/ops/doctor.js +811 -0
- package/dist/ops/elevated.js +47 -0
- package/dist/ops/errorCodes.js +39 -0
- package/dist/ops/follow.js +558 -0
- package/dist/ops/merge.js +830 -0
- package/dist/ops/notify.js +249 -0
- package/dist/ops/plugin.js +92 -0
- package/dist/ops/projects.js +113 -0
- package/dist/ops/quarantine.js +415 -0
- package/dist/ops/rollback.js +868 -0
- package/dist/ops/schedule.js +464 -0
- package/dist/ops/successor.js +51 -0
- package/dist/ops/sync.js +859 -0
- package/dist/ops/syncStatus.js +290 -0
- package/dist/ops/update.js +273 -0
- package/dist/ops/updater.js +641 -0
- package/dist/ops/watch.js +676 -0
- package/dist/ops/watcherControl.js +212 -0
- package/dist/ops/watcherHealth.js +75 -0
- package/dist/organize/apply.js +495 -0
- package/dist/organize/history.js +192 -0
- package/dist/organize/plan.js +283 -0
- package/dist/organize/rename.js +58 -0
- package/dist/organize/sessions.js +100 -0
- package/dist/organize/titles.js +70 -0
- package/dist/organize/types.js +73 -0
- package/dist/plan/categories.js +104 -0
- package/dist/plan/dedupe.js +137 -0
- package/dist/plan/folders.js +82 -0
- package/dist/plan/names.js +93 -0
- package/dist/plan/ownership.js +316 -0
- package/dist/plan/planner.js +669 -0
- package/dist/plan/rehome.js +101 -0
- package/dist/plan/report.js +407 -0
- package/dist/sources/cache.js +89 -0
- package/dist/sources/claude.js +297 -0
- package/dist/sources/codex.js +496 -0
- package/dist/sources/flatten.js +23 -0
- package/dist/sources/jsonl.js +169 -0
- package/dist/sources/native.js +233 -0
- package/dist/sources/opencode.js +483 -0
- package/dist/sources/pi.js +133 -0
- package/dist/sources/registry.js +67 -0
- package/dist/sources/types.js +80 -0
- package/dist/t3/api.js +492 -0
- package/dist/t3/auth.js +248 -0
- package/dist/t3/compat.js +62 -0
- package/dist/t3/decode.js +408 -0
- package/dist/t3/errors.js +185 -0
- package/dist/t3/rpc.js +185 -0
- package/dist/t3/runtime.js +80 -0
- package/dist/ui/caps.js +56 -0
- package/dist/ui/components.js +202 -0
- package/dist/ui/layout.js +205 -0
- package/dist/ui/list.js +423 -0
- package/dist/ui/locale.js +73 -0
- package/dist/ui/organizePreview.js +72 -0
- package/dist/ui/progress.js +237 -0
- package/dist/ui/style.js +32 -0
- package/dist/ui/terminal.js +126 -0
- package/dist/ui/text.js +186 -0
- package/package.json +58 -4
- package/skills/t3code-sessions/SKILL.md +183 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { createReadStream, } from "node:fs";
|
|
2
|
+
import { readdir } from "node:fs/promises";
|
|
3
|
+
import { basename, join } from "node:path";
|
|
4
|
+
|
|
5
|
+
import { statSafe } from "../core/fsutil.js";
|
|
6
|
+
import { expandHome } from "../core/paths.js";
|
|
7
|
+
import { isActive } from "../core/activity.js";
|
|
8
|
+
import { createDiscoveryCache, readCachedMtimes } from "./cache.js";
|
|
9
|
+
import { extractText, isNum, isoOrNull, isStrOrNull, scanJsonlChunks, } from "./jsonl.js";
|
|
10
|
+
import { isUuid } from "../core/uuid.js";
|
|
11
|
+
import {
|
|
12
|
+
CWD_SCAN_MAX_BYTES,
|
|
13
|
+
CWD_SCAN_MAX_RECORDS,
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
} from "./types.js";
|
|
18
|
+
|
|
19
|
+
const MIB = 1024 * 1024;
|
|
20
|
+
const OVER_32MIB = 32 * MIB;
|
|
21
|
+
const OVER_4GIB = 4 * 1024 * MIB;
|
|
22
|
+
const BACKUP_DIR = /\.bak(-\d{8}-\d{6})?$/;
|
|
23
|
+
const CACHE_VERSION = 5; // 5: ScanResult.handoffThreadId and t3Native (4: entrypoint)
|
|
24
|
+
const CACHE_FILE = "claude-discovery.json";
|
|
25
|
+
|
|
26
|
+
/** Result of scanning one transcript; everything that does not depend on `now`. */
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
const HANDOFF_MAX_RECORDS = 200;
|
|
51
|
+
const HANDOFF_THREAD_RE = /\bThread: ([0-9a-f-]{36})\b/;
|
|
52
|
+
|
|
53
|
+
/** Text of a user or system record (message.content, or a system record's own content). */
|
|
54
|
+
function handoffText(o ) {
|
|
55
|
+
if (o.type !== "user" && o.type !== "system") return "";
|
|
56
|
+
const m = o.message;
|
|
57
|
+
const fromMessage = m !== null && typeof m === "object" ? extractText((m ).content) : "";
|
|
58
|
+
return fromMessage !== "" ? fromMessage : extractText(o.content);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A user record whose content is only tool_result blocks is tool plumbing, not a user message. */
|
|
62
|
+
function isToolResultOnly(content ) {
|
|
63
|
+
return Array.isArray(content) && content.length > 0 &&
|
|
64
|
+
content.every((b) => b !== null && typeof b === "object" && (b ).type === "tool_result");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Stream a transcript once (shared byte-exact scanner). The file is never loaded whole.
|
|
69
|
+
*/
|
|
70
|
+
export function scanTranscript(path , readOpts = {}) {
|
|
71
|
+
return scanTranscriptChunks(createReadStream(path, readOpts) );
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* scanTranscript over any byte stream: the same measure discovery takes (a faithful copy is measured from its text
|
|
76
|
+
* before it is written, so the activity journaled for it is exactly what discovery reports for its source).
|
|
77
|
+
*/
|
|
78
|
+
export async function scanTranscriptChunks(chunks ) {
|
|
79
|
+
const r = {
|
|
80
|
+
cwd: null, startedAt: null, updatedAt: null, messageCount: 0, visibleUserCount: 0,
|
|
81
|
+
corruptLines: 0, cwdOffsetBytes: 0, cwdReadable: false, sessionId: null,
|
|
82
|
+
entrypoint: null, t3Native: false, handoffThreadId: null,
|
|
83
|
+
};
|
|
84
|
+
const totals = await scanJsonlChunks(chunks, (o, info) => {
|
|
85
|
+
if (r.cwd === null && typeof o.cwd === "string" && o.cwd !== "") {
|
|
86
|
+
r.cwd = o.cwd;
|
|
87
|
+
r.cwdOffsetBytes = info.offset;
|
|
88
|
+
// T3 (S2 section 4) reads in 8 KiB chunks until the first record with cwd, at most 1 MiB per
|
|
89
|
+
// file, and a record only parses once complete. So a cwd record is readable iff it ends
|
|
90
|
+
// (newline included) at byte <= 1 MiB, and it is among the first 1000 lines (blank lines count).
|
|
91
|
+
r.cwdReadable = info.offset <= CWD_SCAN_MAX_BYTES && info.recordIndex <= CWD_SCAN_MAX_RECORDS;
|
|
92
|
+
}
|
|
93
|
+
if (r.entrypoint === null && typeof o.entrypoint === "string" && o.entrypoint !== "") {
|
|
94
|
+
r.entrypoint = o.entrypoint;
|
|
95
|
+
r.t3Native = o.entrypoint === "t3-code";
|
|
96
|
+
}
|
|
97
|
+
if (r.handoffThreadId === null && info.recordIndex <= HANDOFF_MAX_RECORDS) {
|
|
98
|
+
const text = handoffText(o);
|
|
99
|
+
if (text !== "") r.handoffThreadId = HANDOFF_THREAD_RE.exec(text)?.[1] ?? null;
|
|
100
|
+
}
|
|
101
|
+
const hidden = o.isSidechain === true || o.isMeta === true || o.isCompactSummary === true;
|
|
102
|
+
if (!hidden && typeof o.sessionId === "string" && o.sessionId.trim() !== "") r.sessionId = o.sessionId.trim();
|
|
103
|
+
const ts = isoOrNull(o.timestamp);
|
|
104
|
+
if (ts !== null) {
|
|
105
|
+
r.startedAt ??= ts;
|
|
106
|
+
r.updatedAt = ts;
|
|
107
|
+
}
|
|
108
|
+
if ((o.type === "user" || o.type === "assistant") && o.isSidechain !== true && o.isMeta !== true &&
|
|
109
|
+
o.isCompactSummary !== true) {
|
|
110
|
+
if (o.type === "user") {
|
|
111
|
+
if (isToolResultOnly((o.message )?.content)) return;
|
|
112
|
+
r.visibleUserCount++;
|
|
113
|
+
}
|
|
114
|
+
r.messageCount++;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
r.corruptLines = totals.corruptLines;
|
|
118
|
+
if (r.cwd === null) r.cwdOffsetBytes = totals.totalBytes;
|
|
119
|
+
return r;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The id T3 Code imports a Claude transcript under (its thread is import:<instance>:<id>; S2 §2.6, T3's
|
|
124
|
+
* foldClaudeFields): the last non-hidden record's sessionId, else the file stem.
|
|
125
|
+
*/
|
|
126
|
+
export function claudeNativeId(path , scan ) {
|
|
127
|
+
return scan.sessionId ?? basename(path, ".jsonl");
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** claudeNativeId of a transcript on disk (streams it once); the stem when it cannot be read. */
|
|
131
|
+
export async function readClaudeNativeId(path ) {
|
|
132
|
+
return claudeNativeId(path, await scanTranscript(path).catch(() => ({ sessionId: null })));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Every ScanResult field must be present with the right type; otherwise the entry is rescanned. */
|
|
136
|
+
function isValidResult(r ) {
|
|
137
|
+
if (r === null || typeof r !== "object") return false;
|
|
138
|
+
const o = r ;
|
|
139
|
+
return isStrOrNull(o.cwd) && isStrOrNull(o.startedAt) && isStrOrNull(o.updatedAt) &&
|
|
140
|
+
isNum(o.messageCount) && isNum(o.visibleUserCount) && isNum(o.corruptLines) &&
|
|
141
|
+
isNum(o.cwdOffsetBytes) && typeof o.cwdReadable === "boolean" && isStrOrNull(o.sessionId) && isStrOrNull(o.entrypoint) &&
|
|
142
|
+
typeof o.t3Native === "boolean" && isStrOrNull(o.handoffThreadId);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
async function listDir(dir ) {
|
|
162
|
+
try {
|
|
163
|
+
return await readdir(dir, { withFileTypes: true });
|
|
164
|
+
} catch {
|
|
165
|
+
return [];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async function* candidates(accountId , projects ) {
|
|
170
|
+
for (const d of await listDir(projects)) {
|
|
171
|
+
if (!d.isDirectory()) continue;
|
|
172
|
+
const dir = join(projects, d.name);
|
|
173
|
+
if (d.name.startsWith(".bak-")) {
|
|
174
|
+
for (const sub of await listDir(dir)) {
|
|
175
|
+
if (!sub.isDirectory()) continue;
|
|
176
|
+
for (const f of await listDir(join(dir, sub.name))) {
|
|
177
|
+
if (f.isFile() && f.name.endsWith(".jsonl")) {
|
|
178
|
+
yield { path: join(dir, sub.name, f.name), accountId, backup: true };
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const backup = BACKUP_DIR.test(d.name);
|
|
185
|
+
for (const f of await listDir(dir)) {
|
|
186
|
+
if (f.isFile() && f.name.endsWith(".jsonl")) yield { path: join(dir, f.name), accountId, backup };
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export function createClaudeAdapter(opts = {}) {
|
|
192
|
+
const adapter = {
|
|
193
|
+
id: "claude",
|
|
194
|
+
mode: "native",
|
|
195
|
+
lastErrors: [],
|
|
196
|
+
async isAvailable(env ) {
|
|
197
|
+
for (const a of env.config.accounts) {
|
|
198
|
+
if (await statSafe(join(a.home, "projects"))) return true;
|
|
199
|
+
}
|
|
200
|
+
return false;
|
|
201
|
+
},
|
|
202
|
+
async watchRoots(env ) {
|
|
203
|
+
const out = [];
|
|
204
|
+
for (const a of env.config.accounts) {
|
|
205
|
+
const p = join(expandHome(a.home, env.home), "projects");
|
|
206
|
+
if (await statSafe(p)) out.push(p);
|
|
207
|
+
}
|
|
208
|
+
return out;
|
|
209
|
+
},
|
|
210
|
+
async *fileTimes(env ) {
|
|
211
|
+
const seen = new Set ();
|
|
212
|
+
for (const account of env.config.accounts) {
|
|
213
|
+
for await (const c of candidates(account.id, join(account.home, "projects"))) {
|
|
214
|
+
if (seen.has(c.path)) continue;
|
|
215
|
+
seen.add(c.path);
|
|
216
|
+
const file = await statSafe(c.path).catch(() => null);
|
|
217
|
+
if (file) yield { path: c.path, mtimeMs: file.mtimeMs };
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
cachedFileTimes: (env ) => readCachedMtimes(join(env.stateDir, "cache", CACHE_FILE)),
|
|
222
|
+
async *discover(env ) {
|
|
223
|
+
adapter.lastErrors = [];
|
|
224
|
+
const cachePath = join(env.stateDir, "cache", CACHE_FILE);
|
|
225
|
+
const cache = createDiscoveryCache (cachePath, CACHE_VERSION, isValidResult);
|
|
226
|
+
await cache.load();
|
|
227
|
+
const seen = new Set ();
|
|
228
|
+
for (const account of env.config.accounts) {
|
|
229
|
+
const projects = join(account.home, "projects");
|
|
230
|
+
if (!(await statSafe(projects))) continue;
|
|
231
|
+
for await (const c of candidates(account.id, projects)) {
|
|
232
|
+
if (seen.has(c.path)) continue;
|
|
233
|
+
seen.add(c.path);
|
|
234
|
+
const file = await statSafe(c.path);
|
|
235
|
+
if (!file) {
|
|
236
|
+
adapter.lastErrors.push({ path: c.path, error: "stat failed" });
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
let result ;
|
|
240
|
+
const hit = cache.get(c.path, file.size, file.mtimeMs);
|
|
241
|
+
if (hit) {
|
|
242
|
+
result = hit;
|
|
243
|
+
} else {
|
|
244
|
+
try {
|
|
245
|
+
opts.onScan?.(c.path);
|
|
246
|
+
result = await scanTranscript(c.path, opts.readOptions);
|
|
247
|
+
} catch (e) {
|
|
248
|
+
adapter.lastErrors.push({ path: c.path, error: (e ).code ?? String(e) });
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
cache.set(c.path, file.size, file.mtimeMs, result);
|
|
253
|
+
// nativeId is the id T3 Code imports the transcript under (its thread is import:<instance>:<id>): the last
|
|
254
|
+
// non-hidden record's sessionId, else the file stem (S2 §2.6). Normally both are the same session UUID.
|
|
255
|
+
const stem = basename(c.path, ".jsonl");
|
|
256
|
+
const nativeId = claudeNativeId(c.path, result);
|
|
257
|
+
const flags = [];
|
|
258
|
+
if (nativeId !== stem) flags.push("id-mismatch");
|
|
259
|
+
if (result.corruptLines > 0) flags.push("corrupt-lines");
|
|
260
|
+
if (result.cwd === null) flags.push("no-cwd");
|
|
261
|
+
if (!result.cwdReadable) flags.push("cwd-unreadable");
|
|
262
|
+
if (!isUuid(nativeId)) flags.push("non-uuid-id");
|
|
263
|
+
if (result.visibleUserCount === 0) flags.push("only-hidden");
|
|
264
|
+
if (file.size > OVER_32MIB) flags.push("over-32mib");
|
|
265
|
+
if (file.size > OVER_4GIB) flags.push("over-4gib");
|
|
266
|
+
if (c.backup) flags.push("backup-copy");
|
|
267
|
+
if (isActive(file.mtimeMs, env.now())) flags.push("active");
|
|
268
|
+
const mtimeIso = new Date(file.mtimeMs).toISOString();
|
|
269
|
+
yield {
|
|
270
|
+
harness: "claude",
|
|
271
|
+
accountId: c.accountId,
|
|
272
|
+
nativeId,
|
|
273
|
+
cwd: result.cwd,
|
|
274
|
+
startedAt: result.startedAt ?? mtimeIso,
|
|
275
|
+
updatedAt: result.updatedAt ?? mtimeIso,
|
|
276
|
+
messageCount: result.messageCount,
|
|
277
|
+
corruptLines: result.corruptLines,
|
|
278
|
+
file,
|
|
279
|
+
flags,
|
|
280
|
+
cwdOffsetBytes: result.cwdOffsetBytes,
|
|
281
|
+
origin: result.entrypoint?.startsWith("sdk-") ? "automated" : "human",
|
|
282
|
+
...(result.entrypoint !== null ? { startedIn: result.t3Native ? "t3" : "elsewhere" } : {}),
|
|
283
|
+
...(result.handoffThreadId !== null ? { t3ThreadId: result.handoffThreadId } : {}),
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
try {
|
|
288
|
+
if (!env.readOnly) await cache.save();
|
|
289
|
+
} catch (e) {
|
|
290
|
+
adapter.lastErrors.push({ path: cachePath, error: `cache write failed: ${(e ).message}` });
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
return adapter;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export const claudeAdapter = createClaudeAdapter();
|