Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ export async function analyze(
},
): Promise<AuditResult> {
const llm = opts.llm;
const primaryTimeout = llm.requestTimeoutMs ?? 180000;
const compressedTimeout = Math.max(Math.round(primaryTimeout * (2 / 3)), 45000);

const allItems = profiles.flatMap((p) => p.items);
const username = profiles[0]?.username ?? "(unknown)";
Expand Down Expand Up @@ -307,9 +309,7 @@ export async function analyze(
chunks.length,
);
const totalChunks = chunks.length;
// Default to running every chunk concurrently (capped to avoid API rate
// limits). Chunk analysis is independent, so serial rounds were the main
// source of wall-clock latency.

const maxConcurrency = Math.max(
1,
Math.min(opts.chunkConcurrency ?? 8, totalChunks || 1),
Expand Down Expand Up @@ -373,7 +373,7 @@ ${SCHEMA_HINT}`;
maxTokens: 2200,
json: true,
}),
llm.requestTimeoutMs ?? 70000,
primaryTimeout,
`chunk ${currentChunk}/${totalChunks}`,
);
} catch {
Expand Down Expand Up @@ -409,7 +409,7 @@ ${SCHEMA_HINT}`;
maxTokens: 1100,
json: true,
}),
llm.requestTimeoutMs ? Math.round(llm.requestTimeoutMs * 0.6) : 45000,
compressedTimeout,
`compressed chunk ${currentChunk}/${totalChunks}`,
);
} finally {
Expand Down Expand Up @@ -486,7 +486,10 @@ ${SCHEMA_HINT}`;
}
}

for (const url of parsed.identity?.publicProofUrls ?? []) {
const allProofUrls = parsedChunks.flatMap(
(c) => c.identity?.publicProofUrls ?? [],
);
for (const url of allProofUrls) {
if (typeof url === "string" && /^https?:\/\//i.test(url)) {
knownProofUrls.add(url.trim());
}
Expand Down