@cocorograph/hub-agent 0.8.47 → 0.8.48
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/package.json +1 -1
- package/src/usage.mjs +22 -10
package/package.json
CHANGED
package/src/usage.mjs
CHANGED
|
@@ -1489,6 +1489,7 @@ const _codexThreadListIndex = new Map() // base → Map<fp, {mtimeMs,size,lastSe
|
|
|
1489
1489
|
const _codexThreadListLastWarnAt = new Map() // base → wall-clock ms
|
|
1490
1490
|
const CODEX_THREAD_LIST_LOG_INTERVAL_MS = 5 * 60 * 1000
|
|
1491
1491
|
const CODEX_THREAD_LIST_STALE_ENTRY_MS = 24 * 60 * 60 * 1000
|
|
1492
|
+
const CODEX_THREAD_LIST_HEADER_PARSE_CONCURRENCY = 16
|
|
1492
1493
|
const CODEX_ROLLOUT_PARSE_IO_ERROR = Symbol("codex-rollout-parse-io-error")
|
|
1493
1494
|
|
|
1494
1495
|
function sameCodexThreadListFingerprint(a, b) {
|
|
@@ -1736,18 +1737,29 @@ export async function listCodexThreadsFromDisk({
|
|
|
1736
1737
|
// 4. 新規・変更分だけ header を解析する。別 cwd は session_meta を得た時点で止め、
|
|
1737
1738
|
// その cwd が後で要求された時に一度だけ preview まで補完する。一時 I/O 失敗は cache せず、
|
|
1738
1739
|
// 次 poll で再試行する。解析済み不正 header (meta=null) は fingerprint 不変なら再解析しない。
|
|
1739
|
-
let parsedHeaders = 0
|
|
1740
1740
|
const headerParseStartedAt = Date.now()
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1741
|
+
const uncachedCandidates = candidates.filter(({ fp }) => !snapshot.has(fp))
|
|
1742
|
+
const parsedHeaders = uncachedCandidates.length
|
|
1743
|
+
let nextHeaderIndex = 0
|
|
1744
|
+
const parseNextHeader = async () => {
|
|
1745
|
+
while (nextHeaderIndex < uncachedCandidates.length) {
|
|
1746
|
+
const { fp, mtimeMs, size } = uncachedCandidates[nextHeaderIndex++]
|
|
1747
|
+
const observed = index.get(fp)
|
|
1748
|
+
const meta = await parseCodexRolloutHead(fp, cwd, _testHooks)
|
|
1749
|
+
if (meta === CODEX_ROLLOUT_PARSE_IO_ERROR) continue
|
|
1750
|
+
const entry = { mtimeMs, size, lastSeenAt: seenAt, meta }
|
|
1751
|
+
commitCodexThreadListEntry(index, fp, observed, entry)
|
|
1752
|
+
snapshot.set(fp, entry)
|
|
1753
|
+
}
|
|
1750
1754
|
}
|
|
1755
|
+
await Promise.all(
|
|
1756
|
+
Array.from(
|
|
1757
|
+
{
|
|
1758
|
+
length: Math.min(CODEX_THREAD_LIST_HEADER_PARSE_CONCURRENCY, uncachedCandidates.length),
|
|
1759
|
+
},
|
|
1760
|
+
parseNextHeader,
|
|
1761
|
+
),
|
|
1762
|
+
)
|
|
1751
1763
|
|
|
1752
1764
|
// 5. cwd で絞ってから mtime 降順・limit を適用する。グローバル候補数には左右されない。
|
|
1753
1765
|
const out = []
|