coauthored 0.0.0-stage → 1.0.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.
- package/LICENSE +21 -0
- package/PRIVACY.md +107 -0
- package/README.md +113 -3
- package/THIRD_PARTY_LICENSES.md +105 -0
- package/dist/cli/analytics/anchors.js +39 -0
- package/dist/cli/analytics/archetypes.js +193 -0
- package/dist/cli/analytics/content/analyzer.js +945 -0
- package/dist/cli/analytics/content/classify.js +115 -0
- package/dist/cli/analytics/content/demo-corpus.js +301 -0
- package/dist/cli/analytics/content/sketch.js +54 -0
- package/dist/cli/analytics/dataset.js +321 -0
- package/dist/cli/analytics/demo-fixtures.js +531 -0
- package/dist/cli/analytics/fdr.js +183 -0
- package/dist/cli/analytics/helicorder.js +66 -0
- package/dist/cli/analytics/insights.js +589 -0
- package/dist/cli/analytics/models.js +75 -0
- package/dist/cli/analytics/pricing.js +121 -0
- package/dist/cli/analytics/probable-cause.js +115 -0
- package/dist/cli/analytics/report-builder.js +162 -0
- package/dist/cli/analytics/statistics.js +91 -0
- package/dist/cli/analytics/time.js +252 -0
- package/dist/cli/cli/args.js +105 -0
- package/dist/cli/cli/browser.js +71 -0
- package/dist/cli/cli/index.js +20 -0
- package/dist/cli/cli/main.js +520 -0
- package/dist/cli/cli/phrase-review.js +78 -0
- package/dist/cli/cli/server.js +481 -0
- package/dist/cli/cli/terminal.js +363 -0
- package/dist/cli/ingest/adapters/aider.js +116 -0
- package/dist/cli/ingest/adapters/claude-code.js +139 -0
- package/dist/cli/ingest/adapters/cline-roo.js +89 -0
- package/dist/cli/ingest/adapters/codex-cli.js +240 -0
- package/dist/cli/ingest/adapters/content.js +99 -0
- package/dist/cli/ingest/adapters/cursor-ide.js +149 -0
- package/dist/cli/ingest/adapters/gemini-cli.js +208 -0
- package/dist/cli/ingest/adapters/index.js +18 -0
- package/dist/cli/ingest/adapters/opencode.js +203 -0
- package/dist/cli/ingest/adapters/pi-agent.js +85 -0
- package/dist/cli/ingest/adapters/shared.js +484 -0
- package/dist/cli/ingest/content-sink.js +31 -0
- package/dist/cli/ingest/discovery.js +50 -0
- package/dist/cli/ingest/message-digests.js +61 -0
- package/dist/cli/ingest/pipeline.js +155 -0
- package/dist/cli/ingest/safe-fs.js +284 -0
- package/dist/cli/ingest/sqlite-stage.js +139 -0
- package/dist/cli/ingest/time-window.js +34 -0
- package/dist/cli/ingest/tool-map.js +24 -0
- package/dist/cli/ingest/types.js +1 -0
- package/dist/cli/ingest/worker.js +97 -0
- package/dist/cli/report/content/emoji-names.js +3956 -0
- package/dist/cli/report/content/insights.js +41 -0
- package/dist/cli/report/content/lexicons.js +112 -0
- package/dist/cli/report/content/policy.js +77 -0
- package/dist/cli/report/content/redact.js +164 -0
- package/dist/cli/report/content/stopwords.js +8848 -0
- package/dist/cli/report/content/suppression.js +2617 -0
- package/dist/cli/report/content/validate.js +152 -0
- package/dist/cli/report/copy-lint.js +105 -0
- package/dist/cli/report/share.js +132 -0
- package/dist/cli/report/types.js +1 -0
- package/dist/cli/report/validators.js +334 -0
- package/dist/web/assets/Archivo-VF-BohoA-Sn.woff2 +0 -0
- package/dist/web/assets/DelaGothicOne-subset-CpoJGhTq.woff2 +0 -0
- package/dist/web/assets/Film-Dq8Xxn7U.css +1 -0
- package/dist/web/assets/MartianMono-VF-CmJ1nXx9.woff2 +0 -0
- package/dist/web/assets/app-DEQgytaq.js +38 -0
- package/dist/web/assets/bricolage-grotesque-latin-700-normal-gtcctNPv.woff2 +0 -0
- package/dist/web/assets/bricolage-grotesque-latin-800-normal-J50vIsBe.woff2 +0 -0
- package/dist/web/assets/chorus-D7bfON5Z.ogg +0 -0
- package/dist/web/assets/chorus-bass-CBTKpMv_.ogg +0 -0
- package/dist/web/assets/chorus-drums-BOzgLSoq.ogg +0 -0
- package/dist/web/assets/chorus-harmony-DnJYs_tp.ogg +0 -0
- package/dist/web/assets/chorus-lead-CFpg5DC1.ogg +0 -0
- package/dist/web/assets/chunk-BNfsY4o8.js +1 -0
- package/dist/web/assets/chunk-BSm8IhPY.js +1 -0
- package/dist/web/assets/chunk-Bi6EQAkf.js +1 -0
- package/dist/web/assets/chunk-BmDwUWlX.js +1 -0
- package/dist/web/assets/chunk-Ds4joAI5.js +46 -0
- package/dist/web/assets/chunk-V3YGpFIw.js +1 -0
- package/dist/web/assets/chunk-XGhNFWse.js +1 -0
- package/dist/web/assets/dialogue-card-A5zmbNhu.ogg +0 -0
- package/dist/web/assets/groove-bass-BFNelLKi.ogg +0 -0
- package/dist/web/assets/groove-drums-BY1SBntR.ogg +0 -0
- package/dist/web/assets/groove-harmony-C0CrBzu3.ogg +0 -0
- package/dist/web/assets/groove-lead-CEYPzm5U.ogg +0 -0
- package/dist/web/assets/groove-ln-zQmTb.ogg +0 -0
- package/dist/web/assets/guess-high-CL6mF18x.ogg +0 -0
- package/dist/web/assets/guess-low-C3UnKayZ.ogg +0 -0
- package/dist/web/assets/higher-BevsMIWl.ogg +0 -0
- package/dist/web/assets/identity-0EPS3msD.ogg +0 -0
- package/dist/web/assets/index-DpT0dtHc.css +1 -0
- package/dist/web/assets/intro-DeRh6kUx.ogg +0 -0
- package/dist/web/assets/intro-bass-D63IPU0H.ogg +0 -0
- package/dist/web/assets/intro-drums-Dt9QO534.ogg +0 -0
- package/dist/web/assets/intro-harmony-DBsMG9jJ.ogg +0 -0
- package/dist/web/assets/intro-lead-DWcWS1ia.ogg +0 -0
- package/dist/web/assets/jar-coin-rtCvspuq.ogg +0 -0
- package/dist/web/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/web/assets/ledger-tick-C1rQgQGX.ogg +0 -0
- package/dist/web/assets/night-B_bMOZcf.ogg +0 -0
- package/dist/web/assets/night-bass-B-7Ay9ME.ogg +0 -0
- package/dist/web/assets/night-drums-zEtqWXX3.ogg +0 -0
- package/dist/web/assets/night-harmony-C5Ix2yce.ogg +0 -0
- package/dist/web/assets/night-lead-B7KMlRyj.ogg +0 -0
- package/dist/web/assets/ourturn-DX78hTEz.ogg +0 -0
- package/dist/web/assets/plus-jakarta-sans-latin-400-normal-Dhut76fR.woff2 +0 -0
- package/dist/web/assets/plus-jakarta-sans-latin-500-normal-Bf-nb4oT.woff2 +0 -0
- package/dist/web/assets/plus-jakarta-sans-latin-600-normal-DLTa1BUW.woff2 +0 -0
- package/dist/web/assets/plus-jakarta-sans-latin-700-normal-CfpNZvy6.woff2 +0 -0
- package/dist/web/assets/reveal-BmWAGHih.ogg +0 -0
- package/dist/web/assets/review-split-Dac4zagw.ogg +0 -0
- package/dist/web/assets/shutter-uhz2Y9S9.ogg +0 -0
- package/dist/web/assets/soclose-CiUFR5St.ogg +0 -0
- package/dist/web/assets/stinger-TnnzHAMN.ogg +0 -0
- package/dist/web/assets/stomp-mzIk4cGm.ogg +0 -0
- package/dist/web/assets/syne-latin-700-normal-AF3Rs61n.woff2 +0 -0
- package/dist/web/assets/syne-latin-800-normal-EehdNYzx.woff2 +0 -0
- package/dist/web/assets/tension-BHvWG5ru.ogg +0 -0
- package/dist/web/assets/tension-bass-4G-2qA9W.ogg +0 -0
- package/dist/web/assets/tension-drums-D7sdehJr.ogg +0 -0
- package/dist/web/assets/tension-harmony-FyPldmLb.ogg +0 -0
- package/dist/web/assets/tension-lead-C5uoFMR8.ogg +0 -0
- package/dist/web/assets/why-clock-Dzs1A_ym.ogg +0 -0
- package/dist/web/favicon.svg +1 -0
- package/dist/web/index.html +16 -0
- package/dist/web/licenses/OFL-Archivo.txt +93 -0
- package/dist/web/licenses/OFL-DelaGothic.txt +93 -0
- package/dist/web/licenses/OFL-MartianMono.txt +93 -0
- package/package.json +63 -6
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { contentSink } from './content-sink.js';
|
|
2
|
+
import { randomBytes } from 'node:crypto';
|
|
3
|
+
import { promises as fs } from 'node:fs';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { getAdapter } from './adapters/index.js';
|
|
7
|
+
import { emptyResult, eventKeys, requestGroups, requestQualities, sessionWindows } from './adapters/shared.js';
|
|
8
|
+
import { IngestError } from './safe-fs.js';
|
|
9
|
+
import { parseTimezones, parseWindows, yearWindow } from './time-window.js';
|
|
10
|
+
export async function ingestApprovedCandidates(options) {
|
|
11
|
+
const { locations, year, timezone, onProgress, signal } = options;
|
|
12
|
+
signal?.throwIfAborted();
|
|
13
|
+
const window = yearWindow(year, timezone);
|
|
14
|
+
const approved = new Set(options.approvedCandidateIds);
|
|
15
|
+
const inWindow = (ts) => ts >= window.start && ts < window.end;
|
|
16
|
+
const dataset = {
|
|
17
|
+
year, timezone, sessions: [], humanPrompts: [], agentRequests: [], toolCalls: [],
|
|
18
|
+
compactions: [], interrupts: [], summaries: [],
|
|
19
|
+
};
|
|
20
|
+
const terminalLedger = [];
|
|
21
|
+
const sessions = new Map();
|
|
22
|
+
const requests = new Map();
|
|
23
|
+
const groupOwners = new Map();
|
|
24
|
+
const requestOwners = new WeakMap();
|
|
25
|
+
const crossCandidateEvents = locations.filter(location => approved.has(location.candidateId)).length > 1;
|
|
26
|
+
const seenEvents = crossCandidateEvents ? new Set() : undefined;
|
|
27
|
+
const ownsStaging = !options.stagingDir;
|
|
28
|
+
const stagingDir = options.stagingDir
|
|
29
|
+
? await fs.realpath(options.stagingDir)
|
|
30
|
+
: await fs.mkdtemp(join(await fs.realpath(tmpdir()), 'coauthored-'));
|
|
31
|
+
const hmacSecret = randomBytes(32);
|
|
32
|
+
const contentFor = options.content && contentSink(options.content, hmacSecret, window);
|
|
33
|
+
try {
|
|
34
|
+
if (ownsStaging)
|
|
35
|
+
await fs.chmod(stagingDir, 0o700);
|
|
36
|
+
for (const location of locations) {
|
|
37
|
+
signal?.throwIfAborted();
|
|
38
|
+
const { candidateId, harness, displayName, canonicalPath, fileCount, snapshotMethod, channelLabel, totalBytes } = location;
|
|
39
|
+
const ledger = {
|
|
40
|
+
candidateId, harness, displayName, canonicalPath, fileCount, snapshotMethod, bytesRead: 0, status: 'skipped',
|
|
41
|
+
};
|
|
42
|
+
terminalLedger.push(ledger);
|
|
43
|
+
if (!approved.has(candidateId))
|
|
44
|
+
continue;
|
|
45
|
+
const adapter = getAdapter(harness);
|
|
46
|
+
const reportProgress = onProgress && ((filesDone, filesTotal, eventsProcessed, bytesProcessed) => {
|
|
47
|
+
onProgress({ currentHarness: harness, channelLabel, filesDone, filesTotal, eventsProcessed,
|
|
48
|
+
bytesProcessed, bytesTotal: totalBytes, ...(contentFor ? { label: 'Counting words…' } : {}) });
|
|
49
|
+
});
|
|
50
|
+
const ctx = {
|
|
51
|
+
candidate: location, hmacSecret, stagingDir, signal, crossCandidateEvents,
|
|
52
|
+
...(contentFor ? { content: contentFor(harness) } : {}),
|
|
53
|
+
onProgress: reportProgress,
|
|
54
|
+
};
|
|
55
|
+
parseTimezones.set(ctx, timezone);
|
|
56
|
+
parseWindows.set(ctx, window);
|
|
57
|
+
let result;
|
|
58
|
+
try {
|
|
59
|
+
reportProgress?.(0, fileCount, 0, 0);
|
|
60
|
+
result = await adapter.parse(ctx);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
signal?.throwIfAborted();
|
|
64
|
+
result = emptyResult(location, adapter.version);
|
|
65
|
+
result.summary.filesSeen = fileCount;
|
|
66
|
+
result.summary.filesQuarantined = fileCount;
|
|
67
|
+
result.summary.failureCodes.push(error instanceof IngestError ? error.code : 'SOURCE_UNAVAILABLE');
|
|
68
|
+
}
|
|
69
|
+
const { summary } = result;
|
|
70
|
+
ledger.bytesRead = summary.bytesRead;
|
|
71
|
+
ledger.snapshotMethod = summary.snapshotMethod;
|
|
72
|
+
ledger.fileCount = summary.filesSeen;
|
|
73
|
+
ledger.status = summary.failureCodes.length && !summary.filesOk ? 'error' :
|
|
74
|
+
summary.filesQuarantined || summary.linesSkipped || summary.failureCodes.length ? 'partial' : 'ok';
|
|
75
|
+
if (summary.failureCodes[0])
|
|
76
|
+
ledger.failureCode = summary.failureCodes[0];
|
|
77
|
+
summary.earliestEventTsMs = null;
|
|
78
|
+
summary.latestEventTsMs = null;
|
|
79
|
+
dataset.summaries.push(summary);
|
|
80
|
+
for (const session of result.sessions) {
|
|
81
|
+
const range = sessionWindows.get(session);
|
|
82
|
+
if (!range)
|
|
83
|
+
continue;
|
|
84
|
+
summary.earliestEventTsMs = Math.min(summary.earliestEventTsMs ?? Infinity, range.start);
|
|
85
|
+
summary.latestEventTsMs = Math.max(summary.latestEventTsMs ?? -Infinity, range.end);
|
|
86
|
+
const existing = sessions.get(session.sessionId);
|
|
87
|
+
if (existing) {
|
|
88
|
+
existing.startTsMs = Math.min(existing.startTsMs, range.start);
|
|
89
|
+
existing.endTsMs = Math.max(existing.endTsMs, range.end);
|
|
90
|
+
existing.isSubagent ||= session.isSubagent;
|
|
91
|
+
if (!existing.projectHmac)
|
|
92
|
+
existing.projectHmac = session.projectHmac;
|
|
93
|
+
if (session.parentSessionId)
|
|
94
|
+
existing.parentSessionId = session.parentSessionId;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
sessions.set(session.sessionId, { ...session, startTsMs: range.start, endTsMs: range.end });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
for (const request of result.agentRequests) {
|
|
101
|
+
const prior = requests.get(request.dedupeKey);
|
|
102
|
+
const quality = requestQualities.get(request) ?? 0;
|
|
103
|
+
const previousQuality = prior ? (requestQualities.get(prior) ?? 0) : -1;
|
|
104
|
+
const group = requestGroups.get(request);
|
|
105
|
+
if (group) {
|
|
106
|
+
const owner = groupOwners.get(group);
|
|
107
|
+
if (!owner || quality > owner.quality)
|
|
108
|
+
groupOwners.set(group, { candidateId, quality });
|
|
109
|
+
if (groupOwners.get(group)?.candidateId !== candidateId)
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (!prior || quality > previousQuality || (quality === previousQuality && request.output > prior.output)) {
|
|
113
|
+
requests.set(request.dedupeKey, request);
|
|
114
|
+
requestOwners.set(request, candidateId);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const appendEvents = (target, events) => {
|
|
118
|
+
for (const event of events) {
|
|
119
|
+
if (!inWindow(event.tsMs))
|
|
120
|
+
continue;
|
|
121
|
+
const key = seenEvents && eventKeys.get(event);
|
|
122
|
+
if (key && seenEvents.has(key))
|
|
123
|
+
continue;
|
|
124
|
+
if (key)
|
|
125
|
+
seenEvents.add(key);
|
|
126
|
+
target.push(event);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
appendEvents(dataset.humanPrompts, result.humanPrompts);
|
|
130
|
+
appendEvents(dataset.toolCalls, result.toolCalls);
|
|
131
|
+
appendEvents(dataset.compactions, result.compactions);
|
|
132
|
+
appendEvents(dataset.interrupts, result.interrupts);
|
|
133
|
+
}
|
|
134
|
+
signal?.throwIfAborted();
|
|
135
|
+
dataset.sessions = [...sessions.values()].sort((a, b) => a.startTsMs - b.startTsMs);
|
|
136
|
+
dataset.agentRequests = [...requests.values()].filter(request => {
|
|
137
|
+
const group = requestGroups.get(request);
|
|
138
|
+
return inWindow(request.tsMs) && (!group || groupOwners.get(group)?.candidateId === requestOwners.get(request));
|
|
139
|
+
});
|
|
140
|
+
for (const list of [dataset.humanPrompts, dataset.agentRequests, dataset.toolCalls, dataset.compactions, dataset.interrupts]) {
|
|
141
|
+
list.sort((a, b) => a.tsMs - b.tsMs);
|
|
142
|
+
}
|
|
143
|
+
return { dataset, terminalLedger };
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
hmacSecret.fill(0);
|
|
147
|
+
if (ownsStaging) {
|
|
148
|
+
await fs.rm(stagingDir, { recursive: true, force: true, maxRetries: 3 });
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
const children = await fs.readdir(stagingDir).catch(() => []);
|
|
152
|
+
await Promise.all(children.map(entry => fs.rm(join(stagingDir, entry), { recursive: true, force: true, maxRetries: 3 })));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { createHmac } from 'node:crypto';
|
|
2
|
+
import { constants, promises as fs } from 'node:fs';
|
|
3
|
+
import { dirname, isAbsolute, relative, resolve, sep } from 'node:path';
|
|
4
|
+
export const MAX_LINE_BYTES = 8 * 1024 * 1024;
|
|
5
|
+
const CHUNK_BYTES = 64 * 1024;
|
|
6
|
+
export class IngestError extends Error {
|
|
7
|
+
code;
|
|
8
|
+
bytesRead;
|
|
9
|
+
constructor(code, bytesRead = 0) {
|
|
10
|
+
super(code);
|
|
11
|
+
this.code = code;
|
|
12
|
+
this.bytesRead = bytesRead;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function within(root, path) {
|
|
16
|
+
const rel = relative(root, path);
|
|
17
|
+
return !isAbsolute(rel) && rel !== '..' && !rel.startsWith(`..${sep}`);
|
|
18
|
+
}
|
|
19
|
+
async function verifyBelowRoot(target, canonicalRoot) {
|
|
20
|
+
for (let current = target; current !== canonicalRoot;) {
|
|
21
|
+
if ((await fs.lstat(current)).isSymbolicLink())
|
|
22
|
+
throw new IngestError('UNSAFE_PATH');
|
|
23
|
+
const parent = dirname(current);
|
|
24
|
+
if (parent === current)
|
|
25
|
+
throw new IngestError('UNSAFE_PATH');
|
|
26
|
+
current = parent;
|
|
27
|
+
}
|
|
28
|
+
const canonical = await fs.realpath(target);
|
|
29
|
+
if (relative(target, canonical) || !within(canonicalRoot, canonical)) {
|
|
30
|
+
throw new IngestError('UNSAFE_PATH');
|
|
31
|
+
}
|
|
32
|
+
const stat = await fs.lstat(canonical, { bigint: true });
|
|
33
|
+
if (!stat.isFile() && !stat.isDirectory())
|
|
34
|
+
throw new IngestError('UNSAFE_PATH');
|
|
35
|
+
return { path: canonical, stat };
|
|
36
|
+
}
|
|
37
|
+
export async function safePath(path, root) {
|
|
38
|
+
const absolute = resolve(path);
|
|
39
|
+
if (root !== undefined) {
|
|
40
|
+
const resolvedRoot = resolve(root);
|
|
41
|
+
const canonicalRoot = await fs.realpath(resolvedRoot);
|
|
42
|
+
let rel;
|
|
43
|
+
if (within(canonicalRoot, absolute)) {
|
|
44
|
+
rel = relative(canonicalRoot, absolute);
|
|
45
|
+
}
|
|
46
|
+
else if (within(resolvedRoot, absolute)) {
|
|
47
|
+
rel = relative(resolvedRoot, absolute);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
throw new IngestError('UNSAFE_PATH');
|
|
51
|
+
}
|
|
52
|
+
const target = rel ? resolve(canonicalRoot, rel) : canonicalRoot;
|
|
53
|
+
return verifyBelowRoot(target, canonicalRoot);
|
|
54
|
+
}
|
|
55
|
+
if ((await fs.lstat(absolute)).isSymbolicLink())
|
|
56
|
+
throw new IngestError('UNSAFE_PATH');
|
|
57
|
+
const canonical = await fs.realpath(absolute);
|
|
58
|
+
const stat = await fs.lstat(canonical, { bigint: true });
|
|
59
|
+
if (!stat.isFile() && !stat.isDirectory())
|
|
60
|
+
throw new IngestError('UNSAFE_PATH');
|
|
61
|
+
return { path: canonical, stat };
|
|
62
|
+
}
|
|
63
|
+
export function sameFile(a, b) {
|
|
64
|
+
return a.isFile() && b.isFile() && a.dev === b.dev && a.ino === b.ino;
|
|
65
|
+
}
|
|
66
|
+
export async function openRegularFile(path, root) {
|
|
67
|
+
const before = await safePath(path, root);
|
|
68
|
+
if (!before.stat.isFile())
|
|
69
|
+
throw new IngestError('UNSAFE_PATH');
|
|
70
|
+
const flags = constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0);
|
|
71
|
+
const handle = await fs.open(before.path, flags);
|
|
72
|
+
try {
|
|
73
|
+
const after = await safePath(path, root);
|
|
74
|
+
const stat = await handle.stat({ bigint: true });
|
|
75
|
+
if (!sameFile(before.stat, stat) || !sameFile(after.stat, stat))
|
|
76
|
+
throw new IngestError('UNSAFE_PATH');
|
|
77
|
+
return { handle, stat };
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
await handle.close();
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export async function walkFiles(root, matches, signal) {
|
|
85
|
+
const files = [];
|
|
86
|
+
let boundaryEntry;
|
|
87
|
+
try {
|
|
88
|
+
boundaryEntry = await safePath(root);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if (signal?.aborted)
|
|
92
|
+
throw error;
|
|
93
|
+
const code = error.code;
|
|
94
|
+
if (['ENOENT', 'ENOTDIR', 'EACCES', 'EPERM', 'UNSAFE_PATH'].includes(code ?? '')) {
|
|
95
|
+
return { files, limited: false };
|
|
96
|
+
}
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
const boundary = boundaryEntry.path;
|
|
100
|
+
const queue = [{ path: boundary, depth: 0 }];
|
|
101
|
+
let visited = 0;
|
|
102
|
+
let hitEntryLimit = false;
|
|
103
|
+
let hitDepthLimit = false;
|
|
104
|
+
while (queue.length) {
|
|
105
|
+
signal?.throwIfAborted();
|
|
106
|
+
const next = queue.pop();
|
|
107
|
+
try {
|
|
108
|
+
const entry = next.depth === 0 ? boundaryEntry : await verifyBelowRoot(next.path, boundary);
|
|
109
|
+
if (entry.stat.isFile()) {
|
|
110
|
+
if (matches(entry.path))
|
|
111
|
+
files.push(entry);
|
|
112
|
+
}
|
|
113
|
+
else if (!hitEntryLimit && next.depth < 16) {
|
|
114
|
+
const dir = await fs.opendir(entry.path);
|
|
115
|
+
for await (const child of dir) {
|
|
116
|
+
signal?.throwIfAborted();
|
|
117
|
+
if (++visited > 100_000) {
|
|
118
|
+
hitEntryLimit = true;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
const path = resolve(entry.path, child.name);
|
|
122
|
+
if (child.isDirectory() || (child.isFile() && matches(path))) {
|
|
123
|
+
queue.push({ path, depth: next.depth + 1 });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else if (next.depth >= 16) {
|
|
128
|
+
hitDepthLimit = true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
if (signal?.aborted)
|
|
133
|
+
throw error;
|
|
134
|
+
const code = error.code;
|
|
135
|
+
if (!['ENOENT', 'ENOTDIR', 'EACCES', 'EPERM', 'UNSAFE_PATH'].includes(code ?? ''))
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
files.sort((a, b) => a.path < b.path ? -1 : a.path === b.path ? 0 : 1);
|
|
140
|
+
return { files, limited: hitEntryLimit || hitDepthLimit };
|
|
141
|
+
}
|
|
142
|
+
async function streamLines(path, opts, visit) {
|
|
143
|
+
const stats = { bytesRead: 0, linesSeen: 0, linesSkipped: 0 };
|
|
144
|
+
opts.signal?.throwIfAborted();
|
|
145
|
+
const limit = opts.maxLineBytes ?? MAX_LINE_BYTES;
|
|
146
|
+
if (!Number.isSafeInteger(limit) || limit < 1)
|
|
147
|
+
throw new RangeError('INVALID_LINE_LIMIT');
|
|
148
|
+
const cap = Math.min(MAX_LINE_BYTES, limit);
|
|
149
|
+
const chunk = Buffer.allocUnsafe(CHUNK_BYTES);
|
|
150
|
+
const { handle, stat } = await openRegularFile(path, opts.root);
|
|
151
|
+
const decoder = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true });
|
|
152
|
+
let pending;
|
|
153
|
+
let used = 0;
|
|
154
|
+
let oversized = false;
|
|
155
|
+
const finish = (line) => {
|
|
156
|
+
const ordinal = ++stats.linesSeen;
|
|
157
|
+
if (!line) {
|
|
158
|
+
stats.linesSkipped++;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
let decoded;
|
|
162
|
+
try {
|
|
163
|
+
decoded = decoder.decode(line);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
stats.linesSkipped++;
|
|
167
|
+
}
|
|
168
|
+
if (decoded !== undefined) {
|
|
169
|
+
if (ordinal === 1 && decoded.startsWith('\uFEFF'))
|
|
170
|
+
decoded = decoded.slice(1);
|
|
171
|
+
visit(decoded.endsWith('\r') ? decoded.slice(0, -1) : decoded, ordinal);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
used = 0;
|
|
175
|
+
oversized = false;
|
|
176
|
+
};
|
|
177
|
+
try {
|
|
178
|
+
const size = Number(stat.size);
|
|
179
|
+
while (stats.bytesRead < size) {
|
|
180
|
+
opts.signal?.throwIfAborted();
|
|
181
|
+
let bytesRead;
|
|
182
|
+
try {
|
|
183
|
+
({ bytesRead } = await handle.read(chunk, 0, Math.min(chunk.length, size - stats.bytesRead), null));
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
if (opts.signal?.aborted)
|
|
187
|
+
throw error;
|
|
188
|
+
throw new IngestError('READ_FAILED', stats.bytesRead);
|
|
189
|
+
}
|
|
190
|
+
if (!bytesRead)
|
|
191
|
+
break;
|
|
192
|
+
stats.bytesRead += bytesRead;
|
|
193
|
+
const data = chunk.subarray(0, bytesRead);
|
|
194
|
+
for (let start = 0; start < bytesRead;) {
|
|
195
|
+
const newline = data.indexOf(10, start);
|
|
196
|
+
const end = newline < 0 ? bytesRead : newline;
|
|
197
|
+
const length = used + end - start;
|
|
198
|
+
oversized ||= length > cap;
|
|
199
|
+
if (newline >= 0 && !used) {
|
|
200
|
+
finish(oversized ? undefined : data.subarray(start, end));
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
if (!oversized) {
|
|
204
|
+
if (!pending || length > pending.length) {
|
|
205
|
+
const grown = Buffer.allocUnsafe(Math.min(cap, Math.max(length, (pending?.length ?? 256) * 2)));
|
|
206
|
+
pending?.copy(grown, 0, 0, used);
|
|
207
|
+
pending = grown;
|
|
208
|
+
}
|
|
209
|
+
data.copy(pending, used, start, end);
|
|
210
|
+
used = length;
|
|
211
|
+
}
|
|
212
|
+
if (newline >= 0)
|
|
213
|
+
finish(oversized ? undefined : pending.subarray(0, used));
|
|
214
|
+
}
|
|
215
|
+
start = end + 1;
|
|
216
|
+
}
|
|
217
|
+
opts.onBytesProcessed?.(stats.bytesRead - used);
|
|
218
|
+
}
|
|
219
|
+
if (used || oversized)
|
|
220
|
+
finish(oversized ? undefined : pending.subarray(0, used));
|
|
221
|
+
return stats;
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
await handle.close();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
export async function streamJsonlRecords(path, opts) {
|
|
228
|
+
let invalid = 0;
|
|
229
|
+
const stats = await streamLines(path, opts, (line, ordinal) => {
|
|
230
|
+
if (!line.trim())
|
|
231
|
+
return;
|
|
232
|
+
let record;
|
|
233
|
+
try {
|
|
234
|
+
record = JSON.parse(line);
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
invalid++;
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
opts.onRecord(record, ordinal);
|
|
241
|
+
});
|
|
242
|
+
stats.linesSkipped += invalid;
|
|
243
|
+
return stats;
|
|
244
|
+
}
|
|
245
|
+
export function streamTextLines(path, opts, visit) {
|
|
246
|
+
return streamLines(path, opts, visit);
|
|
247
|
+
}
|
|
248
|
+
export async function readBoundedJson(path, root, signal) {
|
|
249
|
+
signal?.throwIfAborted();
|
|
250
|
+
const { handle, stat } = await openRegularFile(path, root);
|
|
251
|
+
let bytesRead = 0;
|
|
252
|
+
try {
|
|
253
|
+
if (stat.size > 64n * 1024n * 1024n)
|
|
254
|
+
throw new IngestError('JSON_SIZE_LIMIT');
|
|
255
|
+
const data = Buffer.allocUnsafe(Number(stat.size));
|
|
256
|
+
while (bytesRead < data.length) {
|
|
257
|
+
signal?.throwIfAborted();
|
|
258
|
+
const read = await handle.read(data, bytesRead, Math.min(CHUNK_BYTES, data.length - bytesRead), null);
|
|
259
|
+
if (!read.bytesRead)
|
|
260
|
+
break;
|
|
261
|
+
bytesRead += read.bytesRead;
|
|
262
|
+
}
|
|
263
|
+
try {
|
|
264
|
+
const value = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(data.subarray(0, bytesRead)));
|
|
265
|
+
return { value, bytesRead };
|
|
266
|
+
}
|
|
267
|
+
catch {
|
|
268
|
+
throw new IngestError('INVALID_JSON', bytesRead);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
if (error instanceof IngestError || signal?.aborted)
|
|
273
|
+
throw error;
|
|
274
|
+
throw new IngestError('READ_FAILED', bytesRead);
|
|
275
|
+
}
|
|
276
|
+
finally {
|
|
277
|
+
await handle.close();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
export function hmacProjectId(rawCwd, secret) {
|
|
281
|
+
const normalized = rawCwd.replace(/\\/g, '/').replace(/^([A-Z]):/, (_, drive) => `${drive.toLowerCase()}:`);
|
|
282
|
+
const path = /^(?:[a-z]:)?\/$/.test(normalized) ? normalized : normalized.replace(/\/+$/, '');
|
|
283
|
+
return createHmac('sha256', secret).update(path).digest('hex').slice(0, 24);
|
|
284
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import { basename, dirname, join } from 'node:path';
|
|
3
|
+
import { constants, DatabaseSync } from 'node:sqlite';
|
|
4
|
+
import { IngestError, openRegularFile, safePath, sameFile } from './safe-fs.js';
|
|
5
|
+
const stagedFiles = new Set();
|
|
6
|
+
function unchanged(a, b) {
|
|
7
|
+
return sameFile(a, b) && a.size === b.size && a.mtimeNs === b.mtimeNs && a.ctimeNs === b.ctimeNs;
|
|
8
|
+
}
|
|
9
|
+
async function sourceStat(path, optional = false) {
|
|
10
|
+
try {
|
|
11
|
+
const { stat } = await safePath(path, dirname(path));
|
|
12
|
+
if (!stat.isFile())
|
|
13
|
+
throw new IngestError('UNSAFE_PATH');
|
|
14
|
+
return stat;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (optional && error.code === 'ENOENT')
|
|
18
|
+
return null;
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export async function stageSqliteReadOnly(sourceDbPath, stagingDir, signal) {
|
|
23
|
+
signal?.throwIfAborted();
|
|
24
|
+
const source = (await safePath(sourceDbPath)).path;
|
|
25
|
+
const wal = source + '-wal';
|
|
26
|
+
const journal = source + '-journal';
|
|
27
|
+
const before = [await sourceStat(source), await sourceStat(wal, true)];
|
|
28
|
+
// A nonempty rollback journal might require recovery. Treat it conservatively.
|
|
29
|
+
if ((await sourceStat(journal, true))?.size)
|
|
30
|
+
throw new IngestError('SQLITE_HOT_JOURNAL');
|
|
31
|
+
const root = await safePath(stagingDir);
|
|
32
|
+
if (!root.stat.isDirectory())
|
|
33
|
+
throw new IngestError('UNSAFE_PATH');
|
|
34
|
+
const privateDir = await fs.mkdtemp(join(root.path, 'sqlite-'));
|
|
35
|
+
const stagedPath = join(privateDir, basename(source));
|
|
36
|
+
const cleanup = async () => {
|
|
37
|
+
stagedFiles.delete(stagedPath);
|
|
38
|
+
await fs.rm(privateDir, { recursive: true, force: true, maxRetries: 3 });
|
|
39
|
+
};
|
|
40
|
+
let bytesRead = 0;
|
|
41
|
+
try {
|
|
42
|
+
await fs.chmod(privateDir, 0o700);
|
|
43
|
+
const chunk = Buffer.allocUnsafe(64 * 1024);
|
|
44
|
+
for (const [i, path] of [source, wal].entries()) {
|
|
45
|
+
const expected = before[i];
|
|
46
|
+
if (!expected)
|
|
47
|
+
continue;
|
|
48
|
+
const { handle, stat } = await openRegularFile(path, dirname(source));
|
|
49
|
+
try {
|
|
50
|
+
if (!unchanged(expected, stat))
|
|
51
|
+
throw new IngestError('SQLITE_CHANGED', bytesRead);
|
|
52
|
+
const out = await fs.open(i ? stagedPath + '-wal' : stagedPath, 'wx', 0o600);
|
|
53
|
+
try {
|
|
54
|
+
let remaining = Number(stat.size);
|
|
55
|
+
while (remaining > 0) {
|
|
56
|
+
signal?.throwIfAborted();
|
|
57
|
+
const read = await handle.read(chunk, 0, Math.min(chunk.length, remaining), null);
|
|
58
|
+
bytesRead += read.bytesRead;
|
|
59
|
+
if (!read.bytesRead)
|
|
60
|
+
throw new IngestError('SQLITE_CHANGED', bytesRead);
|
|
61
|
+
remaining -= read.bytesRead;
|
|
62
|
+
for (let written = 0; written < read.bytesRead;) {
|
|
63
|
+
const result = await out.write(chunk, written, read.bytesRead - written, null);
|
|
64
|
+
if (!result.bytesWritten)
|
|
65
|
+
throw new IngestError('SQLITE_COPY_FAILED', bytesRead);
|
|
66
|
+
written += result.bytesWritten;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (!unchanged(expected, await handle.stat({ bigint: true }))) {
|
|
70
|
+
throw new IngestError('SQLITE_CHANGED', bytesRead);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
await out.close();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
await handle.close();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if ((await sourceStat(journal, true))?.size)
|
|
82
|
+
throw new IngestError('SQLITE_HOT_JOURNAL', bytesRead);
|
|
83
|
+
for (const [i, path] of [source, wal].entries()) {
|
|
84
|
+
const initial = before[i];
|
|
85
|
+
const current = await sourceStat(path, true);
|
|
86
|
+
if (initial ? !current || !unchanged(initial, current) : current) {
|
|
87
|
+
throw new IngestError('SQLITE_CHANGED', bytesRead);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
stagedFiles.add(stagedPath);
|
|
91
|
+
return { stagedPath, bytesRead, hasWal: before[1] != null, cleanup };
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
await cleanup();
|
|
95
|
+
if (signal?.aborted || error instanceof IngestError)
|
|
96
|
+
throw error;
|
|
97
|
+
throw new IngestError('SQLITE_COPY_FAILED', bytesRead);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const sessionColumns = ['id', 'directory', 'parent_id', 'project_id', 'time_created', 'time_updated', 'data'];
|
|
101
|
+
const messageColumns = ['id', 'session_id', 'time_created', 'time_updated', 'data', 'role', 'type'];
|
|
102
|
+
const partColumns = ['id', 'message_id', 'session_id', 'time_created', 'data', 'type', 'call_id', 'ordinal'];
|
|
103
|
+
export const openCodeColumns = {
|
|
104
|
+
session: sessionColumns, session_v2: sessionColumns, message: messageColumns, session_message: messageColumns,
|
|
105
|
+
part: partColumns, session_part: partColumns, project: ['id', 'worktree'],
|
|
106
|
+
};
|
|
107
|
+
const allowedColumns = new Map(Object.entries({
|
|
108
|
+
...openCodeColumns, cursordiskkv: ['key', 'value'], itemtable: ['key', 'value'],
|
|
109
|
+
}));
|
|
110
|
+
export function openHardenedSqlite(stagedPath, allowedTables) {
|
|
111
|
+
if (!stagedFiles.has(stagedPath))
|
|
112
|
+
throw new IngestError('SQLITE_UNSTAGED');
|
|
113
|
+
const allowed = new Set(Array.from(allowedTables, table => table.toLowerCase()).filter(table => allowedColumns.has(table)));
|
|
114
|
+
const db = new DatabaseSync(stagedPath, {
|
|
115
|
+
readOnly: true,
|
|
116
|
+
allowExtension: false,
|
|
117
|
+
enableDoubleQuotedStringLiterals: false,
|
|
118
|
+
});
|
|
119
|
+
try {
|
|
120
|
+
db.enableDefensive(true);
|
|
121
|
+
db.exec('PRAGMA query_only = ON; PRAGMA trusted_schema = OFF');
|
|
122
|
+
db.setAuthorizer((action, table, column, schema, caller) => {
|
|
123
|
+
if (caller)
|
|
124
|
+
return constants.SQLITE_DENY;
|
|
125
|
+
if (action === constants.SQLITE_SELECT)
|
|
126
|
+
return constants.SQLITE_OK;
|
|
127
|
+
if (action === constants.SQLITE_READ && schema === 'main' && table && allowed.has(table.toLowerCase()) &&
|
|
128
|
+
(!column || allowedColumns.get(table.toLowerCase())?.includes(column.toLowerCase()))) {
|
|
129
|
+
return constants.SQLITE_OK;
|
|
130
|
+
}
|
|
131
|
+
return constants.SQLITE_DENY;
|
|
132
|
+
});
|
|
133
|
+
return db;
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
db.close();
|
|
137
|
+
throw new IngestError('SQLITE_OPEN_FAILED');
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const parseTimezones = new WeakMap();
|
|
2
|
+
export const parseWindows = new WeakMap();
|
|
3
|
+
const formatters = new Map();
|
|
4
|
+
export function zonedTimestamp(localDateTime, timezone) {
|
|
5
|
+
let formatter = formatters.get(timezone);
|
|
6
|
+
if (!formatter) {
|
|
7
|
+
formatter = new Intl.DateTimeFormat('en-GB', {
|
|
8
|
+
timeZone: timezone, calendar: 'iso8601', numberingSystem: 'latn', hourCycle: 'h23',
|
|
9
|
+
year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit',
|
|
10
|
+
});
|
|
11
|
+
formatters.set(timezone, formatter);
|
|
12
|
+
}
|
|
13
|
+
const target = Date.parse(localDateTime + 'Z');
|
|
14
|
+
if (!Number.isFinite(target))
|
|
15
|
+
return NaN;
|
|
16
|
+
const represented = (instant) => {
|
|
17
|
+
const parts = Object.fromEntries(formatter.formatToParts(instant).map(part => [part.type, part.value]));
|
|
18
|
+
return Date.parse(`${parts.year.padStart(4, '0')}-${parts.month}-${parts.day}T${parts.hour}:${parts.minute}:${parts.second}Z`);
|
|
19
|
+
};
|
|
20
|
+
// Sampling both sides also covers midnight offset changes and ambiguous local times.
|
|
21
|
+
const day = 86_400_000;
|
|
22
|
+
const candidates = [-day, 0, day].map(delta => target - (represented(target + delta) - (target + delta)));
|
|
23
|
+
const matches = candidates.filter(instant => represented(instant) === target);
|
|
24
|
+
if (matches.length)
|
|
25
|
+
return Math.min(...matches);
|
|
26
|
+
// When a clock jumps over the requested wall time, use the later compatible instant.
|
|
27
|
+
return Math.max(...candidates);
|
|
28
|
+
}
|
|
29
|
+
export function yearWindow(year, timezone) {
|
|
30
|
+
if (!Number.isInteger(year) || year < 1 || year > 9998)
|
|
31
|
+
throw new RangeError('INVALID_YEAR');
|
|
32
|
+
const boundary = (value) => zonedTimestamp(`${String(value).padStart(4, '0')}-01-01T00:00:00`, timezone);
|
|
33
|
+
return { start: boundary(year), end: boundary(year + 1) };
|
|
34
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const TOOL_MAP_VERSION = '1.0.0';
|
|
2
|
+
const names = {
|
|
3
|
+
investigate: [
|
|
4
|
+
'read', 'read_file', 'read_many_files', 'view', 'view_file', 'glob', 'grep', 'list', 'list_files',
|
|
5
|
+
'list_directory', 'search_files', 'search_file_content', 'grep_search', 'lsp', 'list_code_definition_names', 'rg', 'ls', 'find',
|
|
6
|
+
],
|
|
7
|
+
modify: [
|
|
8
|
+
'edit', 'write', 'multiedit', 'multi_edit', 'apply_patch', 'patch', 'replace', 'edit_file', 'write_file',
|
|
9
|
+
'write_to_file', 'replace_in_file', 'apply_diff', 'str_replace', 'insert_content', 'search_and_replace', 'notebookedit',
|
|
10
|
+
],
|
|
11
|
+
execute: [
|
|
12
|
+
'bash', 'shell', 'terminal', 'shell_command', 'exec_command', 'run_shell_command',
|
|
13
|
+
'run_command', 'execute_command', 'command_execution', 'powershell', 'write_stdin',
|
|
14
|
+
],
|
|
15
|
+
delegate: ['agent', 'task', 'subagent', 'spawn_agent', 'new_task', 'delegate_task', 'run_subagent'],
|
|
16
|
+
research: ['websearch', 'web_search', 'google_web_search', 'webfetch', 'web_fetch', 'fetch_url', 'browser_action'],
|
|
17
|
+
plan: ['todowrite', 'todo_write', 'todoread', 'todo_read', 'plan', 'update_plan', 'update_todo_list', 'write_todos', 'enterplanmode', 'exitplanmode'],
|
|
18
|
+
};
|
|
19
|
+
const families = new Map(Object.entries(names).flatMap(([family, tools]) => tools.map(tool => [tool, family])));
|
|
20
|
+
export function mapToolName(name) {
|
|
21
|
+
const tool = typeof name === 'string' ? name.toLowerCase() : '';
|
|
22
|
+
const toolFamily = families.get(tool) ?? (/^mcp(?:__|[.:_-])/.test(tool) ? 'integrate' : 'other');
|
|
23
|
+
return { toolFamily, isSubagentSpawn: toolFamily === 'delegate' };
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|