mirror of
https://github.com/langchain-ai/docs.git
synced 2026-08-27 02:41:59 -04:00
18 lines
559 B
Plaintext
18 lines
559 B
Plaintext
```ts
|
|
// Keep dispatching rounds, deduping against what's found, until a round adds nothing.
|
|
const seen = new Set();
|
|
const found = [];
|
|
|
|
while (true) {
|
|
const { items } = await task({
|
|
description: `Find dead code. Already found: ${[...seen].join(", ") || "(none)"}.`,
|
|
subagentType: "analyzer",
|
|
responseSchema: itemsSchema, // -> { items: [{ id, file }] }
|
|
});
|
|
const fresh = items.filter((i) => !seen.has(i.id));
|
|
if (fresh.length === 0) break; // converged: nothing new
|
|
for (const i of fresh) { seen.add(i.id); found.push(i); }
|
|
}
|
|
found;
|
|
```
|